2
votes

I wrote a function in ABAP which gets called via SAP pyrfc.

If there is a SAPSQL_PARSE_ERROR the RFC caller (the client written in Python) gets a meaningless error message:

ABAPRuntimeError: RFC_ABAP_RUNTIME_FAILURE (rc=3): key=SAPSQL_PARSE_ERROR, message=Beim Parsen einer dynamischen Angabe trat ein Fehler auf. [MSG: class=, type=, number=, v1-4:=;;;]

Via tcode st22 I can look at the details. To make the round-trip faster I would like to improve the error message which is visible at the python client.

I guess, but don't know, that the abap function needs to be changed. How to obtain the valuable text which is visible in st22?

I know the output of st22 is very long. The valuable text is in the german sap gui the box called "Fehleranalyse" which means roughly "Troubleshooting" or more literal "error analysis"

1

1 Answers

4
votes

SAPSQL_PARSE_ERROR suggests that your remote-enabled function at some point or other submits an incorrect OpenSQL query to the database. This should result in a handleable exception of the type CX_SY_DYNAMIC_OSQL_SYNTAX.

Not catching this exception results in a dump. Transaction ST22 is the dump analysis tool that lets you inspect those.

Putting a TRY ... CATCH around the OpenSQL query should allow you to catch that exception and parse its attributes for a more meaningful message. You can then throw an exception of your own to forward something more helpful to the RFC caller.