Question

first I'm Sorry if my question is too simple I've just learned about ABAP

i have code ini ABAP which uses Selection screen with SELECT-OPTION let say the name is "selection_kunnr" and I want to know if user fill that selection area or not

(not means user leaves the field empty)

note: this selection field (selection_kunnr) is not a mandatory field.

how Can I deal with it?

I have tried using

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

but I think it doesn't work at all.

Thanks All :)

Was it helpful?

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top