on 12-06-2007 6:57 AM
Dear all,
My application will capture all the scanned value n store inside a table ( which is tie to a context node ),how shd i assign those values into it? i understand tat for single input,i can do like followings..wat if the scanned value is to input into a table? please advice. thank you.
public static void wdDoModifyView(IPrivateMLTMAppView wdThis, IPrivateMLTMAppView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
if (firstTime) {
IWDBarCodeReader barCodeReader = (IWDBarCodeReader)view.getElement("BarCodeReader");
barCodeReader.mappingOfOnRead().addSourceMapping("data","scanData");
}
}
//scanData is the scanned value
public void onActionScan(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String scanData )
{
//@@begin onActionScan(ServerEvent)
if(wdThis.wdGetContext().currentContextElement().getData() ==null){
wdThis.wdGetContext().currentContextElement().setData(scanData);
}
//@@end
}
hie,the code is syntax error free,but i havent get to try on the handheld yet
was wondering where shd i write the code to display out the contents in the table? here's my code :
IPrivateWithInvNum.ITableElement element = null;
element = wdContext.createTableElement();
if (ScanData.startsWith("M")){
element.setMatno(ScanData);
}else if (ScanData.startsWith("B")){
element.setStrbin(ScanData);
}else if (ScanData.startsWith("Q")){
element.setQty(ScanData);
}else if (ScanData.startsWith("U")){
element.setUom(ScanData);
}
list.add(element);
wdContext.nodeTable().bind(list);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,finanly i got my handheld wif me to do the testing d..the code seems like wil append one record with only one field filled each time i scanned the data...
any other wya to solve dis problem?
coz for my table,i got 4 fields inside..each time scan,the scan data wl be appointed to a certain field
Hi Joan
Create a node with an element in the context . Everytime you call the onActionScan(), create and add the node element to a collection or an array. Then iterate through the collection and display in the table.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Joan
Create a node named "data" and a node element named "data".
Add this code at the end where we can write java code:
ArrayList list = new ArrayList();
In onActionScan(), add this code
IPrivateMLTMAppView.IDataElement element = null;
element = wdContext.createDataElement();
element.setData(scanData);
list.add(element);
wdContext.nodeData().bind(list);
Regards
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.