cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Business One linking delivery tables to OBTN table

former_member666435
Participant
0 Kudos
1,797

Hi all,

Appreciate if someone could tell me how to join the delivery tables (ODLN, DLN1) to the batch table (OBTN).

Best Regards,

Daniel

Accepted Solutions (0)

Answers (1)

Answers (1)

mgregur
Active Contributor
0 Kudos

Hi,

try the following:

SELECT * FROM DLN1 T1 
INNER JOIN ODLN T2 ON T1."DocEntry" = T2."DocEntry" 
INNER JOIN OITM T3 ON T1."ItemCode" = T3."ItemCode"
LEFT JOIN IBT1 T4 ON T1."DocEntry" = T4."BaseEntry" AND T1."ObjType" = T4."BaseType" AND T1."LineNum" = T4."BaseLinNum" AND T1."ItemCode" = T4."ItemCode" AND T1."WhsCode" = T4."WhsCode" AND T4."Direction" = '1'
LEFT JOIN OBTN T5 ON T4."ItemCode" = T5."ItemCode" AND T4."BatchNum" = T5."DistNumber" AND T3."ManBtchNum" = 'Y'

BR,

Matija