Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module for generating Randon Numbers

Former Member
0 Kudos

Hi,

Is there any Function Module to generate Random Numbers automatically.

Say for example: The Lower Limit is 10 and the Higher imit is 30.

So is should generete the random numbers between 10 and 30. and it should store in he Data Base level.

Please help me in this ascept.

Thanks & Regards:

JSR

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You may try class CL_ABAP_RANDOM if it is available on your system.

Alternatives:

CL_ABAP_RANDOM_INT
GENERAL_GET_RANDOM_INT (fm)

Regards

Uwe

6 REPLIES 6

uwe_schieferstein
Active Contributor
0 Kudos

Hello

You may try class CL_ABAP_RANDOM if it is available on your system.

Alternatives:

CL_ABAP_RANDOM_INT
GENERAL_GET_RANDOM_INT (fm)

Regards

Uwe

Former Member
0 Kudos

Hi,

You can use Number Range Concept.

    • Get new number

  • CALL FUNCTION 'NUMBER_GET_NEXT'

  • EXPORTING

  • nr_range_nr = c_01

  • object = c_key_no

  • IMPORTING

  • number = pw_key_no

  • EXCEPTIONS

  • interval_not_found = 1

  • number_range_not_intern = 2

  • object_not_found = 3

  • quantity_is_0 = 4

  • quantity_is_not_1 = 5

  • interval_overflow = 6

  • buffer_overflow = 7

  • OTHERS = 8.

Thanks,

Sree.

0 Kudos

>

> Hi,

> You can use Number Range Concept.

>

> ** Get new number

> * CALL FUNCTION 'NUMBER_GET_NEXT'

> * EXPORTING

> * nr_range_nr = c_01

> * object = c_key_no

> * IMPORTING

> * number = pw_key_no

> * EXCEPTIONS

> * interval_not_found = 1

> * number_range_not_intern = 2

> * object_not_found = 3

> * quantity_is_0 = 4

> * quantity_is_not_1 = 5

> * interval_overflow = 6

> * buffer_overflow = 7

> * OTHERS = 8.

>

> Thanks,

> Sree.

That's NOT a randomizer.

0 Kudos

You could combine it with buffering the number range object to... lets say... 582438317 records and then randomly restart the server all the time...

Former Member
0 Kudos

Hello

Former Member
0 Kudos

Try this FM

'AQ_INT_RANDOM_NUMBERS'