ABAP 740裡的新語法 - LET表示式

i042416發表於2020-08-17

A LET expression defines variables var1, var2, … or field symbols , , … as local auxiliary fields in an expression and assigned values to them. When declared, the auxiliary fields can be used in the operand positions of the expression. There is no way of accessing an auxiliary field statically outside its expression.

See example below:

  1. in line 25 and line 26 we define two auxiliary fields date and sep with keyword LET, which are used in LET expressions in line 27.
  2. in line 27 we define a LET expression by keyword IN
  3. finally the value of LET expression will be calculated and filled to inline variable isodate defined in line 24. We use CONV string to explicitly specify that inline defined variable isodate has type STRING.


ABAP 740裡的新語法 - LET表示式


Execution result:


ABAP 740裡的新語法 - LET表示式


Another example: Defines three local auxiliary variables, x, y, and z, in a constructor expression to construct the values of a structure. The values of the auxiliary variables are used for the structure components.


ABAP 740裡的新語法 - LET表示式


Execution result:


ABAP 740裡的新語法 - LET表示式


要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":

ABAP 740裡的新語法 - LET表示式


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2712214/,如需轉載,請註明出處,否則將追究法律責任。

相關文章