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 Document issue

Former Member
0 Likes
462

Hi,

I have created one change document in SCDO transaction. I am using that function module in my code.

These are the parameters, I am passing to the function module.

objectid = p_objid.

tcode = sy-tcode.

utime = sy-uzeit.

udate = sy-datum.

username = sy-uname.

upd_psacl_tab = 'U'.

"XPSACL_TAB contains only one record.

eg., Key Field1 Field2 KZ

1. A1 ABC 123 U (Record after modification)

"YPSACL_TAB contains 2 records

eg., Key Field1 Field2 KZ

1. A1 DEF 345 U (Record before modification)

2. B1 XYZ 567 E (Deleted record)

( In the above table, first record - the value of the Field1 and Field2 are changed )

CALL FUNCTION 'CNACL_WRITE_DOCUMENT' IN UPDATE TASK

EXPORTING

OBJECTID = OBJECTID

TCODE = TCODE

UTIME = UTIME

UDATE = UDATE

USERNAME = USERNAME

PLANNED_CHANGE_NUMBER = PLANNED_CHANGE_NUMBER

OBJECT_CHANGE_INDICATOR = CDOC_UPD_OBJECT "value = 'U'

PLANNED_OR_REAL_CHANGES = CDOC_PLANNED_OR_REAL

NO_CHANGE_POINTERS = CDOC_NO_CHANGE_POINTERS

    • updateflag of PSACL_TAB*

UPD_PSACL_TAB = UPD_PSACL_TAB

UPD_ICDTXT_CNACL = UPD_ICDTXT_CNACL

TABLES

ICDTXT_CNACL = ICDTXT_CNACL

XPSACL_TAB

= XPSACL_TAB

YPSACL_TAB

= YPSACL_TAB

.

The issue is after calling this function module, change document is created. When I look into the CDPOS table, the records are created as 2 deleted records(chngind = E) and 1 inserted record(chngind = I). But I need 2 records, one deleted (chngind = E) and another updated record (chngind = U) with old and new values.

(But the same function module is working fine if I pass either only deleted records in YPSACL_TAB table or only updated records, 1record in YPSACL_TAB and 1 record in XPSACL_TAB table . I am confused.)

Is there any mistake in my code or parameter values? Please help me out.

Regards,

SAP Lover.

2 REPLIES 2
Read only

Former Member
0 Likes
369

Please help me out.

Regards,

SAP Lover

Read only

Former Member
0 Likes
369

check the primary key of the table, if the changed field is a part of the primary key then the record will be deleated and re-created.

Since it is not possible to modify the primary key of the table.

Moreover you need to provide more details of the table , also you need to evaluate the last field of the X and Y table in debug mode, that will tell you what exactly it will do 'I' - Inser 'D' - Delete , U - Update.

but if it marked as update , and the primary key has been changed then the only option is to delete the record and re-create with the change in the primary key

Maybe this is the reason you get 2 change docs with 'delete' opeation

Hope it helps