Skip to Content
0
Jun 10, 2020 at 09:17 AM

EXECUTE_ACTION - not getting triggered

428 Views Last edit Jun 10, 2020 at 09:23 AM 6 rev

Hello Experts,

EXECUTE_ACTION isn't getting triggered in the Odata:

It returns Resource not found for the segment 'GetLabelPDF'.

Can you guys help me find where i would have made mistake?

Thanks!

URI Endpoint:

/sap/opu/odata/sap/zpos_srv_srv/GetLabelPDF?Institution='BU10'&CaseNo='0000014009'&MovementNo='00001'
 METHOD /iwbep/if_mgw_appl_srv_runtime~execute_action.

 CASE iv_action_name.

WHEN 'GetLabelPDF'.
DATA:ls_labelpdf TYPE  zcl_zpos_srv_mpc=>ts_labelpdf.


        LOOP AT it_parameter INTO ls_parameter.
          IF ls_parameter-name EQ 'Institution'.
            institution = ls_parameter-value.
          ENDIF.
          IF ls_parameter-name EQ 'CaseNo'.
            caseno = ls_parameter-value.
          ENDIF.
          IF ls_parameter-name EQ 'MovementNo'.
            movementno = ls_parameter-value.
          ENDIF.
        ENDLOOP.



        CALL FUNCTION 'Zxxxxx_LABEL_PDF' DESTINATION lv_destination
            EXPORTING
              i_institution                = institution
              i_case_number                = caseno
              i_movement_number            = movementno
           IMPORTING
             e_pdf_string                 =  pdfstring
           TABLES
             et_return                    = lt_return
          .

        IF lt_return IS NOT INITIAL.
          LOOP AT lt_return INTO retmsg.
            IF retmsg-type EQ 'E' OR retmsg-type EQ 'I'.
              mo_context->get_message_container( )->add_messages_from_bapi(
      it_bapi_messages = lt_return
      iv_determine_leading_msg = /iwbep/if_message_container=>gcs_leading_msg_search_option-first ).
              RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
                EXPORTING
                  textid  = /iwbep/cx_mgw_busi_exception=>business_error
                  message = retmsg-message.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF sy-subrc EQ 0.

          ls_labelpdf-e_pdf_string = pdfstring.
          copy_data_to_ref(
          EXPORTING
          is_data = ls_poslabelpdf
          CHANGING
          cr_data = er_data ).
        ENDIF.
ENDCASE.

ENDMETHOD.