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

Hi,

I should pick OBJNRs from JEST whose stat EQ 'I0010' OR stat EQ 'I0009' and whose stat not equal to I0012,I0045,I0046.

For example

As OBJNRs will have different status,if an OBJNR contains status = 'I0009' and status = 'I0045' ,this OBJNR should not be picked as it has status = 'I0045' .

How to write a 'select' statement for this . Please suggest.

Thanks

Venkat

1 ACCEPTED SOLUTION

former_member761936
Active Participant
0 Kudos

>

> Hi,

>

> I should pick OBJNRs from JEST whose stat EQ 'I0010' OR stat EQ 'I0009' and whose stat not equal to I0012,I0045,I0046.

> For example

> As OBJNRs will have different status,if an OBJNR contains status = 'I0009' and status = 'I0045' ,this OBJNR should not be picked as it has status = 'I0045' .

> How to write a 'select' statement for this . Please suggest.

>

> Thanks

> Venkat

Hi Venkat,

We can not do it dirctly with one select statement

First select records with 'I0010' and 'I0009'

and Select records with I0012,I0045,I0046

then Looping with first Internal table , read the second internal table to see if record exists for the same objnr of first internal table , if record exists delete that record from first internal table.

Then at end you get records what you want.

Try it out.

Regards,

Narendra.Soma

10 REPLIES 10

former_member188685
Active Contributor
0 Kudos

instead of select, you can use the Function STATUS_TEXT_EDIT, fot this pass the Objnr, you get the status in exporting parameter LINE . line consists of all statuses. using CS you can check the status which you want.

0 Kudos

Thanks for your reply. Can you suggest with 'Select' statement.

Former Member
0 Kudos

select * from jest into table ijest where ( stat = 'i0010' and stat = 'i0009' and stat ne 'i0012' ).

0 Kudos

Thanks for the reply. Status should not include 'I0012','I0045','I0046'.

0 Kudos

select * from jest into table ijest where ( stat = 'I0010' or stat = 'I0009' or stat ne 'I0012' and stat ne 'I0045' and stat ne 'I0046').

Former Member
0 Kudos

Hi,

Try like this:

Select objnr from jest

where stat IN ( 'I0009' , 'I0045' ) AND

stat NOT IN ( 'I0012', 'I0045', 'I0046' ).

Regards,

Bhaskar

Former Member
0 Kudos

I should pick OBJNRs from JEST whose stat EQ 'I0010' OR stat EQ 'I0009' and whose stat not equal to I0012,I0045,I0046.

select * from jest

into table it_jest

where stat not in ('I0012' , 'I0045' , 'I0046').

or

select * from jest

into table it_jest

where stat in ('I0010' , 'I0009').

or u can combine both in same select

former_member761936
Active Participant
0 Kudos

>

> Hi,

>

> I should pick OBJNRs from JEST whose stat EQ 'I0010' OR stat EQ 'I0009' and whose stat not equal to I0012,I0045,I0046.

> For example

> As OBJNRs will have different status,if an OBJNR contains status = 'I0009' and status = 'I0045' ,this OBJNR should not be picked as it has status = 'I0045' .

> How to write a 'select' statement for this . Please suggest.

>

> Thanks

> Venkat

Hi Venkat,

We can not do it dirctly with one select statement

First select records with 'I0010' and 'I0009'

and Select records with I0012,I0045,I0046

then Looping with first Internal table , read the second internal table to see if record exists for the same objnr of first internal table , if record exists delete that record from first internal table.

Then at end you get records what you want.

Try it out.

Regards,

Narendra.Soma

Former Member
0 Kudos

Hi you can try like this..

( objnr eq 'I0010' or stat EQ 'I0009' ) and

( objnr ne 'I0012' and objnr ne 'I0045' and objnr ne 'I0046' ).

regards.

Former Member
0 Kudos

Hi Venkat,

Try the code

DATA : IT_JEST TYPE TABLE OF JEST.

SELECT *
FROM JEST
INTO TABLE IT_JEST
WHERE STAT IN ('I0010', 'I0009' ) AND
      STAT NOT IN ('I0012', 'I0045', 'I0046' ).

WRITE 'HAI'.

Regards