Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

How to use Text Memo and Binary Memo in Netweaver Mobile 7.1

Created by Narayani K©

I)  Backend Configurations

Step 1:  Create the following Backend Tables and Function modules

Order Header Table: The fields that represent the TEXT MEMO and the BINARY MEMO fields should not be STRING or RAWSTRING.

These fields would be used as a flag to indicate that there is an attachment.

Order Attachment Table: table to be created in order to store the attachments.

*Domain:Fixed Values(Differentiate between Header Text and Binary Data)

ORDIMG  Order Image

HEDTXT Header Text

Order Table Contents 

Download Attachment Function Module

ZNK_ORDER_DWL_BLOB_DOWNLOAD: RFC Function Module that will be used in DOE.

*"*"Local Interface:
 SELECT SINGLE b~headertext INTO e_headertext
         FROM znk_order_hdr AS a
             b~orderid = a~orderid
             WHERE a~orderid = orderid AND
              a~headertext = 'E' and
              b~ATTCHTYP = 'HEADTXT'.

SELECT SINGLE b~orderimg INTO e_ordimg
         FROM znk_order_hdr AS a
             b~orderid = a~orderid
             WHERE a~orderid = orderid AND
                   a~orderimg   = 'X' and
                   b~ATTCHTYP = 'ORDIMG'.


Report program to upload images:  I have created a program to convert images in a binary format .

This program uploads any files in the backend and then converts it to binary format

Images /Long text table contents


I have created a report to upload the binary data.

This program uploads any files in the backend and then converts it to binary format.

The screen has two options 1)file to upload 2) Order ID the binary memo is attached.

*II­)  * DOE Perspective

Create Data Object

As of now no item nodes created.

Node Attributes:

Activate the Data Object.

III) Create Backend Adapter.

No changes in the existing BAPI Wrappers

Only difference under the GET ATTACHMENTS section we need to put the function module that we created in the backend. (ZNK_ORDER_ATT_DOWNLOAD).

Please see the screenshot below.

There is no change in the mapping for the data object with the BAPI wrapper.

Now you also have to do a mapping for the Attachment function modules.

At present I have only implemented the Download function. After mapping the screen looks like one below.

SAVE and Activate Backend Adapter.

Execute the initial download.

  • Once the initial download is done, there will be two separate tables which get generated automatically apart from the CDS and other runtime tables.
  • One for Text Memo which is suffixed with _TM and for the Binary Memo is suffixed with _BM.

e.g. => if the CDS table is ZDOE00800C0 then the text memo table name would be ZDOE00800C_TM and the binary table name would be ZDOE00800C_BM.

The Binary memo table would have entries in Binary format; the Text Memo will have the Long Text or Header text entered.

IV) Application Development

  1. Create Simple application. 
  2. In the application, when creating a table the BLOB value cannot be bound to the table. Header Text can be bound to a Text view. No extra coding is required for the header text. (Text Memo).

You can design the application to look like this:

Steps for showing the BLOB(Binary) on the application

*In context mapping you will get an error : "*Cannot bind BLOB values"

Therefore the following steps needs to be done in order to display binary data.

1) In the view context table create an attribute with any name of type string  and check the calculated option.

In the View add an Image UI and assign the source property to the attribute just created.

On the Action of OnLeadSelect: This is the code that has been written.

 public void onActionOnLeadSelect( wdEvent )
{//@@begin onActionOnLeadSelect(ServerEvent)        
BLOB file = null;              
{file = (BLOB)wdContext.currentTESTATTACHMENT_ATTACH_ROOTElement().modelObject().getDWL_BLOB();
str = wdContext.currentTESTATTACHMENT_ATTACH_ROOTElement().modelObject().getDWL_BLOB_EXT().toString();}
if(file != null)
                  {try{WDDeployableObjectPart dom = wdThis.wdGetAPI().getComponent().getDeployableObjectPart();
if(str.compareTo("JPG")== 0)
{ res = null; res = WDWebResource._getPublicCachedWebResource_(file.getBinaryStream(), WDWebResourceType._JPG_IMAGE_, WDScopeType._APPLICATION_SCOPE_, dom, "JPGImage"); }                
String path = res.getAbsoluteURL();     
image = path; 
  }catch(Exception e)
{ e.printStackTrace();}  

Create a button called preview. On Click of button write the following code.

public void onActionPreview( wdEvent )

{ if((str.compareTo("GIF")== 0) ||((str.compareTo("JPG")== 0) ) {
//passing the URL to the image getter method
 image = path_test2;//@@end\\ }

Click on the attribute created: click on GO for the calculated Get method.

public java.lang.String getImage2(IPrivateAttachment_testView.IContextElement element)
{//@@begin getImage2    
//return null; //instead of the following line enter the one below.
return image;  //@@end   }

* *Register Client, Synchronize data.
The application looks like this when the user clicks on each record the picture is displayed. Apart from pictures, any document (PDF, xml, txt can be viewed in an external window or on the internet explorer)

Final output.(Images / PDF)

  • No labels