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

Former Member
0 Likes
1,504

Dear Experts,

I created a Z table ZTAB which has 2 fields. I want to capture all the changes being done to this customizing table.

I have tried checking the Table logging option and activating through RZ11 the profile parameter but the performance

seems to be costly since all the tables in the client are logged(customizing tables). It works good but my organization feels

it to be performance load on DB.

I have tried the other alternative( SAP Change Document Management) but am stuck in the midway:

1) checked the 2 fields of the table for change document in further characteristics of data elements

2) created a change document object in SCDO and it has given an FM which should be called in Update Task

3) i have created an event for the ZTAB and have written the code in that event include that this update program should be called

4) which event has to be used? i mean which option..not only at the point of creating a new entry.also at the time of deletion,

modifiication of a record, i should capture the changes..i have used "at the time of getting saved in the database"

5) do i need to call jus the FM in update task..i did so and could see that the CDHDR and CHPOS tables are not updated

Thanks and regards in advance for patiently reading the query,

I request you to throw some light...i have checked the other threads but have seen that the updation is done by programs..

here my case is different..i jus have the table and edit it through SM30

Sampath

12 REPLIES 12
Read only

Former Member
0 Likes
1,454

Hi Sampath,

In SM30, you enter your Z table and display. From the menu choose utilities->Change logs you will get the list of changes made to the table. Was this not useful to you?

Thanks,

Senthil

Read only

0 Likes
1,454

Sorry for the late response,

But the option of checking the logs from SM30 comes only when you activate the table logging and i do not want to do that since all the tables in the client would be logged.

Hence i was trying to update through change management.

Experts,

I request you to throw some light on this

Regards,

sampath

Read only

0 Likes
1,454

Hi,

check this Wiki...

http://wiki.sdn.sap.com/wiki/display/ABAP/ABAP-DataChangeTrackerforCustom+Tables

Prabhudas

Read only

former_member848108
Active Participant
0 Likes
1,454

Hi,

You are on the right way, simply use the table maintenance event 01 (Before saving the data in the database) to call the

change document function module with the appropriate parameters. You don't need the "In Update Task" option while calling the FM.

Best regards,

Ozcan.

Read only

0 Likes
1,454

Thanks everyone,

Am almost on the verge of completing this.

1) For insert , i have used the event " creating a new entry"

2) For upate and delete..am confused since all the events look the same...any idea on this.

Thanks and regards,

sampath

Read only

0 Likes
1,454

Hi Sampath,

Use 07 Before correcting the contents of a selected field for Update

& 03 Before deleting the data displayed for Delete

Regards

Abhii

Read only

0 Likes
1,454

Hi again,

You can use the same event for insert / update and delete, but you need to make use of global table "TOTAL" to make a distinction. The field VIM_ACTION can have the following values:

*VIM_ACTION:

*GELOESCHT : flagged for deletion

*NEUER_EINTRAG : New entry

*AENDERN : changed entry

*UPDATE_GELOESCHT : entry first changed and then flagged for deletion

*NEUER_GELOESCHT : entry first newly created, not yet saved, and then flagged for deletion

*ORIGINAL : the same as the database status



  DATA: BEGIN OF LT_X.
          INCLUDE STRUCTURE ZDUMMY."your z-table here
          INCLUDE STRUCTURE VIMTBFLAGS.
  DATA: END OF LT_X.
 DATA:   LV_CFLAG TYPE CDCHNGINDH.

  LOOP AT TOTAL ASSIGNING <FS_ANY> CASTING.
  MOVE-CORRESPONDING <FS_ANY>  TO LT_X .

    CASE LT_X-VIM_ACTION.
      WHEN NEUER_EINTRAG.
        LV_CFLAG = 'I'.
      WHEN  GELOESCHT OR UPDATE_GELOESCHT.
        LV_CFLAG = 'D'.
      WHEN   AENDERN.
        LV_CFLAG = 'U'.
      WHEN OTHERS.
    ENDCASE.

    CHECK LV_CFLAG NE SPACE.
*complete the code according to your need..
ENDLOOP.

I hope it helps,

Ozcan.

Read only

0 Likes
1,454

Hi Ozcan,

I tried the below code and declared the field symbol but syntactically it results in the below erro:

Das Feldsymbol "<FS_ANY>" muss entweder voll typisiert sein oder einen

der generischen Typen C, N, P oder X tragen.

Any idea on this?

Also when it is the point of update, how can i check the older values..since my ZTAB is holding only one value..

do i have to hit a select and fetch the data by the key fields?

I translated the error as "The field symbol "<FS_ANY>" typed must either be full or

the generic types carry C, N, P or X." . When the casting keyword is put in, it results the above

message. when i take it off, it looks good in syntax But the values do not flow into lt_x.

Regards,

sampath

Edited by: SampathKumarPilla on Aug 31, 2010 5:07 PM

Read only

0 Likes
1,454

Thanks everyone,

But for creation, the insertion is good, how do i fill in the values for old_values for updation..

how can i hit the table dynamically with the key fields?

also is there any report standard as such that i can display the values for old and new?

Thanks and regards,

sampath

Read only

0 Likes
1,454

Hi again,

You can select the old values from the database since the records on the database have not been changed yet. I couldn't understand what you mean with the key fields. I don't know any standard report to display changes but you can write one easily using the FMs BUS_CDHDR_GET and BUS_CDPOS_GET. ( You can pick up change document from the table CDHDR : Change document header ).

Kind regards,

Ozcan.

Read only

0 Likes
1,454

Thanks Ozcan,

I need to write up a report simliar to the ouput of SCU3(Table Logging) showing the complete records inserted,changed,deleted.

But using the change documents, how can i show the complete record for deleted items?

Read only

0 Likes
1,454

Hi again,

It doesn't seem to be possible to show the complete data for the deleted entries. For such a scenario, you can assume adding an extra field called "active" (type c length 1) where you can activate and deactivate entries of the table, so that the need for deleting entries disappears.

Regards,

Ozcan.