‎2011 Apr 07 3:34 PM
Hi all.
I have issue to update sap database table from ALV.
Can I update table with internal table which is not type table of that standard table. I have some same fields not all. Only one fileld is for update.
Is it possible if is, please how.
Kind regards.
‎2011 Apr 07 3:48 PM
First the following text only apply to Customer Database Tables, not SAP standard tables that MUST be updated through SAP tools like BAPI or BDC.
There are only two syntaxes allowed for [UPDATE dbtab|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm]
- [FROM wa |http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_2@2@] or [FROM TABLE itab|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_3@3@] require that you first read the whole data as it will replace every non-key field.
- [SET set_expression|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_1@1@] can change a subset of fields, but you have to use it in a LOOP/ENDLOOP as it change each specified field of every record satisfying the condition of the WHERE option to the same value.
Regards,
Raymond
‎2011 Apr 07 3:41 PM
Hi Nick
Here is a sample piece of code just for your reference.
<<Dangerous sample code removed by moderator>>
Thanks & Regards
Moderator Message: If you are not sure of the answer - Stay away!
Edited by: kishan P on Apr 8, 2011 12:15 PM
‎2011 Apr 07 3:47 PM
But one remembers, the better way to update standard table is using BAPI's.
[ ]'s
Douglas Sant'Ana Santos | SAP ABAP
Linkup SAP
‎2011 Apr 07 3:46 PM
‎2011 Apr 07 3:48 PM
First the following text only apply to Customer Database Tables, not SAP standard tables that MUST be updated through SAP tools like BAPI or BDC.
There are only two syntaxes allowed for [UPDATE dbtab|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm]
- [FROM wa |http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_2@2@] or [FROM TABLE itab|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_3@3@] require that you first read the whole data as it will replace every non-key field.
- [SET set_expression|http://help.sap.com/abapdocu_70/en/ABAPUPDATE_SOURCE.htm#&ABAP_ALTERNATIVE_1@1@] can change a subset of fields, but you have to use it in a LOOP/ENDLOOP as it change each specified field of every record satisfying the condition of the WHERE option to the same value.
Regards,
Raymond