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

CL_ABAP_RANDOM

Former Member
0 Likes
1,234

hi.

DATA: RANDOM TYPE REF TO CL_ABAP_RANDOM.

i am gettin error: CL_ABAP_RANDOM is unknown.

do you know how i should declare this?

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
1,094

Please check

and also check in Se24 whether above class available ?

a®s

Edited by: a®s on Dec 23, 2009 3:44 AM

8 REPLIES 8
Read only

former_member194669
Active Contributor
0 Likes
1,095

Please check

and also check in Se24 whether above class available ?

a®s

Edited by: a®s on Dec 23, 2009 3:44 AM

Read only

former_member182371
Active Contributor
0 Likes
1,094

Hi,

although it uses cl_abap_random_int instead of CL_ABAP_RANDOM maybe you can use something like this:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b824c11b-0701-0010-738f-e76dc3d29925

Best regards.

Edited by: Pablo Casamayor on Dec 23, 2009 9:58 AM

Read only

Former Member
0 Likes
1,094

Hi,

If you want to generate random number, you can also use the FM

RANDOM_P

regards,

amit m.

Read only

Former Member
0 Likes
1,094

Use function RANDOM_P . Objects doesn't work in all SAP versions

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,094

If its a requirement of generating random number

User fm GENERAL_GET_RANDOM_INT

Read only

Former Member
0 Likes
1,094

Hi.. instead of using

DATA: RANDOM TYPE REF TO CL_ABAP_RANDOM.

and calling the CREATE and GET_NEXT methods,

you could just declare a few integers and use the function `QF05_RANDOM_INTEGER` as following:

call function 'QF05_RANDOM_INTEGER'

exporting

RAN_INT_MIN = 1

RAN_INT_MAX = max_rnd

importing

RAN_INT = rnd_no.

this will result in `rnd_no` holding the random number...

Regards,

Prasanna K Rao

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,094

error

Edited by: Sandra Rossi on Mar 5, 2010 5:23 PM

Read only

Former Member
0 Likes
1,094

Hi,

What release are you on?

CL_ABAP_RANDOM only exists as of Basis 7.0. It is not there in 4.6 and Basis 6.x. If you run one of those older releases search for function modules in SE37. The easiest ones to use are the RANDOM_* ones, but curiously enough those belong to Financial Accounting, so you'll find them in an R3 / ERP system but not in others.

Regards,

Mark