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: 

modifying a custom table

Former Member
0 Kudos

I have to modify a custom table with the contents in the internal table. here ztable has more fields than that of itab.I appreciate if anyone can help me with this

MODIFY Ztable FROM TABLE ITAB.

4 REPLIES 4

Former Member
0 Kudos

i think this query will work if order of field in ztable and itab is same try it.

Former Member
0 Kudos

Hi Deepthi ,

All you need to do is move the data from your internal table into an internal table with the structure same as your ztable.

Please make sure that you populate all the primary keys , once you have done you can use the command MODIFY Ztable FROM TABLE ITAB , to add data to your table.

Here is a sample code for the same

-


Data : it_1 type table of Z01F_TRV001 ,

wa_1 like line of it_1.

start-of-selection.

wa_1-PERNR = '100'.

wa_1-REINR = '00001'.

wa_1-RECEIPTNO = 'ABC'.

append wa_1 to it_1.

modify Z01F_TRV001 from table it_1.

write sy-subrc.

-


here i just fill up the primary keys only and a new record is created in the table

Regards

Arun

Former Member
0 Kudos

i think the itab must be as long as the dbtab and it will read from left to right so the fields in itab should be like dbtab. other wise run time error may occur.

regards

shiba dutta

Former Member
0 Kudos

Hi

Try using UPDATE instead of MODIFY

Thanks

Shiva