cancel
Showing results for 
Search instead for 
Did you mean: 

Appoval for Shopping Cart item level.

former_member578547
Participant
0 Kudos

Hi Friends,

For my requirement wise, I need approver with item wise. In details, 1st item value : 1500 $ and 2nd Item value is 900 $. For my requirement , i need to send approval when Item value is more than 1000$(In table , i am specifing this value).

Nothing but, Approval has to go for 1st item only .

How to do this one Please.

Infact, In Tx: /SAPSRM/WF_PROCESS , I am specifing 1st level approval as: Item based decision for Partial Document.

At checking Evaluation id( in Expression i am comparing 0V_SC_TOTALVALUE > ZEX_VALUE(1000$)).

But ,it is not satisfing the requirement. Approval is going to two items.

Please help me how to incorporate this in Process controlled workflow.

Thanks in Advance.

Balaji.T.

Accepted Solutions (1)

Accepted Solutions (1)

former_member578547
Participant
0 Kudos

Hi Friends,

Expression: 0V_SC_TOTALVALUE gives total value of shopping cart(item 1 :1200$+ item 2: 900$).

Please let me know what should i do .

I can use a method , in which i fetch all items of shopping cart using FM: BBP_PD_SC_GETDETAIL, but how can I find which item is considered at that time.

Balaji..T.

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please check 0V_SC_MTRLMSTXPNSV Most Expensive item.

Regards,

Masa

former_member578547
Participant
0 Kudos

Hi Masa,

Thank you very much your input.

I placed that Expression : 0V_SC_MTRLMSTXPNSV so that at least one item value is greater than 1000 $, it goes to approval.

Infact, now if two items are there : 1st item value = 900$ and 2nd item = 1500$ , Approval is going for two items too.

How to restrict item 900 $ in method : GET_AREA_TO_ITEM_MAP or GET_APPROVERS_BY_AREA_GUID .

Any idea Please.

Please help me .

Balaji.T.

former_member578547
Participant
0 Kudos

Hi Masa,

I got solution with below logic in GET_AREA_TO_ITEM_MAP method

I think, my client will get satisfied.:) . MASA: i am giving FULL points to you. your clue is Important to me.

  • Get shopping cart instance

lo_wf_pdo_sc ?= /sapsrm/cl_wf_pdo_impl_factory=>get_instance(

iv_document_guid = is_document-document_guid

iv_document_type = is_document-document_type

iv_pdo_event_handling = abap_false

).

TRY.

lo_pdo_sc ?= lo_wf_pdo_sc->/sapsrm/if_wf_pdo~get_pdo( ).

CALL METHOD lo_pdo_sc->/sapsrm/if_pdo_base~get_item_list

EXPORTING

it_parent_guid = lt_header_guid

IMPORTING

et_item_guid = lt_item_guid.

data : l_value type BBP_PDS_SC_ITEM_D-PRICE value '1000.00'.

LOOP AT lt_item_guid REFERENCE INTO lr_item_guid WHERE leaf = abap_true.

ls_item_to_cc_map-item_guid = lr_item_guid->guid.

TRY.

CALL METHOD lo_pdo_sc->get_item_detail

EXPORTING

iv_item_guid = ls_item_to_cc_map-item_guid

IMPORTING

ET_ITEM = lt_item

ET_ACCOUNT = lt_account.

loop at lt_item REFERENCE INTO lr_item.

if lr_item->price le l_value.

exit.

endif.

LOOP AT lt_account REFERENCE INTO lr_account.

ls_item_to_cc_map-COST_CTR = lr_account->COST_CTR.

EXIT. "each item has exactly one p.-org/group pair

ENDLOOP.

APPEND ls_item_to_cc_map TO lt_item_to_cc_map.

endloop.

ENDTRY.

ENDLOOP.

LOOP AT lt_item_to_cc_map REFERENCE INTO lr_item_to_cc_map.

lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(

iv_area_type = /sapsrm/if_wf_process_c=>GC_AREA_TYPE_COST_CTR

iv_leading_object_id = lr_item_to_cc_map->COST_CTR

).

ls_area_to_item_map-area_guid = lo_area->get_guid( ).

ls_area_to_item_map-item_guid = lr_item_to_cc_map->item_guid.

APPEND ls_area_to_item_map TO rt_item_to_area_map.

ENDLOOP.

***Logic in GET_APPROVERS_BY_AREA_GUID method

DATA lo_area TYPE REF TO /sapsrm/if_wf_area.

  • Input checks

  • Get responsibility area reference for given area GUID

lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~get_instance_by_guid(

iv_area_type = /sapsrm/if_wf_process_c=>GC_AREA_TYPE_COST_CTR

iv_area_guid = is_area-area_guid

).

  • Return all responsible users assigned to that area

rt_approver = lo_area->get_responsible_approvers( ).

DATA LEADING_OBJECT_ID type /SAPSRM/WF_LEADING_OBJECT_ID.

LEADING_OBJECT_ID = lo_area->GET_LEADING_OBJECT_ID( ).

data : l_agent type zsrmagents-agent.

DATA : WA_RT_APPROVER TYPE /SAPSRM/S_BD_WF_APPROVER.

select single agent from zsrmagents into l_agent where kostl = LEADING_OBJECT_ID.

if sy-subrc = 0.

WA_rt_approver-APPROVER_OT = 'US'.

WA_rt_approver-APPROVER_ID = l_agent.

APPEND WA_RT_APPROVER TO RT_APPROVER.

endif.

****try

Edited by: balajit on Dec 13, 2010 7:44 PM

Former Member
0 Kudos

Balaji,

Are you sure the below logic work for this scenario?

item 1 $ 100.00

item 2 $ 1000.00

item 3 $ 200.00

item 4 $ 1200.00

Saravanan

Answers (0)