cancel
Showing results for 
Search instead for 
Did you mean: 

ADMINISTRATOR_APPROVAL parameter in n-step approval badi

Former Member
0 Kudos

Hi,

I have a question regarding administator_approval export parameter in the item level shopping cart approval badi. when no approvers are found in the shopping cart, then we use 'administrator_approval' parameter in n-step badi. In this badi I have done the following coding

if approval_table[] is initial.

ls_approver-approval_agent = 'USADMIN_01'.

ls_approver-name = 'admin name'.

ls_approver-approval_index = 1.

append ls_approval to administrator_approval.

When I see the approval preview it shows USADMIN as an approver, but after ordering shopping cart, the approval preview shows error. I checked in SWI1 and saw that it goes into endless loop during approval task. Also the approval workitem doesn't appear in ADMIN_01's SRM inbox. I also tried doing no_futher_approval_needed = 'X'. But this is causing shopping cart approved immediately. Can anyone tell me why is this happening?

thanks,

Krupa

Accepted Solutions (0)

Answers (2)

Answers (2)

khan_voyalpadusman
Active Contributor
0 Kudos

administrator approval is required only when the N-step badi in your system is not able to find any approvers.

and so this is the default when the badi does not return any approvers.

is your badi able to determine the approvers based on the shopping cart value?

and the parameter no_futher_approval_needed is to be set to X , when the last approver of the approval chain has completed the approval and when no further approvers are to be set by the badi

Former Member
0 Kudos

Hi

<u><b>Please provide the System version details -></b></u>

The BADI to determine the Adminsitrator(if no approvers are found through 1 and 2 step approval workflow ) is BBP_WFL_ADMIN_APPROV.

<b>Also check SAP OSS Note -></b>

Note 978709 - Administrator receives no work item for the BADI workflow

<u>Administrator Approval Determination - coding</u>

http://help.sap.com/saphelp_srm50/helpdata/en/58/c14e3c59bfe747e10000000a11402f/frameset.htm

First check whether the approval_table[] is initial.If so,you will have to populate the table approval_administrators so that the SC is sent to the default administrator if the approvers are not found. Also make sure in the field "approval_agent",you are assigning the username as "USXXXXX".

Hope this will help. Do let me know.

Regards

- Atul

Former Member
0 Kudos

Thanks Atul and Khan for your prompt replies. What I know is that export parameter 'Approval_administrators' should be filled in n-step badi, after checking whether approval_table[] is initial. So that the cart can routed to default WF admin person, who doesn't approve the cart but actually fixes the problems such as adding missing entries in custom tables or organisation and after that workflow derives the correct approvers and continues from there. But in my case, when I did the coding like below, and when i debugged workflow, i saw that it goes into endless loop during the step 'Sub-workflow for N-step parallel approval of shopping cart'. What I noticed is that insided this subworkflow, there is one loop that executes, when approvers are approving shopping cart one by one, it increments and after last approval, it comes out of loop. In my case it goes into endless loop and doesn't come out and eventually errors out. Please help.

HERE IS MY CODE:

IF actual_approval_index GE 6.

no_further_approval_needed = ysrm_ca_if_const=>c_on.

ELSE.

IF approval_table[] IS INITIAL.

CLEAR ls_approver.

  • if no approver found because send sc to default administrator

ls_approver-approval_index = 1.

      • the agent is 'US' + user

SELECT SINGLE * FROM swd_custom INTO ls_swd_custom WHERE user_name = 'SAP*'.

ls_approver-approval_agent = ls_swd_custom-def_admin.

ls_approver-name = 'Workflow Admin'.

ls_approver-approval_description = 'Administrator is the approver'.

APPEND ls_approver TO approval_administrators.

endif.

endif.

khan_voyalpadusman
Active Contributor
0 Kudos

hi,

i want more details fo help you. How many levels of approvers are involved?

what do you mean by endless loop? do you mean first approver approves and then it again goes to the first approver?

let me know

Former Member
0 Kudos

Hi Khan,

When the badi is able to determine the approvers, then workflow is also working fine...only thing that doesn't work is when badi is not able to find the approvers, ie. approval_table[] is initial. This is when I fill approval_administrators table with default workflow admin. In this case when i do the coding that i mentioned in my previous reply, it goes into endless loop and errors out after sometime when it has finished 1000 loops maximum. The endless loop happens in the subworkflow (parallel n-step item approval)of main workflow WS14500015. Workitem doesn't go to the workflow admin atall. In this subworkflow there is one loop step, which basically is executed when approver approves something, and it keeps incrementing everytime, when one by one approvers approves shopping cart. But in this case, there is just one approver, ie. WF_ADMIN and his approval_index is set to 1. he doesn't even get workitem, and loop finishes and goes to next loop and so on. This is what happens. Have you used this approval_administrator parameter before?

Regds,

Krupa

khan_voyalpadusman
Active Contributor
0 Kudos

refer note 978709 which refers to your case.

and also refer to note 733014 which deals with sample implementation for administrators.

looks like there is issue with the index and also make sure that you enter correct name for admin according to the above sample implementation

Message was edited by:

khan voyalpad usman