Adding new Batch Number to AP Invoice

i am working on adding new batch number to an existing AP IN by SDK function. I try the following codes, no errors prompt but also nothing updated. Can anyone advise me how to add new batch number to AP Invoice? Many Thanks!
Dim ErrMsg As String
Dim ErrCode As Integer
Dim opch As SAPbobsCOM.Documents
opch = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices)
opch.GetByKey(5)
opch.Lines.BatchNumbers.Add()
opch.Lines.BatchNumbers.BatchNumber = "3"
opch.Lines.BatchNumbers.Quantity = 3
ret = opch.Update
If ret <> 0 Then
      oCompany.GetLastError(ErrCode, ErrMsg)
      MsgBox(ErrCode & " " & ErrMsg)
End If

Hi ,
Steps to do:
1.Create an User Defined Field on Document Row Level:
Name: Serial / Batch Details
Type: Alphanumeric
Structure: Text
- Create a Formatted Search which will populate the data from Delivery note.
- Put the UDF into the Print Layout of Delivery Order.
Displaying Batch Details
2.   Decide with information is needed from Batch details to be printed out on A/R Invoice
On Bacth Details form (Inventory\Item Management\Batches\Batch Details) we can see all the possible details.
- Batch Number
- Delivered Quantity
- Expiration Date
3.    Build the formatted search SQL command.
By a SQL cursor driven result set we can build a text which contains the list of the delivered batch details separated by new lines. The relations between A/R Invoice and Delivery note is defined on A/R Invoice Form. in columns 45, 46, and 43 
declare @batch as nvarchar(100)
declare @txt nvarchar(max)
set @txt = ''
declare P cursor for SELECT T0.[BatchNum] + space(1)
  + cast(cast(T1.[Quantity] as decimal(19,2)) as nvarchar)
  + space(1) + case when T0.[ExpDate] is null then '' else convert(nvarchar,T0.[ExpDate],102) end
  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 '\n'@batch +','
fetch next from P into @batch
end
close P
deallocate P
select @txt
4. Defined the formatted search on the A/R Invoice.

