cancel
Showing results for 
Search instead for 
Did you mean: 

SRM Purchase Approval note not updated

sreenivas_pachva
Participant
0 Kudos
351

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

Accepted Solutions (0)

Answers (2)

Answers (2)

sreenivas_pachva
Participant
0 Kudos

Hi Laurent,

Thanks for your quick response.

I will try with those two approaches and if it is not working get back to you.

sreenivas_pachva
Participant
0 Kudos

Hi Laurent,

I have one question , in PROCDOC_UPDATE method what value I have to pass to parameter : IV_DECISION

Can you please help us on that.

laurent_burtaire
Active Contributor
0 Kudos

Hello,

cannot help you: you know the business process in which you want to update "Approval note", not me...

Regards.

Laurent.

laurent_burtaire
Active Contributor
0 Kudos

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.