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

itab question

Former Member
0 Likes
615

Hi All,

I have a z table in data dictionary with fields f1 f2 and f3. f1 and f2 form the primary key,

Now i have an itab with fields f2 and f3. I want to update the table ztable from the itab for a key f1(which i already have ).

I have tried modify ztable from itab where f1 = f1. but it doesnt like it.

Can you please advise what will be the best way

thanks

4 REPLIES 4
Read only

Former Member
0 Likes
576

Please use a meaningful subject line and please search in SCN before posting

Read only

RaymondGiuseppi
Active Contributor
0 Likes
576

First read the SAP documentation on MODIFY/UDPATE FROM internal table. You will notice that the internal table must have a structure compatible with the database table. So you should find yourself.

- [MODIFY dbtab FROM TABLE itab |http://help.sap.com/abapdocu_70/en/ABAPMODIFY_SOURCE.htm#!ABAP_ALTERNATIVE_2@2@] or [UPDATE dbtab FROM TABLE itab|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#!ABAP_ALTERNATIVE_3@3@]

- [Work Areas in Open SQL Statements|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm]

Regards,

Raymond

Read only

0 Likes
576

Thanks Vikranth and Raymond for pointing out that SAP help does exist. I admit I could have used a better subject line.

Coming back to my issues and the question, I have already mentioned that modify table from itab dint work.

and then i have written, "can you please advise the best way ?"

I understand that there is no smart way of doing it so I want to look into other options, ofcourse i can use things like loop and end loop but i just wanted to know other experts views.

Read only

Former Member
0 Likes
576

plz try this :

just select F1 first from table into your ITAB and put F2 & F3 vales also in itab.

then write this statement.

loop at itab.

UPDATE ZTABLE SET F2= itab-F2

F3 = itab-F3 where F1 = Itab-F1.

endloop.