Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Problem with join

$
0
0

Hello experts,

 

 

I am having problem with a join statement. Here is the join statement I used.

 

  SELECT VBRK~FKDAT VBRP~VKBUR TVKBT~BEZEI VBRK~SPART TSPAT~VTEXT VBRK~VBELN VBRK~FKART VBRK~KUNAG KNA1~NAME1 VBRK~KUNRG KNA1~NAME1 VBRK~VKORG VBRK~VTWEG VBRK~NETWR

     VBRK~SFAKN

    INTO TABLE IT_FINOVR

      FROM

     VBRK JOIN VBRP ON ( VBRK~VBELN = VBRP~VBELN )

     JOIN TVKBT ON ( VBRP~VKBUR = TVKBT~VKBUR )

     JOIN KNA1 ON ( VBRK~KUNRG = KNA1~KUNNR ) JOIN TSPAT ON ( VBRK~SPART = TSPAT~SPART ) WHERE VBRK~FKDAT IN SO_FKDAT AND TVKBT~SPRAS = 'EN' AND VBRK~KUNAG = KNA1~KUNNR AND TSPAT~SPRAS = 'EN'.

 

 

Here in the first join I am comparing VBRK(Header Table) and VBRP (Item Table) based on the condition VBRP~VBELN = VBRK~VBELN where VBRK~FKDAT is in SO_FKDAT (select options field). But the problem I am getting is, I am getting duplicate billing document numbers (VBELN) which should not happen as I am comparing VBRK~VBELN and VBRP~VBELN. Can anyone point out my mistake in the join statement.

 

Regards,

 

 

Marina.


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>