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

Date without single quotes in SQL Where clause turns to 00000000. Why?

The below program works in 4.6c but does not in ECC 6.0, the issue is the date actually turns to 00000000, debug shows the internal table as having the correct value that was inserted but st05 trace shows that the variable is holding the value 00000000, this works fine when the date is put inside single quotes but the actual program where I have this issue does not warrant adding single quotes. Has someone come across this situation. Any help is appreciated!

data v_vbeln like vbak-vbeln.

data: begin of where_tab occurs 0,

s_date(20) type c,

end of where_tab.

where_tab-s_date = 'audat = 19971106'.

append where_tab.

select vbeln into v_vbeln from vbak where (where_tab).

write:/ v_vbeln.

endselect.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Mar 19, 2009 at 09:27 AM

    Hi,

    In 6.0,at top menu, system -


    > user profile -


    > own data -


    > default tab -


    > here date format should be same as u have in 4.6C.

    Regards,

    Sachin

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 19, 2009 at 09:30 AM

    Hi,

    Please Test with the following Line of Codes.

    DATA v_vbeln LIKE vbak-vbeln.
    DATA: BEGIN OF where_tab OCCURS 0,
    s_date(20) TYPE c,
    END OF where_tab.
    where_tab-s_date = 'audat = ''19971106'''. " i do change here.
    APPEND where_tab.
    
    SELECT vbeln INTO v_vbeln FROM vbak WHERE (where_tab).
      WRITE:/ v_vbeln.
    ENDSELECT.

    Hope will solve out your problem,

    Best Regards,

    Faisal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 19, 2009 at 09:30 AM

    HI,

    data v_vbeln like vbak-vbeln.
    ******data: begin of where_tab occurs 0,
    ******s_date(20) type c,
    ******end of where_tab.
    ******where_tab-s_date = 'audat = 19971106'.
    ******append where_tab.
    ***** The above statements are not needed for the select query.
    ******select vbeln into v_vbeln from vbak where (where_tab).
    Your select query can be re-written as 
    select vbeln into v_vbeln from vbak where audat eq '19971106'.
    write:/ v_vbeln.
    endselect.
    
    and if your requirement is to check for multiple dates then,
    append them to a select-options and rewrite the select query as
    select vbeln into v_vbeln from vbak where audat IN S_DATE. " S_DATE is your select-options
    

    Regards

    Sharath

    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.