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

Similar Messages

  • How to show the internal batch number for order in make to order scenario

    Hi !!!
    Gurus!!
    I am working on make to order scenario .For delivery of order may I see the batch no.of esch order.
    How system will get the internal number batch.
    I have config. batch management.
    What should be the next process.
    Regards,
    Nitin

    Hi,
    QI am working on make to order scenario .For delivery of order may I see the batch no.of esch order.
    A. Yes you can see batch number for each order
    QHow system will get the internal number batch.
    A. there are two possiblities assign you batch number at production order before release or assign batch or each GR at the time of executing GR transaction.
    QI have config. batch management.
    A.In Material master you also have to tick for batch managemnt relevency
    QWhat should be the next process.
    A. Consult again if any thing missing
    Regards,
    Syed

  • Automatic capture of batch number as production order

    Hi,
       How to make the order number to capture automatically while confirming the production order.As it should pick the order by default in the goods movement screen.
    Abap coding and user exit to perform this.
    Regards,
    Deepak GS

    Hi,
    Batch determination uses characteristic values assigned to batch classification for sorting batches and make a selection. A series of customization steps should be completed for batch determination. You will have to learn by reading SAP help or threads throughout this forum. Check out threads below.
    [Batch Determination within Production Orders;
    [Automatic Batch Determination;
    narainmech wrote:
    >      But for GR it is ok, if this is required for the child item level , while doing the confirmation when the issue is happening in bith cases 1. BAckflush 2. Manual issue
    >
    > Here in both the case it should pick the batch automatically.
    According to which criteria do you want batches to be selected, order name? Are there batches in the system named after production order for components of the order? No matter what, selection must be based on batch characteristics.
    Regards.

  • Assign component / batch number at subcon PO

    hi,
    We are using external batch number assignment to manage our components. At component overview of subcon PO, we will maintain the issue storage location and batch number of the component. However, we fount out error meesage ME178
    , batch XXX not maintained for material XXX, will pop up if the batch master hasn't been created at that storage location. This has impacted on our biz process. That means we can't assign batch and storage location before we transfer the stock to that storage location. I tried to switch this system message to warning. But I can't locate it. Any input? Thanks.
    Regards,
    Nancy

    Hi Nancy,
    Use transaction "SE91" to check the message. In your case the message class appears to be ME, so enter ME and go for display. Now you would get all the messages setup for the class ME.
    Find message number 178 and hit where used button, it would list in which program/include this message is called.  There you define it as "W" instead of "E".
    Hope this helps you,
    Regards,
    Prasobh
    Reward your points if this was useful

  • How to generate an incrementing batch-number per set number of rows

    Hi,
    How could you generate an incrementing batch-number per set number of rows for a table in SQL?
    The returned result set of the SQL query should show a preceding batch number per row set and incremented by 1 for the next row set.
    Eg, you want to start the batch_number by 1 for the first three returned rows of the table and than increment by 1 for the next three rows.
    The result set would look like:
    BATCH_NO, TAB_COL1, TAB_COL2, TAB_COL3, TAB_COL4, ..
    1, ...
    1, ...
    1, ...
    2, ...
    2, ...
    2, ...
    3, ...
    3, ...
    3, ...
    etc.
    Cheers.

    Many thanks guys, I would have never thought about these options.. Yes the reason for adding the preceding batch number has to do with migrating data from a source table where we only can grab small sets of rows at the time to bring across to a target table.
    Cheers.

  • How to automatically assign the message processor

    Hello,
    I have configured ppoma_crm organizational model and I have configured rule 13200137 responsibility assign. The system assigns support team automatically and correctly but message processor is always initial. Anybody knows that how I can assign message processor automatically from ppoma_crm organization model. Thank you for your efforts.

    Hi
    Thats a manual step
    the team member logs in to solman and choose the ticket with new status then they goto change mode assign to themself
    and change status to in process
    but in case you have only one person you can do the config for message processor determination via partner determination proc etc
    hope it clarifies
    regards
    prakhar

  • How to automatically assign Newsletter Subcribers to a Secure Zone?

    I want my Newsletter subscribers to access my Media Downloads page. The Media Downloads are on a secured page. How can I automatically assign Newsletter subscriber to a particular secure zone.
    Thank you for your prompt assistance,
    James Vernon

    Dave,
    I did find a solution in the Web Forms page. I created a Newsletter Form again with assignment to my Member Secure Zone then I added the Newsletter check box at bottom of Form.
    This seems to work when I check the CRM customers and the Customer I entered into the Newsletter Form is assigned to both the Newsletter and the Secure Zone. It requires for your Newsletter Form to have a Username and Password Field or the Newsletter Form user will not be able to Login later.
    Thank you for pointing me back to the Web Forms again,
    James Vernon

  • Is it possible to automatically assign a prefix number for all outgoing cal

    Is it possible to setup a rule in in my contacts to automatically dial a specific prefix (my long distance provider number) before calling any long distance number?
    It's kinda annoying having to first dial my long distance provider and then manually type in the long distance number (after having to memorize it first) I want to call.
    One way around this is to key in the long distance number manually into all my long distance numbers, but I'd rather not do that.
    Any suggestions on how to go about this?

    try this app

  • How to get MCH1-CHARG(batch Number)?

    Hi all,
    I have input fields MATNR ,
                                 MVT_TYPE( Movement type),
                                Plant
                                equi-sernr 
                             in the Excel file.
    How can I get the MCH1-CHARG?
    Thanks,
    Suresh

    Hi CSaba,
    I have a data in the excel with the earlier mentioned fields in Excel.
    All these Excel records are passed into BAPI_GOODSMVT_CREATE to create Material Document let us say 30 records.
    As we are not passing the CHARG field. This BAPI creates internal CHARG for all Items(30 records).
    Now my requirement is to get the internal CHARG for each item into memory variable and get that all CHARG in my calling report.
    and then i have to update MCH1-LICHA based on CHARG.
    how can i do this? Is there any Enhancement Point/EXIt/BADI?
    Sample code more helpful 4 me.
    Please help..
    I hope you can help me?
    Thanks alot..
    Suresh

  • How to automatically add colons to number in a cell

    Hello
    I'm working on a video script. I have 2 columns with Time Code that I have to enter. The format is 8 numbers. (00:00:00:00).
    Is there a way to have the colon automatically inserted so I don't have to keep manually inserting it? If it's a sript, the script would have to follow when I export to XLS format.
    Thanks for any help
    Allen

    In the Inspector, go to the Cell Inspector (the "42" tab).
    Choose Custom for the cell format.
    Click on the arrow on the format that is there (the #,###).
    Make it two digits with no separator and show zeros for unused digits.
    Copy that format (highlight it if it isn't already highlighted then Command-C)
    Type a colon then do a paste (command V).
    Repeat until you have 00:00:00:00
    Give it a name and click OK
    12345678 will display 12:34:56:78
    123456789 will display as 123:45:67:89
    0 will display as 00:00:00:00
    I tested an export to Excel and the format came through okay for me.

  • Automatic Batch number for rETURN Delivery

    When creating a return delivery, without reference, we need to manually input the batch number (assign dummy?).
    Is it possible to have the system automatically generate the batch number for returns? If yes, how?

    Hi,
    No you can' not
    even if you try to create Return delivery without refrance to any order then it will determine item category,but gives error that,
    YOU CAN NOT ADD THIS ITEM IN DELIVERY
    because it is controlled by delivery document category
    the delivery document category is - T (Returns delivery for order)
    Kapil

  • Automatic Batch number

    Dear PP Gurus,
    How to  do Auto matic batch number activation.
    PLease tell me the step by step procedure.
    The requirment is . The client wants that batch should come automatically  as per below logic .
    For example  a Batch is    A31039542
    In th above batch   A  denotes  Month ,    Posting  date is    31  , Year is 2010, and a work order number is 9542
    A   is Jan month
    B   is Feb month
    c    is  March month
    How to map this logic?

    Dear,
    Yes you can do this with Enhancement   SAPLV01Z      CFCs for internal batch number assignment.
    With customer exit EXIT_SAPLV01Z_001, you can replace the standard number range (object, sub-object, number range and year) with a user-defined standard number range. Later, this is used for the determination of a new batch number.
    You change an assigned batch number using the exit EXIT_SAPLV01Z_002 .batch number would assigned according to self-defined rules.
    Also refer these links,
    http://help.sap.com/saphelp_40b/helpdata/ru/dc/1d4b6e5733d1118b3f0060b03ca329/content.htm
    Re: Batch Management In Production
    Regards,
    R.Brahmankar

  • Unable to automatically assign batch numbers in REM upon confirmation

    Hi expert,
    I did all required configuration:
    the batch level is Material (OMCT)
    internal Batch Number Assignment is activated (OMCZ)
    Define Batch Creation For Mvt is set to C for type 131
    Define Initial Creation of Data for Batch Master Transactions is set to C for my material type
    the indicator for BM is set in the view Plant Data/Storage Location for the material/SL
    But still when I confirme my production with MF42N, the system is not getting the internal number range for the batch.
    Any idea why?

    Hi,
    U can assign the Batch Number for Finished material at MFBF screen . For Components batch number check with "Postwith correction screen " of MFBF. If u set bacth search procedure at REM profile batch number for Components will com automatically.
    SPRO>LOGISTICS>PRODUCTION>REM>BACKFLUSHING>MAINTAIN GLOBAL SETTINGS FOR CONFIRM. & LIS> BATCH CLASSIFICATION ACTIVE FIELD.
    Use the field value as '1'.
    Maintain Batch search procedure at control data tap2 in REM profile (SPRO) which will be assigned to Finished material.
    Please try and come back.
    Regards,
    R.Brahmankar

  • How can get batch number in process order?(T-code: COR1, COR2)

    Please tell me step by step process it will be better to me the solve my issue.
    When End-user uses alread existed batch number,
    Pop-up Message,
    "Your batch number is already exist.
    Are you creating new batch number?"
    If the answer is "No",
    System still uses that batch number.
    And User-Exits, or bodies don't exist this time.
    How can I get this batch number When saving in process order?
    I uses User-Exits "SAPLV1ZE" in Batch Number Check,
    "PPCO0007" and "PPCO0001" in saving process order.
    I know "PPCO0001" has all information about process order,
    but I can't get batch number to "PPCO0007" From "PPCO0001" by using Memory ID.
    Cause PPCO0007 happens before PPCO0001.
    (ref. PPCO0007 can stop saving in process order.)
    I want to know how can I get batch number when pop-up message's answer is "No".
    I have to send this batch number  to PPCO0007 by using Memory ID.
    Please, help me.
    Edited by: Jamie White 99 on Mar 15, 2010 11:00 AM

    Dear,
    Could you please clear your requirement in brief?
    You don't want to use the existing batch number or want to assign external batch number or want unique batch number?
    Use SAPLV1ZE and EXIT_SAPLV01Z_003 where you can replace the proposed number range with external interval defined by yourself.Also using EXIT_SAPLV01Z_004 you can define your own checking rule.
    Further information can be obtained from the documentation on the enhancements
    Also refer this link,
    http://help.sap.com/saphelp_40b/helpdata/ru/dc/1d4b6e5733d1118b3f0060b03ca329/content.htm
    Re: External batch assignment( Manual)
    Regards,
    R.Brahmankar

  • Batch number assignment after receiving the goods

    iam receiving material from my customer say 100 units, i am giving the challan that i have received 100 units from u, and the challan number will be 1000
    After that i have to do job work, in the received 100 units,
    50 i have to issue to production for different process
    50 i have to issue to production for different process
    I need to give batch number for first 50 units issued to production as 1000A
    I need to give batch number for second 50 units issued to production as 1000B
    How to do in SAP???

    Hi
    You can assign the same material to different batches
    To assign a batch number to the material, you can do it during goods issue in MIGO or MB1C.
    In MB1C, you can give the Material , Qty and Batch No. Use movement type 561 to receive the goods in MB1C
    Hope this helps
    regards
    Anand

Maybe you are looking for