cancel
Showing results for 
Search instead for 
Did you mean: 

Error when handling rejections

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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?

former_member206242
Active Participant
0 Kudos

Hi,

Please refer to SAP Note 1259580, which contains an attachment on rejection-handling scenarios in SAP NetWeaver Mobile 7.1.

The documentation provided with the note should solve your problem.

Regards,

Nipun

Former Member
0 Kudos

Thanks for reply Nipun.

I already followed the document attached to this note.

The error happens when I change both on server and on client and after that I sync.

Please help.

Gabriela

former_member206242
Active Participant
0 Kudos

Hi,

Seems that the row is deleted or there is some other issue.

You need to check the synclogs as what came down from server. I am not sure what went wrong but you can always

create a OSS message for SAP support to help you out.

Regards,

Nipun

Former Member
0 Kudos

Thanks Nipun Dev,

I created an OSS message to SAP an it was a bug.

They corrected and it will be released on next versions.

Thanks and best regards,

Gabriela

Answers (0)