Make your own free website on Tripod.com
 

SAP ABAP Programming, Functional and Basis Components Books


Generate Random Number

REPORT ZRANDOM.
* -------------------------------------------------------------------
* Random Numbers
* -------------------------------------------------------------------
DATA : MYAMOUNT LIKE BBSEG-WRBTR.

DO 5 TIMES.
  PERFORM GENERATE_RND.
ENDDO.

FORM GENERATE_RND.
CALL FUNCTION 'RANDOM_AMOUNT'
  EXPORTING
     RND_MIN  = '1'
     RND_MAX  = '100'
     VALCURR  = 'DEM'
  IMPORTING
     RND_AMOUNT = MYAMOUNT
   EXCEPTIONS
     OTHERS   = 1.

WRITE:/ MYAMOUNT.
ENDFORM.          " GENERATE_RND

Back to Previous

Return to SAP Hints and Tips on Configuration and ABAP/4 Programming