‎2011 Feb 22 7:09 AM
Hi together,
I´ve got a strange problem concering a 'select...into itab...' in a function module.
Although the dbtab contains data, the 'select...' is not successful:
--> select x y from dbtab into itab where...
Are there any restrictions or special requirements?
Thanks for any help
‎2011 Feb 22 7:22 AM
Hi,
May be, your error would be coming like --
"You can not use work-area as internal table"
If so, you need to to put TABLE after INTO like --
select x y from dbtab into TABLE itab where...
And otherwise, above suggestion is there - "INTO CORRESPONDING FIELDS OF TABLE" - , what you need to follow, if you are not declaring your structure according to the position of those in the table.
Thanks.
Kumar Saurav.
‎2011 Feb 22 7:14 AM
try select x y from dbtab into corresponding fields of table itab.
make sure the structure of your internal table is the same as the table your getting values from.
‎2011 Feb 22 7:22 AM
Hi,
May be, your error would be coming like --
"You can not use work-area as internal table"
If so, you need to to put TABLE after INTO like --
select x y from dbtab into TABLE itab where...
And otherwise, above suggestion is there - "INTO CORRESPONDING FIELDS OF TABLE" - , what you need to follow, if you are not declaring your structure according to the position of those in the table.
Thanks.
Kumar Saurav.
‎2011 Feb 22 7:41 AM
Hi,
It still doesn´t work.
Here is the entire coding:
DATA:
it_bsid TYPE TABLE OF ZGMATG_OBI_002,
wa_bsid type ZGMATG_OBI_002.
*Structure zgmatg_obi_002 only contains fields XBLNR and XREF1. (in exactly this order)
SELECT xblnr xref1 FROM bsid
INTO corresponding fields of TABLE it_bsid
where ( blart = 'RV' OR blart = 'DA' )
AND xref1 IN r_datum
AND xref3 IN r_datum.
‎2011 Feb 22 7:52 AM
HI,
What is your sy-subrc value after the Select statement?
Regards,
Suzie
‎2011 Feb 22 8:16 AM
Hi,
The SELECT ...provides sy-subrc = 4.
When I´m doing the same thing within a 'conventional' ABAP the sy-subrc = 0.
‎2011 Feb 22 8:26 AM
try reducing or removing your WHERE conditions first, just to check if your select statement can fetch something from the table. Also, try something like SELECT bsidxblnr bsidxref1FROM bsid . . .
might help.
‎2011 Feb 22 9:25 AM
What is r_datum? What value does it have? If it is a range object, what values does
r_datum[]have? Check in the debugger to find the exact values.
Without this information any answers posted here are just guesses. There is nothing strange - the simple fact is that your where clause, somehow, isn't matching what's in the table.
matt
‎2011 Feb 22 11:44 AM
Hi,
The sy-subrc = 4 indicates that the DB table does not have any records matching your given criteria.
Check if the values are getting populated properly in R_datum[] if it is the date try passing the dates in YYYYMMDD format into r_datum [].
Regards,
Suzie
‎2011 Feb 22 12:29 PM
The problem must be in your range tables - they are not getting populated with the correct values
‎2011 Feb 22 7:23 AM
Hi,
If you confirm the structures and fields are same in the table & DBTAB then verify the WHERE coondition of the SELECT statement where there may be any field with the DATE format or field with the Conversion Exit.
Regards,
SRinivas
‎2011 Feb 22 7:25 AM
‎2011 Feb 22 7:26 AM
Hi,
make sure ur itab structure and selection fields must be in same order.
for ex:
ur itab structure contains
y type mara-matnr
x type mara-pstat
then ur select query should be in the same order as
select y
x
from dbtab
into table itab
where....
Thanks,
Rakesh.V
‎2011 Feb 22 7:28 AM
‎2011 Feb 22 7:36 AM
hi,
i think 1 point i want to add is in where condition key fields is a must.otherwise u will get performance issue somethings it goes to dump.
regards,
Sri