[ABAP] Tiefe Strukturen verwenden

* tiefe Struktur definieren
TYPES: BEGIN OF ty_deep_structure,
* Struktur vom Typ MARA
         s_mara TYPE mara,
* Tabelle vom Typ MARD
         t_mard TYPE STANDARD TABLE OF mard WITH DEFAULT KEY,
* Tabelle vom Typ MAKT
         t_makt TYPE STANDARD TABLE OF makt WITH DEFAULT KEY,
       END OF ty_deep_structure.

PARAMETERS: p_matnr TYPE matnr.

START-OF-SELECTION.
  DATA: lv_data TYPE ty_deep_structure.

* schrittweise Daten lesen
  SELECT SINGLE * FROM mara INTO @lv_data-s_mara WHERE matnr = @p_matnr.

  IF sy-subrc = 0.
    SELECT * FROM mard INTO TABLE @lv_data-t_mard WHERE matnr = @p_matnr.

    IF sy-subrc = 0.
      SELECT * FROM makt INTO TABLE @lv_data-t_makt WHERE matnr = @p_matnr.

      IF sy-subrc = 0.
        WRITE: / 'MATNR:', lv_data-s_mara-matnr.
        WRITE: / 'Coutner MARD:', lines( lv_data-t_mard ).
        WRITE: / 'Coutner MAKT:', lines( lv_data-t_makt ).
      ENDIF.

    ENDIF.

  ENDIF.