ABAP - Types and Subroutines
How to manage ABAP types. Learn how to create subroutines.

Alex Patterson

 | Published:  December 6, 2016
 | Updated:  September 30, 2019
#sap
#abap
Types
Subroutines
Example Report with Subroutines
REPORT ZABAP__TRAIN_00_TECH_EX1. DATA: num1 TYPE i, num2 TYPE i, sum TYPE i. num1 = 2. num2 = 4. PERFORM addit USING num1 num2 CHANGING sum. num1 = 7. num2 = 11. PERFORM addit USING num1 num2 CHANGING sum. FORM addit. USING add_sum1 TYPE any add_num2 TYPE any CHANGING TYPE any. add_sum = add_num1 add_num2. PERFORM out USING add_num1 add_num2 add_sum. ENDFORM. FORM out. USING out_num1 TYPE any out_num2 TYPE any out_sum TYPE any. WRITE: / 'Sum of ', out_num1, ' and ', out_sum2, ' is ', out_sum. ENDFORM.