New ABAP – 7.5

Filling an internal table.

DATA : lt_mara type table of mara.
lt_mara = VALUE #( ( matnr = 'Test-1' maktl = 'GP1' PSTAT = 'P' )
                   ( matnr = 'Test-2' maktl = 'GP2' PSTAT = 'S' )
                   ( matnr = 'Test-3' maktl = 'GP3' PSTAT = 'T' )             
                   ( matnr = 'Test-4' maktl = 'GP4' PSTAT = 'U' )
                   ( matnr = 'Test-5' maktl = 'GP5' PSTAT = 'X' )
                   ( matnr = 'Test-6' maktl = 'GP6' PSTAT = 'Z' )                           ).

Dynamic Declaration

SELECT * FROM mara
  UP TO 10 ROWS
  INTO TABLE @DATA(lt_mara).

Internal Table Access

TRY.
    DATA(lv_material) = lt_mara[ 1 ]-matnr.
  CATCH cx_sy_itab_line_not_found.
ENDTRY.

Conversion Exit

lv_material = |{ lv_material ALPHA = IN }|.

Copying internal table with Mapping and Except.

lt_mailing_addr = CORRESPONDING #( lt_service_addr MAPPING adrnr = addrnum EXCEPT postal_code2 ).
%d bloggers like this: