Wednesday 29 June 2016

Pass by Value

Ex:



Steps

  • Go to transaction code SE38.
  • Enter the program name start's with Y or Z<program name > and click on create button.

  • Enter the Title.
  • Select Attribute Type as Executable Program.
  • Click on save button.


  • Either save it in Package or Local Package.

Source Code





DATA FACT TYPE I.

PARAMETERS NUM TYPE I.

PERFORM FACTORIAL USING NUM CHANGING FACT.

WRITE 'FACTORIAL OF 'NUM '='FACT.
*&---------------------------------------------------------------------*
*&      Form  FACTORIAL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_NUM  text
*      <--P_FACT  text
*----------------------------------------------------------------------*
form FACTORIAL  using    VALUE(p_num)
                changing p_fact.

P_FACT 1.

WHILE P_NUM >= 1..

 p_fact p_fact * P_NUM.

 P_NUM P_NUM 1.
ENDWHILE.
endform.                    " FACTORIAL

----------------------------------------------------------

  • Save -> Check -> Activate.



  • Execute.

Input

Output


No comments:

Post a Comment