How to copy Sales Order to A/R Invoice (or at least set the BaseRef)

Hi, currently if I need to 'convert' a Sales Order into A/R Invoice, I have to do it via the SAP application directly. What I'm trying to achieve is to automatically do it via an EXE application (I have one ready for other purpose -> connect to SAP via DI).
So far I know how to create a new A/R Invoice and close the Sales Order, but the problem is that I can't 'link' the Invoice to the original Sales Order (ie. the BaseRef field). Is there a way to do it?
Furthermore, is there any easier way? ie. simply call a 'copy' method or something else, instead of writing the same information (field by field) from Sales Order to Invoice?
Please advise.
Thanks.

Hi Afandi,
This will solve your problem
Private Sub CreateInvoice()
        ' init the invoice object
        oInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
        oInvoice.CardCode = cmbCustomer.Text
        Dim sNewObjCode As String
        Dim i As Integer
        ' Get last added document number (the order that was added)
        oCompany.GetNewObjectCode(sNewObjCode)
        ' this loop adds the different items to the invoice object
        i = 0
        Do
            oInvoice.Lines.BaseEntry = sNewObjCode
            oInvoice.Lines.BaseLine = i
            oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
            oInvoice.Lines.TaxCode = TableLines.Rows(i).Item(4)
            i += 1
            If i <> TableLines.Rows.Count Then
                oInvoice.Lines.Add()
            End If
        Loop Until i = TableLines.Rows.Count
        ' Try to add the invoice object to the database
        lRetCode = oInvoice.Add()
        If lRetCode <> 0 Then ' If the addition failed
            oCompany.GetLastError(lErrCode, sErrMsg)
            MsgBox(lErrCode & " " & sErrMsg) ' Display error message
        Else
            cmdInvoice.Enabled = True
            MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")
        End If
Mohamed

