Skip to Content

This document is meant for the people who are looking for a prototype of a report program for editing (modifying) Idocs data. Recently, I got a requirement to reprocess few Idocs in the production environment with over 500 fields to be edited per Idoc.

 

Editing and reprocessing can be done by Standard Tcode we19 however, it was too tedious and time consuming activity to change the values of 500 elements per Idoc manually. I checked the Idoc segment fields and found that most of the incorrect values were repeating e.g. Dates in all the date fields were coming incorrectly  as DDMMYYYY instead of YYYYMMDD.As the requirement was an urgent one, I was looking for a quick fix solution for editing the Idoc and repeated incorrect values in the segment fields using a report program.

 

In my voyage of searching the solution I found following function modules which can be used for editing the Idoc.

 

1) EDI_DOCUMENT_OPEN_FOR_EDIT (To Open the IDOC for Editing)
2) EDI_CHANGE_DATA_SEGMENTS    (To change the segments field’s data)
3) EDI_DOCUMENT_CLOSE_EDIT        (To Close the IDoc after editing )

 

However, I was not able to find any completely reusable report which can be used directly or as a template to reprocess Idocs of different message types.

 

I have tried to write a report which can provide us flexibility of editing different types of Idocs and conditional edit in the Idoc with all the possible validations which I can think of 🙂

 

Report layout:

Step 1.  In the selection screen Idoc number, Idoc Type, Segment to be Edited, Element of the segment will be given as input parameters.

For conditional edit, Segment and element values for Comparison at the runtime can be provided.

 

Step2. At selection screen check if the segment type entered in selection screen exists in the message type of the Idoc. Give the appropriate message for the check.

 

Step 3. Open Idoc for editing using Function Module EDI_DOCUMENT_OPEN_FOR_EDIT. Give the appropriate message if unable to open the document.

 

Step 4. Get the segment structure for the segment entered in the selection screen and validate if the element entered in the selection screen exists in the segment. Give the appropriate message if the segment doesn’t exist.

 

Step 5. Create internal table with the structure of the segment for creation of dynamic internal table.

 

Step 6. Create dynamic internal table and dynamic work area and assign it to the field string. Modify the data using EDIDD segment to change the data of the Idoc and Call the function module EDI_CHANGE_DATA_SEGMENTS.

 

Step 7. Change control record using function module  EDI_CHANGE_CONTROL_RECORD.

 

Step 8. Close Idoc using function module EDI_DOCUMENT_CLOSE_EDIT.

 

Source Code :

The source code is available in Code Sample Under Wiki.URL for the same is https://wiki.sdn.sap.com/wiki/display/Snippets/Reusable+Code+for+Editing+Idoc

 

 Usage:

1) We have to edit the Idoc segment E1EDKA1 field PARTN.

      The existing value of PARTN is 05890 as shown in figure.

       We have to made it 05900.

   image

2) Execute the report using Tcode SE38 or SE80 if any tcode is not assigned for the same. If you have used the same Selection Texts as shown in the Code Sample Under Wiki following selection screen will appear.Now fill the values as shown below for our Use case.

  

image

Please note that if no values will be specified for segments and elements for conditional edit the report will modify all the occurence of element PARTN under segment E1EDKA1 in the Idoc. 

3) Message appears if the data is edited successfully.   

 

image

 4) Check the Edited Idoc.

 

   image

And we have edited the Idoc. 🙂

After editing you can reprocess the Idoc.

 Point to Note:  Report is tested in my system and it works excellently for me. It is just a prototype and whoever so using the report can customize and enhance it to address the specific needs of the project. Report can be tuned for its performance for better results.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Abdul Hakim
    Hi
    Nice blog.Even i have caught up with a situation longtime back where i need to edit some 100+ idocs which i have did thru WE19.Your Program will really help the users to save the time. Keep up the gud work.

    Regards,
    Abdul Hakim

    (0) 
  2. Pravesh Sharma
    Thanks a lot for such a nice blog. It would provide a great help in production support activity where reprocessing of IDoc’s is a frequent activity.

    Hoping for many more to come from your side.

    Regards
    Pravesh

    (0) 
  3. ankur garg
    Hi Amitanshu,
    This is very usefuly Blog .With this I can solve my daily Idoc reprocessing issue.

    Thanks for posting it and wish to see good work from you in future as well.

    Regards,
    Ankur

    (0) 
  4. Shareen Hegde
    Looks like an useful program. But if you edit an IDOC in say status 30, it created 2 IDOC. The first one is a back up of the original and in status 33 and the new edited one in status 32. Is there anyway we can stop this ?
    (0) 
  5. Sanjay Deshpande
    Hey….WE05 has this functionality.
    Just click on Page icon infront of segment in WE05 tcode.A widow will open with idoc fields contents and description.
    Data records –> Display <-> change
    (0) 

Leave a Reply