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

random function

Former Member
0 Likes
1,036

hey,

i would like to create test data. for this I would like to

create random prices. In Java we have a function random

wherewhit we are able to create different numbers.

Is there an equivalent in ABAP?

thx

chris

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
922

Hello

RANDOM_AMOUNT

RANDOM_C

RANDOM_C_BY_SET

RANDOM_F8

RANDOM_I2

RANDOM_I4

RANDOM_INITIALIZE

RANDOM_P

choose approaching

7 REPLIES 7
Read only

Former Member
0 Likes
923

Hello

RANDOM_AMOUNT

RANDOM_C

RANDOM_C_BY_SET

RANDOM_F8

RANDOM_I2

RANDOM_I4

RANDOM_INITIALIZE

RANDOM_P

choose approaching

Read only

0 Likes
922

Hello,

are these functions of ABAP Objects?

I'm new to ABAP and just using ABAP without Objects til now.

Would you be so kind to give me an example how to use this?

thx

chris

Read only

0 Likes
922

Hello

It's functions. For example:

CALL FUNCTION 'RANDOM_AMOUNT'

EXPORTING

RND_MIN = '1'

RND_MAX = '10000000'

VALCURR = 'USD'

IMPORTING

RND_AMOUNT = BETRAG

EXCEPTIONS

OTHERS = 1.

Read only

0 Likes
922

The I've got an ABAP dump with the message:

The function module "RANDOM_AMOUNT" is called,

but cannot be found in the library.

So could it be, that we need a special add-On to use

the classes of ABAP OO??

Read only

0 Likes
922

No further hints how to use a random function?

Read only

ThomasZloch
Active Contributor
0 Likes
922

In OO context check out class CL_ABAP_RANDOM.

Thomas