Show TOC Start of Content Area

Procedure documentation Using the RFIDReader  Locate the document in its SAP Library structure

Use

The UI element RFIDReader is used for mobile data entry using a Pocket PC that is able to read data stored on a data carrier.

If you insert this UI element into a view of a mobile Web Dynpro application, the Pocket PC is then ready to read when the application is called and the read data can be passed to the SAP NetWeaver Application Server.

Prerequisites

     The SAP NetWeaver Developer Studio is installed on your computer, and you have created a Web Dynpro application including a component and a view called RFIDTestView.

     You have access to a SAP NetWeaver Application Server, where you are running the Web Dynpro application

     You are using a Pocket PC with special equipment for reading numeric codes stored on a data carrier.

     You have installed the ActiveX control for creating RFIDReader objects.

Procedure

Defining the UI elements

...

       1.      Navigate to the RFIDTestView.

       2.      Double-click the view or choose Edit from the context menu.

       3.      Insert the mobile UI element RFIDReader with the ID RFIDReader.

Note

This interface element is not visible on the user interface and activates the read function of the mobile device when the mobile application is called. When the mobile device reads a numeric code from the data carrier – that is, the onRead event is triggered – the data is passed to the server and can be stored in the context. The event parameter must be mapped to the parameter of the action.

       4.      Insert a TextView called ShowDataFailureCount.

       5.      Insert another TextView called ShowDataTagList.

Defining an Action

...

       1.      In View Designer, define an action called Read and specify two parameters called data (type string) and counts (type integer) for this action. The parameters must be mapped to the event parameters of the UI element in the controller implementation.

Specifying a Context Structure

...

       1.      Switch to the Context tab, select the context root node and choose New Value Attribute in the context menu.

       2.      Specify two context attributes called RFIDData (type string) and RFIDFailCount (type integer).

Specifying UI Element Properties

...

...

       1.      Select the RFIDReader in the Outline and switch to the Properties tab.

       2.      Assign the value SAP.RfidG4 to the classID property.

       3.      Assign the value IBrowse_OnKey49 to the keyCode property.

       4.      Assign the action – in this case, Read – to the onRead property.

       5.      Select the TextView ShowDataFailureCount and assign the context path to the context attribute RFIDFailCount to the text property. Since the context attribute Data is a root node attribute, you only need to assign the RFIDData string. To select the context attribute, press the button on the right of the line.

       6.      Assign the context path to the context attribute RFIDData to the text property of the TextView UI element ShowDataTagList. Since context attribute Data is a root node attribute, you only need to assign the string RFIDData. To select the context attribute, press the button on the right of the line.

Implementation of the View Controller

...

       1.      Switch to the Implementation tab and add the following source code to the implementation of the view controller. The read data is passed to the context by the event handler of the Read action, and the relevant context attribute is set.

public void onActionRead(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent    wdEvent, java.lang.String data, int failCount )

{

   //@@begin onActionRead(ServerEvent)

   wdThis.wdGetContext().currentContextElement().setRFIDData(data);

   wdThis.wdGetContext().currentContextElement().setRFIDFailCount(failCount);

   //@@end

}

 

You also need to define a parameter mapping in the wdDoModifyView method, with which you map the event parameters of the UI elements to the parameters of the action.

Note

In the syntax of the addSourceMapping method, the name of the UI element event parameter precedes the name of the action parameter.

public static void wdDoModifyView(IPrivateRFIDTestView wdThis,    IPrivateRFIDTestView.IContextNode wdContext,    com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

   //@@begin wdDoModifyView

   if (firstTime) {

      IWDRFIDReader rfidReader = (IWDRFIDReader) view.getElement("RFIDReader");

      rfidReader.mappingOfOnRead().addSourceMapping("failCount", "counts");

      rfidReader.mappingOfOnRead().addSourceMapping("data", "data");

      }

   //@@end

}

Result

If you call this Web Dynpro application on a Pocket PC equipped with an RFID reader, the Pocket PC is then ready to read. When a numeric code is read by the RFID reader, the data is passed to the server and stored in the context of the view.

Since the text properties of the TextView UI elements are bound to the corresponding context attributes RFIDData and RFIDFailCount, the data stored in this numeric code can be displayed in UI element TextView.

  

  

 

End of Content Area