on 2015 Dec 15 9:23 AM
Hi All,
Could any one help in updating the SRM PO line item with Quantity,price and delivery date by using 'UPDATE_ITEM' method of class '/SAPSRM/IF_PDO_BO_PO' and '/SAPSRM/IF_PDO_BO_PO~UPDATE_ITEM' method of '/SAPSRM/IF_PDO_BO_PO_ADV' class
below is the code which i have used.
Approach 1:
data: lo_pdo_po TYPE REF TO /sapsrm/if_pdo_bo_po.
TRY.
CALL METHOD /sapsrm/cl_pdo_factory_po_adv=>get_instance
EXPORTING
iv_header_guid = wa_header-guid
iv_mode = 'APPROVAL'
iv_process_type = 'ECPO'
iv_wiid = iv_wiid
iv_user_id = iv_agent
RECEIVING
ro_instance = mo_pdo.
CATCH /sapsrm/cx_pdo_wf_mode_ban .
CATCH /sapsrm/cx_pdo_wrong_bus_type .
CATCH /sapsrm/cx_pdo_pd_read_error .
CATCH /sapsrm/cx_pdo_lock_failed .
CATCH /sapsrm/cx_pdo_no_authorizatio .
CATCH /sapsrm/cx_pdo_parameter_error .
CATCH /sapsrm/cx_pdo_status_error .
CATCH /sapsrm/cx_pdo_incons_user .
CATCH /sapsrm/cx_pdo_abort .
CATCH /sapsrm/cx_pdo_error .
ENDTRY.
IF mo_pdo IS BOUND.
lo_pdo_po ?= mo_pdo.
***it_item1 is containg the changed values of line item of the PO
lo_pdo_po->update_item(
EXPORTING it_item = it_item1
CHANGING co_message_handler = mo_pdo_message_consumer ).
ENDIF.
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
TRY.
CALL METHOD lo_pdo_adv_base->submit_decision
CHANGING
co_message_handler = mo_pdo_message_consumer.
CATCH /sapsrm/cx_wf_decision_missing .
CATCH /sapsrm/cx_pdo_error .
CATCH /sapsrm/cx_pdo_abort .
ENDTRY.
Approach 2.
DATA:lo_pdo_adv_base TYPE REF TO /sapsrm/if_pdo_adv_base.
TRY.
CALL METHOD /sapsrm/cl_pdo_factory_po_adv=>get_instance
EXPORTING
iv_header_guid = wa_header-guid
iv_mode = 'APPROVAL'
iv_process_type = 'ECPO'
iv_wiid = iv_wiid
iv_user_id = iv_agent
RECEIVING
ro_instance = mo_pdo.
CATCH /sapsrm/cx_pdo_wf_mode_ban .
CATCH /sapsrm/cx_pdo_wrong_bus_type .
CATCH /sapsrm/cx_pdo_pd_read_error .
CATCH /sapsrm/cx_pdo_lock_failed .
CATCH /sapsrm/cx_pdo_no_authorizatio .
CATCH /sapsrm/cx_pdo_parameter_error .
CATCH /sapsrm/cx_pdo_status_error .
CATCH /sapsrm/cx_pdo_incons_user .
CATCH /sapsrm/cx_pdo_abort .
CATCH /sapsrm/cx_pdo_error .
ENDTRY.
IF mo_pdo IS BOUND.
lo_pdo_po_adv ?= mo_pdo.
lo_pdo_po_adv->/SAPSRM/IF_PDO_BO_PO~UPDATE_ITEM(
EXPORTING it_item = it_item1
CHANGING co_message_handler = mo_pdo_message_consumer ).
ENDIF.
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
TRY.
CALL METHOD lo_pdo_adv_base->submit_decision
CHANGING
co_message_handler = mo_pdo_message_consumer.
CATCH /sapsrm/cx_wf_decision_missing .
CATCH /sapsrm/cx_pdo_error .
CATCH /sapsrm/cx_pdo_abort .
ENDTRY.
I have tried in both ways, but the line items are not being updated .Could any one help in this regard.
Or are there any other methods to update the line items.
I don't want to used the function module ' BBP_PD_PO_UPDATE' to update the line item of the PO since it is effecting the status of the workflow.
Thanks in advance
Request clarification before answering.
I see you have already posted this in SRM forum. please do not duplicate
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.