Lesson 6: Advanced Integration and Development Techniques in SAP

Lesson 6: Advanced Integration and Development Techniques in SAP


1. RFC and BAPI Integration

  • RFC (Remote Function Call) enables external system communication.

  • BAPIs (Business Application Programming Interfaces) standardize external access.

  • Facilitates seamless SAP and non-SAP system integration.


2. Advanced Table Control Handling

  • Dynamically manipulate table controls in SAP GUI.

  • Supports complex input scenarios and validation checks.

  • Enables bulk data processing within forms.


  • Implements fuzzy and full-text search in HANA.

  • Uses linguistic processing for advanced text analytics.

  • Enhances search capabilities in applications.


Code Example 1: RFC Function Module

FUNCTION z_get_customer_data.
  EXPORTING ev_customer_data TYPE zcustomer.
  IMPORTING iv_customer_id TYPE zcustomer-id.
  SELECT SINGLE * INTO ev_customer_data FROM zcustomer WHERE id = iv_customer_id.
ENDFUNCTION.

Explanation

  1. Defines an RFC-enabled function module z_get_customer_data.

  2. Fetches customer data based on input ID.

  3. Exposes SAP data to external systems.


Code Example 2: BAPI Usage

DATA: lv_salesdoc TYPE bapivbeln-vbeln.

CALL FUNCTION 'BAPI_SALESORDER_GETSTATUS'
  EXPORTING
    salesdocument = lv_salesdoc
  IMPORTING
    statusinfo = lt_status.
IF sy-subrc = 0.
  WRITE: / 'Sales order status fetched'.
ENDIF.

Explanation

  1. Calls the BAPI BAPI_SALESORDER_GETSTATUS for sales order status.

  2. Passes a sales document number as input.

  3. Retrieves and processes status information.


Code Example 3: Table Control Handling

LOOP AT SCREEN.
  IF screen-name = 'IT_CUSTOMERS-CITY'.
    screen-input = 1.
    MODIFY SCREEN.
  ENDIF.
ENDLOOP.

Explanation

  1. Iterates through screen elements dynamically.

  2. Enables input for a specific table control field.

  3. Modifies screen behavior based on requirements.


Code Example 4: Full-Text Search in HANA

SELECT * 
FROM zdocuments 
WHERE CONTAINS(text, 'SAP Development', FUZZY(0.8));

Explanation

  1. Executes a fuzzy full-text search in the zdocuments table.

  2. Matches the keyword "SAP Development" with 80% accuracy.

  3. Enhances search capabilities in SAP HANA.


Code Example 5: Dynamic ALV Report

DATA: lt_fieldcat TYPE lvc_t_fcat, lv_report_title TYPE string.

lv_report_title = 'Dynamic ALV Report'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program = sy-repid
    it_fieldcat        = lt_fieldcat
    i_grid_title       = lv_report_title
  TABLES
    t_outtab           = lt_data.

Explanation

  1. Configures a dynamic ALV (ABAP List Viewer) grid display.

  2. Passes a field catalog and report title.

  3. Displays the data in a user-friendly table format.