SAP Tutorials Blog


DATA(random_num) = cl_abap_random_int=>create( seed = cl_abap_random=>seed( )

                                               min  = 1

                                               max  = 5 )->get_next( ).

DATA num TYPE string.


CASE random_num.

  WHEN 1.

    num = `The number is 1.`.

  WHEN 2.

    num = `The number is 2.`.

  WHEN 3 OR 4.

    num = `The number is either 3 or 4.`.

  WHEN OTHERS.

    num = `The number is not between 1 and 4.`.

ENDCASE.


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com