Hi! Try this:
DATA lc_guid TYPE REF TO cl_abap_random_packed. DATA lv_seed TYPE i. DATA lv_guid TYPE p. CALL METHOD cl_abap_random=>seed RECEIVING seed = lv_seed. CALL METHOD cl_abap_random_packed=>create EXPORTING seed = lv_seed min = 1000000000 max = 9999999999 RECEIVING prng = lc_guid. lv_guid = lc_guid->get_next( ).
This class implements the basic version of a pseudo random number generator. It is based on the Mersenne Twister algorithm. This algorithm guarantees a high period length for the generated values, and ensures that values are evenly distributed when multi-dimensional data is generated.
I found 2 interesting reads -
If i understand correctly, because the period length is so high the chances of getting the same "random" number is minimal. Now if the OP uses this "random" number together with (say) Fiscal Year, it'll kind of ensure that the combination is unique.
BR,
Suhas
Add comment