DATA: ls_parameter TYPE /iwbep/s_mgw_name_value_pair,
      lv_custid    TYPE kunnr,
      lv_flag      TYPE char1,
      lt_custinfo  TYPE TABLE OF ztest_gw_srv,
      ls_custinfo  TYPE ztest_gw_srv,
      ls_entity    TYPE zcl_ztest_gw_srv_mpc=>ts_msg_return.


    IF iv_action_name = 'demoFuncImport'. " Check what action is being requested
      IF it_parameter IS NOT INITIAL.

* Read Function import parameter value
        READ TABLE it_parameter INTO ls_parameter WITH KEY name = 'CustId'.
        IF sy-subrc = 0.
          lv_custid = ls_parameter-value.
        ENDIF.

        READ TABLE it_parameter INTO ls_parameter WITH KEY name = 'Approved_Flag'.
        IF sy-subrc = 0.
          lv_flag = ls_parameter-value.
        ENDIF.

        IF  lv_custid IS NOT INITIAL.
          UPDATE ztest_gw_srv SET approved = lv_flag WHERE cust_id = lv_custid.
          IF sy-subrc = 0.
            ls_entity-type   = 'S'.
            ls_entity-message = 'Customer info successfully approved'.
          ELSE.
            ls_entity-type   = 'E'.
            ls_entity-message = 'Error'.
          ENDIF.


* Call method copy_data_to_ref and export entity set data
          copy_data_to_ref( EXPORTING is_data = ls_entity
                  CHANGING cr_data = er_data ).

        ENDIF.
      ENDIF.
    ENDIF.

 

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Translate »