on 06-18-2012 11:00 PM
Hello Gurus,
We have implemented the custom Evaluation ID for the workflow process step. (i.e Process-Controlled Workflow).
Create a Shopping cart and save the shopping cart, the newly added process step has been displayed in the workflow approval list. But when I order the shopping cart, the newly added process step has been deleted from the "Approval List" and the work item has been sent to the second level of approval agents in stead of 'First level' of approval agents.
Any idea, why the newly added approval process step has been deleted when Ordering the shopping cart.
Here is the evaluation id code (Function Module):
FUNCTION ztsc_brf_bsmc_proc_lvl.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IT_EXPRESSIONS) TYPE SBRF260A_T
*" REFERENCE(IO_EVENT) TYPE REF TO IF_EVENT_BRF
*" REFERENCE(IO_EXPRESSION) TYPE REF TO IF_EXPRESSION_BRF
*" EXPORTING
*" REFERENCE(EV_VALUE) TYPE BRF_RESULT_VALUE
*" REFERENCE(EV_TYPE) TYPE BRF_RESULT_TYPE
*" REFERENCE(EV_LENGTH) TYPE BRF_RESULT_LENGTH
*" REFERENCE(EV_CURRENCY) TYPE BRF_CURRENCY
*" REFERENCE(EV_OUTPUT_LENGTH) TYPE BRF_RESULT_OUTPUT_LENGTH
*" REFERENCE(EV_DECIMALS) TYPE BRF_RESULT_DECIMALS
*" REFERENCE(EV_DATA_MISSING) TYPE BRF_DATA_MISSING
*"----------------------------------------------------------------------
*{ INSERT DR1K901729 1
******Newcode start****************
DATA ol_wf_brf_event TYPE REF TO /sapsrm/cl_wf_brf_event.
DATA ol_context_provider TYPE REF TO /sapsrm/cl_wf_context_provider.
DATA ol_pdo_sc TYPE REF TO /sapsrm/if_pdo_bo_sc.
DATA ol_wf_pdo TYPE REF TO /sapsrm/if_wf_pdo.
DATA vl_document_guid TYPE /sapsrm/wf_document_guid.
DATA vl_document_type TYPE /sapsrm/wf_document_type.
DATA il_document_owner TYPE /sapsrm/t_wf_agent_id.
DATA il_header_guid TYPE bbpt_guid.
DATA il_item_guid TYPE /sapsrm/t_pdo_hier_guid_list.
DATA il_item TYPE bbpt_pd_sc_item_d.
DATA il_item_i TYPE bbpt_pd_sc_item_d.
DATA wl_header TYPE bbp_pds_sc_header_d.
DATA wl_header_guid TYPE bbp_guid_tab.
DATA wl_item LIKE LINE OF il_item.
DATA rl_item TYPE REF TO bbp_pds_sc_item_d.
DATA rl_item_guid TYPE REF TO /sapsrm/s_pdo_hier_guid_list.
DATA rl_document_owner TYPE REF TO /sapsrm/wf_agent_id.
DATA vl_brf_expression TYPE brf_expression.
DATA il_account TYPE TABLE OF bbp_pds_acc.
DATA wl_account LIKE LINE OF il_account.
DATA vl_value TYPE c.
DATA vl_msg TYPE string.
DATA vl_expression TYPE brf_expression.
DATA vl_evaluation_id TYPE /sapsrm/wf_evaluation_id .
*=======================================================================
* Preset return parameters
*=======================================================================
ev_data_missing = 'X'.
ev_value = 0.
ev_type = 'C'.
ev_length = 1.
CLEAR ev_currency.
ev_output_length = 1.
ev_decimals = 0.
*=======================================================================
* Get purchasing document
*=======================================================================
* get event object
ol_wf_brf_event ?= io_event.
*get expression
vl_expression = ol_wf_brf_event->ms_brf210-expression.
* get context container from BRF event
ol_context_provider = ol_wf_brf_event->get_context_provider( ).
* get Content Container from BRF event
IF NOT ol_context_provider IS BOUND.
* BRF Context Container Object not bound. No further execution possible.
MESSAGE e090(/sapsrm/brf) INTO vl_msg.
TRY.
CALL METHOD /sapsrm/cl_wf_brf_ccms=>send_message( ).
CATCH /sapsrm/cx_wf_abort.
ev_data_missing = /sapsrm/if_wf_rule_c=>brf_data_missing.
EXIT.
ENDTRY.
ev_data_missing = /sapsrm/if_wf_rule_c=>brf_data_missing.
EXIT.
ENDIF.
vl_evaluation_id = ol_wf_brf_event->mv_event.
* get document
CALL METHOD ol_context_provider->get_document
IMPORTING
ev_document_guid = vl_document_guid
ev_document_type = vl_document_type.
IF vl_document_type <> 'BUS2121'.
EXIT.
ENDIF.
* get instance
ol_wf_pdo ?= /sapsrm/cl_wf_pdo_impl_factory=>get_instance(
iv_document_guid = vl_document_guid
iv_document_type = vl_document_type
).
*=======================================================================
* Get Document Owner
*=======================================================================
il_document_owner = ol_wf_pdo->get_document_owner( ).
READ TABLE il_document_owner REFERENCE INTO rl_document_owner INDEX 1.
ASSERT sy-subrc = 0.
*=======================================================================
* Specialize to Shopping Cart
*=======================================================================
IF ol_wf_pdo->get_document_type( ) NE /sapsrm/if_pdo_obj_types_c=>gc_pdo_shop.
ev_data_missing = 'X'.
EXIT.
ENDIF.
TRY.
ol_pdo_sc ?= ol_wf_pdo->get_pdo( ).
CATCH /sapsrm/cx_pdo_error
/sapsrm/cx_pdo_abort.
ENDTRY.
*=======================================================================
* Get Shopping Cart Details for Scheme Evaluation
*=======================================================================
TRY.
CALL METHOD ol_pdo_sc->get_header_detail
IMPORTING
es_header = wl_header.
* sl_sc_total_value-value = wl_header-total_value.
* sl_sc_total_value-currency = wl_header-currency.
wl_header_guid-guid = wl_header-guid.
APPEND wl_header_guid TO il_header_guid.
CALL METHOD ol_pdo_sc->/sapsrm/if_pdo_base~get_item_list
EXPORTING
it_parent_guid = il_header_guid
IMPORTING
et_item_guid = il_item_guid.
CATCH /sapsrm/cx_pdo_wrong_bus_type
/sapsrm/cx_pdo_pd_read_error
/sapsrm/cx_pdo_lock_failed
/sapsrm/cx_pdo_no_authorizatio
/sapsrm/cx_pdo_parameter_error
/sapsrm/cx_pdo_status_error
/sapsrm/cx_pdo_incons_user
/sapsrm/cx_pdo_abort
/sapsrm/cx_pdo_error.
ev_data_missing = 'X'.
EXIT.
ENDTRY.
CLEAR il_item.
LOOP AT il_item_guid REFERENCE INTO rl_item_guid WHERE leaf = abap_true.
TRY.
CALL METHOD ol_pdo_sc->get_item_detail
EXPORTING
iv_item_guid = rl_item_guid->guid
IMPORTING
et_item = il_item_i
et_account = il_account.
APPEND LINES OF il_item_i TO il_item.
CATCH /sapsrm/cx_pdo_no_authorizatio
/sapsrm/cx_pdo_abort .
ev_data_missing = 'X'.
EXIT.
ENDTRY.
ENDLOOP.
CLEAR : vl_value,
wl_item,
wl_account.
LOOP AT il_item INTO wl_item.
READ TABLE il_account INTO wl_account
WITH KEY p_guid = wl_item-guid
acc_cat = 'BS'.
IF sy-subrc = 0.
vl_value = 'X'.
EXIT.
ELSE.
READ TABLE il_account INTO wl_account
WITH KEY p_guid = wl_item-guid
acc_cat = 'MC'.
IF sy-subrc = 0.
vl_value = 'X'.
EXIT.
ENDIF.
ENDIF.
CLEAR : wl_item,
wl_account.
ENDLOOP.
ev_value = vl_value.
CLEAR ev_data_missing.
ENDFUNCTION.
Please let me know if there is any problem with the above code .
Thank You.
Shyam
Resolved.
Problem with config.
Thank You.
Shyam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shyam,
Can you please help me in configuring the process schema. My requirement is Based on Purchase Organization in the shopping cart need to determine the approval process. I created a new evaluation id, When I am trying to config the evaluation id it giving an error "An entry with same key already exist".
Please help me to come out of this issue.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.