cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Select query from PRPS and JEST doesn't retrieve expected result

airwave
Explorer
0 Kudos
824

Dear Experts,

do you have an idea why I am still getting results with stat= 'E0012' and inact = SPACE although

as per below mentioned Select query they should be clearly delimited (see EXISTS Command)

I am expecting hits with:

stat= 'E0012' and inact = X

and NOT

stat= 'E0012' and inact = SPACE

<strong>
  TYPES: BEGIN OF ty_s_prps,
           posid TYPE ps_posid,
           post1 TYPE ps_post1,
           psphi TYPE ps_psphi,
           pbukr TYPE ps_pbukr,
           objnr TYPE j_objnr,                              "20160712
         END OF ty_s_prps,

 TYPES: ty_t_prps TYPE TABLE OF ty_s_prps.
 
 DATA:  lt_prps  TYPE ty_t_prps.
 
     SELECT   a~posid
             a~post1
             a~psphi
             a~pbukr                                      
             a~objnr                                       
       INTO TABLE lt_prps
             FROM prps AS a
             INNER JOIN jest AS j ON a~objnr = j~objnr
              WHERE a~belkz EQ lc_on_x            
                AND a~loevm EQ space                    
                AND a~pbukr IN lt_sel_bukrs_range
*               AND a~plakz EQ lc_on_x                                  
                AND j~stat  EQ 'I0002'
                AND j~inact EQ space
                AND a~fakkz EQ lc_on_x
                               AND EXISTS ( SELECT * FROM jest WHERE   stat = 'E0012' AND inact = 'X' 
                                                                       OR stat NE 'E0012').  </strong><br>

Br

Ilhan

View Entire Topic
airwave
Explorer
0 Kudos

Is it not possible to achieve this with ABAP at all?

Requirement:

('stat' I0002 must be present AND 'inact' not equal to “X”) AND (( 'stat' E0012 must not be present) OR ('stat' E0012 is present AND inact equal to “X”))