cancel
Showing results for 
Search instead for 
Did you mean: 

Changes to Std Workflow - WS14500015

Former Member
0 Kudos

Hi friends,

I want to make changes to std workflow WS14500015. Before approval process I want to first send a workitem to a person say 'manager1' who will change a SC field. Only when he changes it and approves, then only should the remaining wfl process continue otherwise the workitem should be sent to creator for resubmission. Can anyone please help me out with this???its very urgent.

Please help out!!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

You can code the logic in the BADI BBP_WFL_APPROV_BADI to determine the 1st level MANAGER who will always change a SC field and then the further approval process will happen.Also you need to maintain the appropriate vlaue for the parameter BBP_WFL_SECURITY in the role for the MANAGER in trascn PFCG for the approval process to restart after the Changes are done in the SC.

HTH.

BR,

Disha.

Pls reward points for useful answers.

Former Member
0 Kudos

Hi Disha

Thanks for the help but i still have some doubts.

I have coded the logic in badi BBP_WFL_APRPOV_BADI, the workitem goes to approver ie manager1. But the problem is that whenever the manager1 approves or rejects, the whole SC gets approved/rejected. ie. it is not going to the other approvers only.

For manager1 I have put approver index as '1' and for rest as '2'. Is that ok?I have filled the approver table only.

Also I didnt understand abt the BBP_WFL_SECURITY parameter. Only by changing that parameter will workflow restart? or do I have to code in badi BBP_WFL_SECUR_BADI?.

Can you please help me out with this????

Its very urgent.

(I have awarded points for your reply!)

Thanks.

Former Member
0 Kudos

Hi,

You need to maintain the BBP_WFL_SECURITY parameter in the role assigned to the MANAGER user.If you have implemneted the BADI "BBP_WFL_SECUR_BADI",that will overwrite the settings made in the Role for the parameter BBP_WFL_SECURITY .

BR,

Disha.

Pls reward points for useful answers.

Former Member
0 Kudos

Hi Preeti,

as per my understanding approval index also behaves as your step who will be the next approver.

If for example u have (1 on the first row of approval table, and 2 on the second as his approval index) it means that after the first approver approves the doc, it goes to the next level.

When you place (1 on the first row, and another 1 on the second row as his approval index) it means that either the first or second approves the document, it will be approved/rejected. I believe this one is called parallel approval.

Although I haven't tried item based approval, maybe this is the reason why the document is getting approved.

Former Member
0 Kudos

Hi Disha,

Thanks for the explaination. I wrote the code in the approv badi and it worked.

But now the problem is that, if no approvers are found then i have to send Sc to default approver. How to do so?

I tried writing that if approval_table is initial then fill it with default approver. I set approval_index to 1. But the SC doesnot go to the default one. In statusit comes as "awaiting approval" but its not there in that inbox. Also in approval preview I get "No approver found" when i click on the approver.

I also tried entering data in approval_administrators table.But still nothing happens.

Could you please help me out with ths????

Please solve this. I m goin nuts!!!

Thanks.

Former Member
0 Kudos

Hi,

See the foll code for reference:

method if_ex_bbp_wfl_approv_badi~get_remaing_approvers.

  • Business objects (local)

constants:

c_shop type crmt_subobject_category_db value 'BUS2121',

c_step1 type bbp_step_description value 'First approval step',

c_step2 type bbp_step_description value 'Second approval step'.

*variables for holding the runtime SC values

data : w_total type reqhead-total_value_long,

w_group type zgroup-zprodgrp,

w_category type zgroup-zprodcat,

w_ccenter type zapprovers-zccnetre.

data:

*Header data table

wa_header type bbp_pds_sc_header_d,

*approver structure

wa_approver type bbp_wfl_approval_table_badi,

  • item structures

it_item type table of bbp_pds_sc_item_d,

wa_it_item like line of it_item,

  • accounting structures

it_account type table of bbp_pds_acc,

wa_it_account like line of it_account.

*tables for holding the final list of approvers bsed on the SC criteria.

data : it_rule type standard table of zrule,

wa_it_rule like line of it_rule,

it_approvers type standard table of zapprovers,

wa_it_approvers like line of it_approvers.

case object_type.

when c_shop.

  • ----------------------------- shopping cart-------------------------------- *

*get the details of the shopping cart

call function 'BBP_PD_SC_GETDETAIL'

exporting

i_object_id = object_id

importing

e_header = wa_header

