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

modifying internal table

Former Member
0 Likes
915

Hi friends i have the follwing reuiremnet

In ITAB1 i have matnr and some fields.

now iam selecting further data.

if itab[] is not initial.

SELECT a~matnr

werks

prctr

bklas

stprs

peinh

FROM marc AS a INNER JOIN mbew AS b

ON amatnr = bmatnr

INTO TABLE it_detail

FOR ALL ENTRIES IN itab

WHERE a~matnr = itab-matnr.

endif.

next iam fetching further data.

if it_detail[] is not initial.

select matnr

maktx

from makt into table it_makt

for all entries in it_detail

where matnr = it_detail-matnr.

i dont want the values in different internal table.

but i want in only one internal table.

how can i get in one internal table.

Reagrds,

priyanka.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
895

after getting all relevant data do this way...

data: l_tabix like sy-tabix.

loop at itab1.

l_tabix = sy-tabix.

read table it_detail with key matnr = itab1-matnr.

if sy-subrc = 0.

move fields of it_detail to itab1 fields.

endif.

read table it_makt with key matnr = ita1-matnr.

if sy-subrc = 0.

move fields of it_makt to itab1 fields.

endif.

modify itab1 index l_tabix.

clear: itab1, it_detail, it_makt.

endloop.

7 REPLIES 7
Read only

Former Member
0 Likes
895

Use

INTO CORRESPONDING FIELDS OF

Regards,

Bhupal

Read only

Former Member
0 Likes
895

Hi,

Create one more internal table as final table and stire the values based on the the above internal tables you got.

we dont use the corresponding fields option as it is a performance issue.

Regards

Lekha

Read only

Former Member
0 Likes
896

after getting all relevant data do this way...

data: l_tabix like sy-tabix.

loop at itab1.

l_tabix = sy-tabix.

read table it_detail with key matnr = itab1-matnr.

if sy-subrc = 0.

move fields of it_detail to itab1 fields.

endif.

read table it_makt with key matnr = ita1-matnr.

if sy-subrc = 0.

move fields of it_makt to itab1 fields.

endif.

modify itab1 index l_tabix.

clear: itab1, it_detail, it_makt.

endloop.

Read only

former_member745780
Active Participant
0 Likes
895

Hello

Create main internal table which contain composite structure and then use

use statement


MOVE-CORRESPONDING itab to main_itab.
append main_itab.

hope this will help you.

Thanks

Anirudh

Read only

Former Member
0 Likes
895

use appending fields in query.

more help press F1 on appending fields and read SAP help.

Read only

Former Member
0 Likes
895

Hi Priyanka ,

After fetching the details in both the tables ,

Loop at itab1 .

read itab2 with key fld1 = itab-fld.

move all the required fields into final table .

Endloop.

Regards,

Chitra

Read only

Former Member
0 Likes
895

Hi,

first itab1 one should have all the fields....

Loop at itab1 into wa1.

read table it_detail into wa_detail with key matnr = itab1-matnr.

'if u want only few fields...

wa1-field1 = it_detail-field1.

.

.

.

.

endloop.

all the fields vil b in one internal table...