Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select Statement.

Former Member
0 Likes
768

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')

5 REPLIES 5
Read only

Former Member
0 Likes
726

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.

Read only

Former Member
0 Likes
726

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

Read only

Former Member
0 Likes
726

SELECT SINGLE * INTO I_JEST FROM JEST

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

Read only

Former Member
0 Likes
726

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

Read only

Former Member
0 Likes
726
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