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

regarding select statement

Hi,

i am using material code ( declared as parameter statement ) in where clause of select statemant . i want to run the select for input like DC* in parameter so that all materials starting from DC are included in the select.

thanks and regards

abaper.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Jun 11, 2007 at 06:56 AM

    Hi,

    If you are using select-options, you can achieve the result without extra effect.

    If you want to use only parameter, you need to use ranges in your logic and equate option = 'CP'.Here is the code.It is working fine.Kindly reward points by clicking the star on the left of reply,if it helps.

    parameters p_matnr type matnr.

    tables mara.

    data itab type standard table of mara.

    data wa type mara.

    ranges r_matnr for mara-matnr.

    r_matnr-low = p_matnr.

    r_matnr-sign = 'I'.

    r_matnr-option = '<b>CP</b>'.

    append r_matnr.

    select * from mara into table itab where matnr <b>in r_matnr</b>.

    loop at itab into wa.

    write wa-matnr.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:22 AM

    Hi King, 😊

    This is dynamic selection and * is not used in this clause. You can use % instead of * to achieve at the solution.

    This sholud solve your query.

    Reward Points if useful.

    Thanks,

    Tej..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:42 AM

    Hi again King, 😊

    Use this way.

    Select field1 field 2

    from table

    into int_table

    where sel_field = 'DC%'.

    Note: <b>Always remember that the code within single cotes should be in CAPS</b>.

    This should solve your query.

    Reward Points if useful.

    Thanks,

    Tej..

    Message was edited by:

    Shree Tejus

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 11, 2007 at 06:05 AM

    Hi,

    use like

    select -


    from ---

    where

    matnr<b> like</b> p_matnr.

    --Patil

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 11, 2007 at 06:23 AM

    select matnr from mara into table itab where matnr like P_MATNR.

    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.