Saturday 12 April 2014

Creating SAP Change Document Object (SCDO):Using CDHDR & CDPOS Table for different applications

Scenario: Creating Sap Change Document Object and using it in the program to log the field changes in the standard data base tables: CDHDR & CDPOS.

Step1. Create a DB table and let's say for certain field value change we need to track the previous value and the new value in the standard table CDHDR & CDPOS. In this case suppose want to keep the track of the material status change by the help of the filed 'MAT_STATUS'.















Step2. Go to the data element of the field MAT_STATUS. In the Further Char tab, check the Change Document check box.





















Step3. Go to the domain.























Step4. Here we have 3 allowed values for the field. This is not related to change document track. just for our test purpose we have restricted to certain values only.

















Step5. Create some material records.















Step6. Now to create the Change Document Object, go to the Tcode- SCDO.









Step7. Click on the Create button.














Step8. Provide a change document object name and click the continue button.














Step9. Continue.















Step10. Provide a description and the Table name which is created above. Then click on insert Entries button.























Step11. The below screen will appear.















Step12. From the Utilities Menu go to Generate Update Pgm.
















Step13. Continue with Yes.














Step14. The e,ow pop up appears, Provide the include name, function group name and a name space 'Z' for the function module. At last click on Generate button.































Step15. The below details are automatically created for our change Document Object 'ZMAT_STATUS_TRK'. The important is the Update function module which will be used later to store the changed value in the CDHDR and CDPOS table. Go back.


























Step16. Later any point You can come to the Tcode- SCDO and select the Change document object and click on the button Generate Info.















Step17. U can get the all required Info.
























Step18. Create a report and call the Change document Object function module. In the code, in the Update part we are calling the Change document Object FM and passing the values before and after. That is Old value and new value.


























Step19. Screen flow logic.














Step20. Screen Fileds.


















Step21. Screen buttons with ok code.













Step22. Lets execute the report. The below screen comes up.



















Step23. Provide a material number and click on the Read button.






















Step24. The appropriate data is filled in the respective fields. Lets change the Status value and hit the Update button.






















Step25. Change the Status value to R and Click  on the Update button.


















Step26. The message appears and the DB table is updated.


















Step27. Lets go to the CDHDR table and provide the Change Document Object name ans F8.






















Step28. The records u will find here.












Step29. Go to CDPOS table and provide the Change Document Object Name and Hit F8.





















Step30. The changed value of that particular field is logged here. The Old value and New Value.










_________________________________________________________________________________

Friday 11 April 2014

Text Objects And IDs Creation and Using It by FMs 'CREATE_TEXT' & 'READ_TEXT'.

Scenario: SAP Script uses Text Object and Text Ids concept to store some information in the standard table 'STXH' and 'STXL'. Also these Text Object and text Ids can be used in some different application to store some information in the same standard table. The below post describes how to create the Text Objects and Text Ids and using the same to store some messages by some standard function modules.

Step1. Go to Tcode- SE75.










Step2. Select the first radio button and click on Change button.





















Step3. Click on Continue button.






















Step4. Now Click on Create button to Create Text Object.













Step5. Provide TEXT Object Name, Description and other details and at last click on Continue button.























Step6. Click on Back button and from the Popup screen click on YES button.



















Step7. Click on Continue button.





















Step8. The Text Object is created. To create Text Ids under Text Object, Select the Text Object and Click on the Text Ids button.













Step9. Click on Create button.















Step10. Provide the TEXT ID details and at last click on the Continue button.






















Step11. Save it.















Step12. The text Object is available in the table 'TTXOB'.












Step13.  The text ID is available in the table 'TTXID'.












Step14. Create a report and use FM 'CREATE_TEXT' and use the above created Text Object and Text ID to store some message in the standard table 'STXH' & 'STXL'.




























Step15. Output.














Step16. Check the details in STXH table.











Step17. Check the details in STXL table.











Step18. Use the FM 'READ_TEXT' to read the above created text from the standard sap script table.





















Step19. Output.
















______________________________________XXX______________________________________

Comments system

Disqus Shortname