Application Development and Automation 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: 
Read only

Function Module for generating Randon Numbers

Former Member
0 Likes
1,017

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
Read only

uwe_schieferstein
Active Contributor
0 Likes
901

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
Read only

uwe_schieferstein
Active Contributor
0 Likes
902

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

Read only

Former Member
0 Likes
901

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.

Read only

0 Likes
901

>

> 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.

Read only

0 Likes
901

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

Read only

Former Member
0 Likes
901

Hello

Read only

Former Member
0 Likes
901

Try this FM

'AQ_INT_RANDOM_NUMBERS'