Add Groovy to generate alphanumeric string of length 8.
import com.sap.gateway.ip.core.customdev.util.Message
import java.security.SecureRandom
def Message processData(Message message)
{
def UniqueString = generateRnadomKey()
message.setBody(UniqueString)
return message
}
def generateRnadomKey()
{
def chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
def random = new SecureRandom()
def key = ''
for(int i = 0; i<8; i++)
{
int index = random.nextInt(chars.length())
key += chars[index]
}
return key
}​Example:





You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 32 | |
| 22 | |
| 21 | |
| 18 | |
| 18 | |
| 17 | |
| 16 | |
| 10 | |
| 10 | |
| 10 |