tables

e_item = it_item

e_account = it_account.

clear w_total.

if sy-subrc = 0.

*move the total value fo SC to w_total.

move wa_header-total_value to w_total.

endif.

clear : w_category,

w_ccenter,

w_group.

*reading the item table for the Product category

*Here the first record is read only since all the items will necessarily

*have the same Product category

read table it_item into wa_it_item index 1.

if sy-subrc = 0.

*set the product category

move wa_it_item-category_id to w_category.

endif.

  • Found out to which cost center the items belong

read table it_account into wa_it_account

with key p_guid = wa_it_item-guid.

if sy-subrc = 0.

move wa_it_account-cost_ctr to w_ccenter.

endif.

*to select the Proper Product Group from the maintained Z-table

*ZGROUP for the Product category of the SC items.

select single zprodgrp

from zgroup

into w_group

where zprodcat = w_category.

if sy-subrc = 0.

clear it_rule.

refresh it_rule.

*selecting the proper approval Levels for the Product Group retrieved from

*the previous step as well as based on the range in which the total value

*of the shopping cart falls in form the maintained Z-table ZRULE

select zrule

zprodgrp

zlevel

into corresponding fields of table it_rule

from zrule

where zprodgrp = w_group

and zval1 le w_total

and zval2 ge w_total.

if sy-subrc = 0.

clear it_approvers.

refresh it_approvers.

*selecting the List of Approvers based on the previously retrieved

*Product Group,Approval Level and the Cost Center value from the

*maintained Z-table ZAPPROVERS

if it_rule[] is not initial.

select zindex

zrule

zprodgrp

zlevel

zccnetre

zuser

zname

into corresponding fields of table it_approvers

from zapprovers

for all entries in it_rule

where zrule = it_rule-zrule

and zprodgrp = it_rule-zprodgrp

and zlevel = it_rule-zlevel

and zccnetre = w_ccenter.

endif.

endif.

endif.

if w_total eq 0.

no_further_approval_needed = 'X'.

endif.

*Based on the Current approval step,the values for the corresponding

*Approvers is exported

clear approval_table.

refresh approval_table.

*Actual approval index represents the current WF approval step

case actual_approval_index.

*WF not started

when 0.

*At each and every approval step we need to pass the Approvers from that step onwards

loop at it_approvers into wa_it_approvers where zindex = 1.

wa_approver-approval_index = 1.

wa_approver-approval_agent = wa_it_approvers-zuser.

wa_approver-name = wa_it_approvers-zname.

wa_approver-approval_description = c_step1.

append wa_approver to approval_table.

endloop.

loop at it_approvers into wa_it_approvers where zindex = 2.

wa_approver-approval_index = 2.

wa_approver-approval_agent = wa_it_approvers-zuser.

wa_approver-name = wa_it_approvers-zname.

wa_approver-approval_description = c_step2.

append wa_approver to approval_table.

endloop.

*1st step approval

when 1.

loop at it_approvers into wa_it_approvers where zindex = 1.

wa_approver-approval_index = 1.

wa_approver-approval_agent = wa_it_approvers-zuser.

wa_approver-name = wa_it_approvers-zname.

wa_approver-approval_description = c_step1.

append wa_approver to approval_table.

endloop.

loop at it_approvers into wa_it_approvers where zindex = 2.

wa_approver-approval_index = 2.

wa_approver-approval_agent = wa_it_approvers-zuser.

wa_approver-name = wa_it_approvers-zname.

wa_approver-approval_description = c_step2.

append wa_approver to approval_table.

endloop.

  • 2nd step approval

when 2.

loop at it_approvers into wa_it_approvers where zindex = 2.

wa_approver-approval_index = 2.

wa_approver-approval_agent = wa_it_approvers-zuser.

wa_approver-name = wa_it_approvers-zname.

wa_approver-approval_description = c_step2.

append wa_approver to approval_table.

endloop.

when others .

no_further_approval_needed = 'X'.

endcase .

endcase.

endmethod.

The above code is for the header level approval but in your case you will have to modify the code for item level approval.

The field "actual_approval_index" is the Approval step while the field "approval_index" is the levels of approval for each approval step.i.e. Total no of approvals can be 3 but at each indidvidual aproval step there can be 2 approvals.

Also you just need to populate the APPROVAL_TABLE and not the approval_administrators table for Approvers.

BR,

Disha.

P. S. Pls reward points for useful answers.

Answers (0)