CL_ABAP_RANDOM

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?

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

Similar Messages

  • Pseudorandom number

    Hi, all... Im generating pseudorandom number by my own functional module with this code. Problem is, that it always returns same number. when i test class CL_ABAP_RANDOM* (all these classes), it returns good numbers. Please, do you see some problems in my code? thanks a lot
    FUNCTION y0bi_cm_sample_psrnd_num_get.
    *"*"Lokální rozhraní:
    *"  IMPORTING
    *"     REFERENCE(X_XTIMESTAMP) TYPE  KENNZX OPTIONAL
    *"  EXPORTING
    *"     REFERENCE(Y_RANDOM_FLOAT) TYPE  CL_ABAP_RANDOM_PACKED=>P31_0
      DATA: lr_random TYPE REF TO cl_abap_random_packed_dec14,
            l_timestamp TYPE timestamp,
            l_seed TYPE i.
      GET TIME STAMP FIELD l_timestamp.
      FREE: lr_random.
      IF x_xtimestamp EQ 'X'.
        l_seed = FRAC( l_timestamp ) * 1000000.
    *TRY.
        lr_random = cl_abap_random_packed_dec14=>create(
                                                          seed   = l_seed
                                                          min    = '0'
                                                          max    = '1' ).
    * CATCH cx_abap_random .
    *ENDTRY.
      ELSE.
        lr_random = cl_abap_random_packed_dec14=>create(
        min    = '0'
        max    = '1' ).
      ENDIF.
      y_random_float = lr_random->get_next( ).
    ENDFUNCTION.

    Dear Filip Kouba
    Use this on your data declaration: tzntstmpl
    instead of this:
    timestamp
    So your code will become like this:
       l_timestamp TYPE tzntstmpl,
    Kind Regards
    /Ricardo Quintas

  • Random no generation

    Hi experts,
    How to generate random number with 12 digits in ABAP?

    Please [search forum for cl_abap_random|http://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_abap_random] (this is the official class)

  • Random unique Integer

    Hi Experts,
    I need to generate a random unique 20 digit integer. I have tried all the QF05 series, but none of them satisfy my requirement (Integer 20 digit). Please suggest.
    Thanks in advance
    Ajith

    Hi,
    Check class:
    CL_ABAP_RANDOM or
    CL_ABAP_RANDOM_INT or
    Check CL_ABAP_*
    Thanks & Regards,
    Navneeth K.

Maybe you are looking for

  • Lost Data | Hard Drive Failure

    hello, after a series of unrecoverable crashes running safari, i tried running disk utilities from the start up disc, only to make matters worse. it won't boot up now. simply stalls while loading for about 15 minutes and shuts down entirely. i tried

  • STEPS TO create OSS message for sap

    hi we i need to k now how to create a oss message for sap pls suggest? the steps regards Arora

  • How to get the parent and child relation of the group (______________)

    Please teach the method of acquiring the parent and child relation of the group with EDK5.2. EDK5.2____________________,_________o

  • How many types of routines .....

    hi gurus, how many types of routines ..... plz any one suggest how we can use .... regards, praveen

  • I can not start my macbookpro  15"

    I have bought an Macbookpro 15" modell 1150 in Afrika but I can not start it. A flashing question mark appears when I start the macbookpro I have tried to install a new OS (10.5) but always the same question mark appears. I have changed the HD and th