Internal Table [DEFAULT] Expression

light111Internal Table [DEFAULT] Expression


SCARR table entries

1

While reading ITAB with key or index the DEFAULT expression can be added. In case the read is unsuccessful then the default value is assigned to the target value holder.

2

below here the s2nd read is unsuccessful, so the target  LS_SCARR2 is assigned to the default structure value.

3


SELECT * FROM scarr INTO TABLE @DATA(lt_scarr).
DATA(ls_scarr_def) = VALUE scarr( mandt = sy–mandt carrid = ‘XX’ carrname = ‘NOT ASSIGNED’  currcode = ‘XXX’ url = ‘NO URL’ ).

DATA(ls_scarr1) = VALUE #( lt_scarr[ carrid = ‘AA’ ] DEFAULT ls_scarr_def ).
DATA(ls_scarr2) = VALUE #( lt_scarr[ carrid = ‘ZZ’ ] DEFAULT ls_scarr_def ).


 

One comment

Leave a Reply