Question

When using JCo (3.x) to read IDOCs sent from a SAP server, what action should be taken to indicate the message has been properly received (i.e. commit)?

In Java I imagine something like:

public class MyHandler implements JCoIDocHandler {
  public void handleRequest(JCoServerContext serverCtx, IDocDocumentList documentList) {
    IDocDocumentIterator iterator = documentList.iterator();
    while (iterator.hasNext()) {
             IDocDocument doc = iterator.next();
             // some processing
    }
    // here I would like to say COMMIT
    // i.e., I confirm all the documents have been read
    // and our side takes ownership
  }   
}

This type of commit seems necessary if we want to make sure no message (IDOC) is lost, even if a bullet hits the CPU during some .hasNext() call. Or am I wrong?

Was it helpful?

Solution

In such cases SAP assumes that you send back IDOC with type of 'ALEAUD'. In this case sender system can change IDOCs statuses to 'document created in receiving system' (41). For more details look into "The advance Guide to inplementing SAP R/3's Application Link Anabling (ALE)" document

OTHER TIPS

From the technical perspective (and not from the perspective of the business data workflow with the IDoc status records) committing and confirming TIDs of a transactional RFC (tRfc) is the task of the RFC client. With receiving IDocs your JCo program is the RFC server in this scenario and you should react on those commit, rollback and confirm events that the RFC client sends to you. This is done by implementing the interface JCoServerTIDHandler.

You will get a commit and later also a confirmTID event, if you return from your handleRequest invocation without an exception, otherwise you will get a rollback and also a confirmTID event for reacting accordingly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top