Condition Variables within Sub-Query in SAP


One line answer - Sub-Queries are not allowed.

But if you need to handle your scenario, then you can do the following:

  • Encapsulate your entire query into a stored procedure and then use the stored procedure.

  • Create a view. The view is created to handle either your main query or sub-query.

  • Create a table level variable and store the end results of view in it and then go ahead and fetch the value of table variable in the main query.

Published on 20-Dec-2017 09:25:11