cancel
Showing results for 
Search instead for 
Did you mean: 

Change documents

Former Member
0 Kudos

Hi All

I am facing a problem while getting the old and new values in the Table CDPOS.

While creating the Change document object i have selected the copy as internal table

and my table has got 3 fields empid, empname and projectid in all the 3 change document flag is selected.

I have successfully created the object and when i am calling the function module generated in my program i am passing all the required parameters even the old and the new table contents

When I select the check box (here also same kind of table with all the settings as before table) and do the 2 fields update,

Here a) If the data in the old and new table are same then no log is created.

b) If I give the diff data in both the old and new table then the 2 log records in CDPOS with the

same document number will be generated.

c) If I donu2019t want the old values to be displayed I just pass new values then one log will be

generated for the two fields updation but no new values are displayed in the table.

In this case also I am updating one line of record.

I am pasting the code please correct me if i am wrong.

REPORT zdipu3.

INCLUDE fztest_1cdt.

DATA: lv_upd TYPE cdpos-chngind VALUE 'U'.

DATA: ls_table TYPE zdipu_114.

DATA: lt_table TYPE zdipu_114.

DATA: ls_table1 like STANDARD TABLE OF zdipu_114.

DATA: ls_txt TYPE cdtxt.

PARAMETERS: lv_id TYPE zdipu_114-zid,

lv_name TYPE zdipu_114-zempname,

lv_pjid TYPE zdipu_114-zprojectid.

MOVE lv_id TO ls_table-zid.

MOVE lv_name TO ls_table-zempname.

MOVE lv_pjid TO ls_table-zprojectid.

APPEND ls_table TO xzdipu_114.

MOVE-CORRESPONDING ls_table TO lt_table.

clear ls_table.

LS_TABLE-zid = '709237'.

LS_TABLE-ZEMPNAME = 'nged'.

LS_TABLE-ZPROJECTID = '8'.

append ls_table to yzdipu_114.

START-OF-SELECTION.

.

UPDATE zdipu_114 FROM lt_table.

IF sy-subrc = 0.

PERFORM fztest_1cdc.

ENDIF.

&----


*& Form FZTEST_1CDC

&----


text

-


FORM fztest_1cdc.

CALL FUNCTION 'ZTEST_1_WRITE_DOCUMENT'

EXPORTING

objectid = 'ZTEST_1'

tcode = sy-tcode

utime = sy-uzeit

udate = sy-datum

username = sy-uname

object_change_indicator = lv_upd

upd_icdtxt_ztest_1 = lv_upd

upd_zdipu_114 = lv_upd

TABLES

icdtxt_ztest_1 = icdtxt_ztest_1

xzdipu_114 = xzdipu_114

yzdipu_114 = yzdipu_114.

ENDFORM. "FZTEST_1CDC

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I have already advised you once that this topic is not appropriate for this forum. You should use the ABAP General Forum for your question. Please do not continue to post this same question again in the incorrect forum.