FOR Operator

Index

 

ABAP HANA 7.51: FOR Operator

FOR Operator works for iteration operation with a combination of REDUCE, NEW and VALUE operators. FOR is a versatile operator and offers an effective alternative to LOOP operator with better performance. Using FOR is good programming practice in new ABAP syntax and should be part of every ABAP coding convention

Sample Source Code applicable for all Variants below… used for test data creation

FOR_VarAll_source

Sample Source Code: Variant 1

FOR_Var1_source

Output: Variant 1

FOR_VarAll_outputFOR_Var1_output

Sample Source Code: Variant 2

FOR_Var2_source

Output: Variant 2

FOR_VarAll_output

FOR_Var2_output

Sample Source Code: Variant 3

FOR_Var3_source

Output: Variant 3

FOR_VarAll_output

FOR_Var3_output

Sample Source Code: Variant 4

FOR_Var4_source

Output: Variant 4

FOR_VarAll_output

FOR_Var4_output

Sample Source Code: Variant 5

FOR_Var5_source

Output: Variant 5

FOR_VarAll_output

FOR_Var5_output

Sample Source Code: Variant 6

FOR_Var6_source

This is provided just for illustration purpose. The output is an object here(lt_value_new) and not an Internal table!

lt_value_new will get following information:

FOR_Var6_output

Check the video for Illustration and Example:

Find the code on GitHub:

Go to Code

Index

 

Leave a Reply