Skip to Content
author's profile photo Former Member
Former Member

Select - Options

Hi experts,

I have doubt in select-options. Please see the below code.

TABLES: ekko.

SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.

DATA: flag TYPE i.

flag = 0.

AT SELECTION-SCREEN.

IF NOT s_bukrs IS INITIAL.

LOOP AT s_bukrs.

IF s_bukrs EQ '1000' OR s_bukrs EQ '0009'.

IF sy-subrc EQ 0.

flag = 1.

ENDIF.

ENDIF.

ENDLOOP.

ENDIF.

During execution in the selection screen I am entering 1000,

0009, CRAB, TRN1 for s_bukrs.

But the If condition IF s_bukrs EQ '1000' OR s_bukrs EQ '0009'. is getting failed. Please let me know the correct syntax. i.e if s_bukrs is either 1000 or 0009 the variable flag should be set to 1. But its not happening.

Thanks & Regards,

Neethu.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

9 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:29 PM

    write as :

    LOOP AT s_bukrs.

    IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.IF sy-subrc EQ 0.

    flag = 1.

    ENDIF.

    ENDIF.

    ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:29 PM

    hi

    do this to ur code

    TABLES: ekko.

    SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.

    DATA: flag TYPE i.

    flag = 0.

    AT SELECTION-SCREEN.

    IF NOT s_bukrs IS INITIAL.

    LOOP AT s_bukrs.

    IF s_bukrs-low EQ '1000' OR s_bukrs-high EQ '0009'.IF sy-subrc EQ 0.

    flag = 1.

    ENDIF.

    ENDIF.

    ENDLOOP.

    ENDIF.

    cheers

    snehi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:30 PM

    Hi,

    Try this -

    at selection-screen on s_bukrs.

    if '1000' in s_bukrs or '0009' in s_bukrs.

    flag = 1.

    endif.

    Cheers.

    ...Reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:31 PM

    Hi,

    Try this -

    at selection-screen on s_bukrs.

    if '1000' in s_bukrs or '0009' in s_bukrs.

    flag = 1.

    endif.

    Cheers.

    ...Reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:31 PM

    Hi ,

    Use the following code.

    U need to use s_bukrs-low instead of s_bukrs

    TABLES: ekko.

    SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.

    DATA: flag TYPE i.

    flag = 0.

    AT SELECTION-SCREEN.

    IF NOT s_bukrs IS INITIAL.

    LOOP AT s_bukrs.

    IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.

    IF sy-subrc EQ 0.

    flag = 1.

    ENDIF.

    ENDIF.

    ENDLOOP.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:38 PM

    Hi,

    TABLES: ekko.

    SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.

    DATA: flag TYPE i.

    flag = 0.

    AT SELECTION-SCREEN.

    IF NOT s_bukrs IS INITIAL.

    LOOP AT s_bukrs where s_bukrs-low = '1000'

    or s_bukrs-low = '0009'.

    flag = 1.

    ENDLOOP.

    ENDIF.

    Hope it helps u.

    regards.

    Manjari.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:38 PM

    Hi,

    TABLES: ekko.

    SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.

    DATA: flag TYPE i.

    flag = 0.

    AT SELECTION-SCREEN.

    IF NOT s_bukrs IS INITIAL.

    LOOP AT s_bukrs where s_bukrs-low = '1000'

    or s_bukrs-low = '0009'.

    flag = 1.

    ENDLOOP.

    ENDIF.

    Hope it helps u.

    regards.

    Manjari.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:47 PM

    Hi neethu

    U r working with select options and many of our people has given replyes. But u need to consider the S_BUKRS-SIGN also while searching for the bukrs. There can be I -> INCLUDE E->EXCLUDE.

    So instead of doing all these validations take an internal table with field bukrs and hit the table t001 and get the company codes which can be considered. Then loop through that table and check for your company code and set the flag.

    This would be best solution.

    Reward points if useful.

    Venkat.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2008 at 12:29 PM

    Hi,

    you forgot to specify the field for the value in select-option header line:

    LOOP AT s_bukrs.
      IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.
    *     IF sy-subrc EQ 0.
        flag = 1.
    *     ENDIF.
      ENDIF.
    ENDLOOP.
    

    By the way: A usual select option has got two value fields (LOW and HIGH). If you want to use the code above it could be better to restrict the select option e.g. with NO INTERVALS.

    [Restricting Entry to Single Fields|http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba76d35c111d1829f0000e829fbfe/frameset.htm|]

    Regards Rudi

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.