13 Replies Latest reply: Jun 9, 2009 10:26 AM by Sebastian John RSS

Duplicate records

Sebastian John
Currently Being Moderated

Hi

 

I have written one query like follow, but some records are duplicating please let me know what is problem

 

  SELECT  catsdb~pernr

          pa0001~ename

          t001p~btext

          t528t~plstx

  •          t542t~atx

          catsdb~raufnr

          aufk~kdauf

          afih~qmnum

          vbak~vkbur

          t003p~txt

          aufk~ernam

          aufk~auart

          catsdb~catshours

          t554t~atext

          catsdb~workdate

          catsdb~status

          catsdb~lstar

  •          catsdb~lstnr

          catsdb~raufnr

          catsdb~werks

          catsdb~autyp

          catsdb~awart

          catsdb~lgart

          t503t~ptext

          catsdb~skostl

          catsdb~rkostl

          aufk~objnr

          catsdb~laeda

          catsdb~laetm

          catsdb~aenam

          catsdb~apdat

          catsdb~apnam

          crtx~ktext_up

          t528t~plans

          t503t~persk

   INTO CORRESPONDING FIELDS OF TABLE i_output

   FROM catsdb

   INNER JOIN pa0001  ON catsdbpernr  EQ pa0001pernr  AND

                         pa0001~endda  GT sy-datum

   INNER JOIN aufk    ON catsdbraufnr EQ aufkaufnr

   INNER JOIN afih    ON afihaufnr    EQ aufkaufnr

   LEFT  JOIN crtx    ON crtxobjid    EQ afihgewrk    AND

                         crtxobjty    EQ afihpm_objty AND

                         crtx~spras    EQ sy-langu

   LEFT  JOIN vbak    ON vbakvbeln    EQ aufkkdauf

   LEFT  JOIN t001p   ON t001pwerks   EQ pa0001werks  AND

                         t001pbtrtl   EQ pa0001btrtl

   LEFT  JOIN t528t   ON t528tplans   EQ pa0001plans  AND

                         t528t~sprsl   EQ sy-langu      AND

                         t528t~otype   EQ 'S'

   LEFT  JOIN t554t   ON t554tawart   EQ catsdblgart  AND

                         t554t~sprsl   EQ sy-langu

  •   LEFT  JOIN t542t   ON t542tansvh   EQ pa0001ansvh  AND

  •                         t542t~spras   EQ 'EN'

   LEFT  JOIN t003p   ON t003pauart   EQ aufkauart    AND

                         t003p~spras   EQ sy-langu

   LEFT  JOIN t503t   ON t503tpersk   EQ pa0001persk  AND

                         t503t~sprsl   EQ sy-langu

   WHERE catsdb~workdate IN s_workdt      AND

                         pa0001~werks  EQ p_werks

   ORDER BY catsdbpernr catsdbraufnr.

 

Regards

Sebastian John

Actions