Batch Number Linking to Item in any document

Dear All,
I am struggling to find the actual link to Batch number allocation table ( OBTN) to actual document detail tables ( ORIN/RIN1) of particular Item.
I do not find any references in OBTN which belongs to the document detail table. I have noticed the same in Credit Memo, Delivery, Invoice documents if the item has serial numbers. GUI is allowing user to select Item serial numbers, which is considering as DistNumber, but how the entries in OBTN relates to document detail table, could not figure out.
I appreciate your help and need your help on emergency basis...
Regards,
K Sakthivel

Hi K Sakthivel........
Please try this code.....
Select * from ORIN T0 inner join RIN1 T1 on T0.DocEntry=T1.DocEntry
left outer join IBT1 I1 on T1.ItemCode=I1.ItemCode   and (T1.DocEntry=I1.BaseEntry and T1.ObjType=I1.BaseType)
left outer join OBTN T4 on T4.ItemCode=I1.ItemCode and I1.BatchNum=T4.DistNumber
Regards,
Rahul

Similar Messages

  • Serial Number Linking to Item in any document

    Dear All,
    I am struggling  to find the actual link to sernial number allocation table ( OSRN) to actual document detail tables ( ORIN/RIN1) of particular Item.
    I do not find any references in OSRN which belongs to the document detail table. I have noticed the same in Credit Memo, Delivery, Invoice documents if the item has serial numbers. GUI is allowing user to select Item serial numbers, which is considering as DistNumber, but how the entries in OSRN relates to document detail table, could not figure out.
    I appreciate your help and need your help on emergency basis...
    Regards,
    K Sakthivel

    Hi,
    You may check:
    http://forums.sdn.sap.com/thread.jspa?messageID=10349722#10349722
    http://forums.sdn.sap.com/thread.jspa?messageID=10423329#10423329
    Please close all your open threads or respond to others' posting.
    Thanks,
    Gordon

  • Derivation of batch number in Profitability Analysis for Sales document

    Hi Gurus
    We are trying to put Batch number in PA derived through sales order sales delivery document but due to timing issue like do not have billing document untill processed and PA derivation done
    scenario SA created with multiple line items
    Batch number can be seen in Delivery document number   
    Thanks in advance

    We are trying to put Batch number in PA derived through sales order sales delivery document but due to timing issue like do not have billing document untill processed and PA derivation done
    scenario
    SO created with no batch number
    In the Delivery split batch into two seperate lines with batch numbers in it
    PA post two seperate lines however unbale to map batch numbers
    Btach number exist in tables MSEG, LIPS and VBRP
    Unfortunately these postings happen after updating PA so not available for derivation in PA
    Thanks in advance

  • Updating Batch Number while delivery creation from sales document

    Hi Experts,
         I have to write code inside user exit MV50AFZZ which updates batch number during delivery creation. Suppose I have a sales having more than one line items. Each line item have different material numbers, and one material number may have more than 1 batch number. And all these batch numbers have to be updated for their corresponding material numbers. Batch  number corresponds to LIPS-CHARG. So how we can maintain values for this field more than once for a particular material number?

    Hi Pankaj,
    Were you able to update the Batch Number?
    What is the function Module that you used? and where exactly did you code in the logic?
    Thanks,
    RV

  • Stored Procedure for Batch Number Format and Block Duplicate Batch Number

    Hi Experts !
    I am new one in forum asking question.. I want Stored procedure for Batch Number Format. I want fix one Batch number format in Stored Procedure.
    Example :
    My Batch number format Like  BATCH00001 - It should be first five digit is text format and next five is Numeric.
    IF create Goods receipt PO or Goods receipt stage I create batch number like BATCH 00001 or any other number means don't add that document and also duplicated batch number also does not allowed. please give me the solutions. I am sorry for my bad english .

    Dear Nagarajan K.
                         Thanks for your replay ..
    IF @transaction_type IN ('A','U') AND (@object_type = '106' )
    BEGIN
    set @item = LEFT( @list_of_cols_val_tab_del, CHARINDEX(CHAR(9),  @list_of_cols_val_tab_del,1) - 1)
    set @batch = substring(@list_of_cols_val_tab_del, len(@item)+1, (CHARINDEX(CHAR(9),  @list_of_cols_val_tab_del,len(@item)+2)) - (len(@item)+1))
    --set @base =( select basetype from ibt1 where batchnum = ltrim(rtrim(replace(@batch,char(9),''))))
    set @count = (select count(*) from oibt quantity > 0 and where  batchnum = ltrim(rtrim(replace(@batch,char(9),''))))
    if @count > 1
    begin
    set @error = 1
    set @error_message = 'Please enter different Batch Code for batch ''' + @batch + ''' for item ' + @item 
    select @error, @error_message
    END
    END
                  I used above Stored Procedure. here we can use one batch number for different item but  i want to block one batch we should use one item and one time only after than we never use that batch number for same item and another item.
             After that I want format for Batch, we should follow unique Batch number for all items.

  • Listing Batch Number with transaction detail

    We use the Sales Order Usage Indicator to designate a Site location for order materials we supply to customers' building sites and I've written a report that lists component material details used in the Production orders created per sales order for each of those sites. What the user department would like is for the batch managed items detail to include the batch number associated with the material.
    However, I'm finding it difficult to find which file this batch number data is actually in. I've found some batch numbers in RESB (which I use to get the component material number and configured data) but out of the millions of records in there only about 66 have the batch number included in the record. The other files I've checked that include the batch number field do not have any data in it. It is at component level that the batch field should have a batch number included.
    Can anyone please advise as to where I can find the relevant data to complete my report.
    FYI, I start with getting Sales Orders with selected Usage Ind in from VBAK, then pick up relevant sales order item data from VBAP with joins to MARA and MAKT for basic material data.
    I get the Production order number from AUFK using the Sales order number and then I chain to RESB for the component material data using the Productioon order number. I pick up the batch field from RESB at this time but so far it has always been empty.
    Thanks very much
    Jim Jackson

    Thanks, Jurgen
    I was hoping to get away without using the MSEG file because of the size implications and resultant search time - as per BSEG on the financial side of things. 
    Anyway thanks for the confirmation of what I need. Much appreciated.
    Best regards
    Jim

  • Batch number auto generation nedded

    hi all,
                  i have a query that when i make a GRPO of 10 items with different qty, these items are set to batch on every transaction, then it will ask to enter the batch number of all item with the number of their quantity, is there any process to create these batch number automatically, is there any formatted search query for auto generation of batch number.
    even they are making GRPO by taking 100 items, it is very difficult to for them to to enter manually all the batch code.
    is there any provision to do the task by formatted search.
    revert back soon
    its very urgent
    regards
    sandip

    Sandip, 
    I have answered a few posts on this Forum about the different options.  Formatted searches can be considered but you will need to maintain a temp table.
    What is the real usage of the batch numbers in this business case?
    Suda

  • Assign batch and quantity to items of delivery (VL02n)

    Hi ppl,
    I have a file which has the delivery document number, item number, quantity abd batch details.
    I need open VL02n programatically, assign the corresponding quantity and batch number for each item as mentioned in the file.
    Please let me know how I can achieve this programatically.
    If I use BDC, then how will I do the recording for each item...the number of items can vary for each document.
    Please help.
    Regards,
    David.

    Hi, try function module: WS_DELIVERY_UPDATE.

  • Batch Number in A/R Invoice

    Hi All,
    How do you print Batch Number of an Item in A/R Invoice PLD?
    Thanks
    SV Reddy

    Hi SV,
    i think directly will not get the batch no field in PLD,
    sorry, i dont have any test(client) database. so try this way,
    Table -> INV1 - A/R Invoice- Row
    Column -> BatchNo.
    or
    Create the UDF and assign the FMS.
    i think, (get the batch no)FMS is not possible on A/R invoice .
    it is possible to Create the UPDATE Stored Procedure
    but you should not write the UPDATE Stored Procedure in SAP database.
    best way, Create the UDF and type the Batch No on A/R Invoice.
    ->> Open the A/R invoice(System) PLD and Save as the New PLD.
    ->> Create the UDF(Batch no) Field in Repetetive Area on PLD.
    Save as and Run the Print Preview.
    OR
    Try to Create a Query Report and design a QPLD.
    If you want to Create QPLD, Check the thread, will be get some idea or solution.
    Invoice details related to Serial Numbers 
    Re: Item Serial No. on A\R Invoice Report
    Re: Item Serial No. on delivery note PLD
    Regards,
    Madhan.

  • How to automatically assign a batch number

    Hello experts,
    Our customer have the "Manage Item by" settings on "Batches" and the "Management Method" settings on "On Release Only".
    He don't want to manually generates the batch numbers in Delivery Entry because he would like to have an automatic assignment of batch number like a progressive number for year.
    How can I achieve it using DI API ?
    I have tried to create a Delivery Document using the BatchNumbers object but I got the following error message "the batch number you selected doesn't exists".
    So I created a Goods Receipt for the batch number above and finally the delivery document has been created successfully.
    The issue came out is about the stock quantity for the itemcode because the Goods Receipt have increased it and as result I have the same stock quantity as before the delivery and of course it's not correct !
    I noticed that SAP B1 after the manually generation of batch number it creates a record on the OIBT table using an existing Good Receipt.
    How can I add a batch number in the OIBT table using DI API  without the need to create a Good Receipt ?
    Can someone help me ?
    It would be very appreciated.
    Many thanks for your time in advance.
    Best regards
    Andrea

    Hi,
    Try this code, May be it will help you
    Dim v_StockEntry As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenEntry)
                Dim v_StockExit As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit)
                Dim str_ProEntryNo As String = oDBDSHeader.GetValue("DocNum", 0)
                'Dim str_DocDate As String = CDate(frmProductionEntry.Items.Item("t_DocDate").Specific.Value).ToString("yyyyMMdd")
                Dim str_DocDate As String = Date.Now
                Dim intStockRowCount As Integer = 0
                Dim FGCost As Double = 0
                Dim RMCost As Double = 0
                Dim RMQty As Double = CDbl(oDBDSHeader.GetValue("U_TotRW", 0))
                '---  RM Exist
                v_StockExit.Comments = "Stock Exit For Production Entry(RM) Production-Entry No: " & str_ProEntryNo
                v_StockExit.DocDueDate = str_DocDate
                v_StockExit.Reference2 = str_ProEntryNo
                intStockRowCount = 0
                For i As Integer = 1 To oMatrix1.VisualRowCount - 1
                    intStockRowCount += 1
                    If intStockRowCount > 1 Then v_StockExit.Lines.Add()
                    v_StockExit.Lines.ItemCode = oMatrix1.GetCellSpecific("ItemCode", i).Value
                    v_StockExit.Lines.Quantity = oMatrix1.GetCellSpecific("Qty", i).Value
                    v_StockExit.Lines.WarehouseCode = oMatrix1.GetCellSpecific("WarCode", i).Value
                    'v_StockExit.Lines.AccountCode = AccCode
                    Dim qty = oMatrix1.GetCellSpecific("Qty", i).Value
                    qty = IIf(qty.ToString.Trim = "", 0, qty)
                    Dim cost = oMatrix1.GetCellSpecific("Cost", i).Value
                    cost = IIf(cost.ToString.Trim = "", 0, cost)
                    Dim PerQtycost = CDbl(cost) / CDbl(qty)
                    v_StockExit.Lines.Price = PerQtycost 'GetItemPrice(oMatrix1.GetCellSpecific("ItemCode", i).Value)
                    Dim ManBtchNum = getSingleValue("Select ManBtchNum  from OITM Where ItemCode='" & oMatrix1.GetCellSpecific("ItemCode", i).Value & "'")
                    If ManBtchNum.Trim <> "N" Then
                        Dim rs As SAPbobsCOM.Recordset = GFun.DoQuery("select * from OBTQ where ItemCode ='" & _
                                                                      oMatrix1.GetCellSpecific("ItemCode", i).Value & _
                                                                      "' and WhsCode ='" & oMatrix1.GetCellSpecific("WarCode", i).Value & _
                                                                      "' And Quantity > 0 order by SysNumber")
                        Dim count As Double = oMatrix1.GetCellSpecific("Qty", i).Value
                        For k As Integer = 0 To rs.RecordCount - 1
                            If CDbl(rs.Fields.Item("Quantity").Value) >= count Then
                                Dim ss = rs.Fields.Item("SysNumber").Value
                                v_StockExit.Lines.BatchNumbers.BatchNumber = _
                                getSingleValue("select DistNumber from OBTN where ItemCode ='" & _
                                               oMatrix1.GetCellSpecific("ItemCode", i).Value & _
                                               "' and SysNumber ='" & rs.Fields.Item("SysNumber").Value & "'")
                                v_StockExit.Lines.BatchNumbers.Quantity = count
                                v_StockExit.Lines.BatchNumbers.Add()
                                Exit For
                            Else
                                v_StockExit.Lines.BatchNumbers.BatchNumber = _
                                getSingleValue("select DistNumber from OBTN where ItemCode ='" & _
                                               oMatrix1.GetCellSpecific("ItemCode", i).Value & _
                                               "' and SysNumber ='" & rs.Fields.Item("SysNumber").Value & "'")
                                v_StockExit.Lines.BatchNumbers.Quantity = rs.Fields.Item("Quantity").Value
                                v_StockExit.Lines.BatchNumbers.Add()
                                count = count - CDbl(rs.Fields.Item("Quantity").Value)
                            End If
                            rs.MoveNext()
                        Next
                    End If
                Next
                If oMatrix1.VisualRowCount > 1 Then
                    If v_StockExit.Add() <> 0 Then
                        StatusBarWarningMsg("Unable To RM Post Stock Document.......   " & oCompany.GetLastErrorDescription)
                        Return False
                    End If
                End If

  • How to Define Batch Number

    Hi,
    Regarding the batch management,I have a question ..can we design a special batch number when we use auto generate batch number?Do you have any suggestion for it?thanks ..
    for example:
    if the PO use work center A1,it will get a batch number 201110A1+00001
    if the PO use work center A2,it will get a batch number 201110A2+00001

    Please refer following link to get user exit of MIGO:
    [Re: User Exit for MIGO]
    [Re: User Exit for Migo?]
    [User Exit in MIGO or MB1A for reason for movement]
    [User exit at  MIGO transaction]

  • BAPI to delete Batch number

    Hi,
    Can anyone let me know the BAPI to delete the Batch Number when ever a particular Material document is reversed for a year.
    (Batch Number that was created as part of Material Document Creation and Each Batch Number is used only for one Material Document number)
    Points for sure..
    Thanks,
    Ponraj.s.

    Ponraj,
    BAPI_BATCH_CHANGE              Change Batch   
    BAPI_BATCH_CREATE              Create Batch   
    BAPI_BATCH_DELETE              delete batch
    Amit.

  • Maximun line items per CO document

    Hello,
    Which is the maximum number of line items per CO document?
    Thanks,

    I am really not sure about MM.
    But in FI and CO, maximum is 999.
    There are also some enhancement available for this functionality to increase the number of documents.
    If you browse through internet, you will find some source code (sample) for this.
    Regards,
    Ravi

  • Inventory Audit Report with Batch Number

    Hi all.
    I am trying to build a query that similar to the inventory audit report but with batch number. I want to know which batch number of each item is being charged out in deliveries or goods issue and which batch of item is being received. I am using SAP B1 2007A. Following is the query that I used to generate the inventory report (warehouse, itemcode, description, price, opening balance, receipt, issue, closing)  but I don't know where to get the batch number information for it.
    Declare @StrtDate Datetime
    Declare @EDate Datetime
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Group nvarchar(10)
    Declare @Whse nvarchar(10)
    Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >= @StrtDate)
    Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <= @EDate)
    Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = 'QA01')
    Select
    @Whse as 'Warehouse',
    a.Itemcode,
    max(a.Dscription) as 'Description',MAX(a.Price) as 'Price',
    sum(a.OpeningBalance) as 'OpeningBalance',
    sum(a.[IN]) as Receipt,
    sum(a.OUT) as Issue,
    (sum(a.OpeningBalance) + sum(a.[IN]) - Sum(a.OUT)) as Closing,
    MAX(a.Price) * (sum(a.OpeningBalance) + sum(a.[IN]) - Sum(a.OUT)) as ClosingValue
    from(
    Select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.Price,
    (sum(N1.inqty)-sum(n1.outqty)) as 'OpeningBalance',
    0 as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate < @FromDate and N1.Warehouse = @Whse and N1.ItemCode Between '1C2K50NBAC' AND '7S2N40ADAM'
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as 'OpeningBalance',
    sum(N1.inqty) as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and
    N1.Inqty >0
    and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as 'OpeningBalance',
    0 as [IN],
    sum(N1.outqty) as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and
    N1.OutQty > 0
    and N1.Warehouse = @Whse
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode
    Order By a.Itemcode
    I wish to create the report like Inventory audit report merge with the batch number transactions report.
    Thanks.

    Dear Shobah, it can be possible by some custom report. Try some complementary bi solution for better analysis with SAPB1.

  • RF LM03/LM05 verification on batch number

    Hi All,
    LM03/LM05 (putaway/pick by TO) does not seem to have verification field for batch number.
    Do you know any standard SAP RF transaction that supports verification on batch (for batch managed material) during putway and pick?
    Many Thanks!
    Steven

    Hi,
    Does this note work for you ?
    789651 - Lean WM: TO for batch mat cannot be confirmed by CONFIRM_TO
    Regards,

Maybe you are looking for

  • Problem with syncing audionooks

    Hi I have an iPod shuffle 4th generation .. I have a problem with syncing audiobooks. I have the audiobook file at my desk. When I drag and drop to the audiobooks section in iTunes it doesn't go to it's right place. Instead, it goes to the music sect

  • Creation of release order possible during release strategy

    Hi folks, we have currently contract and purchase order release strategy parallel in place. Both are working fine. We are using quantity and value contracts. Quantity contracts are changed frequentely by the business; with every change (adding new it

  • Just need to know

    javascript:smilie(':O') i know this is a problem on the k7n2 delta mobo's But how far out is the temp senor for the cpu. the only reason i ask is when the cpu is running at normal spec " barton 2500" 11 x 166 fsb the temp is 45c at load when the cpu

  • Acrobat x download does not start

    i click the link nothing. can download any of their other trial software, just acrobat x will not start. i click the button, nothing.

  • Oracle Zip and Send Mail

    Hi, I was just wondering if there is a pl/sql code that would do the following: 1. Zip a file (originally generated from DB query written to Unix OS using UTL_FILE package). 2. Place a password on the file. 3. Send the file as an attachment in mail.