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

How to edit Idoc data in inbound processing

Former Member
0 Likes
5,930

Moved to correct forum by moderator

Hi All,

How to edit idoc data in inbound processing ? We have a custom FM in inbound scenario and requirement is to update a value in idoc, this value comes after certain processing in custom FM.

I tried editing it through

EDI_DOCUMENT_OPEN_FOR_EDIT

EDI_CHANGE_DATA_SEGMENTS

EDI_DOCUMENT_CLOSE_EDIT

but there is problem in this approach. By this procedure two idocs are created in system, one with original data and one with modified data. We want only one with modified data.

We do not want any direct database table updates.

Please provide appropriate solution.

Note : We are not changing status record. Please do not post replies related to status change

Edited by: Matt on Nov 19, 2008 2:24 PM

Moved to correct forum by moderator

Hi All,

How to edit idoc data in inbound processing ? We have a custom FM in inbound scenario and requirement is to update a value in idoc, this value comes after certain processing in custom FM.

I tried editing it through

EDI_DOCUMENT_OPEN_FOR_EDIT

EDI_CHANGE_DATA_SEGMENTS

EDI_DOCUMENT_CLOSE_EDIT

but there is problem in this approach. By this procedure two idocs are created in system, one with original data and one with modified data. We want only one with modified data.

We do not want any direct database table updates.

Please provide appropriate solution.

Note : We are not changing status record. Please do not post replies related to status change

Edited by: Matt on Nov 19, 2008 2:24 PM

19 REPLIES 19
Read only

former_member404244
Active Contributor
0 Likes
4,027

Hi,

Please can u bit elaborate what u want to chnage as ur using custom fm ushould have full control..

Regards,

Nagaraj

Read only

0 Likes
4,027

We have a inbound scenario. Some date is coming from legacy system and with that data we are creating equipment in SAP. Equipment is not coming from legacy data and it is known after it is created using a BAPI in the function module of inbound idoc processing.

Idoc data in WE02 has only that data which is coming from legacy. Now our requirement is too update the equipment number is one of the fields in idoc so that it can be seen in we02. By this we can keep track of idocs that which equipment was created from which idoc. So equipment number must be visible in transaction we02.

I tried directly updating the IDOC_DATA in function module but it does not works and I tried using 3 function modules mentioned in top of this thread, then it created two idocs, one with original data(coming from legacy) and other with updated data(data from legacy + equipment number).

So my question here : Is there any other technique to update the data in idoc.

Read only

Former Member
0 Likes
4,027

you mentioned it is your own custom function module, so why cant you update the IDOC_DATA in that function module itself? Just read IDOC_DATA, and based on your conditions, update it back with the segemnt and data you want.

if the above doesnt work, explain the issue clearly

Read only

0 Likes
4,027

We are creating equipments and installing them in custom FM and the requirement is to populate the equipment number(generated in processing) in one of fields in IDOC, so that later idoc for a particular equipment can be identified.

I tried changing the idoc_data in FM itself but it does not reflects in WE02.

Please let me know if any requirement is not clear.

Thanks

Anuraag

Read only

0 Likes
4,027

use tcode bd87

Read only

0 Likes
4,027

We want to change the idoc in the same LUW. Separate transactions are not part of requirement.

Read only

0 Likes
4,027

how is this function module called? is the number there in SAP database when you are reading that. you can debug to see what your Function module is doing while updatign the field in the idoc data. I assume this is the function module which is fillign the rest of the idoc data, so why is that going to be different for this field.

Read only

0 Likes
4,027

this function module to linked to a process code and that in turn is linked to a message type in a partner profile. An external system will send data in idoc and we are creating equipments with that data. (Inbound Scenario)

Status messages are successfully updating but as I mentioned earlier, if we try to edit data in idoc it is not reflecting in database after the idoc is processed. Data which legacy system sends is stored in IDOC as it is.

Thanks

Anuraag

Read only

0 Likes
4,027

ok, now i got the issue. the data you are changing in the IDOC will not be stored in SAP IDOC in the database.

what you can do arther is read the idoc in the fucntion module, and then based on your condition, set the value, and do you processing using that value you are changing. as it is your custom function, you should have the way if using the filed value you wan tto update while posting IDOC to Application. But that value will not be reflected inteh IDOC data afterwards in WE02 or WE05

