cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_REQUISITION_RELEASE_GEN - approval purchase requisition

Former Member
0 Kudos

Hello,

This question if for the ones who used BAPI_REQUISITION_RELEASE_GEN function module, in workflows.

I have defined in spro, in the release strategy for purchase requisition, two strategies. If the overall value of a purchase requisition is under 20 then the order is to be approved by one person(release code L1). If the value is over 20, the purchase will be approved by person 1 and after by person 2(release code L2).

I made an abap program with the following code. In this case purchase requisition with number 0010000444 has a value under 20.

CALL FUNCTION 'BAPI_REQUISITION_RELEASE_GEN'

EXPORTING

number = '0010000444'

rel_code = 'L1'.

After i run this code, and look in the SWEL transaction i see the only event that started is Released.

But if i run the code for a purchase requisition with the value over 20(2 approvers), in SWEL, i see two events:RELEASED and RELEASESTEPCREATED.

I am asking you this, because i want to create a workflow for the release of a purchase requisition.

The logic is: create requisition in me51n, trigger release event which triggers the workflow. In the workflow, i send an email to a user which contains a link to a webdynpro. In the webdynpro i have the button approve which calls BAPI_REQUISITION_RELEASE_GEN(i do not know what other function to call for the release of a pr).

After the user has approved(clicked on the button), if the purchase requisition contains a value under 20, the event RELEASED is triggered. I have another workflow which has as a trigerring event RELEASED. This workflow sends email to another user with notification. Everything goes fine in this case.

But if the value is over 20, the events RELEASESTEPCREATED and RELEASED are triggered. The call of the function BAPI_REQUISITION_RELEASE_GEN(the click on the button), triggers also the RELEASESTEPCREATED. This triggers also my first workflow which sends again a message that a purchase requisition was created. And of course, i do not want that.

Maybe i can connect the two workflows, so the call of the function does not trigger again the event RELEASESTEPCREATED.Or maybe you have another solution.

Thank you very much,

Efren

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Actually i have the same requirement. But i didn't find which event will trigger when create PR. So, Please guide me to design Workflow for release PR. In my requirement there are 5 different release strategies. Need to design WF to get approval depend upon release strategy. Thanks in advance.

Please Help Me.

Thanks,

Madhavi

Former Member
0 Kudos

Hello,

The event is called RELEASESTEPCREATED of the object BUS2105.

The workflow is triggered by this event. I have a table with the new purchase requisitions. The first step checks if the purchase requisition is new(if it is not found in the table). Next a mail is sent to the first approver. Then i have a fork with two wait events: released and rejected. If it is released i send a mail to the next approver and aftewards again a fork. If it is rejected a mail of rejection is sent to the creator of the purchase requisition.

And so on.

Efren

Former Member
0 Kudos

Solved.

I created a function module that verifies if the purchase requisition was created, and inserted it in a method of the object BUS2105. If it was, the first mail is not sent.

Thanks,

Efren