Skip to Content
0
Former Member
Jan 14, 2012 at 05:47 AM

Select Query Fetching same records multiple time

449 Views

Hi ABAPers,

I have an issue where the select query is fetching the same records more than one time for particular sale order.

Kindly help to solve the issue.

Thanks in advance..

Here is the Select Query:-

SELECT  VBAK~VKORG VBAK~VTWEG VBAK~VBELN VBAK~KUNNR
               VBAK~ERDAT VBAK~LIFSK VBKD~INCO1 VBKD~INCO2
               VBAP~MATNR VBAP~ARKTX VBAP~MATKL VBAK~BSTNK
               VBAK~BSTDK VBAK~KNUMV VBAP~UEPOS VBAP~POSNR
               VBAP~KWMENG VBAK~VDATU VBAP~VRKME VBAK~ERNAM VBAK~WAERK 
  INTO CORRESPONDING FIELDS OF TABLE IT_PENDING FROM VBAK
  INNER JOIN VBAP ON VBAK~VBELN = VBAP~VBELN
  INNER JOIN VBKD ON VBAK~VBELN = VBKD~VBELN
  WHERE
  VBAK~VBELN IN SO_VBELN AND
  VBAK~ERDAT IN SO_ERDAT AND
  ( AUART EQ 'OR' OR AUART EQ 'ZEO' OR AUART EQ 'TA' OR AUART EQ 'LP' OR AUART EQ 'ZFOC' ) AND
  VKORG IN SO_VKORG AND
  VTWEG IN SO_VTWEG AND
  SPART IN SO_SPART AND
  KUNNR IN SO_KUNNR AND
  MATNR IN SO_MATNR AND
  MATKL IN SO_MATKL AND
  ABGRU EQ '' AND LIFSK <> '35'.

Edited by: Suhas Saha on Jan 14, 2012 3:42 PM