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: 

Modify Internal table?

Former Member
0 Kudos

hi experts,

in open sql, as far i know, when we use modify <internal table> from <wa>.....

if record already exits it modifies, bt if not than it insert new in internal table bt its not working...

is there any simple example....?

Thanks,

Saurin Shah

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Modify on an internal table will only modify an existing entry. Modify DBTAB from an internal table will modify or insert entries into the database table.

Darren

5 REPLIES 5

Former Member
0 Kudos

Hi,

Modify on an internal table will only modify an existing entry. Modify DBTAB from an internal table will modify or insert entries into the database table.

Darren

Former Member
0 Kudos

Hi,

MODIFY statement will have 2 faces.

1) while you are using it on internal tables, if the entry is available then that perticular entry will be get updated.

2) while you are using it on database tables, if that perticular entry is available then it get modified. else a record will be inserted.

thanks & regards

Kishore M

MarcinPciak
Active Contributor
0 Kudos

Do like this to achieve what you want:


INSERT wa INTO TABLE itab.
if sy-subrc ne 0. "record is in
 MODIFY TABLE itab FROM wa. 
endif.

Former Member
0 Kudos

hi,

before modifying u can check whether the internal table is blank or not...if its not blank i.e. it contains data then modify the internal table....

modify <internal table> from <wa> or

modify <internal table> index < > from <wa> transporting .....

(in transporting only those fields which r to be modified).

if internal table is blank then...

append <wa> into <internal table>.

that will work....

Former Member
0 Kudos

hi,

Refer to this link.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/modify_d.htm

hope it will be helpful.

regards,

sreelakshmi