02-27-2008 10:26 AM
If this code results in an error, the remedy is:
SELECT fld1 fld2 FROM tab1 WHERE fld3 = pfld3.
WRITE: /1 tab1-fld1, tab1-fld2.
ENDSELECT.
A: Add a SY-SUBRC check.
B: Change the WHERE clause to use fld1 or fld2.
C: Remove the /1 from the WRITE statement.
😧 Add INTO (tab1-fld1, tab1-fld2).
02-27-2008 10:29 AM
Hi Prakash,
Option D is the only reason you would get a syntax error. You have to move the data into a target field.
Cheers.
02-27-2008 10:29 AM
Hi Prakash,
Option D is the only reason you would get a syntax error. You have to move the data into a target field.
Cheers.
02-27-2008 10:33 AM
Hi
Here you can D option to move the data to work area of ITAB
the system will check this statement only
Regards
Shiva
02-27-2008 10:35 AM
Hi,
Option D, becz the selected data should be place in an internal table or work area or stored some where .
Regards,
kavitha.
02-27-2008 10:36 AM
Hi,
You can also use a declaration
TABLES :tab1.
and then it should not give you the error.
Regards,
Himanshu
02-27-2008 10:44 AM
thanx to all of u , but i have one more querry , how its possible to select from TAB1 and then again INTO internal table TAB1(both are same).
02-27-2008 10:49 AM
Hi
You can use the TAB1 which works as work area but you need to delcare as tables TAB1
then only it works
regards
Shiva
02-27-2008 10:51 AM
Hi,
You can at program level you can define a internal table of the same name there are different function related to internal tables and tables there would be some statements that would be used for tables and some that would be used for Internal tables the system would be able to differentiate between the two.
Regards,
Himanshu
02-27-2008 10:51 AM
Hi Prakash,
You internal table would have to have a different name e.g. itab or something and then you move the multiple records using INTO TABLE itab.
Otherwise, if you are getting a single record, then you can use the same database table name as a work area by first declaring the table with
TABLES: tab1.
Then move the field into TAB1-<field>
Cheers
02-27-2008 10:54 AM
in the program at the global declaraions add Tables:TAB1. and due to this the query will run fine. Beacuse tables dclaration makes the defalult work area availabale to put the selected fileds into.