Application Development and Automation 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: 
Read only

data selection into same itab

Former Member
0 Likes
805

hi,

itab having txz01 and bukrs field , bukrs having data.

can i do like this to fetch data for txz01 for all bukrs having in same itab.

is this correct to fetch data?

select txz01 from ekpo

into corresponding fields of table gt_item

for all entries in gt_item

where bukrs = gt_item-bukrs

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
786

Hi,

syntactically there is no wrong.

but, if u use like this ur previous data in that itab will we cleared off and new selected data only will present.

rgds,

bharat.

5 REPLIES 5
Read only

Former Member
0 Likes
787

Hi,

syntactically there is no wrong.

but, if u use like this ur previous data in that itab will we cleared off and new selected data only will present.

rgds,

bharat.

Read only

Former Member
0 Likes
786

i dont think so you can do like this..

you have to use read statemnt

Read only

Former Member
0 Likes
786

Hi,

Make use of below alternatives........

if not gt_item[] is initial.

select txz01 from ekpo

into corresponding fields of table gt_item1

for all entries in gt_item

where bukrs = gt_item-bukrs.

endif.

else.

if not gt_item[] is initial.

select txz01 from ekpo appending

into corresponding fields of table gt_item

for all entries in gt_item

where bukrs = gt_item-bukrs.

endif.

Reward if useful..........................

Read only

Former Member
0 Likes
786

syntactically correct. but you will end up fetching the same data. copy to a temp table and then moce back to the original one.

Read only

Former Member
0 Likes
786

Hi,

You are having BUKRS values in table gt_item. so you want txz01 field in gt_item in same table.

bettere declare another internal table gt_item01 of same type of gt_item.

loop at gt_item.

move-corresponding gt_item to gt_item01.

append gt_item01.

endloop.

        • here you have bukrs in gt_item01.***

loop at gt_item..

select txz01 from ekpo

into corresponding fields of table gt_item01

where bukrs = gt_item-bukrs

modify gt_item01 index sy-tabix transporting txz01.

endoop.

Now in table gt_item01 you have field values of both bukrs and txz01.

try this once....

<b>reward if useful</b>

Regards,

sunil kairam.