Similar Messages

  • Copy Sales Order to A/R Invoice

    Hi, currently if I need to 'convert' a Sales Order into A/R Invoice, I have to do it via the SAP application directly. What I'm trying to achieve is to automatically do it via an EXE application (I have one ready for other purpose -> connect to SAP via DI).
    So far I know how to create a new A/R Invoice and close the Sales Order, but the problem is that I can't 'link' the Invoice to the original Sales Order (ie. the BaseRef field). Is there a way to do it?
    Furthermore, is there any easier way? ie. simply call a 'copy' method or something else, instead of writing the same information (field by field) from Sales Order to Invoice?
    Please advise.
    Thanks.

    Hi,
    If you need discuss about DI programming, it is better post it on SDK forum.  In this forum, you may discuss about achieving it by DTW.  However, I don't think that has any time benefit for this task.
    Thanks,
    Gordon

  • Routine for copying sales order header text to invoice

    Hi friends,
    My requirement is to copy header texts from sales orders when creating an invoice (VF01). In T-Code VOTX the system suggests two routines :
    1 - DATEN_KOPIEREN_01 include LV45TE01
    2 - DATEN_KOPIEREN_02 include LV45TE02
    Does anyone already use one of these routines? When invoicing more than one sales order does the routines work fot this case ?
    Best Regards.

    Hello.
    .....goto transaction VOFM
    Menue: Copying requirements -> Billing documents
    ...or maybe: Data transfer -> Billing documents
    Put a break-point and the header routine......for long-text you should use transaction VOTXN
    Edited by: Erik Hoven on Feb 24, 2009 12:28 PM

  • How to Copy Sales Order Filed in FI from SD while Creating Billing

    Hi Everyone
    I was checking the line item report for my sales account. (FS10N or FBL3N). The problem is i am not able to see the original sales document number filed against that Sales Gl. Its not even visible on customer account line item details as it only provides billing number field detail. Can anyone guide me is it possible to fill out the sales order number field while creating the accounting document from SD. I have observed only once the sales document field is filled but i struggling how it has been copied from SD and not possible on remaining one? Your kind help will be really appreciated.
    Kind Ragards

    Hello,
    This can be done in your copying control for Billing by using
    - Reference Number
    - Allocation Number
    in the header node of the copying control.
    You can find the allocation number under additional information in the (document) line item that is forwarded from
    SD to FI. If the field was not filled in the order, you can determine
    For that you have an option of maintaining in Reference & Allocation Number:
    A-Purchase order number
    B-Sales order number
    C-Delivery number
    D-External delivery number
    E-Actual billing document number
    Say, if you do not make an entry and the field is not filled in the order, the field remains empty. If you would like to link the delivery to invoices in accounting (which is necessary in the self-billing procedure), enter 'C' for the relevant invoices.
    Check in the relevant tcode VTFA / VTFL / VTFF, based on your business process.
    Thanks & Regards
    JP

  • How to copy sales order item text in to purchase requisition

    Hi Experts,
    We enter text for the sales order items in the sales order item details.
    we have done settings for the purchase requision to copy text from sales order into purchase requisition and this works for purchase requisitions automatically created from sales order.
    we need to get text from sales order to be copied in purchase requisitions which are created by converting the planned order.
    we have tried SPRO settings SPRO->Materials Management>purchasing--->text for purchase requisition.
    but this settings does not works for Pur Req. created by converting the planned order.
    is this because planned order does not have segment for text like sales order and purchase requisition?
    Please let me know if it is possible through standard SAP or with the lease development, any help will be appreciated.
    Thanks
    Anand

    Hi Rajesha,
    Thanks for your reply, some of the items in sales order are procured externally by us and our customer maintains text related to price and specification in the item details of the sales order, MRP creates planned order for these materials and these planned orders are always converted in pur requisition, we want that text from the sales order item details should be copied in to the purchase requisitions converted from planned orders.
    is there any user exit which can be called at the time of saving a purchase req or user exit for converting planned order in to pur req.?
    if there is any such exit available, then I think I can read the pegged requirement of the planned order where sales order item will be found then read the text in the item then copy this text in pur req then save pur req may work.
    but this will be a bulky development, please let me know if we can shorten the development.
    Thanks again
    Anand

  • How to block sales orders automatically if an invoice is overdue

    Hi,
    I want to block all new sales orders automatically if the customer has got an overdue invoice. how can i do that?

    You can do through credit managemet. through OVA8 setting you can set "max xopen item%" and "nos. of days" field  & "days oldest item". Third field i.e "days oldest item" will restrict Number of days the oldest open item can be overdue and  hence it will block sales order.

  • How to display Sales Order Document No into Invoice  ALD document

    Hi everyone
    I need to know how to bring in the sales order number into a UDF on a sales invoice which i will then pull into the invoice document using ALD.The client creates a sales order and copys into a delivery and THEN copys into an Invoice therefore it loses the original base number
    SBO only displays the delivery number into the invoice and the sales number in the delivery - it will not take the sales order all the way into the invoice.
    I can see that it brings it into the remarks field but this also brings in text, which i dont want displaying in ALD document.
    can anyone help either with a formatted search or if you know how i can strip out the text from the remarks field.
    any suggestions will be much appreciated
    Thanks

    You can use the next query:
    Select o.DocNum
    From DLN1 d
    Join ORDR o On o.DocEntry=d.BaseEntry and d.Linenum=0
    Where d.DocEntry=$(INV1.BaseEntry)
    (You should replace the ')' with '']' and the '(' with  '[')
    But this is usable only when the user derives the invoice from one delivery and the delivery from one order.

  • Copy Sales Order Plant in Header to all items

    HI,
    can anyone tell me how to copy sales order header plant down to all items.  I looked in sales order maintain settings and can't config here.  Thanks in advance for your assistance.
    Stacey

    These were the first things I  checked when the issue started happening and have not found the source of the issue, all of the orders I checked. 
    1º  Customer Material Information (Info-Record) (sold-to/material)
    2º  Customer Master Data > Ship to Party
    3º  Material Master Data
    the issue is that the rush orders are intermittenly incomplete for some items missing plant.
    They have had different ship to's, sold to's and different materials on each order that has had the issue.  I have checked each one that is incomplete and it has the plant in the material master, the plant has been in the customer material info record, and the customer master data ship to party as well as in the material master mrp data itself. 
    I have not been able to consistently see a reason that this should occur so for a short term solution I wanted to use a user exit, set config or something to populate the plant in all incoming rush orders so they wont be incomplete.   The rush orders come in and ship the same day, they can't wait for someone to check the incomplete orders and manually populate the plant in the item on the order. 
    thank you for your help and explanations, but do you know where I can add this to user exit or something to fix short term always have the same plant in all items on this order type?
    Stacey

  • How to find Sales order numbers for List of Deliveries

    Hi
    How to find Sales order numbers for List of Deliveries
    Thanks
    Muthu

    Hi,
    Open the delivery list.
    Select  a delivery, goto menubar, environmment, document flow.
    Here u can able to see the  order no. (but, here u can see one by one , not cumulatively)
    Regards
    Kaleeswaran

  • How to configure Sales order item text copy to Purchase requisition item

    Hi,
    How to configure sales order item text copy to Purchase requisition text then copy to PO item text.
    Regards
    Jack

    Hi Rajesha,
    Thanks for your reply, some of the items in sales order are procured externally by us and our customer maintains text related to price and specification in the item details of the sales order, MRP creates planned order for these materials and these planned orders are always converted in pur requisition, we want that text from the sales order item details should be copied in to the purchase requisitions converted from planned orders.
    is there any user exit which can be called at the time of saving a purchase req or user exit for converting planned order in to pur req.?
    if there is any such exit available, then I think I can read the pegged requirement of the planned order where sales order item will be found then read the text in the item then copy this text in pur req then save pur req may work.
    but this will be a bulky development, please let me know if we can shorten the development.
    Thanks again
    Anand

  • System should Not copy sales order header text

    Hi all,
    My requirement is system should not copy sales order header text while copying sales order to sales order with same order type.
    for example i have order type OR - standard type with 500 line items with reference to that same sales order we are creating another order with same line 500 line items,but requirement is system should not copy source document header text in to target document header text,
    Do you have any standard functionality to avoid this or we need to go exit
    Regards
    Nishad

    Hi,
    You can do it via standard SAP configuration.
    Transaction VOTXN.
    In the access sequence you have the corresponding Text ID added with "Text Object" VBBK. That's the reason why you are copying text.
    Change the entry.
    Check below link on how exactly to do that. This doc says about how to copy customer text to the sales order. But procedure is same for you as well. Just the object is different.
    [Text type config|http://learnsaptips.blogspot.com/2010/09/text-type-configuration-in-sap.html]
    Hope it helps!
    Best regards,
    Rahal

  • Copying sales order from one company code to other

    Hi,
    I am trying to copy one sales order data from one company code to another, all the details should be same other than the company code and some fields , for this I am using std BAPI Getdetail to get all the details of sales order and passing to BAPI, CREATE FROM DAT2 , so that I create new order.
    When I check the new order, I see everything same but CANCEL DATE value in the ITEM Overview is not copied, I checked the original order , it has cancel date value. The order is an AFS order with AFS tabs.
    I Checked the BAPI GET Detail FM, it doesn't retrieve that information, moreover it doesn't have that field ( J3_ACADA) in the ITEM structure. I can see cancel date value in VBAP. The ITEM structure in CREATE FROM DAT2 also doesn' have that field.
    I can populate using USER_EXIT but I need to get the value from original order.
    How to copy the cancel date value to new order.It should happen only for the orders which I run through this report.
    Any suggestions let me know.
    Thanks

    Hi Uma,
    As my understand, the couple Tcode FS15 and FS16 is used to copy GL master data from in same client or different client.
    The file attract from FS15 will be stored in SAP, not in your local computer.
    And when you run FS16, the system will file this file and upload it.
    Here is selection screen in FS15, you can determine the file name, and keep the batch input name as default.
    After executed, the file is generated with message like below
    Then, go to tcode FS16 with parameter:
    You can untick "Check file only" for Production run.
    When you execute it, the batch input RFBISA20 is generated.
    After that, you go to tcode SM35 to check the batch input RFBISA20, excute this batch input here and check the log.
    Julie

  • Copy Sales Order to Delivery

    hi experts,
    i made a Delivery from a Sales Order, for example, the Sales Order contained an Item with 10 quantities. then I copied it to a Delivery, but in Delivery, I broke the Item with 2 lines and each one contains the same item with 5 quantities. then I added the Delivery document.
    I found the Sales Order didn't be closed by that Delivery, and the open Qty is left as 5 quantities, How can I improve it? since I have to close the Sale Order manually.
    Thanks...
    My SBO version: 2005B(7.40.252) SP:00 PL:41

    When you copied the SO to Delivery the first line only has the link to the SO.  When the first line was split into a second one, the second line is not having any link with the SO and changing the quantity of the first line which had a link with the SO made the SO partially shipped thats why SO did not close
    In these situation split the lines in SO itself and then copy to Delivery

  • How to compare sale order bom and production order bom.

    i would like to provide report with respect to comparation of sale order bom and production order bom, but i am not familiar with SD and PP, can anyone give me some clue? i only know sale order bom is created via 'CS61', afterwards run mrp to get production order, the process appears complicated, i needn't know the process detail, just want to know how to get sale order bom and relative production order bom. please guide me.

    Hi,
    Check Tcode:CS14 to SD/PP BOM's
    Chidambaram

  • WMS :  How to Process Sales Order Released before Turning on WMS

    Hello Gurus,
    How to process sales orders released before WMS enable flag is turned on in the  new WMS enviournment in Oracle 11.5.10 ?

    Helios,
    Thanks for the document.
    I m looking for how to perform Pick confirm transactions for already printed Pick slips before WMS enabled flag is turn on for the org.
    One option is to close all the deliveries  but if there is no on hand at that point the they will remain option.
    Other option is to Back order those deliveries and re release them post wms enable flag is turned on... The only issue i see here is that if there are more new orders for one of the items  and the orders are released then which orders will get allocated/reserved if there is limited on hand quantity to statisfy the SO need.
    Let me know if you can think off some alternative solution.
    Apprecite help !!
    Thanks,
    Sam

Maybe you are looking for

  • Windows installer won't install iTunes 10.5 Windows Vista 64

    Can't install iTunes 10.5 on my operating system. I'm running windows vista home premium 64.   Every time I try, a window installer alert pops up. It says; This installation package could not be, opened. Verify that the package exists and that you ca

  • Release strategy of Purchase order

    Dear all,    I configured Release strategy for purchase order in which i create characteristic,Class.    I also define release procedure for PO like release group,release code,release indicator & release strategy.    But it is not reflecting in Purch

  • Opening a web page progresses the module

    Captivate 2.0 We entered a link to open a webpage containing a related lesson. The lesson opens just fine in a new window. However, the lesson itself progresses as if the user clicked on a continue button or text box. Is there a workaround for this?

  • ABS Connection Shutter

    A few days ago when I started my phone it automatically went into power-saving mode despite being fully charged. Instead of my newtowrk provider details being shown top left there was a message something along the lines of "ABS free version upgrade t

  • Trying to find Java release 1.6.0.1_45, any ideas

    Trying to find Java release 1.6.0.1_45, any ideas