Archived discussions are read-only. Learn more about SAP Q&A

Error While running Query in SAP B1

Hi All,

I am creating one Q-PLD so i have to run the following query. Query is working fine in SQL Server

But while running with SAP B1 showing error 'Cant convert into varchar to small int'

Query is

Select (select M1.[GroupName] from OCRG M1 where M1.[GroupCode] = T2.[GroupCode]) As 'State', 
T0.[CardCode] AS 'Customer Code',T0.[CardName] AS 'Customer Name',T4.[U_SchNo] As 'Scheme Ref No',
T1.[U_Itmgrp] AS 'Item Group',T1.[U_TAdvAmt] AS 'Actual Adv',T0.[DocDate] As 'Doc Date',
T0.[DocNum] AS 'Invoice No.',T1.[U_QtyKgs] AS 'Qty In KG',T1.[U_CAdvRate] AS 'Advance Rate',
T1.[U_DedAdvA] AS 'Actual Adv. Adj.',T1.[U_BalAdvA]- T1.[U_DedAdvA] As 'Balance'
from [dbo].[OINV] T0  INNER JOIN [dbo].[INV1] T1 ON T0.DocEntry = T1.DocEntry 
INNER JOIN [dbo].[OCRD] T2 ON T0.CardCode = T2.CardCode 
INNER JOIN [dbo].[OCRG] T3 ON T2.GroupCode = T3.GroupCode
LEFT OUTER JOIN [dbo].[@CUSTAMT] T4 ON T0.[CardCode] = T4.[U_Custcode] 
And T1.[U_Itmgrp] = T4.[U_Itemgrp]
Where T0.[DocDate] between '[%0]' And '[%1]' And 
T0.[CardCode] between '[%2]' And '[%3]'
And T1.[U_Itmgrp]  between '[%4]'  And '[%5]'   ' This line i am getting error 
     ' If i this line will remove error will disappear or i will pass parameter directly like 'ItemGrop1'
And T3.[GroupName] between '[%6]' And '[%7]'


Firos C

Not what you were looking for? View more on this topic or Ask a question