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

Change data in base tables

Former Member
0 Likes
617

Hi,

How to modify and insert data in SAP base tables.

6 REPLIES 6
Read only

Former Member
0 Likes
589

Hi Basu

use SAP standard trasaction like va01 va02 mm02

dont modify the data directly , sap not recomended

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
589

hi

good

USe MODIFY STATEMENT always.

MODIFY ZADMN_PARTNERS FROM TABLE GT_ADMN_PATNR_SAVE.

CLEAR V_TEMP1.

thanks

mrutyun^

Read only

Former Member
0 Likes
589

Hi,

U can use INSERT and MODIFY statements. In Abap editor type insert ,select insert keyword and press F1 key and check for the syntax. Also, refer the following link.

http://help.sap.com/saphelp_nw04s/helpdata/en/c7/9dbd2a09a211d2a96c00a0c9449261/frameset.htm

Try and reward if found useful.

Read only

Former Member
0 Likes
589

hi sourav ,

Inserting or Changing Single Lines

To insert or change a single line in a database table, use the following:

MODIFY <target> FROM <wa> .

The contents of the work area <wa> are written to the database table <dbtab>. The work area <wa> must be a data object with at least the same length and alignment as the line structure of the database table. The data is placed in the database table according to the line structure of the table, and regardless of the structure of the work area. It is a good idea to define the work area with reference to the structure of the database table.

If the database table does not already contain a line with the same primary key as specified in the work area, a new line is inserted. If the database table does already contain a line with the same primary key as specified in the work area, the existing line is overwritten. SY-SUBRC is always set to 0.

A shortened form of the above statement is:

MODIFY <dbtab>.

In this case, the contents of the table work area <dbtab> are inserted into the database table with the same name. You must declare this table work area using the TABLES statement. In this case, it is not possible to specify the name of the database table dynamically. Table work areas with the same name as the database table (necessary before Release 4.0) should no longer be used for the sake of clarity.

To insert or change several lines in a database table, use the following:

MODIFY dbtab FROM TABLE <itab> .

Those lines of the internal table <itab> for which there is not already a line in the database table with the same primary key are inserted into the table. Those lines of the internal table <itab> for which there is already a line in the database table with the same primary key overwrite the existing line in the database table. The same rules apply to the line type of <itab> as to the work area <wa> described above.

SY-SUBRC is always set to 0. SY-DBCNT is set to the number of lines in the internal table.

reward points if helpful

Read only

Former Member
0 Likes
589

You should use transactions, BAPIs, function modules, class methods etc which are designed for a specific purpose and which respect the relational integrity of the database.

If you directly modify SAP tables by INSERT, MODIFY, DELETE etc you are asking for trouble. It is not recommended.

Good luck

Brian

Read only

alejandro_bindi
Active Contributor
0 Likes
589

You MUST NOT modify SAP tables directly by any means. Primary reasons are 1) consistency is compromised, for example you could be deleting a record which another table record references to, because cascading referential integrity is not assured inside SAP, and 2) If SAP finds out you probably loose support.

Regards