on 2009 Nov 30 1:42 PM
Hi experts,
This is relative to Mobile Infrastructure 7.1 SP8.
I have a scenario where the client wants to upload to the backend only orders that are finalized. In our Data Object Node we created an BOOL attribute 'finalized', in the client this status is setted when needed. If the order is not finalized, the changes made on client (such as 'description' and 'hours spent') can´t be lost on close the mobile client and can´t either go to backend until this order is finalized.
In this [Thread|; I asked for possible solutions for this issue and got a solution. In this solution I changed my BAPI Wrapper modify to handle a rejection when the order is not finalized:
IF ( ORDERHEADER-FINALIZED = 1 ).
UPDATE ZORDERS
SET HOURS_SPENT = ORDERHEADER-HOURS_SPENT
FINALIZED = ORDERHEADER-FINALIZED
DESCRIPTION = ORDERHEADER-DESCRIPTION
WHERE ID = ORDERHEADER-ID.
ELSE.
LTYPE = 'E'.
LCL = 'not_finalized'.
ENDIF.
In the mobile client I followed this Document which describes how to handle rejections on mobile client. My rejection implementation is that:
public void getOrdersRejections() {
//@@begin getOrdersRejections()
RejectionRepository rr = OcaRoot.getInstance().getSyncManager().getRejectionRepository();
Ordem_srvModel model = ((Ordem_srvModel) OcaRoot.getInstance().getModel(Ordem_srvModel.class));
Collection rejections = rr.getRejections((OcaModel) model);
forRejections : for (Iterator iterRejections = rejections.iterator(); iterRejections.hasNext();) {
Rejection rejection = (Rejection) iterRejections.next();
if (rejection.getRejectionState() != RejectionState.INITIAL) {
continue forRejections;
}
// If there is at least one normal rejection, accept server version.
for (Iterator iterInfo = rejection.getRejectionInfos(); iterInfo.hasNext();) {
RejectionInfo info = (RejectionInfo) iterInfo.next();
if (!"not_finalized".equals(info.getMessageClass())) {
rejection.acceptServerVersion();
wdContext.nodeordem_srv().nodegetOrders().reload();
rejection.delete();
continue forRejections;
}
}
// There was no normal rejection, only mine, accept client version.
rejection.acceptClientVersion();
wdContext.nodeordem_srv().nodegetOrders().reload();
rejection.delete();
}
//@@end
}
I tested changing only the order description on client and sync, this scenario was sucessfull, the description wasn´t updated on backend. I tested changing the order description and I finalized the order and sync, this scenario was sucessfull also, the description and the 'finalized' attribute went updated on backend.
In the third scenario, when I updated description on client and on server, after sync the object on client went in an invalid state, I could not update anymore, receiving this message on NWDS console:
java.lang.IllegalStateException: Cannot update row in status - 4
at com.sap.tc.mobile.cfs.sync.InternalSyncState.update(InternalSyncState.java:27)
...
Any ideia?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
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.