cancel
Showing results for 
Search instead for 
Did you mean: 

Batch Numbers Tables SAP 8.8

former_member203638
Active Contributor
0 Kudos

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

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f81618-0ab4-2c10-0eab-f5255034e...

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.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member204969
Active Contributor
0 Kudos

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.

former_member203638
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

There are some change in table name in SAP 8.8