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

Reg select-options

Hai all,

Under select-options i have declared 3 varibles

1.X1 is of char(30)

2.X2 is of char(4)

3.x3 is a date field.

now i have to get values from a db table where x1 begin with 'ARC5' and date in x3 entered on screen.

if x1 is entered on screen fetch those records otherwise dont fetch any records.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 10:27 AM

    hi,

    Do this way ..

     if not x1 is initial.
    
      Do something.
    
     endif.

    Regards,

    Santosh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 10:31 AM

    hi ganesh,

    first select data basing on the select-options fileds and then do like this.

    if x1[] is not initial.

    write the seelct query here.

    endif.

    Regards,

    Nagaraj

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 10:32 AM

    Under select-options i have declared 3 varibles

    1.X1 is of char(30)

    2.X2 is of char(4)

    3.x3 is a date field.

    now i have to get values from a db table where x1 begin with 'ARC5' and date in x3 entered on screen.

    if x1 is entered on screen fetch those records otherwise dont fetch any records.

    --

    SELECT fields FROM dbtable

    WHERE xf2 in X2 and xf3 in x3 and xf1 in x1.

    Since you have defined it as select-options..if you leave it blank it means all records. Secondly for X2, on the screen you can enter the pattern ACR5* and it would fetch the records according to the selected pattern. For date it is similar to X1.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 10:39 AM

    hi,

      If  x1 cp 'ARC5*'.
         select * from xyz into table it_xyz 
           where x1 = 'ARC5%' and
                 x3 = x3.
      endif.

    REgards,

    Sailaja.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      A small correction in the code above

      If x1 cp 'ARC5*'.

      select * from xyz into table it_xyz

      where x1 <b>LIKE</b> 'ARC5%' and --> for pattern

      x3 <b>IN</b> x3. -> select-options

      endif.

      Hope Sailaja wont mind it.

      Kind Regards

      Eswar

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 11:36 AM

    Hi,

    start-of selection.

    if not x1[] is initial.

    select * from <db> where

    f1 = 'ARC5'

    and f2 in x3.

    endif.

    Regards

    amole

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 02:11 PM

    Hi ganesh,

    1. we need to do this in 2 steps.

    (bcos getting data from table with beginning with ARC5 etc, is complicated)

    2.

    a) select * from dbtable

    into table itab.

    where DateField In X3.

    b) loop at itab.

    if itab-X1(4) = 'ARC5' .

    ELSE.

    DELETE ITAB.

    ENDIF.

    ENDLOOP.

    regards,

    amit m.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 29, 2006 at 02:57 PM

    Hi Ganesh,

    if X3 is a select option, use CODE A and if X3 is a parameter, use CODE B:

    CODE A:

    if not x1 is initial.

    select x1

    x2

    x3

    from <dbtable> into <internal table>

    where x1 = 'ARC5%'

    and x3 in x3.

    endif.

    CODE B:

    if not x1 is initial.

    select x1

    x2

    x3

    from <dbtable> into <internal table>

    where x1 = 'ARC5%'

    and x3 = x3.

    endif.

    Regards,

    Divya

    Message was edited by: Divya Lingala

    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.