guettli
guettli

Reputation: 27806

Test OpenSQL statements in the SAP GUI or Eclipse ADT?

I am writing an OpenSQL query, including joins and sub-selects, and I am unsure whether it works. To find out, I'd like to run it somewhere, look at the results, then change it, it an iterative way.

Traditional tools like transactions SE16 or SQVI don't help, because they have too little functionality (only one table, only joins but no sub-selects, etc.). Other threads with similar questions, like this one remained unanswered.

Of course, I could write a report or a unit test, paste my code there, and run it, but this makes the iterative cycle so slow because I need to change input and output data formats all the time. Optimal solution would be something like the SQL Console in SAP HANA Studio, but for OpenSQL instead of native SQL.

Upvotes: 0

Views: 5579

Answers (2)

mxstml
mxstml

Reputation: 95

Good morning, you could take a look into queries (SQ01/SQ02) instead of QuickViews in SQVI. In Queries you have a chance to enhance your Joins with coding and you are still able to test your "code". For incremental changes this might be your easiest way to go.

Regards

Upvotes: 0

Sandra Rossi
Sandra Rossi

Reputation: 13629

  1. (on behalf of @Florian) Use the SQL console in Eclipse. it allows Open SQL SELECT, except FOR ALL ENTRIES and variables.

  2. (on behalf of @JozsefSzikszai) software "OpenSQL Editor for SAP", by STA Consulting Kft. There is a 30 days trial period, so might be a short term solution only (unless your company buys it)

  3. Use the tool ZTOAD, created by Sébastien Hermann : http://quelquepart.biz/article7/ztoad-requeteur-open-sql.

  4. You may indirectly test the Open SQL statements by creating test classes (ABAP Unit), in which you use the class CL_OSQL_TEST_ENVIRONMENT (ABAP >= 7.52), which is used to mock the database, so you may provide false data, enter the expected result, execute the open SQL in test mode, and verify that actual result = expected result. It supports all Open SQL features.

  5. All the above solutions allow testing Open SQL directly. Another solution is to use native SQL editors, and to write the Open SQL statements in the Strict mode (ABAP >= 7.40) so that they are closer to the native SQL syntax (especially the comma is to be used to separate the column names; but the alias separator has to be manually changed from ~ to .). There are two native SQL editors: one is a tool in ST04 or ST04N, one is the standard program RSDU_EXEC_SQL. Both display the result of SELECT statements in an ALV grid.

Upvotes: 5

Related Questions