Updating records in the database table from an internal table
table: personel.
data: itab like personel.
* Read records from the database table where name is space, into an internal table
select * from personal into table itab
where name = space.
* Update name in the internal table to Unknown
loop at itab.
itab-name = 'Unknown'
endloop.
* Modify records in the database table. Only records with the same key values as then
* internal table is modified
MODIFY personel from table itab.
Updating a single entry
In this example the entry with the key value Customerno = 1 is changed.
table customer.
customer-customerno = 1.
customer-customnavme = 'John'.
UPDATE customer.
if sy-subrc <> 0.
..... No entry with the customerno = 1, add error handling
endif.
Updating multiple entries
Examlpe updating the field zchecked to 'X'
UPDATE zcostcheck set zchecked = 'X'
WHERE zcostcheck-zaar = zaar and
zcostcheck-zmaaned = zmaaned and
zcostcheck-zbukrs = zbukrs and
zcostcheck-zsaknr = zsaknr2 and
zcostcheck-zgsber = zgsber.
ABAP,ABAP report,Interactive Report,ALV grid,ALV list,IDOC,User Exit,RFC,Smartform,sapscript,ABAP Performance,Remote Function Module( RFC ),Function Module,Modularization techniques,ABAP tools,ALV report Generator,ABAP Interview Questions,BDC,BAPI,ALE,BADI, EDI,InternalTable,DataStructure,LSMW,Domain,DataElement,Basis and Administration ,ABAP HR development,ABAP Debugger,BW,ExceptionHandling,Download FI, CO, MM, PP, SD, PM, PS, QM, SM, HR, BW, APO,ABAP Tutorial
Search on this Website
Sunday, December 16, 2007
Updating database tables - SQL Query
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment