Lesson 7: Advanced SAP Development Techniques

Lesson 7: Advanced SAP Development Techniques


1. SAP ABAP RESTful Application Programming Model (RAP)

  • Simplifies development of Fiori apps using CDS views and OData services.

  • Supports transactional and analytical scenarios in one framework.

  • Ensures end-to-end extensibility and cloud readiness.


2. Custom OData Services in SAP Gateway

  • Enables creation of CRUD operations for external systems.

  • Facilitates secure data exchange with minimal latency.

  • Supports metadata-driven service generation for integration.


3. ABAP Parallel Processing for Performance

  • Utilizes background jobs or asynchronous RFCs for heavy workloads.

  • Reduces runtime for data-intensive operations.

  • Manages parallel tasks with error handling and logging.


Code Example 1: RAP CDS Behavior Definition

define behavior for ZCustomerView alias Customer
  implementation in class ZCL_BEHAVIOR_HANDLER unique
{
  create;
  update;
  delete;
}

Explanation

  1. Defines behavior for the ZCustomerView CDS view.

  2. Enables creation, update, and delete operations.

  3. Associates the behavior with a custom handler class.


Code Example 2: Custom OData Service

METHOD get_entityset.
  SELECT * INTO TABLE et_entityset FROM zsales.
ENDMETHOD.

Explanation

  1. Implements the get_entityset method for OData services.

  2. Fetches data from the zsales table for client consumption.

  3. Supports easy integration with web or mobile apps.


Code Example 3: ABAP Parallel Processing

CALL FUNCTION 'Z_PROCESS_CUSTOMER'
  STARTING NEW TASK 'TASK1'
  EXPORTING
    iv_customer_id = 'C001'.
WAIT FOR ASYNC TASKS.

Explanation

  1. Executes a custom function module in parallel.

  2. Uses asynchronous RFC for performance optimization.

  3. Waits for tasks to complete before proceeding.


Code Example 4: Fiori App UI Adaptation

sap.ui.getCore().applyChanges();
this.getView().byId("customerName").setVisible(false);

Explanation

  1. Hides a specific field (customerName) dynamically in a Fiori app.

  2. Applies changes instantly to the UI.

  3. Supports runtime adaptation without affecting backend logic.


Code Example 5: ABAP Debugging with Breakpoint

BREAK-POINT ID 'DEBUG_RFC_CALL'.
CALL FUNCTION 'Z_CUSTOMER_SYNC'
  DESTINATION 'RFC_DEST'
  EXPORTING iv_customer = lv_customer.

Explanation

  1. Sets a breakpoint for debugging RFC calls.

  2. Analyzes the execution of the Z_CUSTOMER_SYNC function module.

  3. Facilitates troubleshooting of external integrations.