I want to generate a random UUID like in Java with UUID.randomUUID().
I came up with the function GUID_GENERATE and used it like this
DO 5 TIMES.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = ev_guid_16
ev_guid_22 = ev_guid_22
ev_guid_32 = ev_guid_32.
WRITE: /, ev_guid_16, ev_guid_22, ev_guid_32.
ENDDO.
The result of this program is always the same GUID. I need a new random one at every request.
I want to use it as a primary key in database table. This key will be transmitted via a Web Service to a Java application and user there as identifier, too.
Do you have any ideas how I can generate random UUID/GUID in ABAP?
Are you absolutely sure the created
GUIDis always the same? Because this shouldn’t be happening. Note that the difference between them can be just one character when you generate them inside a fast loop.