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

3.9k views Asked by At

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?

2

There are 2 answers

0
mydoghasworms On BEST ANSWER

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.

0
Grant B On

Given that this creates an internal table you can also use the DESCRIBE statement. Which works just as well on ranges and internal tables in your program.

DESCRIBE TABLE LINES w_count.