Application Development 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: 

Select Statement.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

SELECT SINGLE * INTO I_JEST FROM JEST

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

Former Member
0 Kudos

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

Former Member
0 Kudos
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