Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to handle BLOB field in receiver JDBC adapter into ABAP table

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,*** 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...

Former Member
Former Member replied

Yes, your understanding is correct.

Steps,

  1. * Enable "Read Attachments" option in interface/operation mapping
  2. Create a UDF for response graphical mapping with input fields s, and then copy below code AS-IS.  Now, use this UDF between JDBC response structure blob input field and root node of target abap proxy response structure

//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

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question