VALUE Expressions/Chaining/DEFAULT

Index

 

ABAP HANA 7.51: VALUE expressions/Chaining/DEFAULT

VALUE expression – This provides a powerful mechanism to declare as well as initialize internal tables. Syntax also facilitates to set a type of internal table.

This is a very useful utility for ABAPers where they can enjoy to do more with minimal coding. Earlier, to achieve similar functionality, the programmer used to fill up the work area and then append it to the internal table which was a cumbersome work. SAP finally recognized made this easy.

VALUE expression has two types:

  1. Non-generic data type e.g. type can be defined before using it with VALUE keyword. The Type created using this mechanism is Structured or Table type.
  2. Using # character for type where operand position is fixed and identifiable

VALUE chaining – Newly created CONV and LET operators can be used with the combination of VALUE keyword. It is also possible to fill multiple rows with same data by writing it only once in syntax. An example can be checked to below video where RANGE table is filled with sample data on the fly.

DEFAULT addition – When content inside VALUE refers to information that doesn’t exist, DEFAULT keyword comes handy and defaults to that reference to the defaulted value.

Sample Source Code: Variant 1

VALUE_Var1_source

Output: Variant 1

VALUE_Var1_output

Sample Source Code: Variant 2

Notice extra parentheses around values(Line 17-18). This may produce unexpected results if this is not intended for what is actually does.

VALUE_Var2_source

Output: Variant 2

Four lines are created… each for one parenthesis set!

VALUE_Var2_output

Sample Source Code: Variant 3

A sample code for how easily a range table can be filled.

VALUE_Var3_source

Output: Variant 3

VALUE_Var3_output

Sample Source Code: Variant 4

Check that how intelligently provision is given that same field need not be addressed again and again in case of repetition. In this example, SIGN and OPTION in line 11 and 12 are written once however creates two lines in output with values I and EQ.

VALUE_Var4_source

Output: Variant 4

VALUE_Var4_output

Sample Source Code: Variant 5

VALUE_Var5_source

Output: Variant 5

VALUE_Var5_output

Check the video for Code and Execution:

Find the code on GitHub:

Go to Code

Index

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s