on 09-16-2014 1:28 PM
Dear Experts,
I am working in a synchronous scenario with Sender ABAP Proxy to Oracle Database as receiver via SAP PO 7.4.I will be calling a stored procedure view with fields ID, NAME,Age,Sex and BLOB (Image binary).
1. The response from Oracle Database field BLOB is to be stored in ABAP table.Would I have to write any JAVA program to read the BLOB or the receiver JDBC adapter will handle it and store in a table by using ABAP proxy once it reaches ECC.
2. If yes, would the JAVA program have to deal with other 4 fields.
3. Can I use a UDF mapping to this BLOB field.
Regards
Rebecca...
Hi Rebecca,
Now I have a bit more clarity on your requirement. In addition to my reply to your comment in my blog:
In response graphical mapping from JDBC to ABAP proxy, use UDF code same as method "public static byte[] hexStringToByteArray(String s)" that I have mentioned in blog. Using the byte data, create binary attachment in mapping for abap proxy response
Handle attachment on SAP according to your requirement
Hope this helps
Best Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Praveen,
Thanks for your response...
Please correct me if I am wrong.
1. For 1-1 response mapping for BLOB field, I will use just use the below UDF code.
2. ===Using the byte data, create binary attachment in mapping for abap proxy response===
Could you please share how to create the binary attachment.. I am not clear
Regards...
Yes, your understanding is correct.
Steps,
//Map this UDF output to root node of target ABAP proxy response structure (preferably)
GlobalContainer globalContainer = container.getGlobalContainer();
OutputAttachments outputAttachments = globalContainer.getOutputAttachments();
AbstractTrace trace = container.getTrace();
int len = s.length();//s is UDF input: for JDBC response BLOB hexadecimal string
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i/2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16));
}
try
{
trace.addInfo("Creating Binary image attachment in mapping... ");
Attachment binaryImageData = outputAttachments.create("YourImageName.jpg", data);
outputAttachments.setAttachment(binaryImageData);
}catch (Exception e){
trace.addInfo("Error while creating attachment... ");
throw new StreamTransformationException(e.toString());
}
return "";
BR,
Praveen Gujjeti
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.