Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9190

Re: Modifying Standard SAP tables

$
0
0

Dear

You can definitely modify Standard Database table from ABAP Program.

 

 

1.Syntax for modifying Database table from Workarea is,

 

MODIFY dbtab FROM workarea.

 

Effect

When a wa work area that is not table-type is specified, which meets the requirements for use in Open SQL statements, a line is searched for in the database table that has the same content in the primary key as the corresponding beginning part of the work area.

 

If such a line is not found, a new line is inserted according to the same rules as for the INSERT statement.

 

If such a line is found, this line is overwritten according to the same rules as for the UPDATE statement.

 

If the change would lead to a double entry in a unique secondary index, then it is not executed and sy-subrc is set to 4.

 

Notes

The wa work area should always be declared with reference to the database table or the view in the ABAP Dictionary.

 

If the the database table or view is specified statically, then you the specification of the work area using FROM wa can be ommitted outside of classes if a dbtab table work area is declared for the corresponding database table or for the view using the TABLES statement. The system enhances the MODIFY statement implicitly with the FROM dbtab addition.

 

Eg. :

DATA message_wa TYPE t100.

 

message_wa-sprsl = 'EN'.

message_wa-arbgb = 'MYMSGCLASS'.

message_wa-msgnr =  '100'.

message_wa-text =  'Some new message ...'.

 

MODIFY t100 FROM message_wa.

 

2. Syntax for changing Database table from internal table is ,

 

MODIFY dbtab FROM TABLE itab.

 

Effect

If an itab internal table is specified, the system processes all lines in the internal table according to the rules for the wa work area. The line type of the internal table has to meet the requirements for use in Open SQL statements.

 

If the change to a line in the internal table would lead to a double entry in a unique secondary index, the corresponding line is not inserted and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The sy-dbcnt system field is always set to the number of lines that were actually processed

 

<removed by moderator>

 

Regards

 

Message was edited by: Manish Kumar


Viewing all articles
Browse latest Browse all 9190

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>