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

Diff. btwn UPDATE & MODIFY? reg. CDHDR tbl?

Former Member
0 Likes
1,223

Hi Experts,

pls. clarify me that,

1) Doff. btwn UPDATE and MODIFY?

2) How/When INSERT entry is populated in CDHDR tbl?

3) I guess, If I create(brand-new) a record in a Master tbl, it wuld NOT go to CDHDR tbl? am I correct?

thanq.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,087

Hi,

The CDHDR will not create an entry unless the change document is used for that object..

The CDHDR will not have an entry for Z tables unless you create an change object in SCDO ...and call the write function module

Thanks

Naren

Hi Experts,

pls. clarify me that,

1) Doff. btwn UPDATE and MODIFY?

2) How/When INSERT entry is populated in CDHDR tbl?

3) I guess, If I create(brand-new) a record in a Master tbl, it wuld NOT go to CDHDR tbl? am I correct?

thanq.

8 REPLIES 8
Read only

Former Member
0 Likes
1,087

Hi,

1)

Update database table command will insert a new entry. But MODIFY will check if record already exist, if it exist then it will modify existing record else it will insert new record in db table.

For more details here is screenshot from F1 help -

INSERT - Inserting Data in Database Tables

Variants:

1. INSERT INTO dbtab [CLIENT SPECIFIED] VALUES wa.

INSERT INTO (dbtabname) [CLIENT SPECIFIED] VALUES wa.

2. INSERT dbtab [CLIENT SPECIFIED] FROM TABLE itab. oder

INSERT (dbtabname) [CLIENT SPECIFIED] FROM TABLE itab.

3. INSERT dbtab [CLIENT SPECIFIED]. oder

INSERT *dbtab [CLIENT SPECIFIED]. oder

INSERT (dbtabname) [CLIENT SPECIFIED] ... .

Effect Adds new records to a database table (see relational

database). You can specify the name of the database table

either directly in the program in the form dbtab or at runtime

as the contents of the field dbtabname. In either case, the

database table must be declared in the ABAP Dictionary. You

can only insert data using a view if the view refers to a

single table and has the maintenance status "No restriction"

in the ABAP Dictionary.

By default, data is only inserted in the current client.

However, if you use the CLIENT SPECIFIED addition, you can

switch off the automatic client handling. This enables you to

enter data for any client in a cross-client table, not just in

the client in which you are logged on. In this case, the

client field is treated like a normal field to which you can

assign a value in the work area.

MODIFY - Change a database table

Variants:

1. MODIFY dbtab. or

MODIFY *dbtab. or

MODIFY (dbtabname) ... ..

2. MODIFY dbtab FROM TABLE itab. or

MODIFY (dbtabname) FROM TABLE itab.

3. MODIFY dbtab VERSION vers. or

MODIFY *dbtab VERSION vers.

Effect Inserts new lines or updates existing lines in a database

table (s. relational database). If a line with the specified

primary key already exists, an UPDATE is executed. Otherwise,

an INSERT is performed. You can specify the name of the

database table either in the program itself in the form MODIFY

dbtab ... or at runtime as the contents of the field dbtabname

in the form MODIFY (dbtabname) ... . In both cases, the

database table must be defined in the ABAP Dictionary.

Normally, records are inserted or updated only in the current

client. Data can only be inserted or updated using a view, if

the view refers to a single table and was created in the ABAP

Dictionary with the maintenance status "No restriction".

MODIFY belongs to the Open SQL command set.

When the statement has been executed, the system field

SY-DBCNT contains the number of edited lines.

2)

When a document is changed it ll get posted in CDHDR table.

3)

I assume new records wouldnt be in CDHDR table.

Sri

Read only

Former Member
0 Likes
1,087

Hi,

1) Update will modify an existing record if the record is available in the database.

MODFY will modify an existing record if the record is available in the database. If the record is not available then it will create a new record.

2) When there is a change in the document then you will have an entry in the CDHDR table.

3) I believe it will have an entry in CDHDR table when you create a new record for the transaction table. I am not sure for master table.

Thanks

Naren

Read only

0 Likes
1,087

thanq,

When INSERT comes into picture in case of CDHDR tbl? I mean, When an entry comes into cdhdr tbl, with INSERT value ?

curious sake, so the cdhdr is huge one, coz there r many many tbls in SAP and happens changes in every day!!

thanq.

Message was edited by:

Srikhar

Read only

0 Likes
1,087

whenever a document is changed, an entry is updated in the table CDHDR.

Sri

Read only

Former Member
0 Likes
1,088

Hi,

The CDHDR will not create an entry unless the change document is used for that object..

The CDHDR will not have an entry for Z tables unless you create an change object in SCDO ...and call the write function module

Thanks

Naren

Read only

0 Likes
1,087

thanq,

can u pls. elobarate with an example, of ur statement,

<i><i><b>The CDHDR will not create an entry unless the change document is used for that object..</b></i></i>

thanq.

Read only

0 Likes
1,087

Hi Srikhar,

CDHDR and CDPOS table are related to change documents. You need to create the change document or need to activate the change documents then only entries will be made in these tables.

Just refer below link for details

http://help.sap.com/saphelp_nw04s/helpdata/en/2a/fa015b493111d182b70000e829fbfe/frameset.htm

also check transaction SCD0.

Regards,

Atish

Read only

Former Member
0 Likes
1,087

Hi Srikhar,

For each object class when even a data is created and entry is inserted into header table.... and the same record when modifyed (changes or deleted....) header table is modified with indicator...for detailed entries you can find out in items table....

If the hint is useful… Say thanks by reward….

Regards,

Prabhu Rajesh