Quantcast
Channel: SCN: Message List - SAP MaxDB
Viewing all articles
Browse latest Browse all 2539

How To Link Tables In Query ..Please Help Im New To Sap

$
0
0

Hi,

 

How to link CRD1.City  Into this Query ?Please Help Im New To Sap ...

 

 

 

 

Declare @FrmDate as date

Declare @ToDate as date

Declare @series as Varchar(10)

Declare @Location as nVarchar(10)

 

 

/* SELECT FROM [dbo].[OINV] S1 WHERE   */ SET  @FrmDate = /* S1.DocDate */  '[%0]'

/* SELECT FROM [dbo].[OINV] S2 WHERE   */ SET  @ToDate = /* S2.DocDate */  '[%1]'

/* SELECT FROM [dbo].[NNM1] S3 WHERE   */ SET  @series = /* S3.SeriesName */  '[%2]'

/* SELECT FROM [dbo].[OLCT] S4 WHERE   */ SET  @Location = /* S4.Location */  '[%3]'

 

 

if(@series='') set @series='%'

 

 

 

 

Select SALE.[Bill No.],SALE.[Bill Date],SALE.Party ,SALE.[Sales Employee],

SALE.[Item Name],SALE.Quantity,SALE.TaxCode,SALE.Rate,SALE.Discount,

SALE.[Round Off],SALE.Total ,SALE.Amount,

RTN.[Return Bill No.],RTN.[Return Date],RTN.[Return Party Name],

RTN.[Return Qty] ,RTN.[Return Rate]  from

(select  OINV.DocEntry,INV1.LineNum, NNM1.SeriesName + '/'+CAST( OINV .DocNum AS NVARCHAR) as [Bill No.],

OINV.DocDate[Bill Date], OINV.CardName [Party],OSLP.SlpName[Sales Employee]

,INV1.Dscription[Item Name],INV1.Quantity,INV1.Price[Rate] ,

INV1.LineTotal[Total],INV1.TaxCode,(INV1.LineTotal+INV1.VatSum)[Amount],

OINV.DiscSum [Discount],OINV.RoundDif [Round Off] from OINV

inner join INV1 on oinv.DocEntry=inv1.DocEntry

INNER JOIN OLCT ON INV1.LocCode=OLCT.Code

inner join NNM1 on NNM1.Series=oinv.Series

left join OSLP on OSLP.SlpCode=OINV.SlpCode

where OINV.DocDate between @FrmDate and @ToDate

and NNM1.SeriesName like @series

and OLCT.Location like @Location

)SALE

left join

(

Select ORIN.DocEntry,NNM1.SeriesName + '/'+CAST( ORIN .DocNum AS NVARCHAR) as [Return Bill No.],ORIN.DocDate[Return Date] ,

ORIN.CardName [Return Party Name],RIN1.DocEntry [DocLine],RIN1.BaseEntry

,RIN1.BaseLine,RIN1.BaseOpnQty ,RIN1.BaseQty,RIN1.Quantity [Return Qty],RIN1.Price [Return Rate]  from ORIN

inner join RIN1 on ORIN.DocEntry = RIN1.DocEntry

inner join NNM1 on ORIN.Series = NNM1.Series

inner join OLCT on RIN1.LocCode = OLCT.Code 

where ORIN.DocDate between @FrmDate and @ToDate

and OLCT.Location like @Location

)RTN on SALE.DocEntry = RTN.BaseEntry  and SALE.LineNum = RTN.BaseLine


Viewing all articles
Browse latest Browse all 2539

Trending Articles



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