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

Very Urgent Help , ABAP SQL Query

Guys,

Please suggest.I have a table(custom_table1) with a field say A which is of date type = c and length = 9. And i want to query this table.Following is the query.

Select substr(A,0,5) B C into itab From table custom_table1

where b = ( select b from cusstom_table2 )

and substr(A,0,5) = Input_A.

That is i want to equate an Input_A (which is of 5 character length) with field A (only first 5 character of the 9 length). But it seems the query is wrong. Kindly help ,very urgent

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Nov 21, 2007 at 03:28 AM

    Hi,

    You can not query based on the first 5 characters only.

    But you can use LIKE

    Select A B C into itab From table custom_table1

    where b = ( select b from cusstom_table2 )

    and A LIKE <first 5 characters>

    Regards,

    Atish.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Thanks guys, U have helped me to fill up the where condition as

      but what about the column A in the select query ?I need only 5 characters from the field populated into Itab.

      CONCATENATE srch_str '%' INTO srch_str. -- bcos i want it to be 'InputA%'

      Select Substr(A,0,5) , B C Into Itab From CustomTable 1 where B = (Select B from customtable2) and A Like SrchStr

      Is there any means i can populate only the 5 characters from the select field A into Itab without using Substr (becos it doesnt work) ? Please help.

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.