If you want to generate a random string in ABAP, you can use the following FM where you can specify the length of the generated random string: CRR_GET_RA
If you want a random and unique string, then you need to use the UUID generation class cl_system_uuid which can be accessed in either instance or static form. See the API for the UUID generation document attached to SAP Note 935047 – Creating and using GUIDs (UUIDs) or click on the download below.
Download – UsingTheUUIDABAPInterface2.pdf – 30.0 kB – 582 downloads
Download – SAPNote0000935047_CreateUseUUIDs.pdf – 38.1 kB – 499 downloads