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: 

include and exclude status

Former Member
0 Kudos

i need to take all the status of "objnr" but there are status that i dont want to see exclude

this is the select that take all the status

select-option: z_stat_i FOR jest-stat,

z_stat_e FOR jest-stat.

SELECT stat

FROM jest

INTO mdstat-zs_stat

WHERE objnr = mdeqp-objnr

AND stat IN z_stat_i

AND inact = ' '.

APPEND mdstat.

any ideas?

thanks

6 REPLIES 6

Former Member
0 Kudos

n.b

there is an example in trans IE05

Former Member
0 Kudos

Hi,

I would think it is as simple as this:

SELECT stat

FROM jest

INTO mdstat-zs_stat

WHERE objnr = mdeqp-objnr

AND stat IN z_stat_i

<b>AND NOT stat IN z_stat_e</b>

AND inact = ' '.

APPEND mdstat.

regards

Thomas

0 Kudos

i dont think it's so simple

becuase in trans IE05

if you donot write status in-include

and you write status in exclude you get data, is this select catch all the cases???

0 Kudos

I'm not familiar with IE05. But this select works this way:

If EX is empty you get nothing returned.

If EX has data - this is the only thing you don't get.

If IN has data - this is the only thing you get as long as the result don't match your EX.

To be sure you get all if the EX is empty, you should validate the input before select and make a nonexisting entry in your EX-select-option. Or simply make 2 select-statements: 1 with the EX and 1 without.

Regards

Thomas

Former Member
0 Kudos

Hi Please try with the following code snippet.

SELECT stat

FROM jest

INTO mdstat-zs_stat

WHERE objnr = mdeqp-objnr

AND stat IN z_stat_i

AND NOT stat IN z_stat_e

AND inact = ' '.

APPEND mdstat.

clear mdstat.

endselect.

satish

Former Member
0 Kudos

Hi yehiel,

1. It is clear that the normal sql statement

won't work in the way we won't.

2. Thats why, some extra logic needs to be applied.

As already mentioned,

The RANGE for EXCLUDE

must be filled with some DUMMY Data.

Just write this CODE

JUST BEFORE CALLING THE SQL.

IF z_stat_eIS INITIAL.

z_stat_e-sign = 'I'.

z_stat_e-option = 'EQ'.

z_stat_e-low = 'XXX'.

z_stat_e-high = 'XXX'.

APPEND z_stat_e.

ENDIF.

HOPE THIS WORKS.

Regards,

Amit M.