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

UPDATE INTERNAL TABLE

Former Member
0 Likes
566

Hi all,

I have one final internal table with data like :

matnr lbkum 101

10000 -


11

10001 -


12

10001 2344 -


10001 1234 -


what should i do to get below output.

matnr lbkum 101

10000 2344 11

10001 1234 12

plz help me.

1 ACCEPTED SOLUTION
Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
539

Hi,

If you make matnr as the key of your internal table and use COLLECT statement then this can be achevied.

DATA: itab type table <table_type> with key matnr with header line.

LOOP AT ITAB.

COLLECT ITAB.

ENDLOOP.

Else you can also think of using

AT NEW.

But COLLECT will sum all other fields of the internal table based on the key of the internal table which is MATNR in your case.

Regards,

Sesh

4 REPLIES 4
Read only

Former Member
0 Likes
539

Hi Ankita,

I think you are updating the internal table by means of append it.

Make use of the Modify ITAB(internal table) so that you will not get those repating values.

Reward point if it is useful.....

Thanks

Yogesh

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
540

Hi,

If you make matnr as the key of your internal table and use COLLECT statement then this can be achevied.

DATA: itab type table <table_type> with key matnr with header line.

LOOP AT ITAB.

COLLECT ITAB.

ENDLOOP.

Else you can also think of using

AT NEW.

But COLLECT will sum all other fields of the internal table based on the key of the internal table which is MATNR in your case.

Regards,

Sesh

Read only

Former Member
0 Likes
539

Hi Ankita,

u r modifying Internal table , but only one field

If this is u r requirement..

Then use

MODIFY ITAB WITH TRANSPOTING FIELD1.

Thanks & Regards,

jogu_vinesh@yahoo.com

Read only

0 Likes
539

Hi ,

this my code,

LOOP AT ITAB.

MOVE ITAB-MATNR TO ITAB1-MATNR.

MOVE ITAB-101_102 TO ITAB1-101_102.

MOVE ITAB-121_122 TO ITAB1-121_122.

APPEND ITAB1.

ENDLOOP.

here I m moving all itab in itab1.

SORT ITAB BY matnr mblnr.

LOOP AT ITAB.

IF ITAB[] IS NOT INITIAL.

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING MATNR .

MOVE ITAB-lBKUM TO ITAB-OPN.

MODIFY ITAB.

*APPEND ITAB1.

ENDIF.

ENDLOOP.

then this is code for getting single row and delete all other values.

LOOP AT ITAB.

MOVE ITAB-opn TO ITAB1-OPN.

APPEND ITAB1.

ENDLOOP.

here I m coping opn in itab1.

I know my output is wrong because of second append statment.

can u tell me what should i do now?

plz