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

Modify Internal table?

Former Member
0 Likes
829

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
Read only

Former Member
0 Likes
787

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
Read only

Former Member
0 Likes
788

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

Read only

Former Member
0 Likes
787

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

Read only

MarcinPciak
Active Contributor
0 Likes
787

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.

Read only

Former Member
0 Likes
787

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....

Read only

Former Member
0 Likes
787

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