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

Select Statement.

i need to compare two status and then diplay how should i do that.

if the stat - 'I0002' , stat - 'I0042'.

if the object id is having both the stat then only i need to display it.

how should i write the select statement.

SELECT SINGLE * INTO I_JEST FROM JEST

WHERE OBJNR = I_TMP_CAUFV-OBJNR and STAT IN ('I0002','I0042')

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 05:02 PM

    Do like this:

    data: i_jest type standard table of jest,

    wa_jest type jest.

    SELECT * INTO table I_JEST FROM JEST

    WHERE OBJNR = I_TMP_CAUFV-OBJNR and

    ( STAT = 'I0002' or STAT = 'I0042' ).

    if sy-subrc = 0.

    endif.

    Regards,

    Praaksh.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 05:02 PM

    Hi,

    I think you cannot do this in a single select statement..

    Instead Try this..

    SELECT * INTO TABLE IT_JEST FROM JEST

    WHERE OBJNR = I_TMP_CAUFV-OBJNR and STAT IN ('I0002','I0042')

    READ TABLE IT_JEST WITH KEY OBJNR = I_TMP_CAUFV-OBJNR

    STAT = 'I0002'.

    IF SY-SUBRC = 0.

    READ TABLE IT_JEST WITH KEY OBJNR = I_TMP_CAUFV-OBJNR

    STAT = 'I0004'.

    IF SY-SUBRC = 0.

    • Both the status are found..

    ENDIF.

    ENDIF.

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 05:03 PM

    SELECT SINGLE * INTO I_JEST FROM JEST

    WHERE OBJNR = I_TMP_CAUFV-OBJNR and STAT = 'I0002' or stat = 'I0042'.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 05:05 PM

    Hi Kamlesh,

    write this select ...

    SELECT SINGLE * INTO I_JEST FROM JEST

    WHERE OBJNR = I_TMP_CAUFV-OBJNR and

    ( STAT = 'I0002' or STAT = I0042)

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2006 at 05:12 PM
    SELECT SINGLE * INTO I_JEST FROM JEST
    WHERE OBJNR = I_TMP_CAUFV-OBJNR and STAT = 'I0002'.
    if sy-subrc = 0.
      SELECT SINGLE * INTO I_JEST FROM JEST
    WHERE OBJNR = I_TMP_CAUFV-OBJNR and STAT = 'I0042'.
    endif.
    
    so now ur object id will contain both the status
    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.