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

Updating CDHDR table

Former Member
0 Likes
1,775

Hi All,

I have a Z table of which I change the primary key values though a Z program. The object id field in CDHDR table is a combination of the key fields in my Z table. I have made some changes to the values of these key fields in this Z table.But I dont see the same reflected in CDHDR. I have created change document for Z table through SCDO transaction and generated a function module too. But I am not sure where to insert this function module and how to go further so that I can find the value in CDHDR.

Please assist.

Thanks.

Vineeta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,079

Hi Vineeta,

To update CDHDR table with a Z field, locate the data element of that Z field in table. In data element there is a flag called 'Change Document', tick the flag.

Now whenever you are changing value of that Z field, it will reflect in CDHDR.

Hope it will solve the problem.

Regards

Krishnendu

2 REPLIES 2
Read only

Former Member
0 Likes
1,079

The following function module is used to extract values from the CDHDR table.

*---------------------------------------------------------------------*
*             Form  GET_CHANGEDOCUMENT_HEADER
*---------------------------------------------------------------------*
*              Description :
*                            Get Change Document Header data
*---------------------------------------------------------------------*
*             -->P_I_T_CDHDR       Change Document Header
*             -->P_I_S_VBAK_VBELN  Order
*---------------------------------------------------------------------*

form get_changedocument.

* Get Change Document Header data
  clear g_objectclass.
  g_objectclass = c_verkbeleg.          " OBJECT CLASS: 'VERKBELEG'
  g_objectid    = is_vbak_vbap-vbeln.   " OBJECTID    : current Sales Order

  call function 'CHANGEDOCUMENT_READ'
    exporting
      objectclass                = g_objectclass
      objectid                   = g_objectid
    tables
      editpos                    = i_cdpos
    exceptions
      no_position_found          = 1
      wrong_access_to_archive    = 2
      time_zone_conversion_error = 3
      others                     = 4.
* If records are returned from CDHDR
  if sy-subrc eq 0.
* Sort by latest change number
    sort i_cdpos by changenr descending.
  endif.

endform.                    " GET_CHANGEDOCUMENT_HEADER

But I really don't think that the table registers changes done to any Z object. Try this anyways.

Reward if useful,

Thanks,

Rahul

Read only

Former Member
0 Likes
1,080

Hi Vineeta,

To update CDHDR table with a Z field, locate the data element of that Z field in table. In data element there is a flag called 'Change Document', tick the flag.

Now whenever you are changing value of that Z field, it will reflect in CDHDR.

Hope it will solve the problem.

Regards

Krishnendu