Similar Messages

  • Stock transfer of QM stock thereby creating a new batch number

    Dear Experts,
    I have searched for this content but didn't get content which match my requirement.
    My client has placed a requirement.When they receive a material against a purchase order through movement type 101 they receive it to quality inspection stock.After quality inspection this material is taken to unrestricted area through movement type 321.
    Now after this material comes to unrestricted area,this material is again subject to quality inspection.Quality testing is done after a particular period.
    Next quality testing date is calculated based on this formula:-321 movement type posting date + quality inspection interval days maintained in material master.
    i.e:-If for a material 321 movement type is 16th July 2014 & if quality inspection interval days for that material is maintained as 365 days then next quality inspection of that material will be after a year.
    Now client has placed a requirement when this material comes to quality testing,15 days prior to quality testing this material should move to quality inspection area from the present unrestricted area thereby generating new batch number for that material.
    This changes the client will view in MMBE.
    Gurus Please help as I'm new to QM.
    Kind regards,
    Pradeesh.P

    Hi,
    This is not possible,you cannot generate a new batch number through recurring inspection.
    If you require a new batch number then during stock posting in UD you post it to new material,in your
    case this will be the same materiaal and you give new batch number.
    In this way a batch material has come for inspection and after inspecting it you are changing the
    batch number of the material.
    CSN

  • No New Batch number creation at the time of Material Transfer Movement(309)

    We are upgarding from 4.6C to ECC6.0. We have an issue in regards with the material movement type 309. At the time of creating the material tranfer using the same material as issuer and receiver, the same plant and storage location ( this process is used by the business to diferentiate batches).
    In 4.6C a new batch number is created automatically when 309 movement is posted; stock and characteristics transfered are allocated at the new batch created automatically.
    The same case in ECC6.0 does not create a new batch as done in 4.6C. We have looked for any SAP note or forum discussion without success.
    If anybody has an answer for this issue, let us know.

    As a matter of fact these configuration has been checked before, additionally we compare configuration at 4.6C and ECC6.0 and it is the same but the new batch creation (for this specific case) is working at 4.6C, not at ECC6.0.

  • Batch Number on AR Invoice Printout

    Hello Experts,
    Can somebody please guide me, I have a requirement of having Batch number on AR Invoice Printout. I am unable to do that, help required please.
    Thanks & Regards,

    It is quite dificult to do so using PLD (you can show batches easily when reocrding an invoice which is not coming from an delivery, otherwise, batch data is stored in delivery tables).
    I've done this using crystal reports. You can get batch information true sql or even Subreports (one take information when batch is recorded during invoice creation, another one takes information when batch is recorded during delivery creation), etc.
    I recomend you to use Crystal Reports, definitively

  • Batch Number in Proforma Invoice

    Hi All,
    Our customer has a requirement for proforma invoice for order in export sales and they want to give a batch number and want to see it in proforma invoice before delivery. Is it possible to do it? and how to maintain it if it is possible?
    Thanks for your help in advance.
    Regards,
    Sinan

    Hi
    If you determine batch in SO, you can populate the field CHARG in table VBRP for the proforma invoice with copy rules. But as usually batch is determined in delivery, if it's your case, I don't understand the reason to write batch in proforma invoice, because the reasonable is that the batch that you write won't be the same that you will send.
    I hope this helps you
    Regards
    Eduardo
    Edited by: E_Hinojosa on Aug 10, 2011 1:06 PM

  • Printing new phone number in old invoice

    Hi all
    The phone number of one particular sales office was changed this week. Now the customer is asking to change the old phone number printed in one of the invoice created last month to new telephone number. How do we do it? Shall I cancel the invoice and recreate so that the new phone number gets picked from Sales Office address? or any other method pls
    Regards

    I dont think you need recreate the invoice again.if you are maintaining PH number in sales office addres than it would be automatically picked new one once you give print from issue output to.
    for more you may take ABAPes help to check or confirm  from where phone number is getting picked in form.
    yes VF11 is the transaction for cancel the billing document.
    but before canceling the docs please make sure from where it is getting picked actually.

  • New batch number for Draft Good Receipt Purchase Order

    Hello,
    I'm using SBO 8.81
    I'm looking for the table that contains the information about the batch number of a draft good receipt.
    DRF16 contains quantity of batch, but when itu2019s new batch, they are not in OBTN yet (in the table, SBO define object type as 10000068 while itu2019s 10000044 for existing batch)
    The query defined here  is not working as the batches are not in OBTN yet (not in stock)
    I used the profiler trying to understand in which table these data are recorder, without success.
    Any idea ?
    Thank you for your help
    Sébastien
    Edited by: Sébastien Danober on Aug 24, 2011 6:31 PM
    Sorry, wrong forum, I recreate it under SDK

    Hi Sébastien,
    The link is from DRF16 to ODBN:
    select * from DRF16 T0 inner join ODBN T1 on T0.ObjAbs = T1.AbsEntry
    DRF16 has a zero-to-many relationship with DRF1 (ie draft lines)
    Kind Regards,
    Owen

  • Adding new phone number to contacts in address book on IOS4

    Has anyone else come across those bug? When I try and press the add symbol to add a new phone number or extra number ie. Home or work as the default in new contact is mobile, the + symbol doesn't respond.
    So infuriating for such an essential app. For the most my upgrade is ok although a few apps now don't open.

    I see a number if the number of cards in the group more than fills the page. However, if there are blank lines on the page, there is no number.

  • The keypad does not come up while adding new phone number to contact

    I use iphone4. After I upgraded to ios7 finding lot sof issues. The biggest irritating issue is if I want to add a new number (after dialing this number or receiving a call from this number or receiving a sms from this number) and press add to contact, the contact place holders come up but if i click on the typing place the soft keybord does not come up. Funny thisg is it comes up sometimes. But not most of the time ! Lets solve this first before we get onto the more nuanced issues.

    Try going to settings to General to reset to 'reset all settings'
    This should do the trick!
    Good luck

  • Query on batch number in Invoice

    Hi Experts,
    I would like to get the batch number picked during the Delivery document and shown in the print layout in A/R Invoice. Unfortunately, PLD of Invoice with Batch will not show the Batch numbers as they're already linked in the DR document.
    My workaround is to attach a FMS in the INV1 field line to get the batch number when the Invoice is copied from the DR.
    Any help with the query is very much appreciated.
    We are using 8.81 PL7.
    Thanks,
    Don

    Hi Don..........
    Please check this........
    Select (Case When T1.BaseType=15 then I1.BatchNum else I11.BatchNum end) 'BatchNum', T0.DocNum 'Inv. No'      
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OCTG T2 ON
    T0.GroupNum = T2.GroupNum LEFT Join INV12 T3 On T3.DocEntry=T0.DocEntry LEFT JOIN OITM T4 On T4.ItemCode=T1.ItemCode LEFT JOIN OCHP T5 On T4.ChapterID=T5.AbsEntry
    LEFT Join DLN1 T6 On T6.DocEntry=T1.BaseEntry and T6.LineNum=T1.BaseLine
    left outer join IBT1 I1 on T1.ItemCode=I1.ItemCode   and (T6.DocEntry=I1.BaseEntry and T6.ObjType=I1.BaseType)
    left outer join OBTN T8 on T8.ItemCode=I1.ItemCode and I1.BatchNum=T8.DistNumber
    LEFT Join WTR1 T16 On T16.DocEntry=T1.BaseEntry and T16.LineNum=T1.BaseLine
    left outer join IBT1 I11 on T1.ItemCode=I11.ItemCode   and (T16.DocEntry=I11.BaseEntry and T16.ObjType=I11.BaseType)
    left outer join OBTN T18 on T18.ItemCode=I11.ItemCode and I11.BatchNum=T18.DistNumber
    LEFT Outer Join OWHS T20 On T20.WhsCode=T0.Filler
    Run this query you get Invoice No. and its Batch.....
    You may insert required c0olumns also.....
    Regards,
    Rahul

  • Creation of Batch number

    Hi Experts,
    I have a probelm with the Transaction MIGO to restrict the ignore the batchnumber entered by the user.
    If the user is not enter the batch number, then i can generated the new number by using the following 2 UE's
    EXIT_SAPLV01Z_001 (ZXVBZU01)  & EXIT_SAPLV01Z_002 (ZXVBZU02) and it is working fine.
    If the user enters , then System first check that whether it is already exist in the Database . If it won't find then automatically it is considering the same number.Which needs to be stopped.
    Any body has an idea about this requirement, to ignore the user entered value.
    Actually, there are 2 more exists, EXIT_SAPLV01Z_011& EXIT_SAPLV01Z_012 there i can't change the value of the batch number.
    Any suggestion or Any alternative way or Any idea Please......?
    Warm Regards,
    Vijay

    Hi,
    I think you can restrict by using FM EXIT_SAPLV01Z_001, this i copied the FM documentation for your reference. Just read the FM documentation you will get an idea
    You can restirict by using automatic generation using number ranges
    <<Function module Documentation>>
    Functionality
    You can use this customer function call (CFC) to replace the standard number range (object, subobject, number range, and year) with one of your own. This is used subsequently to determine a new batch number.
    Number assignment is carried out using the central number assignment.
    The communication structure X_BNCOM contains the application data known up to this time. You can extend this structure in the DDIC using structure BNCOMZ.
    Using the parameter CUST_NO_INTERNAL, you can suppress the number assignment function. Then you can either generate a batch number in function module EXIT_SAPLV01Z_002 using your own criteria or suppress the entire number assignment function.
    Using the parameter MESSAGE_WHEN_AUTO, you can decide if a dialog box is to appear before a new number is assigned. This only happens during online processing.
    Example
    You can define internal batch number assignment according to your requirements via the enhancement SAPLV01Z with the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002
    SAP delivers a total of 6 examples for batch number assignment:
    1. Copying the production order number to the batch number
    2. Copying the sales order number to the batch number
    3. Material-type-dependent batch number assignment
    4. Material-number-dependent batch number assignment
    5. Including the date in the batch number
    6. Including the plant number in the batch number
    For examples 1 and 2 you have to use the exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002.
    For examples 3 and 4 you have to use the exit EXIT_SAPLV01Z_001.
    For examples 5 and 6 you have to use the exitEXIT_SAPLV01Z_002.
    For a detailed description of the examples, see below.
    Prerequisites
    1. Internal batch number assignment via the customer exit is activated:
    To do this, in Customizing, choose Logistics general -> Batch management -> Batch number assignment -> Activate internal batch number assignment.
    2. Maintaining the number range object
    Two number range objects are provided for batch number assignment:
    Standard number range for batch number assignment BATCH_CLT
    Number range for material-type-dependent or material-number-dependent batch number assignment BATCH_MAT
    Activities
    1. Use the SAP enhancement SAPLV01Z:
    a) In transaction CMOD, create either a new project or use an existing project.
    b) Add the SAP enhancement SAPLV01Z to the project.
    2. Copying the example code:
    a) Choose Component.
    b) Choose Change.
    c) Choose:
    EXIT_SAPLV01Z_001 for examples 1-4
    EXIT_SAPLV01Z_002 for examples 1-2 and 5-6
    d) Choose Edit -> Copy SAP source text.
    The example code is copied to the relevant table in the function module exit.
    e) To copy the example, remove the comment symbol before the include it pertains to.
    3. Activate the project.
    When you activate the project, the enhancement with the function module exits EXIT_SAPLV01Z_001 and EXIT_SAPLV01Z_002 comes into effect.
    Examples
    Example 1
    Copying the production order number to the batch number
    When a batch is produced, the process order number or production order number is copied as the batch number. This type of assignment is only possible in connection with process orders or production orders.
    Outwith an order, a number range is determined for batch number assignment. In this example, it is the standard number range BATCH_CLT.
    If the order has not yet been saved (for example, when a number is assigned when the order is created), a temporary number is created. A message appears prompting you to save the order. The system then assigns an order number which is accepted as the batch number.
    The system checks whether a batch already exists with this number. If this is the case, the system aborts internal batch number assignment with a corresponding error message.
    Note:
    In this example, note that the include LXVBZB21 in EXIT_SAPLV01Z_002 has to be activated at the same time, as actual batch numbers are not assigned until this is activated.
    Example 2
    Copying the sales order number to the batch number
    If a batch number is assigned in connection with a sales order, the sales order number is accepted as the batch number.
    If there are no sales orders, a number range object is defined with a number range from which the batch number is taken. If a batch already exists with this sales order number, the batch number is assigned externally.
    Note:
    In this example, note that the include LXVBZB22 in EXIT_SAPLV01Z_002 has to be activated at the same time before actual number assignment can take place.
    Example 3
    Material-type-dependent batch number assignment
    In the number range object BATCH_MAT a separate sub-object is created for each material type. Note that the number range object is maintained accordingly or batch number assignment cannot take place.
    For example, if the material "flour" belongs to raw materials, it is maintained in the sub-object ROH, and the batch number is taken from the same number range as the material "eggs" which also belongs to the raw materials group.
    Example 4
    Material-number-dependent batch number assignment
    In material-number-dependent batch number assignment, materials that are handled in batches must be maintained in the table BNMAT, which specifies the assignment of the material to the number range.
    If there is no assignment in the table, the system aborts batch number assignment. An error message appears informing you that batch number assignment is not possible and specifying the table that has to be maintained.
    Each material number is assigned a number range object, a sub-object, and a number range in the table BNMAT. This is how each material receives its own batch number range.
    The number range object BATCH_MAT is an example of this. The material numbers are divided into groups via their material type that match the sub-object. Each material number is then assigned its own number range by table BATCH_MAT. The number ranges used must be maintained in the number range object.
    Examples 5 and 6
    Including the date or plant number in the batch number
    The number ranges for the batch numbers must be defined in a way that ensures that no characters are overwritten by the templates.
    Parameters
    X_BNCOM
    CUST_NO_INTERNAL
    NR_RANGE_NR
    OBJECT
    SUBOBJECT
    TOYEAR
    MESSAGE_WHEN_AUTO
    MESSAGE_DONE
    Exceptions
    CANCELLED
    Regardas
    Krishna

  • Creation of new batch while transfer posting

    Dear Experts,
    Please guide me to meet the following requirement:
    I am posting the Goods Receipt for the production order to the Quality stock by using indicator X in T Code MB31. The material is batch Managed and QM is not implemented.
    Now after the Quality Inspection this batch is posted to Un-restricted Stock with movement type 321. Here the requirement is to create a new batch whereas system is setting the original batch (batch in QI stock) as receiving batch. My requirement is to have a new batch number here either automatically (incremental for internal number range) or could be entered manually.
    But when I enter a new batch number the system throws an error message "Batch MATERIAL_NUMBER PLANT SLOC BATCH_NUM does not exist". Message no. M7042. The requirement is to post the stock to a new batch here.
    Experts, kindly help me clear my understanding as where I am going wrong. How to be able to create a new batch here. Also how to generate a new batch number automatically during the goods movement.
    Thanks & Regards,
    Rohit.

    Hi Rohit,
    Sometime back, I have copied the below information from this forum for ref. Just check the usefulness of this information for your requirement.
    You can further enquire about this with other gurus in this forum, before taking any decision.
    Configure Customer Exits for intern. batch number assignment
    You can use SAP enhancement SAPLV01Z for internal batch number assignment. This enhancement contains two function module exits that you can use to define number ranges or templates for batch numbers.
    u2022     EXIT_SAPLV01Z_001. You use this exit to replace the number range object and/or interval proposed by the system with your own number range object and/or interval.
    In addition, you can, for instance, stop the system from assigning an internal number depending on the material or plant. You can also use this exit to stop the dialog box from appearing.
    u2022     EXIT_SAPLV01Z_002. Using this exit, you can either change the number assigned by the system, or assign your own number.
    Note
    Both exits contain a communication structure with application data from the respective business transaction (plant or material type, for example). If you need further information, such as the time, the user name or the date, you must include them yourself in one of the exits.
    The system always checks whether the assigned batch number already exists in the system. If it does, it terminates the function without assigning a batch number.
    Example
    In function module exit EXIT_SAPLV01Z_001, the system uses the material type to determine number range interval XY. This number range is then used to determine number 0000100123 as the next batch number .
    In function module exit EXIT_SAPLV01Z_002, the final batch number 'ABCD100123' is determined from batch number 0000100123 and plant ABCD. The system suppresses the leading zeros.
    If you do not use a sequential counter for the batch number, you can skip internal number assignment in exit EXIT_SAPLV01Z_001 to specify your own batch number in exit EXIT_SAPLV01Z_002.
    Activities
    1. Implement the required enhancement.
    Either create a new project or use an existing one.
    2. Activate the project.
    Your enhancement works only after the project has been activated.
    Madhava

  • Inspection type 01 - inspection lot creation based on vendor batch number

    Hi Guys,
    this topic has been discussed several times here, but I was not able to find a suitable answer for my question.
    I am facing the folowing requirement:
    I have activated inspection type 01 for a raw material.
    I am receiving a firs goods receipt from vendor A with vendor batch number 0001.
    The system creates its own goods receipt batch number 0546 based on internal numbering.
    A new inspection lot is created.
    I am posting a second goods receipt from vendor a with vendor batch 0001.
    The system creates a new batch number 0547 based on internal numbering.
    A new inspection lot is created.
    I do not want to get the second inspection lot, because I received vendor batch 0001 before and I am assuming it has been inspected or is in inspection.
    Option 1: Post the second goods receipt against the first internal batch number created.
    I am aware of this need at the moment, but a user is not always checking if there is an internal batch with the same vendor received before.
    Can I customize the system to create inspection lots based on the fact that the vendor batch number was received before?
    Or do I have to use an exit and some ABAP code to get the wanted result?
    Thanks for your advice in advance.

    You need to use one of the enhancements that Do-Wook has suggested.  There is no standard SAP way to suppress the inspection based on the vendor batch number.
    With the first enhancement you use the system to check for a previously received vendor batch and if one is found, then that batch number is proposed and not the next one from the numbering series.  In this case, the lot isn't created than due to the inspection lot control of the inspection type.
    With the second enhancement you check the vendor batch number and if it's been received you suppress the inspection lot creation and the stock goes right to unrestricted.
    You'll probably need to do one or the other.  Myself, I prefer the first enhancement.
    Craig

  • 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

  • GRN batch number assignment error?

    Dear All,
    We have configured that whenever we do GRN batch number should generate automatically but while doing GRN if i don't save or post the document also it is generating batch number i mean to say without saving a PO GRN one batch number is generated and if i go in to MIGO screen for same PO then new batch number getting assigned.
    so anyone tell me where have set wrong and how to check and correct it?

    Hi,
    If you are coming out of the transaction completely by using F3, then system won't create any batch, but after entering all the details if you are clicking on "Check", then system will create a batch number, this is standard behaviour only.

Maybe you are looking for