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 Z Tables via SAP Data Modeler and Custom Z Program

      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 ...
    • SAP Data Modeler - Working with the entity "ANY"

      Introduction This document provides a step-by-step guide for creating and configuring an entity within Onibex's SAP Modeler using transaction ZONT_ONECM. It outlines the essential processes, including selecting the appropriate domain and data type, ...
    • SAP Data Modeler - Customizing Parameters

      OneConnect Parameter Adjustments The OneConnect solution includes a parameter table used for sending information—especially real-time data. It is important to configure this table beforehand, prior to sending any data, to ensure proper communication ...
    • SAP Data Modeler - Execute an entity in batch mode

      Batch Mode Entity Sending Pre-execution Requirements Before executing an entity and sending information in batch mode, ensure that the entity is correctly created and configured. Likewise, confirm that the endpoint configuration is properly set up ...
    • SAP Data Modeler - Entity Creation and Main Customizing

      Introduction This document provides a step-by-step guide for creating and configuring an entity within Onibex's SAP Modeler using transaction ZONT_ONECM. An entity in the Data Modeler is defined as a set of standard SAP tables and their key fields, ...