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

purpose of modify statement

Former Member
0 Likes
1,360

MODIFY ymtid_tab FROM TABLE itab.

what will the above statement do, considering ymtid_tab is a custom database table and itab is an internal table.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
903

This statement will update all records of database table YMTID_TAB where the key fields match the records in ITAB.

Regards,

Rich Heilman

MODIFY ymtid_tab FROM TABLE itab.

what will the above statement do, considering ymtid_tab is a custom database table and itab is an internal table.

5 REPLIES 5
Read only

Former Member
0 Likes
903

It will update the database table with the values in internal table

Also click F1 in your modify statement and see SAP help for details

Message was edited by:

ANIRUDDHA DAS

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
904

This statement will update all records of database table YMTID_TAB where the key fields match the records in ITAB.

Regards,

Rich Heilman

Read only

JozsefSzikszai
Active Contributor
0 Likes
903

hi vivek,

thi statement will add the entries from itab to DB table ymtid_tab. If any of the entries are already in the table (acc. to table key), it will change them.

ec

Read only

former_member249594
Participant
0 Likes
903

Hi vivek vangala

itab should have the same structure as ymtid_tab so that they will have the same key field

if a record in ymtid_tab have the same table key as the record in itab, then this record in ymtid_tab will be modified(non-key field value is changed as the value in itab)

if no record in ymtid_tab have the same table key as the record in itab, then record of itab will be insterted in ymtid_tab.

Read only

Former Member
0 Likes
903

hi,

Modify statment will work both insert and Update..

Modify ymtid_tab FROM TABLE itab.

if you are changing non primary key,then it works like update..

if you are creating new record then it works like insert command.

when a record is found then modify works like update and saves that changes to internal table with new record.

if it didnt found any record then it appends a record at the end of internal table with given data.