Hello everyone,
In this blog you will learn about Inline Declarations in Netweaver ABAP 7.40. There are many new features introduced in ABAP Netweaver 7.4 and the ABAP stack is optimized for SAP HANA. SAP Netweaver 7.4 is minimum requirement to move to SAP Business Suite on HANA. With these new features introduced from SAP Netweaver 7.4 SAP HANA database in-memory computing can be leveraged at ABAP level. So, let look at these features, learn it and implement them.
1.Are you working on SAP ABAP Netweaver 7.40 ?
To answer this question, log on to your SAP system. In the menu bar navigate to System → Status. In the popup window, under SAP system data section click on display button under “Product Version” field. You can see list of installed software component versions like below
From list of installed software components, look for the Release-采购向厂商下P/O之后,必须透过一定权限经由主管对此张P/O做 release后才能收料 version of SAP_BASIS and SAP_ABA components to check the SAP Netweaver version.
Below are list of main features among different sections
[su_box title=”1. Inline Declarations” style=”soft” box_color=”#f0ab00″]Now you can declare the variables and field-symbols at the same position where you are using them. Inline declarations are possible only for DATA and FIELD-SYMBOL.2.#LEFT ASSIGNMENT
2.1.Old Syntax
1 2 3 |
DATA lv_name TYPE string. lv_name = 'SAPLEARNERS.COM'. |
2.2. New Syntax
1 |
DATA(lv_name) = 'SAPLEARNERS.COM'. |
3.#LOOP STATEMENT
2.1.Old Syntax
1 2 3 4 5 6 |
DATA: lw_mara TYPE ty_mara, LOOP AT lt_mara INTO lw_mara. WRITE: lw_mara-matnr,lw_mara-ernam. .... ENDLOOP. |
3.2.New Syntax
1 2 3 4 |
LOOP AT lt_mara INTO DATA(lw_mara). WRITE: lw_mara-matnr,lw_mara-ernam. .... ENDLOOP. |
4.#READ STATEMENT
2.1.Old Syntax
1 2 3 |
DATA: lw_mara TYPE ty_mara. READ TABLE lt_mara INTO lw_mara INDEX 1. |
4.2.New Syntax
1 |
READ TABLE lt_mara INTO DATA(lw_mara) INDEX 1. |
5. #SELECT STATEMENT
2.1.Old Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
TYPES: BEGIN OF ty_mara, matnr TYPE matnr, ersda TYPE ersda, ernam TYPE ernam, laeda TYPE laeda, aenam TYPE aenam, END OF ty_mara. DATA: lt_mara TYPE STANDARD TABLE OF ty_mara. SELECT matnr ersda ernam laeda aenam FROM mara INTO TABLE lt_mara UP TO 10 ROWS. |
4.2.New Syntax
1 2 3 4 5 6 7 |
SELECT matnr ersda ernam laeda aenam FROM mara INTO TABLE @DATA(lt_mara) UP TO 10 ROWS. |
NEW creates object
VALUE creates values
REF get references
EXACT perform a lossless assignment or calculation
CONV convert values
CAST performs an up cast or down cast
COND and SWITCH enable conditional expression
2.1.Old Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 |
TYPES: BEGIN OF ty_old, f1 TYPE c, f2 TYPE c, f3 TYPE c, END OF ty_old. DATA: ls_old TYPE ty_old. ls_old-f1 = 'A'. ls_old-f2 = 'B'. ls_old-f3 = 'C'. WRITE: ls_old-f1,ls_old-f2,ls_old-f3. |
2.2. New Syntax
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
TYPES: BEGIN OF ty_new, f1 TYPE c, f2 TYPE c, f3 TYPE c, END OF ty_new. * creating intial values using constructor expression - VALUE DATA(ls_new) = VALUE ty_new( f1 = 'A' f2 = 'B' f3 = 'C'). WRITE: ls_new-f1,ls_new-f2,ls_new-f3. * changing the initial values using '#' ls_new = VALUE #( f1 = 'X' f2 = 'Y' f3 = 'Z'). WRITE: ls_new-f1,ls_new-f2,ls_new-f3. |
Congrats! You have successfully created Synonym in SAP HANA. Please stay tuned for SAP HANA tutorials. Leave a comment in the below comment section and let us know your feedback.