SAP Tutorials Blog


 


Subroutines, also known as FORM routines in ABAP, are modular units of code that perform a specific task but do not return a value. They are defined with the FORM keyword and are typically used for performing actions or calculations within a program or function.


Defining a Subroutine:


FORM calculate_discount USING p_amount TYPE p DECIMALS 2

                          CHANGING p_discount TYPE p DECIMALS 2.


  IF p_amount > 100.

    p_discount = p_amount * 0.1.

  ELSE.

    p_discount = 0.

  ENDIF.


ENDFORM.


Serkan AKKAVAK

Computer Engineer BSc

Head of SAP & Software Department

Contact : serkurumsal@yandex.com