cancel
Showing results for 
Search instead for 
Did you mean: 

RFC LookUP to get UUID

Former Member
0 Kudos

Hi ,

I am using RFC LookUp to get UUID by calling SYSTEM_UUID_CREATE. The user defined function is as follows...

The response I am getting is not the UUID but i think in encrpted form...

uuid coming is g53edmlgikawgikvkahibg== which is not the UUID from R/3

Can anyone please help me ..

String ret = "";

MappingTrace importanttrace;

importanttrace = container.getTrace();

// filling the string with our RFC-XML (with values)

String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><p2:SYSTEM_UUID_CREATE xmlns:p2=\"urn:sap-com:document:sap:rfc:functions\"></p2:SYSTEM_UUID_CREATE>";

RfcAccessor accessor = null;

ByteArrayOutputStream out = null;

try

{

// 1. Determine a channel (Business system, Communication channel)

Channel channel = LookupService.getChannel("XID","diCarta_Receiver_XID_CC");

// 2. Get a RFC accessor for a channel.

accessor = LookupService.getRfcAccessor(channel);

// 3. Create a xml input stream representing the function module request message.

InputStream inputStream = new ByteArrayInputStream(m.getBytes());

// 4. Create xml payload

XmlPayload payload = LookupService.getXmlPayload(inputStream);

// 5. Execute lookup.

Payload output = accessor.call(payload);

InputStream in = output.getContent();

out = new ByteArrayOutputStream(1024);

byte[] buffer = new byte[1024];

for (int read = in.read(buffer); read > 0; read = in.read(buffer)) {

out.write(buffer, 0, read);

}

ret = out.toString();

}

catch(LookupException e)

{

importanttrace.addWarning("Error while lookup " + e.getMessage() );

}

catch(IOException e)

{

importanttrace.addWarning("Error " + e.getMessage() );

}

finally

{

if (out!=null) {

try {

out.close();

} catch (IOException e) {

importanttrace.addWarning("Error while closing stream " + e.getMessage() );

}

}

// 7. close the accessor in order to free resources.

if (accessor!=null) {

try {

accessor.close();

} catch (LookupException e) {

importanttrace.addWarning("Error while closing accessor " + e.getMessage() );

}

}

}

//returning the result – RFC-XML.response

ret = ret.toLowerCase();

String value =

ret.substring( ret.indexOf("<uuid>")+6, ret.indexOf("</uuid>"));

result.addValue(value);

}

}

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Raju,

Pls use the FM - SYSTEM_UUID_C_CREATE ...

the one you are using returns the value in hex format...may be the conversion is causing the issue you are having....

SYSTEM_UUID_C_CREATE gives the output in character format...

Thanks,

Renjith

Former Member
0 Kudos

Thanks a lot for your help Renjith

Thanks

Raju

Answers (0)