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.
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'
ZVBDKA-AUART = 'ZWDN'
ZVBDKA-AUART = 'ZWRE' )
GV_WAERS = 'EUR'
ZNAST-PARNR = GS_SKINV-PARTNER