‎2009 Oct 29 9:55 AM
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
‎2009 Oct 29 9:58 AM
Please use a meaningful subject line and please search in SCN before posting
‎2009 Oct 29 10:09 AM
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
‎2009 Oct 29 10:14 AM
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.
‎2009 Oct 29 10:49 AM
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.