SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Change document history



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Arch & Logs
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sun Oct 14, 2007 6:00 pm    Post subject: Change document history Reply with quote

Change document tables
The change document tables are as follows:
CDHDR - Change document header table
CDPOS - Change document items table

Activate change document history for a specific field
In order to activate the change history for a specific field simple check the 'change document' checkbox within the data element.


Add entries to Change Document tables
When adding entries manually to the change document history tables(CDHDR, CDPOS) you will need to find the actual function module used by the SAP transaction to create these entries! This can be done as follows:

Step 1 (Execute transaction)

Execute transaction SCDO

Step 2 (Select required object)

Place the cursor in the required entry (i.e. GMGRANT) and go to the menu option: Change doc.object->Display


Step 3 (View generation info)

Press the ‘Generation info’ button


Step 4 (Retrieve update function module )

The following screen will be displayed showing various information, including the ‘update function module’ (i.e. GMGRANT_WRITE_DOCUMENT). This can then be viewed via SE37 or SE80 like any other function module.


Step 5 (Executing the function module)

If you want to know how the function module works and how to populate its parameters, then it is a good idea to put a break-point within the FM code and then execute the transaction which creates the change history entry. You will then be able to see what the transaction passes to the FM and replicate it.

Create Change Document History functionality for a new table
If you want change history on one of your newly created Ztables or infact an SAP table that
does not currently have it you will need to implement the following steps:

Step 1 (Execute transaction SCDO)

Step 2 (Click the create button and enter name!)

Note: Will probably get the message ‘Change document object ZNEWCH is not in your namespace. Do you still want to create the object?’. Just click yes!

Step 3 (Enter table details )
Enter table name of which changes need to be tracked and press insert!


Step 4 ( Save )
You should now see the following screen, Press the save button, followed by the


Step 5 ( Generate Update Program )
Goto Utilities->Generate update pgm.

Note: Will probably get the message ‘Change document object ZNEWCH is not in your namespace. Do you still want to create the object?’. Just click yes!

Step 6 ( Enter Update Program details )
Enter details as follows, and press 'Generate'.

Note: Please note if the function group entered does not exist then it will be created during this process!

Step 7 ( Update program proposal screen )
You will now be presented with an update program proposal screen detailing what objects will be created.


Step 8 ( Press SAVE )
Now press save and the update program will be created.


Step 9 ( How to Use it )
You will now see that a function module has been created, this can now be used to make entries in the documnet history tables when any entries are made to you table:
Code:
CALL FUNCTION 'ZGMRESP_WRITE_DOCUMENT'
EXPORTING
objectid = 'ZGMRESP'
tcode = 'ZP218'
utime = sy-uzeit
udate = sy-datum
username = sy-uname
n_zgmresp = wa_ngmresp "New record
o_zgmresp = wa_ogmresp "Old record
UPD_ZGMRESP = 'U'.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Arch & Logs All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.