2019.11.06 [learn every day point SAP Tips] Day1 - ABAP 7.40 new syntax

 I recently ABAP colleagues used the new syntax thief slipped, save a lot of effort, still using the old syntax I jealous.

So it after their own grammar mend 7.40, allowing it to write code more smoothly.

Today, learning inline declared inline

Means: When the compiler finds a piece of code in an inline function calls, it is not to call the function, but the function code, the whole is inserted into the current location. The benefit of this is to save a procedure call to speed up running speed. (Function calling process, due to the previously mentioned parameters onto the stack and other operations, so the total to more than take some time) so plan focused on: inline functions picked up speed, but takes up more space .

When you use the following code:

 

Inline stated:

description  Before 7.40  After 7.40
Variables declared assignment 

Data text type string.

text = 'TAB'.

DATA(text) = 'TAB'
Cycle work area

DATA wa LIKE LINE OF itab.

FIELD-SYMBOLS <FS> LIKE LINE OF itab.

LOOP AT itab INTO wa.

ENDLOOP.

LOOP AT itab ASSIGNING <FS>.

ENDLOOP.

LOOP AT itab into data(wa).

...

ENDLOOP.

LOOP AT itab ASSIGNING FIELD-SYMBOLS(<FS>).

...

ENDLOOP.

Call the method

DATA: a1 TYPE CHAR1.

 

oref->method_a1( 

   IMPORTING

  P1 =? 1).

oref->method_a1(

  IMPORTING P1 = DATA(a1) ).

READ TABLE

DATA wa LIKE LINE OF itab.

FIELD-SYMBOLS <FS> LIKE LINE OF itab.

READ TABLE itab INTO wa INDEX 1.

READ TABLE itab ASSIGNING <FS> INDEX 1.

READ TABLE itab INTO DATA(WA) INDEX 1.

READ TABLE itab ASSIGING FIELD-SYMBOLS(<FS>) INDEX 1.

SQL 

DATA itab TYPE TABLE OF MARA.

SELECT * FROM MARA INTO TABLE itab 

WHERE matnr = lv_matnr.


SELECT * FROM mara INTO TABLE @DATA(itab)
  WHERE matnr = lv_matnr.
SQL 2 

DATA:lv_matnr TYPE mara-matnr.
DATA:lv_matkl TYPE mara-matkl.

SELECT SINGLE matnr matkl INTO (lv_matnr,lv_matkl)
  FROM mara.

 SELECT SINGLE matnr,matkl INTO @DATA(lv_structue)
  FROM mara.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

- TAB learning technology, love life.

 

Guess you like

Origin www.cnblogs.com/jxzhu/p/11809505.html
Recommended