Search code examples
abapsap-selection-screens

How to know if selection-screen is filled or not?


I have selection screen with SELECT-OPTION let say the name is selection_kunnr and I want to know if user filled that selection area or not

Note: this selection_kunnr is not a mandatory field. How can I deal with it?

I have tried so far

if selection_kunnr is not initial.
  "do some action here
endif.

but I think it doesn't work at all.

Any suggestions?


Solution

  • SELECT-OPTIONS create an internal table (same as the RANGE statement) for a field. (It creates 4 fields: SIGN, OPTION, LOW and HIGH). You can check whether the table has any contents by using:

    IF SELECTION_KUNNR[] IS INITIAL.
    

    The [] operator specifies the contents (rows) of an internal table.

    I am not sure anymore, because I am not in front of an SAP system right now, but if only the initial FROM/TO fields are filled, I am not sure whether this creates an entry in the table.

    HINT: In the ABAP editor, you can place the cursor on any statement, and press F1 to get help on that statement.