1

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?

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
yukou
  • 305
  • 3
  • 6
  • 17
  • 1
    sorry.. I have the answer it should be selection_kunnr[] instead of selection_kunnr because of multiple selection and the condition check shoul be in at-selection-screen – yukou Oct 31 '11 at 02:32

2 Answers2

3

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.

mydoghasworms
  • 18,233
  • 11
  • 61
  • 95
0

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.

Grant B
  • 146
  • 5