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
1,425

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
Read only

former_member761936
Active Participant
0 Likes
1,358

>

> 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
Read only

Former Member
0 Likes
1,358

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.

Read only

0 Likes
1,358

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

Read only

Former Member
0 Likes
1,358

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

Read only

0 Likes
1,358

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

Read only

0 Likes
1,358

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

Read only

Former Member
0 Likes
1,358

Hi,

Try like this:

Select objnr from jest

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

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

Regards,

Bhaskar

Read only

Former Member
0 Likes
1,358

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

Read only

former_member761936
Active Participant
0 Likes
1,359

>

> 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

Read only

Former Member
0 Likes
1,358

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.

Read only

Former Member
0 Likes
1,358

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