RFC Data Sending Guide – ZONCL_FETCH_DATA_V2

RFC Data Sending Guide – ZONCL_FETCH_DATA_V2

RFC Data Sending Guide – ZONCL_FETCH_DATA_V2

This guide describes how to send data from a custom Z table in SAP to a remote system using the class ZONCL_FETCH_DATA_V2. The process supports optional filters and allows update/delete operations on the target system.

1. Variable Declarations

Start by declaring the necessary objects and structures:

DATA:
  lo_fetch_data TYPE REF TO zoncl_fetch_data_v2, " Object for data transfer
  lt_where      TYPE ZONTTRSDSWHERE,             " WHERE conditions table
  ls_where      TYPE ZONTRSDSWHERE.              " Individual condition line

2. Create the Sending Object

Instantiate the processing class:

CREATE OBJECT lo_fetch_data.

3. Define WHERE Conditions (Optional)

Apply one or more logical filters to limit the data being sent:

ls_where = '( LIFNR NE ''999'' )'.
APPEND ls_where TO lt_where.

Example with multiple conditions:

ls_where = '( BUKRS EQ ''1000'' AND LIFNR NE ''999'' )'.
APPEND ls_where TO lt_where.

Note: These filters are applied on the source system before transmission.

4. Send the Table to the Remote Destination

Call the method send_json_any_table with the relevant parameters:

CALL METHOD lo_fetch_data->send_json_any_table 
  EXPORTING
    iv_tabname  = 'ZONTA_APAGING'   " Table name
    iv_update   = 'X'               " 'X' allows updates on destination
    iv_delete   = ' '               " 'X' allows deletion; space disables it
    it_where    = lt_where          " WHERE conditions
    iv_alias    = ' '               " Optional alias
    iv_dest     = 'ONIBEX'.         " RFC destination (defined in SM59)

Basic error control can be added as follows:

IF sy-subrc <> 0.
  MESSAGE 'Error sending table data' TYPE 'E'.
ENDIF.

Final Notes

  • Ensure the RFC destination ONIBEX is correctly configured in transaction SM59.
  • The target system must have the table structure ZONTA_APAGING available.
  • This logic is reusable for other Z tables by changing the table name and conditions accordingly.
    • Related Articles

    • Sending Data via BW Extractors

      Sending Data via BW Extractors Using One Connect for SAP Overview One Connect for SAP supports data extraction through SAP BW (Business Warehouse) Extractors, allowing you to leverage existing BW DataSources to extract and transmit data to your ...
    • Sending Z Tables via SAP Data Modeler and Custom Z Program - For ABAP RAP

      Manual: Sending Z Tables via SAP Data Modeler and Custom Z Program In the SAP Data Modeler, create an “ANY” Entity including the desired Z tables. Ensure the Domain is set to ANY. Inside the entity, select the desired columns to send in the Column ...
    • Sending Z Tables via SAP Data Modeler and Custom Z Program - For Classic ABAP

      Manual: Sending Z Tables via SAP Data Modeler and Custom Z Program In the SAP Data Modeler, create an “ANY” Entity including the desired Z tables. Ensure the Domain is set to ANY. Inside the entity, select the desired columns to send in the Column ...
    • Sending IDocs Using One Connect for SAP

      Sending IDocs Using One Connect for SAP Output Message, EDI/ALE, and Distribution Model Configuration Overview One Connect for SAP supports data extraction through SAP IDocs (Intermediate Documents), allowing you to leverage standard and custom IDoc ...
    • How to add new RAP Events to the Data Modeler

      How to Add New RAP Events to the One Connect Data Modeler Overview One Connect for SAP supports real-time event-driven data transmission through SAP RAP (ABAP RESTful Application Programming Model) Business Events. By subscribing to RAP behavior ...