Inline ABAP DATA declarations are a new concept introduced in release 7.4 which allows you to declare your
internal table variables or work areas within the code that uses them. This is done simply by adding the
DATA(wa_data) or @DATA(it_data) statements.
The easiest way to describe this is to show you a very simple before after ABAP code example. Pre
7.40 you would declare a work area and read data into it somthing like this
DATA: it_ekko TYPE STANDARD TABLE OF EKKO, wa_ekko TYPE EKKO. READ IT_EKKO INTO WA_EKKO.
READ TABLE it_ekko INDEX 1 INTO DATA(wa_ekko_new).Hopefully the above example gives you an idea of how this new functionality can streamline your ABAP code and make it more readable. Also gives you the basics so you can have a play yourself. Now onto the @DATA statement....
TYPES: BEGIN OF t_ekko, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, statu TYPE ekpo-statu, aedat TYPE ekpo-aedat, matnr TYPE ekpo-matnr, menge TYPE ekpo-menge, meins TYPE ekpo-meins, netpr TYPE ekpo-netpr, peinh TYPE ekpo-peinh, CELLCOLOR TYPE LVC_T_SCOL, END OF t_ekko. DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0, wa_ekko TYPE t_ekko. select ebeln ebelp statu aedat matnr menge meins netpr peinh up to 10 rows from ekpo into CORRESPONDING FIELDS OF TABLE it_ekko.Using the new @DATA statement you could essentially replace all this with the following ABAP code, which automatically create an internal table with the correct field structure and drops the selected values into it. AS well as the @DATA note the ,'s after each field in the SELECT.
select ebeln, ebelp, statu, aedat, matnr, menge, meins, netpr, peinh up to 10 rows from ekpo into TABLE @DATA(it_ekko_new).This is more like it and if you combine the two examples together you get quite a neat and efficient looking section of code. It essentially removes all the ABAP declaration lines of code without adding much at all to SELECT and READ statements.
select ebeln, ebelp, statu, aedat, matnr, menge, meins, netpr, peinh up to 10 rows from ekpo into TABLE @DATA(it_ekko_new). READ TABLE it_ekko_new INDEX 1 INTO DATA(wa_ekko_new2). WRITE:/ wa_ekko_new2.