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

incorrect data selection

Former Member
0 Likes
401

Hi experts,

below is my part of code.

SELECT A~MATNR A~VKORG A~AUDAT A~VTWEG A~SPART A~AUART
           A~VKBUR A~VKGRP A~KUNNR A~VBELN A~POSNR A~WERKS B~ETENR
           B~J_3ASIZE B~J_4KRCAT B~J_3AABGRU B~LMENG B~J_3ANETW
           FROM VAPMA AS A JOIN VBEP AS B ON A~MANDT = B~MANDT
                                         AND A~VBELN = B~VBELN
                                         AND A~POSNR = B~POSNR

           INTO CORRESPONDING FIELDS OF TABLE IT_VBEP
           FOR ALL ENTRIES IN TMP_PLAN
           WHERE A~MATNR EQ TMP_PLAN-STYLECODE
             AND A~VKORG EQ P_VKORG
             AND A~TRVOG EQ '0'
             AND A~AUDAT IN S_AUDAT
             AND A~VTWEG IN S_VTWEG
             AND ( A~AUART IN S_AUART AND A~AUART NE 'ZORB' AND
                   A~AUART NE 'ZKA' AND A~AUART NE 'KA'     AND
                   A~AUART NE 'ZRE' AND A~AUART NE 'RE'     AND
                   A~AUART NE 'ZKE' AND A~AUART NE 'ZKR'    AND
                   A~AUART NE 'ZCR' AND A~AUART NE 'ZDR' )
             AND A~KUNNR IN S_KUNNR
             AND A~WERKS IN S_WERKS.

in the above code when i debug the values are like this.

matnr is space, vkorg = 1000 , audat between 01.01.2010 to 01.02.2010

vtweg eq space and auart ne above specified values and kunnr eq space and werks eq space.

while debugging i get 4 entries in it_vbep for which vbeln contains 3 repeated entries 1998(3 times) and another entry 1999(once).

but if i put exact selection option in VAPMA table i get only 2 entries where vbeln is 1998 & 1997.

and it_vbep contains wrong spart value(HR,which is not correct as we are providing LE only on selection screen) also for vbeln 1999.

Am i getting this duplicate entry in it_vbep because of 'FOR ALL ENTRIES IN TMP_PLAN'.?????

plz help.

You would help yourself by using code tags to format the code

Regards,

Ashmita Singh

Edited by: Rob Burbank on Aug 5, 2010 10:13 AM

1 ACCEPTED SOLUTION
Read only

andreas_mann3
Active Contributor
0 Likes
354

this part

AND ( AAUART IN S_AUART AND AAUART NE 'ZORB' AND

AAUART NE 'ZKA' AND AAUART NE 'KA' AND

AAUART NE 'ZRE' AND AAUART NE 'RE' AND

AAUART NE 'ZKE' AND AAUART NE 'ZKR' AND

AAUART NE 'ZCR' AND AAUART NE 'ZDR' )

seems to be contradictorily - please check it

and use ranges or select-options for the literals 'ZKA' . etc.

hope that helps

Andreas

Edited by: Andreas Mann on Aug 5, 2010 4:27 PM

1 REPLY 1
Read only

andreas_mann3
Active Contributor
0 Likes
355

this part

AND ( AAUART IN S_AUART AND AAUART NE 'ZORB' AND

AAUART NE 'ZKA' AND AAUART NE 'KA' AND

AAUART NE 'ZRE' AND AAUART NE 'RE' AND

AAUART NE 'ZKE' AND AAUART NE 'ZKR' AND

AAUART NE 'ZCR' AND AAUART NE 'ZDR' )

seems to be contradictorily - please check it

and use ranges or select-options for the literals 'ZKA' . etc.

hope that helps

Andreas

Edited by: Andreas Mann on Aug 5, 2010 4:27 PM