Complete Projects

A selection-screen report with layered local classes, ABAP SQL with joins and aggregates, authorization checks, and SALV output.

41.1 Project A — Customer order analysis report (classic, on-premise)

A selection-screen report with layered local classes, ABAP SQL with joins and aggregates, authorization checks, and SALV output.

Extensions: add a drill-down to order items on double-click, a background mode that e-mails the result as XLSX, and ABAP Unit tests with CL_OSQL_TEST_ENVIRONMENT.

REPORT zorder_analysis.

DATA gv_date TYPE zorders-order_date.
DATA gv_cust TYPE zorders-customer.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
  SELECT-OPTIONS: s_date FOR gv_date OBLIGATORY,
                  s_cust FOR gv_cust.
  PARAMETERS      p_open AS CHECKBOX DEFAULT abap_true.
SELECTION-SCREEN END OF BLOCK b1.

CLASS lcl_report DEFINITION FINAL.
  PUBLIC SECTION.
    TYPES: BEGIN OF ty_out,
             customer    TYPE zorders-customer,
             name        TYPE kna1-name1,
             order_count TYPE i,
             total       TYPE zorders-amount,
             currency    TYPE zorders-currency,
             rating      TYPE c LENGTH 6,
           END OF ty_out,
           tt_out TYPE STANDARD TABLE OF ty_out WITH EMPTY KEY.
    METHODS run.
  PRIVATE SECTION.
    DATA mt_out TYPE tt_out.
    METHODS check_authority RETURNING VALUE(rv_ok) TYPE abap_bool.
    METHODS select_data.
    METHODS enrich.
    METHODS display.
ENDCLASS.

CLASS lcl_report IMPLEMENTATION.
  METHOD run.
    IF check_authority( ) = abap_false.
      MESSAGE 'No authorization to display orders' TYPE 'S' DISPLAY LIKE 'E'.
      RETURN.
    ENDIF.
    select_data( ).
    IF mt_o
…

41.2 Project B — Inbound file interface with logging

Selection screen: logical file name, test-run checkbox.

Read the CSV from the application server (OPEN DATASET), parse rows into a typed table, collect conversion errors (CX_SY_CONVERSION_ERROR).

Validate (customer exists, amount > 0, currency valid) using hashed lookup tables built with one SELECT each.

In update mode, lock each order (ENQUEUE_EZORDERS), post via MODIFY zorders FROM TABLE, COMMIT WORK.

Write all messages to an application log (SLG1) using BAL_LOG_CREATE / BAL_LOG_MSG_ADD / BAL_DB_SAVE (or CL_BALI_LOG in ABAP Cloud); move processed files to an archive directory.

Schedule as a daily job (SM36) with a variant.

41.3 Project C — RAP "Travel" app (ABAP Cloud)

Follow §34–§35 end to end on the BTP ABAP Environment trial:

Tables ZRAP_TRAVEL, ZRAP_BOOKING (+ draft tables generated via quick fix).

Root/child view entities ZR_Travel, ZR_Booking; projections ZC_Travel, ZC_Booking; metadata extensions.

Managed BDEF with draft, numbering, validations, determinations, actions, feature control.

Service definition ZUI_TRAVEL_O4, binding OData V4 – UI, preview.

ABAP Unit tests for handlers with CL_BOTD_TXBUFDBL_BO_TEST_ENV.

Optional: generate a Fiori elements app with SAP Fiori tools and deploy it; push the code to GitHub with abapGit.

Tip: ADT's *Generate ABAP Repository Objects* wizard (right-click a table → *Generate ABAP Repository Objects… → OData UI Service*) scaffolds the whole RAP stack, which you then refine.

41.4 Project D — Classic-to-modern refactoring

Take an old report using header lines, FORMs, nested SELECTs, and REUSE_ALV:

Replace header-line tables with typed tables and work areas/field symbols.

Convert forms into methods of a local class; inject a data-access interface.

Replace nested selects with a join or CDS view; measure with ST05 before and after.

Replace REUSE_ALV_GRID_DISPLAY with CL_SALV_TABLE.

Run ABAP Cleaner and ATC; add unit tests.