Skip to Content

Using Attachments with Netweaver Mobile for Handhelds 7.10

The attachments handling for upload/download of BLOB data is accomplished using the <<com.sap.tc.mobile.sf.api.BLOB>> type object provided as an API with OCA framework.

In the client framework all attachments will be masked through this framework object, This can be checked in data object nodes editor in the service component.You can manipulate the BLOB data using the APIs on this type.

h2. SAMPLE EXAMPLE: 

For e.g. for an image control, to load an image, direct binding of BLOB data attribute is not possible. Image control expects a string as source (path of the image). You need to create an unbound manual attribute in the context as string which will store the path of the image on the client. So one needs to read the BLOB data from the DO node, use the getBinarystream() API to get an input stream.

Using java classes convert the input stream into the required format (in this case, an image e.g test.jpg). 

Now create a path = Configuration.getHomeDirectory() +  “
MobileApps
” + WDLite.getApplicationDCName() + “~implementation
Components
h3. Some example code for image

+ +

This code reads a downloaded BLOB data from the model bound context attribute. The attribute or node is getting the data in a normal way using a query in the service component.

It reads the BLOB data converts it into an image and stores in the path as mentioned above.

The “city” contains the name of the image and is the value which will be sent to bound to the image control source using unbound context attribute

 

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.