!--a11y-->
Debugging of SAPClient
Proxies 
With the SAP .NET Connector you can debug from your C# proxy directly into the SAP function module by setting the ABAP_DEBUG flag in the connection string. The best way to do this is to set the AbapDebug and Trace flags on the SAPLogonDestination object. Debugging through to the SAP system is useful when you are getting unexpected results back from the SAP system. To use the ABAP_DEBUGoption you must have installed SAPGUI on your developer workstation. You cannot use the integrated ABAP debug option with web applications because they run under another Windows context that is invisible to the interactive user. For that reason it is often useful to test your proxy first against a Windows form or Console application in case integrated debugging is required.
It is often useful to run the SAP RFC function directly in the SAP system using transaction SE37. It is easier to isolate the problem once you are sure that input values are valid. In addition, you can use the SAP function module documentation. The SAP data dictionary, which is integrated in the function editor, also gives you information on valid input values.
In the SAP system, there are automatic formatting functions that are not available in the connector, for example to add leading zeroes to a customer or invoice number. If the function is working in the SAP system but not in your proxy, it could be that the SAP system has applied one of these automatic formatting routines but you did not.
To see what values the SAP function module is using, proceed as follows:
...
1. Execute transaction SE37.
2. Enter the function name and select Single test (F8).
3. Enter valid parameters and select Debugging (Ctrl F7).
4. Use Single Step (F5) to examine the code execution and variable values in the SAP function debugger window, part of the Abap/4 developer workbench.
You can turn on tracing in the SAP system by setting the environment variable CPIC_TRACE and RFC_TRACE. For more information on RFC tracing, refer to SAP Note 65325.

· CPIC_TRACE writes out detailed trace files to the application directory so it is not advisable to leave tracing on any longer than you need it.
· You can do advanced tracing within the SAP system, for example from transaction code SM50 and by examining the work process trace files (for example, dev_w0 in the SAP work directory).
· We recommend developers to use the SAP .NET Connector exception classes in their code to determine why an error has occurred and to use as a starting point for debugging.
· TRFC applications can be monitored from the TRFC monitor (transaction SM58). QRFC applications can be monitored from QRFC monitor (transaction SMQ2).