Almost every ABAP developer comes to a point where they require obligatory parameters along with user command logic in their selection screens. As you might already know, that’s a problem. Because obligatory parameters demand input on every action of user and interfere with user command logic, which results in a broken selection screen. Let’s see an example.

 As soon as we run the report, we see  P_SUB  parameter as input-disabled and we expect it to be enabled when we click  P_DET radiobutton. But no…

Obligatory parameter interfering with user command

“Company Code” field demands input and “Display subtotal” field is still disabled although “Detail” radiobutton is already selected, which means our selection screen is broken. This certainly is not desired. The outcome gets even funnier if use  OBLIGATORY addition for a select option. We are not allowed to click extension button to enter an interval to the very same select option!

 Most likely, SAP intended to make things easier for us by automating required field validation with a simple  OBLIGATORY addition. But almost every time, this validation is only required after executing the report, not on every user action. Fortunately SAP also provided us with a workaround: the “recommended” field. If we assign value  2  to the  REQUIRED attribute of screen, the field becomes “recommended”, which means we still see the checkmark in field which indicates the field expects an entry but no automated validation will run. So it is up to us when and how the required field validation would take place. In order to fix our previous code, we need an assignment to a selection screen field attribute, plus the validation code.

With this code, we won’t see any error messages until we hit the execute button, but still have the obligatory checkmark. This feature is also available in classical dynpro screens.

Leave a Reply