Application Development 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: 

Why is EXIT_SAPMM06E_017 triggered more done once por a PO line?

Former Member
0 Kudos
651

Hi experts!!

We have some code placed in EXIT_SAPMM06E_017 within a project. This code reads documents associated to the material in the PO line and writtes ( associates)  these documents to the PO line. We wanted this exit to trigger only once when a PO line is completed. It used to trigger just once but now it is being triggered for each change in the PO line. What could be happenning?

Is there another user exit more suitable to transfer material documents to PO line ?

Thanks in advance.

3 REPLIES 3

Former Member
0 Kudos
105

Hi Jaione,

Please try to implement BADI : ME_PROCESS_PO_CUST.

In method : PROCESS_ITEM you can set your code in inside method.

Regards,

Prasenjit

raymond_giuseppi
Active Contributor
0 Kudos
105

Customer-exit EXIT_SAPMM06E_017 (good old time) or method PROCESS_ITEM of BAdI ME_PROCESS_PO_CUST (more up-to-date) may and will both be executed multiple times, and always re-executed when some data is changed (SAP did even implement a check to stop recursive call to prohibit infinite loops once  a number of call are executed (I forgot the note and the number of execution, but does not matter)

So If you want to process only one, two solutions (depends also on WHAT you intend to do)

  • Memorize a flag "line already processed" (instance attribute of implementing class or STATICS internal table in customer-exit)
  • Only execute once (e.g. method POST of BAdI if you don't change the item but trigger another task, e.g. IN BACKGROUN D TASK), method CHECK is also usually executed only once (but user may call it manually and if error raised in it it will trigger another execution when error corrected)

NB: But actually, you should also execute your code (and some deletion) when user change the material reference ?

Regards,

Raymond

0 Kudos
105

Hi Raymond!!

Thanks for your answer.Actually what I shoud do is:

- Read the material code and write in the PO line all documents linked to this material.

Also, if user decides to make any change, they should free to do it; thus I need to know if user has changed documents assigned to the PO line; in this case I should not transfer any document to the PO line. Is there any way to know that user has changed documents in a PO line?

When you suggest to control if PO line has been already proccessed you write:

  • Memorize a flag "line already processed" (instance attribute of implementing class or STATICS internal table in customer-exit)

How can I declare a variable for each line ?

In which method should I initialize the variable?

Thanks in advance.