Knowledge Base

Sending feedback and status updates to SAP


The information in this article in intended for SAP users who wish to receive feedback about label printing from NiceWatch Server to SAP, information about printing errors or confirmation about sucessfull print.

NiceWatch can keep a connection with the print engine open and report its statuses back to SAP. If an error occurs, NiceWatch will provide details about it (why it happened and what caused it). If there is no error coming from the print engine, the label was successfully send to Windows spooler for printing.



Requires a functioning HTTP trigger in NiceWatch server, including variables set in the trigger filter. To receive and process SAP data with return information, the processing of SAP data should be set inside the HTTP trigger with the help of the RUN SAP AII XML action.


  1. Start the NiceWatch Server manager.
  2. Open the settings of the HTTP trigger used to print information from SAP.
  3. On the Preferences tab, enable Supervised Printing
    This setting allows the trigger to use an exclusive print engine, so that any error identified by the engine is traceable back to the individual trigger. It also means that this trigger will not queue behind other engines when the system is processing several prints.
  4. On the Variables tab, select Show Internal Variables
  5. Enable internal error variables:
    • ActionLastErrorID
    • ActionLastErrorDesc
  6. On the Actions tab, select Properties to enter the Actions Editor.
  7. If available, click Advanced >> in the bottom left area of the Actions Editor.
  8. In the Actions Editor, select and drag the Send XML to SAP action into the list.
  9. Position the Send XML to SAP action behind actions where you would like to track errors.
    The actions are executed sequentially from top to bottom and if an error happens after the Send XML to SAP action is processed, the action will not identify it and feedback will not be sent to SAP.
    • Set up the RFC Destination: this is the service in SAP that will accept the feedback coming from NiceWatch.
      - Enter the Target Host IP address
      - Enter the Target Host Port
    • Select Custom XML for the message type
    • Edit XML content to a structure expected by SAP
      - You can copy/paste the XML schema.
      - Use the variable ActionLastErrorDesc to add an error description to the message. When XML is sent to SAP, the actual error description will be included in place of the variable.
      - Use other variables to add variable content data to the message, if necessary.

      You have to adapt the XML code to what your SAP system expects to receive, a sample XML code could look like this. Note usage of the variable ActionLastErrorDesc:

      Entering custom XML code for feedback to SAP
    • Set the Condition for the action Send XML to SAP to ActionLastErrorID > 0
      This will cause the execution of this action whenever an error occurs, but not for the sucessful prints.

      Defining condition for the action
  10. Select Ignore Failure for all actions above the Send XML to SAP action
    By default, an action failure terminates the execution of all following actions. This setting allows NiceWatch to proceed with next actions until the failure is reported back to SAP by the action Send XML to SAP.

Additional Info

  • If the variable ActionLastErrorID contains 0 as the value, no error occured.
  • Any other value for the ActionLastErrorID represents an error state; the number identifies the error type.
  • For the list of available error IDs and their descriptions, open the following in NiceWatch Manager: Tools -> Options -> General -> Error Configuration

Print document   Email document


Did this article help you? *