Read only

0 Likes
4,027

I think requirement is still not clear.

We have a inbound scenario. Some date is coming from legacy system and with that data we are creating equipment in SAP. Equipment is not coming from legacy data and it is known after it is created using a BAPI in the function module of inbound idoc processing.

Idoc data in WE02 has only that data which is coming from legacy. Now our requirement is too update the equipment number is one of the fields in idoc so that it can be seen in we02. By this we can keep track of idocs that which equipment was created from which idoc. So equipment number must be visible in transaction we02.

I tried directly updating the IDOC_DATA in function module but it does not works and I tried using 3 function modules mentioned in top of this thread, then it created two idocs, one with original data(coming from legacy) and other with updated data(data from legacy + equipment number).

So my question here : Is there any other technique to update the data in idoc.

Read only

0 Likes
4,027

ok, now it is much clear.

if you are creating equipments from these IDOCs, isnt tthe equipment# visible in IDOC status message? also if you are using the correct business object, you would be able to check the relation between idoc and equipment in SRREROLES table.

But there is no doirect way to update a fiedl in IDOC Data, unless you want to do direct DB update.

Read only

0 Likes
4,027

No equipment number is not displayed in message.

And please check the table name, I can find this table in database.

Read only

0 Likes
4,027

Hi,

If I am right then you want to change the data after idoc reached R/3 and while processing that Idoc.

If ur processing FM is custom then u should be able to edit the SDATA part of the segment (wh u want to edit).

Revert back if more help required.

Rhea.

Read only

0 Likes
4,027

Hi Rhea

I have already written this in thread that I have tried to edit SDATA but it is not helpful. Please read the thread and provide any possible solution. (If any)

Thanks

Anuraag

Read only

0 Likes
4,027

Did you find a solution for this?

Apologies for resurrecting this thread but I have the exact same question only with a different object / scenario.

But the general problem / question is the same: I have a standard inbound processing function module which has a TABLES parameter IDOC_DATA, which holds the records that end up later saved in EDID4. Inside the function module a BADI is provided to be able to embed custom coding. In that coding a custom key is generated which I would need to be saved in a segment field to be able later to relate the idoc to the created document. It is updated in the IDOC_DATA internal table but when the processing ends, the relevant piece of EDID4-SDATA for that segment is empty.

Since it is a TABLES parameter it cannot be infered if it is provided for reading only or to allow fields updation / population.

So the question is: Inside an inbound processing function module (any one), should I be able to change EDID4 records by changing IDOC_DATA internal table, or not?

I haven't found this relatively simple question / answer anywhere else.

Many thanks

Read only

0 Likes
4,027

Hi,

You can edit the idoc by doing the following steps:-

1. Goto WE02 transaction and give the IDOC number and execute

2. Once the required IDOC gets retrieved then double on the text pad icon beside the segment which you wanted to change.

3. Select the Data Record at the top and click Display <-> Change option, which will enable you to change the data in that segment.

4. After doing the step 3 then click the save button to save your changes.

5. Then system will generate a new idoc number to store the actual data and your current idoc will hold the new data and the idoc will be in 69 status.

6. Execute the Program RC1_IDOC_SET_STATUS by giving your idoc number and status as 69 and new status 64 and remove the test flag

7. Then the IDOC will be in 64 status and you can reprocess the idoc with the help of the program RBDAPP01 by giving the idoc number.

The above is the entire process for editing the error idoc and reprocessing it again.

I hope I am clear and you understood the entire flow of editing and reprocessing an idoc.

Thanks,

Mahesh.

Read only

0 Likes
4,027

That's not the question. Please read the whole thread.

Read only

0 Likes
4,027

Hi Anuraag,

Goto we19 t-code and change the data wherever you want in the segments & then select 'standard inbound procesing' for re-posting the IDoc, a new Idoc wll be created with the modified values, like this you can try.

Rgds,

Sripal

Read only

0 Likes
4,027

Not the question either.

However if you use the "Inbound function module" option inside WE19, to reprocess an IDOC with a function module directly (bypassing configuration), you can see that inside function IDOC_TO_FUNCTION_PASS, nothing is done with the data records after calling the processing function. Only status records are updated in DB.

That gives enough hints to answer my question with a NO I guess.