Quantcast
Channel: SCN : All Content - SAP Gateway
Viewing all articles
Browse latest Browse all 2823

Netweaver Gateway Function Imports and RFCs

$
0
0

 

Hi - I am trying to use a Function Import to return a table of name value pairs using an RFC. The call takes a single paramter.
It should be pretty straight forward except I am getting the error "Name or password is incorrect (repeat logon)" off the RFC.

On the same service I have created a regular GetEntity(Read) operation calling the same RFC and using the same destination and it works.
Obviously the data is useless but it proves that the service is configured correctly to make the call.

Any ideas?

 

method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~EXECUTE_ACTION.

DATA lo_dp_facade TYPE REF TO /iwbep/if_mgw_dp_facade.
data LV_DESTINATION type RFCDEST.
data LV_EXC_MSG type /IWBEP/MGW_BOP_RFC_EXCEP_TEXT.
data LV_SUBRC type SYST-SUBRC.

DATA: ls_parameter  TYPE /iwbep/s_mgw_name_value_pair,
        lv_userid    TYPE string,
        ls_entity     TYPE  ZCL_ZFOH_READ_SETTINGS_MPC=>TS_SETTINGS,
        lt_entityset  TYPE ZCL_ZFOH_READ_SETTINGS_MPC=>TT_SETTINGS.

TYPES: BEGIN OF s_param,
        mandt type string,
        name type string,
        value type string,
      END OF s_param.

DATA: t_param type standard table of s_param.
DATA  ls_param like line of t_param.

  IF iv_action_name = 'GetSettings'. " 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 = 'UserId'.

      IF sy-subrc = 0.

        lv_userid = ls_parameter-value.

      ENDIF.

      IF lv_userid IS NOT INITIAL.

        lo_dp_facade = /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).
        lv_destination = /iwbep/cl_sb_gen_dpc_rt_util=>get_rfc_destination( io_dp_facade = lo_dp_facade ).

        call function 'Z_FOH_READ_SETTINGS_ODATA' destination lv_destination
        exporting
          IV_USER_ID   =   lv_userid
        importing
          EV_SETTINGS   =   t_param
          exceptions
          system_failure         = 1000 message lv_exc_msg
          communication_failure  = 1001 message lv_exc_msg
          others = 1002.
        lv_subrc = sy-subrc.

*-------------------------------------------------------------
*  Map the RFC response to the caller interface - Only mapped attributes
*-------------------------------------------------------------
*-------------------------------------------------------------
* Error and exception handling
*-------------------------------------------------------------
IF lv_subrc <> 0.
* Execute the RFC exception handling process
  me->/iwbep/if_sb_dpc_comm_services~rfc_exception_handling(
    EXPORTING
      iv_subrc            = lv_subrc
      iv_exp_message_text = lv_exc_msg ).
ENDIF.

        LOOP AT t_param into ls_param .
          ls_entity-NAME  = ls_param-name.
          ls_entity-VALUE = ls_param-value.
          APPEND ls_entity TO lt_entityset.

        ENDLOOP.

* Call methos copy_data_to_ref and export entity set data

        copy_data_to_ref( EXPORTING is_data = lt_entityset

                CHANGING cr_data = er_data ).

 

      ENDIF.

    ENDIF.

  ENDIF.

  endmethod.


Viewing all articles
Browse latest Browse all 2823

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>