Creating Multiple Invoice, First details repeat on every invoice

Im creating a addon were in a select statement will create a multiple invoice with 2 details each ,The correct number of records were save, but we notice looping this into several invoice the first details of every invoice are the same, the second details for every invoice are ok
pls see codes
-- start  of  loop -
vProcess = oMatrix.Columns.Item("Include").Cells.Item(nLnDtls).Specific.checked
If vProcess = True Then
Dim sDateAsOf As String
Dim nProcAmt As Integer
oCompany.StartTransaction()
oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Service
oInvoice.CardCode = oMatrix.Columns.Item("CardCode").Cells.Item(nLnDtls).Specific.value()
oInvoice.Comments = " Data Interface = " & oMatrix.Columns.Item("LineId").Cells.Item(nLnDtls).Specific.value().ToString & " of " & oMatrix.Columns.Item("Terms").Cells.Item(nLnDtls).Specific.value().ToString
oInvoice.NumAtCard = oMatrix.Columns.Item("AcctNo").Cells.Item(nLnDtls).Specific.value()
oInvoice.DocDate = Date.Now.ToShortDateString
oInvoice.TaxDate = oMatrix.Columns.Item("DueDate").Cells.Item(nLnDtls).Specific.value()
oInvoice.DocDueDate = oMatrix.Columns.Item("DueDate").Cells.Item(nLnDtls).Specific.value()
'-- Invoice Details for Monthly Amortization--
sDateAsOf = oMatrix.Columns.Item("DueDate").Cells.Item(nLnDtls).Specific.value().ToString
nProcAmt = oMatrix.Columns.Item("PrinDue").Cells.Item(nLnDtls).Specific.value()
oInvoice.Lines.ItemDescription = "Remaining balance as of: " & sDateAsOf
oInvoice.Lines.AccountCode = "4101010"
oInvoice.Lines.LineTotal = nProcAmt
oInvoice.Lines.BaseLine = 1
oInvoice.Lines.SetCurrentLine(1)
oInvoice.Lines.Add()
prevPrinDue = prinDue + nProcAmt
prinDue = nProcAmt
Deferred Interest oInvoice.Lines.ItemDescription = "Deferred Interest Income For : " & oMatrix.Columns.Item("DueDate").Cells.Item(nLnDtls).Specific.value()
oInvoice.Lines.AccountCode = "2102030"
oInvoice.Lines.LineTotal = oMatrix.Columns.Item("IntrDue").Cells.Item(nLnDtls).Specific.value()
oInvoice.Lines.BaseLine = 2
If oInvoice.Add 0 Then
MsgBox("Error " + oCompany.GetLastErrorDescription())
Else
'Update flag
oRsSave = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
strSave = "UPDATE @CPI_LOA1 SET U_flag=1 WHERE @CPI_LOA1.LineId = "
strSave = strSave & oMatrix.Columns.Item("LineId").Cells.Item(nLnDtls).Specific.value() & " AND @CPI_LOA1.DocEntry = " & oMatrix.Columns.Item("DocEntry").Cells.Item(nLnDtls).Specific.value()
oRsSave.DoQuery(strSave)
End If
oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
End If
nLnDtls = nLnDtls + 1
Case Else
nLnDtls = nLnDtls + 1
End Select
--- end loop
I hope some could help me to solve this problem
Thanks
Loren

Hi Loren,
Try this,
oInvoice.Lines.ItemDescription = "Remaining balance as of: " & sDateAsOf
oInvoice.Lines.AccountCode = "4101010"
oInvoice.Lines.LineTotal = nProcAmt
oInvoice.Lines.BaseLine = 1
'oInvoice.Lines.SetCurrentLine(1)  <------- remove this line
oInvoice.Lines.Add()
Regards
Edy

