Skip to Content

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

Bin Allocated Serial/Batch Number in GRPO

Hi experts,

I'm trying to have an SAL query to in SAP 9.0 with Bin allocated GRPO.

The objective is to list out the Serial and Batch Number for each items, the result columns should be:

GRPO DocNum      |      Item Code      |     Quantity      |     BinCode     |      SerialNumber     |      BatchNumber

So far I have the below query to list out the first 5 columns.

select  OPDN.DocNum ,pdn1.ItemCode,

  OBTL.Quantity as Quantity , OBin.BinCode

from opdn inner join pdn1 on opdn.docentry = pdn1.docentry

inner join OITM on pdn1.ItemCode = OITM.ItemCode

inner join oivl on oivl.CreatedBy   = opdn.DocEntry

  and oivl.TransType = 20

  and oivl.ItemCode = pdn1.ItemCode

  and pdn1.LineNum = oivl.DocLineNum

left join OBTL on oivl.MessageID = obtl.MessageID

Left join OBIN on obin.AbsEntry = obtl.BinAbs

left join POR1 on pdn1.BaseType=22

  and PDN1.BaseEntry = POR1.DocEntry

  and PDN1.BaseLine = POR1.LineNum   

left join OPOR on OPOR.DocEntry = POR1.DocEntry

where opdn.DocNum >= '111'

And opdn.DocNum <= '111'

BUT, I cannot found the link between the above query with the Serial / Batch Number that has been allocated in the GRPO.

I tried to use the following query, but there will be row duplication in the result.

select  OPDN.DocNum ,pdn1.ItemCode,

  OBTL.Quantity as Quantity , OBin.BinCode

  ,OSRI.IntrSerial

  ,IBT1.BatchNum

from opdn inner join pdn1 on opdn.docentry = pdn1.docentry

inner join OITM on pdn1.ItemCode = OITM.ItemCode

inner join oivl on oivl.CreatedBy   = opdn.DocEntry

  and oivl.TransType = 20

  and oivl.ItemCode = pdn1.ItemCode

  and pdn1.LineNum = oivl.DocLineNum

left join OBTL on oivl.MessageID = obtl.MessageID

Left join OBIN on obin.AbsEntry = obtl.BinAbs

left join POR1 on pdn1.BaseType=22

  and PDN1.BaseEntry = POR1.DocEntry

  and PDN1.BaseLine = POR1.LineNum   

left join OPOR on OPOR.DocEntry = POR1.DocEntry

left join OSRI on OSRI.ItemCode = PDN1.Itemcode

  and OITM.ManSerNum = 'Y'

  and OSRI.BaseEntry = OPDN.DocEntry

  and OSRI.BaseType = 20

  and PDN1.LineNum = OSRI.BaseLinNum

left join IBT1 on IBT1.ItemCode = PDN1.Itemcode

  and OITM.ManBtchNum = 'Y'

  and IBT1.BaseEntry = OPDN.DocEntry

  and IBT1.BaseType = 20

  and PDN1.LineNum = IBT1.BaseLinNum

where opdn.DocNum >= '111'

And opdn.DocNum <= '111'

Any idea how to get the above results? Thank you in advance..

Best Regards,

Krisma

Former Member
replied

Hi Krisma,

check this thread

http://scn.sap.com/message/15284000#15284000

it is for inventory transfer and batch

if you need grpo and serial then

change the owtr to OPDN

and OBTN to OSRI

you dont need oivl unless you need the item valuation.

regards

edy

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