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 the Idoc segment field value while processing

Former Member
0 Likes
6,915

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

1 ACCEPTED SOLUTION
Read only

ThangaPrakash
Active Contributor
2,499

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

9 REPLIES 9
Read only

ThangaPrakash
Active Contributor
2,500

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

Read only

0 Likes
2,499

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

Read only

0 Likes
2,499

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

Read only

0 Likes
2,499

Hi Thanga Prakash,

Thanks a lot . It works now.. Best solution .

Regards,

Pradeep.

Read only

0 Likes
2,499

Do we need to call EDI_DOCUMENT_OPEN_FOR_EDIT? Is it mandatory ?

Read only

0 Likes
2,499

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

Read only

0 Likes
2,499

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 . 

Read only

0 Likes
2,499

Okay, it is better you can use them all in sequence.

Give a try by removing them in your code.

Read only

atul_mohanty
Active Contributor
0 Likes
2,499

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.