Similar Messages

  • Creating multiple invoices

    Hi,
    I would like to create multiple invoices for a sales order which has multiple line items, for eg:
    if the sales order is havig 10 items, i want the system to create 10invoices,
    and this is for a Order related billing.
    I have an idea of doing this by writing routine with a piece of code at the item level in the OR to F2 copy controls, and guess it should work.
    If you have any better solution for this or any oss notes , request you to share with me.
    Thanks,
    SR

    Dear Syed
    If <b>you would like to implement at Sales Org level</b>, no need to writing routine and all.  Just follow the IMG Path - SD -> Billing -> Billing Docs -> Country specific features.
    Here you can see an option "<i>Maintain maximum Number of Billing Items</i>" where you can enter so that for that particular sales organization, irrespective of your sale order line items, there will be an invoice split item wise.
    Alternatively, in <b>VTFL</b> copy control, select the respective item category and tick the blue lens on top.  Now pick the tab "<b>Data VBRK/VBRP</b>" and <b>assign 351</b>.
    I think your requirement can be met with either of the above.
    Thanks
    G. Lakshmipathi

  • One order with multiple lines in OM is creating multiple invoices

    Application: Oracle 11i (11.5.3)
    Modules implemented: GL, OM, AR, AP, PO and CM
    Business Requirement:
    Our client would like to create Order consisting of multiple lines in Order Management.
    The Orders created in OM with multiple lines could be booked, picked, released and transferred
    over to Accounts Receivable. On transferring over the Orders from Order Management to Accounts
    Receivables using Auto Invoice process the Order should create ONE invoice with multiple lines.
    Moreover, for the multiple lines created on an invoice deferred revenue could be applied.
    ( eg. An order is placed for software and support. The support is to be invoiced all at once but revenue deferred to 1/12
    recognized each month as revenue is earned.)
    Right now we are getting two invoices. It is putting the deferred revenue item on a seperate invoice. Is this normal
    functionality? How can I get both on one invoice.
    thanks

    Hello Monique,
    Well you can have one invoice generated for an order with multiple lines. This is possible by changing some rules in Account Receivables. Use the grouping rules under setups->autoinvoice in AR. You can club your invoices based on any of the columns of ra_interface_lines_all. Hope this works for you.
    Arvind

  • One order-multiple invoices

    Single order-how can we create multiple invoices based on items.
    order contains 5 items.
    invoice it appears 5 items(this is a order related billing process).
    how can i first make an invoice of first two items and later with 3 items.
    can this facility is there in sap standard.
    Thanks in advance

    Hi Sameer,
    There must be reason for splitting of billing document.
    If that reason is pertainig to different payer, billing date, or terms of payment then your invoice will be splitted automatically.
    You just process your orders through transaction VF06.
    Reward points if it helps.
    Regards
    Karan

  • Multiple Invoice Batches

    How do I create multiple invoice batches with
    a single submission of Payables open interface import.

    Hi Chris,
    standard functionality of oracle does not allow you to do that ....
    You either validate Invoice batches one by one .... or you execute the Invoice Validation program for all Invoice Batches ....
    However i can suggest an workaround if your are not making use of the Pay Group feature ...
    Pay group is a value that we configure in advance and assign it to the Invoices or the Invoice Batches ....you can see this value as one of the parameter in the Invoice Validation program .....
    This is how the workaround works ...
    1) You create a dummy value for a Paygroup ..
    2) You assign this dummy value to the Invoice Batches that you want to validate ...
    3) Run the Invoice Validation program leaving the Invoice batch name parameter value blank and select the dummy value in the Paygroup field .....
    4) Verify the results ....
    Regards,
    Ivruksha

  • Multiple Invoice Creation

    Hi All,
    I want to create Multiple Invoice Creation through BAPI or FM. For this invoice PO is the Reference.
    As per requirement i have multiple PO in container, at one shot i want to create invoice realted PO as the reference.
    Thanks
    Amit

    hi,
    I am trying in another way - creating one proforma invoice for multiple deliveries. and with that proforma invoice trying to create excise invoice.
    But i am facing problem in creating proforma with multiple deliveries because of DIFFERENT NUMBER RANGE IN HEADER (delivery)AT FOREIGN TRADE --- UNDER ORGANIZATION --- NUMBER OF FOREIGN TRADE DATA - ( which is internally assigned by the system)
    If i can get where this number is assign my problem is solved
    K.S.Rao

  • Deliery with multiple invoice

    Dear sap gurus,
    1.how to create multiple invoice for a single delivery.
    2. end user point of view what is the difference between sap 4.6c and ecc version:
    AWAITING FOR YOUR REPLY.
    venkat

    Hi
    In item category the billing relevence should be set to K in VOV7
    After completing the delivery when you di VF01 the delivery no will automatically appear
    Dont enter or execute instead choose selection list in the application tool bar
    In that you can see the delivery items and quantities in the editable mode
    There you can select the items and quantities both
    If a delivery doc has 3 items and if you want to bill only 2 items you can do that
    Suppose the delivery qty is 100 and you want to create that as 3 bills say 50 and 30 and 20 you can do that
    Thus you can make multiple invoices
    But item category setting is must
    Regards
    Raja

  • How to create sales return with multiple invoices

    Hi ,
    I am creating a sales order return with reference of billing document using FM SD_SALESDOCUMENT_CREATE, if i give one Billing document as a reference document it is creating document perfectly.
    But my Requirement is to create one Return sales order with multiple invoices.
    I tried to pass reference document no's in Item level , but it take first reference document number only , for that reference document only return is creating.
    Can you any one help me how to create this.
    Thanks in advance
    Swapna.

    Hello Venkat,
    As I know it is not possible to create a single return order for multiple invoices in the background.
    It is possible in the foreground by following the below steps.
    1) Goto VA01 --> enter the Sales order type and Sales area.
    2) Press F8 or click on create with reference, provide the first invoice.
    3) Now the main screen would appear, displaying line items from Invoice1.
    4) Without going back, again goto path, Sales document -> Create with reference
    5) Enter second invoice2. and the items from invoice2 will also appear in the Sales order line item.
    ------ Enter as many number of invoices by repeating the above step--------------------
    6) Press save, so one sales order is created for multiple invoices.
    Regards,
    Thanga

  • How can i use row set iterator to create multiple dummy detail rows upfront

    Hello i am new to ADF and jdeveloper and have a Forms 9i/PLSQL background.
    I have a 1 to many master to detail view link and 2 vo's one for each of the master and detail table.
    I am trying unsuccsessfully to create 7 unique detail rows up front to populate at a later stage.
    I have created a master record with primary key being staff number and week ending date.
    i then use code below to try and create 7 detail records - P.S i have trimmed it to the first 2 for demonstration.
    I am using
    RowSetIterator rsi = this.mydetailVO.getRowSetIterator();
    Row newRow1=rsi.createRow();
    newRow1.setAttribute("Staff Num","123456A");
    newRow1.setAttribute("Week_Ending_Date", "2010-01-01");
    newRow1.setAttribute("Claim_Date", "2010-01-01");
    newRow1.setAttribute("Day", "Sun");
    rsi.insertRow(newRow1);
    Row newRow2=rsi.createRow();
    newRow2.setAttribute("Staff Num","123456A");
    newRow2.setAttribute("Week_Ending_Date", "2010-01-01");
    newRow2.setAttribute("Claim_Date", "2010-01-02");
    newRow2.setAttribute("Day", "Sat");
    rsi.insertRow(newRow2);
    However it does create two rows but it always writes over the first row with the details of the second row so they are not unique.
    How can i get a new unique row inserted with different details to the firat and how then do i access it uniquely.
    Thanks

    John thanks for reply.
    I have tried the following and still i get 2 rows created but the first one gets overwritten with the last one. I'm confused as to why the inbuilt insert row doesnt move it on to the next available row. Any idea what i'm not doing in between inserting rows?
    ViewObject vo1 = this.getmyVO1();
    vo1.executeQuery();
    Row newRow1 = vo1.createRow();
    newRow1.setAttribute("Staff Number","123456A");
    newRow1.setAttribute("Week_end_date", "2010-04-04");
    newRow1.setAttribute("Date", "2010-04-01");
    newRow1.setAttribute("Day", "Sun");
    vo1.insertRow(newRow1);
    Row newRow2 = vo1.createRow();
    newRow2.setAttribute("Staff Number","123456A");
    newRow2.setAttribute("Week_end_date", "2010-04-04");
    newRow2.setAttribute("Date", "2010-04-03");
    newRow2.setAttribute("Day", "Sat");
    vo1.insertRow(newRow2);
    P.S Yes they are dates but i made them strings for the time being until i get this working thanks for noticing.
    Edited by: user13012264 on 20-Apr-2010 04:19
    Edited by: user13012264 on 20-Apr-2010 04:20

  • Possible bug when creating multiple detail view objects

    using jdev 11.1.1.0.0 to build jsf/adf applications. I wanted to report what seems like a bug in 11g. I have a parent table which has two child tables. After creating the appropriate entities, associations, views, and view links, the app module looks like this:
    MasterView
    --DetailView1
    --DetailView2
    The two detail view objects are on the same level, they are both direct children of the Master view.
    Here's what's happening:
    1) I create the master entity/view objects (MasterView)
    2) I create one of the detail entity/view objects (DetailView1).
    3) I create the association and view link to establish relationship between MasterView and DetailView1. Everything works fine.
    4) I create the entity/view objects for second detail view (DetailView2)
    5) When I attempt to create a second view link (based off an association) to establish the relationship between MasterView and DetailView2, the query clauses of the Create View Link wizard (screens 4 and 5) do not get created properly. I finish the wizard and save. Not only does this view link not get created properly, but in the process the query clauses that were defined in the first view link between MasterView and DetailView1 are wiped out. This will break any coordination between master and detail views in both the app module tester and runtime. Has anyone seen this problem?

    fyi, it looks like this issue has been resolved with jdev 11.1.1.0.2 (Update 2)

  • How can I create a cron schedule that repeats every 2 weeks on Mondays?

    I need to create a cron schedule that repeats every 2 weeks on Mondays. Cronmaker.com doesn't have the cron expression for this. Please advice.
    Using calendarSchedule I can do this,
    var trigger = TriggerBuilder.Create()
    .StartAt(new DateTime(2012, 11, 19, 12, 0, 0).ToUniversalTime())
    .WithCalendarIntervalSchedule(x => x.WithIntervalInWeeks(2))
    .Build();
    But where do  I specify it should be the 2nd monday?
    mayooran99

    Cron expressions available in Quartz.net library, which is used to schedule jobs through .Net code
    mayooran99
    Hi mayooran99,
    Welcome to MSDN forums.
    Since this is a 3rd-party library, we recommend that you directly contact the provider for help, or post your question in their own forums.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to create an invoice from multiple sales doc.

    Hi,
    how to create an invoice from multiple sales doc.
    thanx,
    sourav

    hello, friend.
    assuming that your settings in VTFA and VTFL allow, you can create 1 invoice for many sales orders or deliveries by using VF04.  choose all documents that apply and click "collective billing document". 
    you can also click on "simulation" if you want to test if the combination is possible and the system will give you a split analysis if this is not possible.
    regards.

  • Every delivery nos having same sales order should create single invoice.

    Hello All,
    My Business requirement is :
    For particular Order type if the deliveries belong to the same sales orders, then Routine allow creating Single invoice else it should spilt the invoice according the deliveries belonging to different sales orders.
    Before this routine is called i have to check conditions like 'delivery type' and sales area.
    So, I have copied routine FV60C001 , added conditions as per requirement. But how to code this requirement is my issue.
    Could anyone please suggest how to achieve this.
    Regards,
    Meena

    Hi,
    Check SAP Note 11162 - Invoice split criteria in billing document to seach other possible causes.
    Regards
    Eduardo

  • How to create multiple accouting documents for one invoice for diff curr

    Hi experts/gurus,
    I have a requirement where we need to create two two different accounting documents for one invoice. The scenario is this:
    1) We are exporting goods to oversea customer, as such the currency is bill in USD
    2) We also have transportation charges using another condition type, we need to capture this charges/accrual in local currency which is MYR.
    Currently, the system will automatically convert the transporation charges to USD when we create the invoice and the accounting document will be generated in USD for both sales and transport charges.
    is there a way to fullfil the above requirement, any setting in condition type or any user exists we can used to create hte accounting documents.
    Any ideas/input is highly appreciated, points will be awarded

    Hi Wan,
       The following user exits are available in report SAPLV60B for transfer to accounting (function group V60B): So please go through these.
    ·EXIT_SAPLV60B_001: Change the header data in the structure acchd
    You can use this exit to influence the header information of the accounting document. For example, you can change the business transaction, "created on" date and time, the name of the person who created it or the transaction with which the document was created.
    ·EXIT_SAPLV60B_002: Change the customer line ACCIT
    You can use this exit to change the customer line in the accounting document. This exit is processed once the ACCIT structure is filled in with data from document header VBRK.
    ·EXIT_SAPLV60B_003: Change the customer line in costing
    The customer line is filled in differently for costing. You can use exit 003 to influence the ACCIT structure.
    ·EXIT_SAPLV60B_004: Change a GL account item ACCIT You can add information to a GL account item (such as quantity specifications) with this exit.
    ·EXIT_SAPLV60B_005: User exit for accruals
    Once all relevant data for accruals was entered in the GL account item, you can add to this data with this exit.
    ·EXIT_SAPLV60B_006: Change the control line ACCIT
    You can use exit 006 to add information to the control line.
    ·EXIT_SAPLV60B_007: Change the installment plan
    You can use exit 007 to add information to the installment plan
    parameters in the GL account item.
    ·EXIT_SAPLV60B_008: Change the transfer structure ACCCR, ACCIT and ACCHD
    After the accounting document is filled in with data, you can use exit 008 to change the document once again.
    ·EXIT_SAPLV60B_010: Item table for customer lines
    You can use exit 10 to influence the contents of customer lines before they are created.
    ·EXIT_SAPLV60B_0011: Change the parameter for cash account determination or reconciliation account determination
    You can use this exit to change inbound parameters in order to influence account determination.
    I hope any one of these will solve your problem
    Thanks,
    Murali.

  • Single Credit Note for Multiple Invoices

    Hi,
    For multiple invoice of a specific customer only one credit note to be issued.
    Pls guide.
    Regards
    Vijay.

    Create credit memo request with reference to first invoice (the pop-up screen will take only one).
    Once all the items are copied to the credit memo request use menu path Sales document -> create with Reference , enter the second reference invoice. This will copy all the line items in the second invoice.
    Repeat the second step to copy all the invoices of the customer to the credit memo request.
    Do invoicing to generate a single credit memo. The credit memo request may split at the time of invoicing (some times) but you can prevent it.

Maybe you are looking for