cancel
Showing results for 
Search instead for 
Did you mean: 

ACTUAL_APPROVAL_INDEX value in GET_REMAINING_APPROVERS

Former Member
0 Kudos

Hi,

I would like to confirm my understanding of the ACTUAL_APPROVAL_INDEX field in method GET_REMAINING_APPROVERS of BADI BBP_WFL_APPROV_BADI.

Does the system increment this field each time the method gets called? First time called the value is ZERO, subsequent calls the system increments the value by one before entry into the method.

What is the purpose of the export APPROVAL_TABLE-APPROVAL_TABLE_INDEX field?

Thanks,

Jerry

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jerry,

ACTUAL_APPROVAL_INDEX fields gives you step in approval process.

If you look at the following sample code, in this case MANAGER1 will get work item first, once MANAGER1 approves the shopping cart, MANAGER2 and MANAGER4 will get the work item ( second level).

You will have to append APPROVAL_TABLE with proper APPROVAL_INDEX. Thats it.

Just copy following bit in your BAdI and create a shopping cart.

Please reward few points if you find this answer very helpful.

Regards.

Pras

IF ls_header-total_value < 490000000.

      • 2 step approval

ls_approver-approval_index = 1.

ls_approver-approval_agent = 'USMANAGER1'.

ls_approver-name = 'Arthur Manager1'.

ls_approver-approval_description = 'First approval step'.

APPEND ls_approver TO approval_table.

ls_approver-approval_index = 2.

ls_approver-approval_agent = 'USMANAGER2'.

ls_approver-name = 'Arnold Manager2'.

ls_approver-approval_description = 'Second approval step'.

APPEND ls_approver TO approval_table.

ls_approver-approval_index = 2.

ls_approver-approval_agent = 'USMANAGER4'.

ls_approver-name = 'Thomas Manager4'.

ls_approver-approval_description = 'Second approval step'.

APPEND ls_approver TO approval_table.

ENDIF

Former Member
0 Kudos

Hi Guys,

Within the badi, we manage to add the approvers to the APPROVAL_TABLE . However, in the workflow, we only see the first step approver; ls_approver-approval_index = 1.

Therefore, the sc doesnt go to the second approver for approval.

Do you have any idea about this problem?

Thanks.

Former Member
0 Kudos

Hi Burak,

When appending approvers for second level, your approval_index has to be 2. Instead of hardcoding, you can do

approval_index = approval_index + 1.

then move this approval_index to ls_approval_index and append it to the Approval_table.

Do drop me a reply, if you need more help on this.

Please reward few points, if you find this very helpful.

If you are using Item level approval then coding will be bit tricky.

Regards.

Pras

Former Member
0 Kudos

Burak,

Please check start conditions using transaction SWB_PROCUREMENT for business object BUS2121 (Shopping Cart). There may be possibility that workflow for 1 step approval is active. In this case you will have to deactivate this workflow in change mode.

Go to transaction

PFTC -> Select Workflow template -> Enter 14000133.

select display.

Goto tab -> Triggering event, activate this by double clicking on very first line. Save it.

Also goto event linkage table using transaction SWETYPV.

Check entry BUS2121 and WS14000133. Double click on it.

Make sure 'Event linkage activated' checkbox is active.

Hope this will help. Please reward few points if you find this answer useful.

Regards.

Pras

Former Member
0 Kudos

Hi Pras,

thank you for your early answer.it was very helpfull.But now i have an another problem.i want to fill approval_table with an another internal table.i dont want to hard code the users .i mean;

 
CASE actual_approval_index.
   WHEN 0.
 
   loop at zzapproval_table into lt_approval
                                 where APPROVAL_INDEX = 1 .
    ls_approver-approval_index = 1.
    ls_approver-approval_agent = lt_approval-approval_agent .
    ls_approver-name = zzapproval_table-name.
    ls_approver-approval_description = 'First approval step'.
    APPEND ls_approver TO approval_table.
   endloop .
   loop at zzapproval_table into lt_approval
                                 where APPROVAL_INDEX = 2 .
    ls_approver-approval_index = 2.
    ls_approver-approval_agent = lt_approval-approval_agent .
    ls_approver-name = zzapproval_table-name.
    ls_approver-approval_description = 'Second approval step'.
    APPEND ls_approver TO approval_table.
   endloop .
