on 04-03-2008 4:20 PM
Hello,
I am using BADI BBP_WFL_APPROV_BADI to determine next level approver. Please refer to below code,
CASE object_type.
====================== shopping cart =========================== *
WHEN c_shop.
get the details of the shopping cart
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = lv_guid
i_object_id = object_id
IMPORTING
e_header = ls_header.
IF ls_header-total_value < 490000000.
CASE actual_approval_index.
WHEN 0.
ls_approver-approval_index = 1.
ls_approver-approval_agent = 'US 146296'.
ls_approver-name = 'SA'.
ls_approver-approval_description = 'First approval step'.
APPEND ls_approver TO approval_table.
ls_approver-approval_index = 2.
ls_approver-approval_agent = 'US 146720'.
ls_approver-name = 'BA.
ls_approver-approval_description = 'Second approval step1'.
APPEND ls_approver TO approval_table.
WHEN 1.
ls_approver-approval_index = 2.
ls_approver-approval_agent = 'US 146720'.
ls_approver-name = 'BA.
ls_approver-approval_description = 'Second approval step1'.
APPEND ls_approver TO approval_table.
WHEN 2.
ls_approver-approval_index = 3.
ls_approver-approval_agent = 'US 146474'.
ls_approver-name = 'SU'.
ls_approver-approval_description = 'Third approval step1'.
APPEND ls_approver TO approval_table.
WHEN OTHERS.
no_further_approval_needed = 'X'.
ENDCASE.
The code is not determined the next approval. It is taking only first approval. Once first approver approves, workflow is completed.
Can anybody tell me what is wrong here?
Thanks in advance,
Sunil Joyous
Hi Sunil,
I don't think you need to code with the actual_approval_index.
We don't use the actual_approval_index, but just add approvers and levels to the export-table as needed.
Suppose you would need the follwing scenario:
- total value <= 100 : no approval
- total value > 100 : 1-step approval
- total value > 1000 : 2-step approval
- total value > 10000 : 3-step approval
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = lv_guid
i_object_id = object_id
IMPORTING
e_header = ls_header.
IF ls_header-total_value le 100.
no_further_approval_needed = 'X'.
endif.
IF ls_header-total_value > 100.
ls_approver-approval_index = 1.
ls_approver-approval_agent = 'US 146296'.
ls_approver-name = 'SA'.
ls_approver-approval_description = 'First approval step'.
APPEND ls_approver TO approval_table.
endif.
if ls_header-total_value > 1000.
ls_approver-approval_index = 2.
ls_approver-approval_agent = 'US 146720'.
ls_approver-name = 'BA'.
ls_approver-approval_description = 'Second approval step1'.
APPEND ls_approver TO approval_table.
endif.
if ls_header-total_value > 10000.
ls_approver-approval_index = 3.
ls_approver-approval_agent = 'US 146474'.
ls_approver-name = 'SU'.
ls_approver-approval_description = 'Third approval step1'.
APPEND ls_approver TO approval_table.
endif.
regards,
Hendrik-Jan Bosma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
There might be a problem with the approval_index. I remember problems when the tabel contains gaps in the approval_index. Example:
approval_agent ls_approver-approval_index
US 146296 1
US 146474 3
Pleaase make sure that you renumber the approval_index:
approval_agent ls_approver-approval_index
US 146296 1
US 146474 2
Regards,
Hendrik-Jan Bosma
For Line Item approval it is mandatory to get GUID generated. Please take a look at the sample BADI implementation SAP_LIA_BADI_EXMPL_2 and the following line:
the following function now creates a GUID and an entry in the item
approval object table if the criterion/value pair does not yet have
a definition in that table - otherwise it returns the GUID already
defined. The table lt_item_app_obj is updated in that function and
there is no other modification to this table necessary in the BADI.
The only important thing is, that the function has to be called with
exactely the same key in order to identify the correct entry.
CALL FUNCTION 'BBP_WFL_DIN_APP_OBJ_GET'
EXPORTING
sc_guid = ls_header-guid
criterion1 = c_item_value
value1 = lv_call_value1
IMPORTING
approval_obj_guid = ev_app_obj_guid
TABLES
item_app_obj = item_approval_obj.
It is mandatory to get this field ls_approval_item-approval_object_guid populated with different ev_app_obj_guid.
Hope this solves your problem.
Regards, IA
Hi Sunil,
I think your case statement has to be corrected like below:
CASE actual_approval_index.
WHEN 0.
Add 1st level
*Add 2nd level
*Add 3rd level
WHEN 1.
Add 1st level
*Add 2nd level
*Add 3rd level
WHEN 2.
*Add 2nd level
*Add 3rd level
WHEN 3.
*Add 3rd level
WHEN OTHERS.
no_further_approval_needed = 'X'.
ENDCASE.
Can you try this?
Rgds,
Prasanna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.