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

URGENT : select options

Hye techies,

I have a requirement, where i have 3 select options. Atleast data one select option should be entered. So, i cannot use obligatory tag.

i am writing the code as follows.

select-options: s_a for ztab-a,

s_b for ztab-b,

s_c for ztab-c.

data: chk_input type i.

chk_input = 0.

if s_a is not initial.

chk_input = chk_input + 1.

endif.

if s_b is not initial.

chk_input = chk_input + 1.

endif.

if s_c is not initial.

chk_input = chk_input + 1.

endif.

case chk_input.

when 0:.

MESSAGE 'Select atleast one entry in block 2' TYPE 'I'.

when 1.

when others.

MESSAGE 'Too many inputs in block 2' TYPE 'E'.

endcase.

I have 2 problems here.

1. When i am clicking on the arrow next to select options, it is displaying the first message considering the entry as empty.

2. If i enter one entry in one of the select options and then click on arrow for multiple selection, second error message is coming.

Please help me, as my requirement is one entry should be dere in one select options and it can have multiple values. but one entry is mandatory.. If the entry is wrong, previously entered values should be cleared.

At selection-sceen output.

Thanks in advance

Imran.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 08:43 AM

    Hi,

    please go through the following logic.

    perform validations in start-of-selection instead of at selection screen.

    start-of-SELECTION.

    if s_a is initial and s_b is INITIAL and s_c is INITIAL.

    chk_input = 1.

    stop.

    endif.

    end-of-SELECTION.

    if chk_input = 1.

    MESSAGE 'Select atleast one entry in block 1' TYPE 'I'.

    endif.

    This validates atleast one value is entered.

    Reward points if helpful.

    Thanks and regards.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 07:04 AM

    Hi,

    Use AT SELECTION-SCREEN event.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 07:10 AM

    Hi ─░mran,

    You firstly create a block and then put the select options within this block like this:

    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-003.
    SELECT-OPTIONS: 
    s_lgort FOR ekpo-lgort  NO-EXTENSION NO INTERVALS,
    s_vtweg FOR vbak-vtweg. 
    SELECTION-SCREEN END OF BLOCK  block1.

    Afterwards,

    AT SELECTION-SCREEN ON BLOCK block1.
    
      IF s_lgort[] IS INITIAL AND
         NOT s_vtweg[] IS INITIAL.
        MESSAGE e101(c+) WITH
          'Please enter the value.... write here whatever you want'
      ELSEIF s_vtweg[] IS INITIAL AND
             NOT s_lgort[] IS INITIAL.
        MESSAGE e101(c+) WITH
            'Please enter the value.... write here whatever you want'
    
      ENDIF.

    In the past I have used this and it works.

    Hope helps.

    Edited by: Deniz Toprak on Jun 17, 2008 10:12 AM

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 17, 2008 at 07:11 AM

    hi Imran,

    pls. check the following code:

    AT SELECTION-SCREEN.

    IF s_a[] IS INITIAL
    AND s_b[] IS INITIAL
    AND s_c[] IS INITIAL.
    ==> All three select options are empty
    ELSEIF ( s_a[] IS NOT INITIAL
    AND s_b[] IS INITIAL
    AND s_c[] IS INITIAL ) OR
    ( s_a[] IS INITIAL
    AND s_b[] IS NOT INITIAL
    AND s_c[] IS INITIAL ) OR
    ( s_a[] IS INITIAL
    AND s_b[] IS INITIAL
    AND s_c[] IS NOT INITIAL ).
    ==> Exactly one of the three select options is filled with value(s)
    ELSE.
    ==> The rest... (At least two select options are filled)
    ENDIF.

    hope this helps

    ec

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 07:12 AM

    Hi Imran,

    Use At selection-screen event.

    If you have multiple entries in your select options then use

    s_a[], s_b[] and s_c[] for checking the if condition instead s_a which will check for work area.

    Regards,

    Ravi K

    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.