cancel
Showing results for 
Search instead for 
Did you mean: 

GUID conversion and assigning to a node element

0 Kudos

Hi All,

I have a GUID from my back end which I want to hard code in my webdynpro application. This GUID will later be transferred back to the back end. Do anyone has any sample code to assign the guid to a node element of type binary. From the back end system, I have the GUID of type RAW "41FAF49741FE0A1DE10000000A114B54". When the model is imported into the web dynpro application, the GUID type is taken as binary. I want to set this value "41FAF49741FE0A1DE10000000A114B54" to my node. Can anyone help me with this?

Thanks for your help.

Best Regards,

Hemanth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Hemanth

I assume the binary attribute will be a byte array.

You can create a string using the string constructor that takes in the byte array and there are string methods that give back the byte array. If wdContext.currentSomeElement().getBin() is a binary attribute then


//converted byte array to string
String strBinary = new String(wdContext.currentSomeElement().getBin());
//converted string to byte array 
byte b[] = strBinary.getBytes();

Regards

Pran

0 Kudos

Hi Pran,

Thanks for your suggestion. I don't think, that will work.

The GUID data that I have 41FAF49741FE0A1DE10000000A114B54 is already in the RAW format (byte format) in the back end. I just need to hard code this value in the web dynpro application so that the backend RFC model can execute code with this GUID. As I mentioned in my earlier question, the GUID is in RAW format and when you import the RAW format, it is stored in the web dynpro application as the binary format. I am not sure how to exactly set this value (41FAF49741FE0A1DE10000000A114B54) into this field without the data getting changed so that I can access this GUID in the backend.

Regards,

Hemanth

Former Member
0 Kudos

Hi Hemanth

I havent tried it, but what I was trying to say is binary format should be assignable to byte[] variables or byte[]value attributes in a Web Dynpro app. Or String variables (using the conversion method above).

You can then send it back to other models deriving values from the attributes or variables

Regards

Pran

Former Member
0 Kudos

Hi Hermanth,

for simply hardcoding, you could do something like this:

final byte[] hardcodedGUID = new byte[] { 
  0x41, 0xFA, 0xF4, 0x97, 
  0x41, 0xFE, 0x0A, 0x1D, 
  0xE1, 0x00, 0x00, 0x00, 
  0x0A, 0x11, 0x4B, 0x54
};
wdContext.current<YourBinaryElement>().set<yourBinaryAttr>(hardcodedGUID);

Hope that helps.

Regards

Stefan

Answers (0)