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

IDOC - Changes recorded not consistent

Former Member
0 Likes
1,202

Hi,

I have a problem in idoc. The code for idoc is triggered from user exit in sales order. It is placed in form FORM USEREXIT_SAVE_DOCUMENT (MV45AFZZ).

Now the problem is that changes done in sales order are not getting captured consistently in idoc. Sometimes i am able to see those changes and sometimes it is not carried by idoc.

In most of the cases first time when i change an order data is not reflected in the idoc. I am suspecting that it is because those changed data are still in the buffer at that point of time. Has anyone faced this problem before? Please suggest some solution.

Shweta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
915

I donot know how u r triggering the idoc creation logic in FORM USEREXIT_SAVE_DOCUMENT (MV45AFZZ). But if it is a FM then make the FM RFC enabled and call it in background task. That means whenever commit work is executed by the system then it calls ur FM. From the USEREXIT_SAVE_DOCUMENT if u know the sales order no. then u can directly fetch the changed data from database within the FM and can populate ur idoc.

Regards,

Joy.

5 REPLIES 5
Read only

Former Member
0 Likes
915

The reason for this behavior is because when you save an order it is always saved asynchronously in update task. Meaning at the time the user exit is executed, the data has not yet been passed to database completely.

If you need to kick off the IDOC with the order data, why are you not reading the internal tables (all order data is available in that user exit) and pass it to the IDOC?

In case you are just triggering a standard IDoc, you need to create a change pointer and then based on that change pointer trigger the IDOC

Hope that helps,

Michael

Read only

Former Member
0 Likes
916

I donot know how u r triggering the idoc creation logic in FORM USEREXIT_SAVE_DOCUMENT (MV45AFZZ). But if it is a FM then make the FM RFC enabled and call it in background task. That means whenever commit work is executed by the system then it calls ur FM. From the USEREXIT_SAVE_DOCUMENT if u know the sales order no. then u can directly fetch the changed data from database within the FM and can populate ur idoc.

Regards,

Joy.

Read only

0 Likes
915

Thanks!!!

Actually i could make out that problem becuase when i ran the program manually it worked.

I don't want to schedule a job periodically for this purpose. Is it fine to call the job using workflow?

I need to trigger this when a orders with a particular order type are getting changed.

Read only

0 Likes
915

This is not a background job rather it is a tRFC FM call that is running in ur system only.And yes u can choose workflow as well but it can be a overhead for u as u have to maintain all the config. for it. Instead of workflow I will prefer tRFC as for it no additional config. is required.

Regards,

Joy.

Read only

0 Likes
915

Just had another thought,

You could also set your trigger in the V2 update. Just create a update function module (update module - start delayed). Put your call for the IDOC in there and call it in the SAVE userexit IN UPDATE TASK.

Since the V2 update modules are only executed once the V1 update modules have all been executed successfully, you know that at this point the order data has already been updated on the database hence calling the IDOC will read the correct data.

Regards,

Michael