SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Complex Conditions in SAP Smartform with AND/OR

Every element in SAP Smartforms has a Conditions tab where Smartform developers can define conditions to run the Smartform element. Output Conditions is one of the most used conditions. This screen is just like the Node Conditions screen of Smartform Alternative element.

Smartform developer can define a condition which will print a text on SAP invoice. Or define a condition in Conditions tab for a Window element which will be printed on the last page. Some conditions require controlling of a variable against more than one value. Some require validation of more than one variable and these conditions are combined with each other using AND (default) or OR.

Smartform Alternative element can provide a decision tree for the developer. If Node conditions are met then TRUE path will be executed. Otherwise, if node conditions return FALSE then the FALSE path will be executed by Smartform function module.

Sometimes in SAP Smartform output documents, I was required to use AND, OR together. This is a little bit tricky since it is difficult to build a safe WHERE condition for that element.

The trick is using "(" and ")" within the Conditions lines.
Below developers can see a live example of complex conditions for a Smartform element.

building complex conditions in SAP Smartform
Complex Conditions records for Smartform element

Below code is showing how you can create complex conditions. Please note that conditions that are not combined using OR keyword are combined with AND keyword.

( ZVBDKA-AUART = 'ZWCN'
OR
ZVBDKA-AUART = 'ZWDN'
OR
ZVBDKA-AUART = 'ZWRE' )
GV_WAERS = 'EUR'
ZNAST-PARNR = GS_SKINV-PARTNER
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.