Showing results for 
Search instead for 
Did you mean: 

How to get Binary Value from Partner Directory via Groovy


Hello SAP Experts,

I currently have a problem that I could not find out exactly how I can read a binary value from the Partner Directory via a Groovy Script ( inside the I-Flow).

Writing, updating and reading the binary value via Postman works as desired, here I have stored the XML as Base64 in the Partner Directory

    "Pid":"{{ _.pd_pid }}",

i followed this methods to get the data in the groovy script: 

Here would be my approach how I would have read the binary value in my Groovy script

				//get Value from PartnerDirectory
				paramValue = partnerDirectoryService.getParameter(paramName, callerPID ,;
				if (paramValue == null){
					throw new IllegalStateException(paramName + " is not configured in " + paramName + " in Partner Directory");
                message.setProperty("Test1", paramValue);
				message.setProperty("Test2_Data", paramValue.getData());
				message.setProperty("Test3_ContentType", paramValue.getContentType());

Reading a ContentType (with getContentType()) works fine, but it seems that a binary value is read in a strange way.

Here are the output of the Output of the Binary Value:


Does anyone have an idea what my error is or has an example code for me?


Many thanks in advance.

Best regards

Chris. P.


View Entire Topic
0 Kudos

Hi Chris,

Could you please add the following code to your script and make a test?

byte[] decoded = Base64.getDecoder().decode(paramValue.getData())
String content = new String(decoded, StandardCharsets.UTF_8)
message.setProperty("Test4_Decoded", content)



0 Kudos

Hi Andrzej_Filusz,

thank you very much for your answer,

i tried to implement you coding, also added the 

import java.nio.charset.StandardCharsets Class to the script. 
But unfortunately i received following error on your first line of coding: 


Is there a additional coding which i need? 

Best Regards. 

Chris P. 

0 Kudos

Hi Andrzej_Filusz,

i changed the coding to 

				//byte[] decoded = Base64.getDecoder().decode(testData)
				byte[] decoded =  Base64.getMimeDecoder().decode(testData);
                String content = new String(decoded, StandardCharsets.UTF_8)
                message.setProperty("Test4_Decoded", content)

now i get no errors, but the output seems not correct 


Do you have a idea how i could handle this?

Best Regards 

Chris P.