Writing a Custom SAP Result Checker

An SAP result checker is a custom Java class that implements error checking for SAP mobile business objects.

Since not all SAP BAPIs or RFCs use the "standard" error reporting technique, you can implement your own custom SAP result checker. This allows you to check any field for errors, or implement logic that determines what constitutes an error, and the severity of the error.

  1. Provide a Java class that implements the SAPResultChecker interface:
    package com.sybase.sup.sap;
    public interface SAPResultChecker
    {
        /**
         * 
         * @param f - JCO function that has already been executed. 
         * Use the JCO API to retrieve returned values and determine if the RFC has executed
         * successfully.
         * @return a single Map.Entry. The boolean "key" value should be set to true if the
         * RFC is deemed to have succeeded. Normal result processing will ensue.<P>
         * If the String value is not empty/null, that value will be treated as a warning message, 
         * which will be logged on the server, 
         * and returned as a warning in transaction logs to the client.<P>
         * Set the key value to false if it is deemed the RFC has failed. The String value will
         * be thrown in the body of an exception. The error will be logged on the server, and the
         * client will receive a transaction log indicating failure, including the string value.
         */
        Map.Entry<Boolean, String> checkReturn(JCO.Function f);
    }
    
    There are two SAPResultChecker implementations located in %SUP_HOME%\Servers\UnwiredServer\uep\tomcat\webapps\onepage\samples\sap directory, which you can modify and reuse as custom result checkers:
    • DefaultSAPResultCheck – the default SAP result checker.
    • NoOpSAPResultCheck – this result checker always returns a successful result.
  2. Save any classes you create to an accessible Unwired WorkSpace location. This allows you to select the class when you configure the SAP result checker for your mobile business object.