on 04-28-2011 9:40 PM
Hi Experts, In SAP 2005, we use copy function from deliveries to AR invoices and also a query for BatchNum,Date and Attribute on user defined fields under row level, and works great.
Example of BatchNum Query SAP2005A
declare @batch as nvarchar(100)
declare @txt nvarchar(max)
set @txt = ''
declare P cursor for SELECT T0.[BatchNum]
FROM OIBT T0 INNER JOIN IBT1 T1 ON T0.ItemCode = T1.ItemCode and T0.WhsCode = T1.WhsCode
and T0.BatchNUm = T1.BatchNum
WHERE T1.[BaseEntry] =$[$38.45.0] and T1.[BaseLinNum] =$[$38.46.0]
open P
fetch next from P into @batch
while @@fetch_status = 0
begin
set @txt = @txt + @batch +','
fetch next from P into @batch
end
close P
deallocate P
select @txt
And Now, i have an issue, we upgrade to SAP 8.8 PL20, but this query is very slow when we copy the delivery to AR Invoice.
My Partner Sent me a SAP NOTE 1455278 - Batch/Serial Print templates changes in 8.8 and told me that i have to re design the query.
I searched Information about this, and i found the next article (Page 19) and it says that the old tables have been replaced for new tables.
Batch Number
Old Tables OIBT, IBT1, OSRD
New Tables OBTN, OBTQ, OBTW, OITL, ITL1
My doubt is: wich tables of the new ones have to be joined so i could get the details of the batchs in the delivery and also they could be transfered to A/R INVOICE. Can anyone help me please?
Best regards,
Alessandro.
I used this FROM clause to get the batch information connected to a sales order:
FROM dbo.OITL l
INNER JOIN dbo.ITL1 bt ON bt.LogEntry = l.LogEntry
inner join OBTW w on w.MdAbsEntry=bt.MdAbsEntry and l.LocCode=w.WhsCode
inner join OBTN b on bt.MdAbsEntry=b.AbsEntry
Where l.ApplyType=17 and l.ApplyEntry=@de
I think you can start with it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks István, but it doesn't work, what am I doing wrong? INNER JOIN?
declare @batch as nvarchar(100)
declare @txt nvarchar(max)
set @txt = ''
declare P cursor for
SELECT T0.[DistNumber]
FROM OBTN T0 INNER JOIN OITL T1 ON T0.ItemCode=T1.ItemCode
WHERE T1.[BaseType] =15 and T1.[BaseEntry] = $[INV1.BaseEntry] and
T1.[BaseLine] = $[INV1.BaseLine]
open P
fetch next from P into @batch
while @@fetch_status = 0
begin
set @txt = @txt + @batch +','
fetch next from P into @batch
end
close P
deallocate P
select @txt
regards,
Alessandro.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.