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' .
Below is the code with which i have tried.
DATA: lo_pdo_po TYPE REF TO /sapsrm/if_pdo_bo_po,
lo_message TYPE REF TO /sapsrm/cl_pdo_msg,
mo_pdo_message_consumer TYPE REF TO /sapsrm/if_pdo_msg_consumer,
mo_pdo TYPE REF TO /sapsrm/if_pdo_base.
iv_agent = sy-uname.
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.
CREATE OBJECT lo_message.
mo_pdo_message_consumer ?= lo_message.
IF mo_pdo IS BOUND.
lo_pdo_po ?= mo_pdo.
ENDIF.
****Set the approval status***
IF iv_decision_key EQ '0001'.
lv_apr_status = 'APPROVED'.
lv_apr_ind = 'A'.
ELSEIF iv_decision_key EQ '0002'.
lv_apr_status = 'REJECTED'.
lv_apr_ind = 'R'.
ENDIF.
TRY.
CALL METHOD lo_pdo_appr->set_decision
EXPORTING
iv_status = lv_apr_status.
CATCH /sapsrm/cx_pdo_abort .
CATCH /sapsrm/cx_pdo_error .
ENDTRY.
***Approve or reject by calling the following methods***
lo_pdo_adv_base ?= mo_pdo.
IF lv_apr_ind EQ 'A'.
TRY.
CALL METHOD lo_pdo_adv_base->approve
CHANGING
co_message_handler = mo_pdo_message_consumer.
CATCH /sapsrm/cx_pdo_check_failed .
CATCH /sapsrm/cx_pdo_error .
CATCH /sapsrm/cx_pdo_abort .
ENDTRY.
ELSEIF lv_apr_ind EQ 'R'.
TRY.
CALL METHOD lo_pdo_adv_base->reject
CHANGING
co_message_handler = mo_pdo_message_consumer.
CATCH /sapsrm/cx_pdo_check_failed .
CATCH /sapsrm/cx_pdo_abort .
CATCH /sapsrm/cx_pdo_error .
ENDTRY.
ENDIF.
***Update the header level details with approval indicator**
MOVE-CORRESPONDING wa_header TO ls_header_u.
ls_header_u-approval_ind = lv_apr_ind.
TRY.
CALL METHOD lo_pdo_po->update_header
EXPORTING
is_header = ls_header_u
CHANGING
co_message_handler = mo_pdo_message_consumer.
CATCH /sapsrm/cx_pdo_wrong_mode .
CATCH /sapsrm/cx_pdo_no_authorizatio .
CATCH /sapsrm/cx_pdo_abort .
ENDTRY.
lo_pdo_po->update_item(
EXPORTING it_item = it_item1
CHANGING co_message_handler = mo_pdo_message_consumer ).
.
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.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
I have tried in this way 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.