on 2015 Dec 08 1:36 PM
Hi Techies,
I was trying add SRM PO approval note at header during the approval process but I could not get success.
below is the source code for Approval note add at header in SRM PO approval process
Source Code :
DATA:mo_pdo TYPE REF TO /sapsrm/if_pdo_base.
DATA:lo_pdo_po_text TYPE REF TO /sapsrm/if_pdo_do_longtext.
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.
lo_pdo_po_text ?= mo_pdo.
CALL METHOD lo_pdo_po_text->update_longtext
EXPORTING
iv_p_guid = wa_header-guid
iv_tdid = 'NOTM'
iv_tdspras = sy-langu
iv_tdformat = 'X'
iv_text_preview = lv_note
* CHANGING
* co_message_handler =
.
* CATCH /sapsrm/cx_pdo_abort .
* ENDTRY.
mo_pdo->submit_update( CHANGING co_message_handler = mo_pdo_message_consumer ).
COMMIT WORK.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
Please suggest me and explain where I did mistake .
thanks in Advance
Request clarification before answering.
Hi Laurent,
Thanks for your quick response.
I will try with those two approaches and if it is not working get back to you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
your type ref "mo_pdo" must be a type ref to /SAPSRM/IF_PDO_PD_BO_PO_ADV, not to /SAPSRM/IF_PDO_BASE.
An alternative solution is to take example with PROCDOC_UPDATE method from class /SAPSRM/CL_OFFLINEAPP_INBOUND.
Regards.
Laurent.
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.