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 RANDOM_I2

Former Member
0 Kudos

Hi Group,

I used FM RANDOM_I2 in my report to generate two digit (from 1 to 100) unique number, when I execute this for the first time it generate 5 ,when I run for second time

still it is showing 5.Can any body tell me why it is giving the same numebr when I generated for the second time.

4 REPLIES 4

uwe_schieferstein
Active Contributor
0 Kudos

Hello Swabap

The FM documentation says that before calling the function module you should call RANDOM_INITIALIZE (probably to initialize some buffers).

Regards

Uwe

Former Member
0 Kudos

Hi,

IF you try to call run multiple times for one session it is bringing out random numbers..but if you run only once I think it will bring you the same number..

data: v_output like DATATYPE-INTEGER2.

do 5 times.

CALL FUNCTION 'RANDOM_I2'

IMPORTING

RND_VALUE = v_output

.

write: / v_output.

enddo.

Thanks,

Naren

Former Member
0 Kudos

Hi,

The FM will return you the same value if you run your report second time since field values used by the FM are initialised back. It will give you random numbers only when you use that FM iteratively in the report during single execution. You wont find this difference if you run FM thru SE37 because the field values are not intialised howver if you come out of the SE37 and again then excute FM thru SE37, you will find same numbers generated.

Cheers,

Vikram

Pls reward for helpful replies!!

0 Kudos

Hi Vikram,

Thank you for your response,then what is the solution for this.COuld you please help me in solving out this problem