Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Structure not getting populated

Former Member
0 Kudos
123

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
52

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.

2 REPLIES 2

Former Member
0 Kudos
52

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' .

Former Member
0 Kudos
53

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.