**** it goes like that for actual_approval_index = 1 and
**** actual_approval_index = 2 
when others .
     no_further_approval_needed = 'X'.
endcase .

i fill the internal table zzapproval_table before.this code doesnt work.it says no approval needed.

but when i write the code as below, it works correctly.

zzapproval_table has the same data with hard code below.


CASE actual_approval_index.
   WHEN 0.
    ls_approver-approval_index = 1.
    ls_approver-approval_agent = 'USEYILDIZ'.
    ls_approver-name = 'Eyüp Yýldýz'.
    ls_approver-approval_description = 'First approval step'.
    APPEND ls_approver TO approval_table.

    ls_approver-approval_index = 2.
    ls_approver-approval_agent = 'USEKIZILIRMAK'.
    ls_approver-name = 'Erkut Kýzýlýrmak'.
    ls_approver-approval_description = 'Second approval step' .
    APPEND ls_approver TO approval_table.
**** it goes like that for actual_approval_index = 1 and
**** actual_approval_index = 2 
when others .
     no_further_approval_needed = 'X'.
endcase .

i couldnt solve tihs problem.if u can help me i'll be very thankfull.

best regards,

Burak

Former Member
0 Kudos

Hi Pras,

I have a question/confirmation for you regarding the correct way of setting up the approval table and the respective approval_index values for an item level based workflow WS14500015.

I have a shopping cart with a number of different that has three different approval categories (CC, PSO, PMO).

I included some background as well as what is my current understaning of how the approval table would be setup. My current thinking is that Option B is what the approval table should look like along with the approval index values.

-


Shopping Cart Account Value

Item 1 CC 1000

Item 2 CC 2000

Item 3 PMO 1000

Item 4 PSO 5000

Item 5 CC 5000

Total 1400

-


Category - CC Apprv Lim

MGR1A - Lvl 1 $500

MGR2A - Lvl 2 $1000

MGR3A - Lvl 3 $4000

MGR4A - Lvl 4 $10000

Category - PMO Apprv Lim

MGR1B - Lvl 1 $500

MGR2B - Lvl 2 $1000

MGR3B - Lvl 3 $5000

Category - PSO Apprv Lim

MGR1C - Lvl 1 $500

MGR2C - Lvl 2 $1000

MGR3C - Lvl 3 $3000

MGR4C - Lvl 4 $6000

-


Option A

approval_index Cost Center PMO PSO

Lvl 1 - CC - MGR1A

Lvl 2 - CC - MGR2A

Lvl 3 - CC - MGR3A

Lvl 4 - CC - MGR4A

Lvl 5 - PMO - MGR1B

Lvl 6 - PMO - MGR2B

Lvl 7 - PSO - MGR1C

Lvl 8 - PSO - MGR2C

Lvl 9 - PSO - MGR3C

Lvl 10 - PSO - MGR4C

-


Option B

approval_index Cost Center PMO PSO

Lvl 1 - CC - MGR1A; PMO - MGR1B; PSO - MGR1C

Lvl 2 - CC - MGR2A; PMO - MGR2B; PSO - MGR2C

Lvl 3 - CC - MGR3A; ; PSO - MGR3C

Lvl 4 - CC - MGR4A; ; PSO - MGR4C

Lvl 5

-


Your response would be greatly appreciated.

Jerry

Former Member
0 Kudos

Hi Burak,

Were u able to solve this problem???If so ,please tel me the solution cos Im facing the same problem.

Regards,

Disha.

Answers (1)

Answers (1)

pvanhoove
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

The parameter approval_index correspond to a container value in the workflow, it is incremented during workflow execution. The badi is only called when changing the SC.

0 : workflow not started.

1 : workflow started (SC saved)

2 : first step executed, goes to next approver

A table, similar to the approval table from badi, is used by the workflow. It use the container value approval index to determine the current approver at runtime.

Rgds,

Pierre