2015 Jul 23 6:35 AM
Hi All,
I am processing a Idoc with we19 ttnsaction. I am processing by inbound custom function module.
Inside that , for a particular segment i need to change the value of the field.
For example : In the segment = 'A1BDEF'.
if the segment-field1 = '1000'.
change it to '2000'.
endif.
I am changing the value in the Internal table which is defined in the function module tables parameter.
Even though,after processing when i check in WE02, the segment-field1 remains '1000'. Please share your ideas how can i change it exactly .
Thanks,
pradeep
2015 Jul 23 12:27 PM
Hello Pradeep,
Try with the below option, where you can ope the IDOC, do changes and close it.
Use the below function modules in sequence to achieve.
EDI_DOCUMENT_OPEN_FOR_EDIT
EDI_CHANGE_DATA_SEGMENTS
EDI_DOCUMENT_CLOSE_EDIT
Search for the where used lit of the function modules to find how it is used.
Regards,
TP
2015 Jul 23 12:27 PM
Hello Pradeep,
Try with the below option, where you can ope the IDOC, do changes and close it.
Use the below function modules in sequence to achieve.
EDI_DOCUMENT_OPEN_FOR_EDIT
EDI_CHANGE_DATA_SEGMENTS
EDI_DOCUMENT_CLOSE_EDIT
Search for the where used lit of the function modules to find how it is used.
Regards,
TP
2015 Jul 24 7:08 AM
Hi Thanga Prakash,
Thanks for your input . I have tried the 3 function modules in sequence with the proper subrc checks .
After the EDI_DOCUMENT_OPEN_FOR_EDIT , i have changed the segment value and then i have called the remaining 2 function modules. After completion i have checked in WE02.
But still the segment field VSTEL has the same value.
Thanks
2015 Jul 24 7:45 AM
Hello Pradeep,
Try using COMMIT WORK after you change the segment data.
IDOC data is stored in table EDID4. Might be it is not updating this table once you edit the Idoc.
Try COMMIT WORK and check.
Regards,
TP
2015 Jul 24 7:56 AM
Hi Thanga Prakash,
Thanks a lot . It works now.. Best solution .
Regards,
Pradeep.
2015 Jul 24 8:00 AM
Do we need to call EDI_DOCUMENT_OPEN_FOR_EDIT? Is it mandatory ?
2015 Jul 24 8:12 AM
Hello Pradeep,
All 3 function modules has to be called in sequence.
EDI_DOCUMENT_OPEN_FOR_EDIT --> Open the IDOC for editing
EDI_CHANGE_DATA_SEGMENTS --> Change the segment data
EDI_DOCUMENT_CLOSE_EDIT --> Close the edited IDOC
IDOC has to be opened, changed and closed.
So it is necessary to use EDIT function module.
Regards,
TP
2015 Jul 24 8:25 AM
I asking this because after CALL FUNCTION 'EDI_DOCUMENT_OPEN_FOR_EDIT',
The idoc_data-sdata is getting changed after execution of the above fm .
2015 Jul 24 8:32 AM
Okay, it is better you can use them all in sequence.
Give a try by removing them in your code.
2015 Jul 24 8:48 AM
Hi -
There are other way to Edit the IDoc (Data Segments). Its from WE02 transaction.
In WE02,once you have idoc details on WE02 transaction, select the segment (double click segment) that you want to change.
Then from menu-> Data Record -> Display change
Edit the value and then SAVE.
If you want to change the value in data segments of IDoc during the processing, please check for the user exits or BADI inside the Function module and there you can write your code.