A LET expression defines variables var1, var2, … or field symbols <fs1>, <fs2>, … 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.

/wp-content/uploads/2013/12/clipboard1_337648.png


Execution result:

/wp-content/uploads/2013/12/clipboard2_337727.png

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.

/wp-content/uploads/2013/12/clipboard3_337728.png

Execution result:

/wp-content/uploads/2013/12/clipboard4_337729.png

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Avirat Patel

    Hi Jerry,

         Nice to read about new feature and very useful further.

    but somehow i am experience some difficulty as shown below.

    1.     Why i am not able to declare table like

    2.     I am not able to assign values to table

    *I have not implemented LET statement(due to older version of ABAP).

    and was just trying to assign values in table.

    -Avirat

    (0) 
    1. Jerry Wang Post author

      Hi Avirat,

      your ABAP version is older than 740. Both of the features mentioned by you need ABAP 7.40. For example regarding EMPTY KEY, refer to this blog. You can search in SCN with keyword “ABAP 740” and you can find a series of blogs for new features available in 740.

      Best regards,

      Jerry

      (0) 

Leave a Reply