on 01-03-2007 12:45 AM
Hello friends.
We use SRM Server 5.5 (Classic scenario)
We implemented n-step work flow for shopping cart. (WS 14000133)
To determine the agent, we have the criteria such like company code, plant, cost center and total amount.
We created customer view table to maintain the shopping cart routing.
-
Company code Plant cost center total amount approval step approver
-
202 : K1 : K000012: 0 : 1: manager1
202: K1: K000012: 1000,000 : 2 : manager2
202 : K1: K000012: 10,000,000: 3: manager3
-
For example, if user creates shopping cart with company code 202, plant K1, Cost center K000012 and total amount 1,500,000. 1st agent will be manager 1 and 2nd agent will be manger 2.
But we have some problem to determine the correct agent.
If User created shopping cart, all user received the work item.
When I go to swi1 to see the work flow log, agent is not determined.
I dont know what is problem? Could you give me some information?
----------- shopping cart ---------------------------------- *
get the nevessary field entries from the shopping cart
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = lv_guid
i_object_id = object_id
IMPORTING
e_header = ls_header
TABLES
e_item = lt_item
e_account = lt_account.
read definition table
CLEAR: lt_apprexep, lt_apprmain.
READ TABLE lt_item INDEX 1 INTO ls_item.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_item-be_co_code
IMPORTING
output = lv_bukrs.
.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_item-kostl
IMPORTING
output = lv_kostl.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ls_item-be_plant
IMPORTING
output = lv_werks.
SELECT * FROM zktsrmapprexep
INTO CORRESPONDING FIELDS OF ls_apprexep
WHERE bukrs = lv_bukrs
AND kostl = lv_kostl.
APPEND ls_apprexep TO lt_apprexep.
ENDSELECT. "zktsrmapprexep
IF sy-subrc = 0.
no_further_approval_needed = 'X'.
ELSE.
SELECT * FROM zktsrmapprmain
INTO CORRESPONDING FIELDS OF ls_apprmain
WHERE bukrs = lv_bukrs
AND kostl = lv_kostl
AND werks = lv_werks.
APPEND ls_apprmain TO lt_apprmain.
ENDSELECT. "zktsrmapprmain
IF sy-subrc = 0.
CLEAR : lv_cnt.
LOOP AT lt_apprmain INTO ls_apprmain .
ADD 1 TO lv_cnt.
IF ls_header-total_value > ls_apprmain-tot_amt.
ls_approver-approval_index = lv_cnt.
CONCATENATE 'US' ls_apprmain-apprid INTO ls_approver-approval_agent.
ls_approver-name = ls_apprmain-apprnam.
CASE lv_cnt .
WHEN 1.
ls_approver-approval_description = 'First approval step'.
WHEN 2.
ls_approver-approval_description = 'Second approval step'.
WHEN 3.
ls_approver-approval_description = 'Third approval step'.
WHEN 4.
ls_approver-approval_description = 'Fourth approval step'.
WHEN 5.
ls_approver-approval_description = 'Fifth approval step'.
WHEN 6.
ls_approver-approval_description = 'Sixth approval step'.
WHEN 7.
ls_approver-approval_description = 'Seventh approval step'.
WHEN 8.
ls_approver-approval_description = 'Eighth approval step'.
WHEN OTHERS.
ls_approver-approval_description = 'N level approval step'.
ENDCASE.
APPEND ls_approver TO approval_table.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
WHEN c_po.
WHEN c_contract.
WHEN c_quotation.
ENDCASE.
ENDMETHOD.
Hi,
I would suggest you to store in the custom table combination of company code, plant, cost center and total amount(range e.g. Rs1 - Rs.10) and the total no of approvasl based on these values and the Approvers at each level.
e.g. 202 : K1 : K000012: 0 : 1-10(total value range):2(total levels of approval):1: USmanager1
202 : K1 : K000012: 0 : 1-10(total value range):2(total levels of approval):2: USmanager2
At runtime,select the appropriate approver names(pls remeber you need to append US to user names).Acc,populate the table approval_table with the approver names at each index(sub levels of approval).
<u> Sample code is as follows:</u>
*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.
in the above code,actual_approval_index -->main level of approval
zindex-->sub level of approval (mainatined in the table )within the main level.
e.g. actual_approval_index -->1
zindex-->1 and 2(total no of approvals in 1st approval)
HTH.
BR,
Disha.
Pls reward points for useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Now you have to activate external debugging in the ABAP system by doing the following:
Execute transaction SE38.
Choose Utilities -> Settings
Click on the "Debugging" tab.
Check the checkbox "Actv." to activate external debugging for your userid (the user id you use in EBP). You can also choose the Classic Debugger or New Debugger
Now you can go into an ABAP program (i.e. the Get_APPROVER BAdI) and set an external breakpoint. It appears that if you just click on the "Stop" icon in the toolbar to set a breakpoint, it does NOT set an external breakpoint. Use the menu Utilities -> Breakpoint -> Set/Delete and it should prompt you if you want an external breakpoint (choose HTTP). Verify that the message in the status bar says that an EXTERNAL breakpoint was set.
When you run the service via the Portal, the webgui should pop-up when it hits the external breakpoint. The interface is really poor (maybe the New Debugger is better), but the basic functionality is there.
Hello
Just adding some additional info to the Naing steps.
1. Make sure that the corresponding service has the parameter ~GENERATEDYNPRO set to 1.
If you have one host then the below step is not necessary.
1. Make sure that the breakpoint is set in all the ABAP HOST Servers. You can find all the hosts in the tcode SM51.
Best regards,
~Mani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.