cancel
Showing results for 
Search instead for 
Did you mean: 

BADI: Purchase order Workflow restart, Order Confirmation entered

Stephen_Niemann
Participant
0 Kudos

Hi there,

I´m new to the "BADI World", but I have an issue I´m trying to solve:
My Procurement Team wants a PO-Workflow, which only will be triggered AGAIN, when the price rises. I therefore implemented this code in BADI MMPUR_PO_WORKFLOW_RESTART:

   DATA newPoValue TYPE P.<br>    DATA newNetPriceAmount TYPE P.<br>    DATA oldPoValue TYPE P.<br>    DATA oldNetPriceAmount TYPE P.<br><br>    workflowrestarttype = 'N'.<br><br><br>    LOOP AT PURCHASEORDERITEM INTO DATA(N_PO_ITEM).<br>        newPoValue = newPoValue + N_PO_ITEM-netamount.<br>        newNetPriceAmount = newNetPriceAmount + N_PO_ITEM-NetPriceAmount.<br>    ENDLOOP.<br><br><br>    LOOP AT PURCHASEORDERITEM_DB INTO DATA(O_PO_ITEM).<br>        oldPoValue = oldPoValue + O_PO_ITEM-netamount.<br>        oldNetPriceAmount = oldNetPriceAmount + N_PO_ITEM-NetPriceAmount.<br>    ENDLOOP.<br><br><br>   IF newPoValue GT oldPoValue.<br>       workflowrestarttype = 'R'.<br>       RETURN.<br>   ELSEIF newNetPriceAmount GT newNetPriceAmount. "If Net Amount for line item 1 is changed then Conditional Restart<br>       workflowrestarttype = 'R'.<br>   RETURN.<br>ENDIF.

The code itself works quite well. The Idea was: If the price rises, trigger again the workflow, in any other case --> proceed.

I also already tried to just put

    DATA newPoValue TYPE P.<br>    DATA newNetPriceAmount TYPE P.<br>    DATA oldPoValue TYPE P.<br>    DATA oldNetPriceAmount TYPE P.<br><br>    workflowrestarttype = 'N'.<br>

as the only code, to see if it is the right BADI to achieve my goal, well, it didnt work.

Question:
We now have the issue, when the procurement manager enters the Order Confirmation for the PO, the Workflow will be triggered again.
How can I adjust that the Workflow of the PO will only be triggered (in case a OC is entered) when the price of the OC rises, but not in any other case?

View Entire Topic
george_joseph4
Explorer
0 Kudos

Have you tried using Condition Restart ? I have tried but its not working , any other pre-requisites to make it work ?