2011 Mar 21 2:42 AM
Hi Experts,
My code is as below:
loop at itab4.
SELECT pernr FROM pa0001 INTO TABLE IT_t1 where
orgeh in (itab4-obj) and orgeh ne '00000000' .
result_final1[] = it_t1[].
append result_final1.
endloop.
itab4 contains the list of orgeh (org units). itab4 is getting populated correctly. It has 22 records (itab4-obj has 22 records). For each itab4-obj - org unit, there are multiple records in pa0001. Using debugger, I can see that first itab4-obj record. It has 16 records in pa0001.
I want to insert all pernr for all orgeh in the structure result_final1.
However the records are not getting inserted into result_final1.
Please help.
Regards,
Gary
2011 Mar 21 4:06 AM
Hi ,
Please check this code instead of that:
Select pernr from pa0001 into table it_t1 for all entries in itab4
where obj eq itab4-obj and orgeh ne '00000000'.
if it_t1 ne 0.
loop at it_t1 into result_final1.
result_final-pernr = it_t1-pernr.
endloop.
2011 Mar 21 3:06 AM
There are a few poblems for your coding, to make it simple, never select inside the loop, the way you transfer data are invalid.
Try to use for all entries, and remember to make the it_t1 is not initial before you proceed.
SELECT pernr FROM pa0001 INTO TABLE IT_t1 for all entries in itab4 where
obj = itab4-obj and orgeh ne '00000000' .
2011 Mar 21 4:06 AM
Hi ,
Please check this code instead of that:
Select pernr from pa0001 into table it_t1 for all entries in itab4
where obj eq itab4-obj and orgeh ne '00000000'.
if it_t1 ne 0.
loop at it_t1 into result_final1.
result_final-pernr = it_t1-pernr.
endloop.