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
832

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

Hello Raymond,

this returned 0 entries unfortunatelly.

AND NOT EXISTS ( SELECT * FROM jest WHERE stat = 'E0012' AND inact = ' ')
Sandra_Rossi
Active Contributor
0 Kudos

Please use the COMMENT button for comments, asking for complements, adding details, replying to a comment or a proposed solution or to the OP question, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.

If you want to target someone, if this person has posted an Answer, use the button COMMENT, if this person is the Original Poster of the question he/she will be automatically informed, otherwise copy/paste their hyperlinked name e.g. ilhan.ertas so that the person receives a warning (NB: @ doesn't work/but typing this character will suggest hyperlinked names).