Sometimes you encounter problems while integrating your application with SAP. OutSystems Platform includes features and tools that help you to troubleshoot those problems.
You can troubleshoot your SAP RFC calls by:
If a call to an SAP Remote Function results in an exception, you can find it the Integration Log, in the environment management console.
To access the Integration Log, go to the 'Monitoring' menu, and select 'Integrations'. Filter by 'SAP' in the 'Type' dropdown.
This logging shows all requests made to SAP. In case of error, the 'Error' link is displayed to inspect for further information.
If you need more details on what is sent and received from SAP, change the logging level of the SAP connection:
Requests and responses are now fully logged and new logs for calls to SAP have always a link:
Click on the link and press the 'Download Trace' button (at the bottom of the page).
Notice that, output parameter values may be not logged if the SAP execution fails, because they simply are not sent back.
OutSystems Platform allows you to debug the calls to SAP remote functions. This allows you to validate what is being sent and received. Learn more about debugging.
In this example, we will troubleshoot the 'SAPCustomers' application module that raises an exception when it tries to get the customer from SAP.
Since the message returned from SAP isn't explicit enough to understand the problem, check the logs to see the complete trace:
The complete error message is displayed and some other info, like the SAP remote function that generated the error.
By looking at the message, it's evident that the login credentials are not valid.
After fixing to the right credentials, publish and execute the application again.
Now, the list screen is displayed, but empty. In SAP there are customers, so they should be displayed here also!
Since there is no error message returned from SAP, check values sent and received from the SAP system.
For that, debug the application:
Fix the parameter value with the value expected by SAP.
A typical reason for parameter errors is that SAP expects text identifiers with leading zeros. Normally, integer identifiers are automatically converted to text without leading zeros.
Example: In SAP, an order number has the format '0000001000'. However, you display it on the screen in a more readable format: '1000'. So whenever you send that value to SAP you must add the leading zeros.
When using BAPIs, make sure you correctly format identifiers before sending to SAP, i.e., with leading zeros.
Another possible reason is when you are working with translated values from SAP.
Example: A sales order document type is displayed to English users as 'OR'. The internal SAP value is 'TA'. This value is translated automatically by SAP when returning values. When sending back the record, the document type has to be translated back to 'TA' or, otherwise, SAP raises an error.
When using SAP remote functions, you need to set parameters with SAP internal codes, instead of the translated ones.
Implement conversion functions to convert types before sending them to SAP is a good approach.
SAP Connection | SAP Remote Function