Function module to create Invoice from the Delivery no ?

Hi All,
Is there any way (function module) to create an Invoice from the Delivery no and the Billing Type ? We do not want to go with BDC for transaction VF01.
Details:
We want to generate a pro-forma invoice while saving the delivery. We will have 'Special Function' (NAST-NACHA = 8) in the output determination and a routine would be called from there. That routine would contain the code to generate the Invoice. We will have only the 'Delivery no and the Billing Type'  in that routine. So trying to find any function module which can create an Invoice from the Delivery no and the Billing Type.
Any suggestion / hint  is welcome.
Thanks,
Ashok

Hello Ashok Satapathy ,
                                    The only option  for you is to call the FM "GN_INVOICE_CREATE" .
There is no special FM availaible to pass only the delivery number at this point.
You need to retrieve all the delivery information details and need to pass it to the FM "GN_INVOICE_CREATE".
Thanks,
Greetson

Similar Messages

  • Can't create invoice from the delivery

    Hello.
    Ship out the trade order then i created the delivery and PGI successfully.
    But when i went to VF01 to invoice the delivery i can´t create it.
    I take a look to the LOG and this is what i found:
    Error Log
                 6910517662 000010 The item is blocked for billing
    I double click the item and in the configuration of Financial processing there is a field called "Block" but there is nothing selected over there. Do you have any suggestion?
    I appreciate your help

    The item is blocked for billing
    Apart from the suggestions, if that particular material is kept open in some other system, then also, system will throw this error.  Also ensure that in material master Sales Org.1 view, this material is not blocked against the field "X-distr.chain status"
    thanks
    G. Lakshmipathi

  • Creating Invoice from a Delivery Note using SDK

    Hi,
    I am working on SAP 2005 A Patch 4 with SQL 2000 SP 4. I am using VB.NET (VS2005). I am trying to create a Invoice from a Delivery note which is created based on a Sales order.
    I am getting the following error
    Error occured while saving Invoice: 0 - '15' is not a valid value for field 'BaseType'. The valid values are: '-1' - '',  '0' - '',  '23' - 'Sales Quotation',  '17' - 'Sales Order',  '16' - 'A/R Returns'
    The Code that i used to create the invoice is as follows
    Dim oInvoice As SAPbobsCOM.Documents
            oInvoice = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            oDelivery = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes)
            Try
                If oDelivery.GetByKey(iDlvNo) = True Then
                    sTaxCodes = sTaxCode
                    oInvoice = pcompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)
                    oInvoice.CardCode = oDelivery.CardCode
                    oInvoice.SalesPersonCode = oDelivery.SalesPersonCode
                    oInvoice.DocType = SAPbobsCOM.BoDocumentTypes.dDocument_Items
                    oInvoice.DocumentSubType = SAPbobsCOM.BoDocumentSubType.bod_None
                    oInvoice.Address = oDelivery.Address
                    oInvoice.ShipToCode = oDelivery.ShipToCode
                    oInvoice.Address2 = oDelivery.Address2
                    oInvoice.JournalMemo = "Invoice - " & oDelivery.CardCode
                    oInvoice.Comments = "Based on Delivery  " & oDelivery.DocNum
                    oInvoice.PaymentGroupCode = oDelivery.PaymentGroupCode
                    oInvoice.DocDueDate = Now.Month & "/" & Now.Day & "/" & Now.Year
                    For iRowNo = 0 To oDelivery.Lines.Count - 1
                        If iRowNo > 0 Then
                            oInvoice.Lines.Add()
                        End If
                        oDelivery.Lines.SetCurrentLine(iRowNo)
                        oInvoice.Lines.ItemCode = oDelivery.Lines.ItemCode
                        oInvoice.Lines.Quantity = oDelivery.Lines.Quantity
                        oInvoice.Lines.Rate = oDelivery.Lines.Rate
                        oInvoice.Lines.BaseType = SAPbobsCOM.BoAPARDocumentTypes.bodt_DeliveryNote
                        oInvoice.Lines.BaseEntry = iDlvNo 'DocEntry of Delivery Note
                        oInvoice.Lines.BaseLine = iRowNo
                        oInvoice.Lines.TaxCode = sTaxCodes
                    Next
                    iReturnValue = oInvoice.Add()
                    If iReturnValue <> 0 Then
                        pcompany.GetLastError(iReturnValue, sErrorDescription)
                        Throw New Exception("Error occured while saving Invoice: " + _
                                           iErrorNo.ToString() + " - " + sErrorDescription)
                    Else
                        MessageBox.Show("Invoice created succesfully")
                    End If
                End If
    Since in the error message it has specified that i have given the BaseType as Delivery which has a value of 15 i changed that from bodt_DeliveryNote to bodt_Order which has a value as 17.
    When i tried creating the invoice again it gave the error
    Error occured while saving Invoice: 0 - Target item number does not match base item number.  [RDR1.TargetType][line: 2]
    I am not able to proceed further ... can any one help me
    thanks in advance
    Ganesh

    Greetings,
    I am having a similar problem, only I'm doing it as suggested in Louis' reply.  In fact I copied that code and tried it.  It's giving me a 2028 error with no description.
    I had been doing it slightly differently and the error I was getting was 5002 "Item no. is missing [INV1.ItemCode][line 2]"  I don't have 2 lines and I'm certain I have an item code.  The numbers I'm putting in for baseentry & baseline are absolutely in the table and the order is open.
    Here is that code:
            oDNUpd = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            oDNUpd.CardCode = CardCode.Text
            oDNUpd.Lines.BaseEntry = CInt(SalesOrder.Text)
            oDNUpd.Lines.BaseLine = CInt(baseline.Text)
            oDNUpd.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
            oDNUpd.Lines.Add()
            lretcode = oDNUpd.Add
    I'm using SBO 2005 patch 7 (and the new dll).  I have similar code doing a stock transfer and it's working fine.
    Thanks for any suggestions you can offer
    John

  • L_TO_CREATE_DN function module for creating TO for a delivery

    Hi,
    I am using L_TO_CREATE_DN function module to create a TO for a delivery and it is working fine as long as the HU, I am picking has quantity less than the delivery quantity or equal to delivery qty. But whenever I try to pick a HU whose qty is little more than the delivery quantity, its throwing an error. Also, there is tolerance set on the delivery line item (and the qty I want to pick is within the tolerances). When I am trying to do it manually using LT03, it throws a popup about conversion error and is creating the TO taking the rouding into account. Here is the example of the above scenario.
    Delivery Qty = 1300 LB (pounds, base unit of measure)
    Alternate Unit of measure for this material is Roll (RL)
    I am trying to pick a HU which is 1350 LB.
    Manual Case : When I use LT03 it throws a popup (saying conversion error) and accepts only
    0.963 RL which is equal to 1300 LB and creates a TO. when I see the delivery after creating the TO, the picked qty is 1300LB.
    Function Module : When I use the function module, it does throw me the same popup but does not create the TO. Rather it throws an error "Available quantity in bin is zero".

    hi , it will create only 1 TO with multiple line items
      CALL FUNCTION 'l_to_create_multiple'
        EXPORTING
          i_lgnum                      = ls_9001_scrn-lgnum
          i_bwlvs                      = lc_bwartwa
          i_bname                      = sy-uname
        IMPORTING
          e_tanum                      = ltak-tanum
        TABLES
          t_ltap_creat                 = li_ltap_creat
    ls_9001_scrn-lgnum = warehouse number
    lc_bwartwa = movement type
    li_ltap_creat = itab containing the line items with diff material
    Just check if it helps
    Thanks

  • RFC function module always creating BPs with the same user name (RFC user )

    Hi All
    I posted the below question in a different area before. But thought it would be more suitable here.
    Moderators - Please let me know if am doing any mistake.
    Question:
    I have a RFC function module in CRM that creates Business Partners in ECC (XD01 tcode).
    I am using a dialog RFC destination configured in SM59 in CRM.
    But my RFC function module in CRM is always creating the Business Partners in ECC with the RFC user id (the user that we maintain for the RFC destination in SM59).
    This is a problem for the users because they are not able to track the actual person responsible for creating these Business Partners.
    Can somebody please let me know how to solve this problem?
    Thanks
    Raj

    Hi.
    You may use the trust relationship between CRM and R/3 and in SM59 instead of set a specific username, you set the flag "current user".
    With this flag, the system will access R/3 system with the user logged in CRM system. The Trust relationship must be created between CRM and R/3 in order to the system doesn't ask for a password to login in R/3.
    If you need more details please reply.
    Kind regards,
    Susana Messias

  • Function Module to retrieve Address from the table ADRC

    Is there any function module available to retrieve data from ADRC by using the ADDRNUMBER as input

    Try using FM: ADDR_GET
    This has import parameter ADDRESS_SELECTION which contains ADDRNUMBER.
    Hope this helps.
    Please reward if it works.
    Vallabh.

  • Single Function module to create inbound and outbound delivery

    Dear Frens,
       I would like to know how VL10A is creating a deliverty document in background mode.
       otherwise can anyone help me with a single function module or BAPI or BADI which creates both
       inbound and outbound delivery.
    Regards
    Priya

    Hi,
    Try FM RV_DELIVERY_CREATE or GN_DELIVERY_CREATE.
    For creating a delivery wrt PO u 1st need to have a sales order i guess.
    Regards,
    Amit

  • Creating an invoice from a delivery does not closes the delivery.

    I am creating an invoice using DI. The invoice is based on an already existing delivery note.
    The delivery is manually created from SBO. When I'm creating the invoice I transfer all items and expenses from the delivery to the invoice.
    case 1. The delivery has no freight defined.
    When the invoice is created the delivery is automatically closed
    case 2. The delivery has some freight
    When the invoice is created the delivery remains open even though the invoice contains everything in the delivery, including the freight.
    'Copy to' from this delivery opens an invoice with no items - only the freight is filled.
    Currently I explicitly close the delivery using the Close method.
    Is this correct?
    Is it normal for the base document to remain open if the target document imports everything?
    Thanks,
    Svilen

    Hi Svilen,
    My experience with getting a delivery note to automatically close when I create an invoice against it is that the base document information on each line item on the invoice must be set to point at the delivery note (base document).  You are probably already doing this on your line items and that's why it closes when there is no freight.  But freight items have "base" fields too, and they have to point back to the freight item on the delivery note.   Are you setting the base doc info on the invoice freight lines?
    The following code worked for me (although this example is for sales order to delivery, it is the same thing for deliveries to invoices):
                    Dim ix As Short
                    Do Until ix = vso.Expenses.Count
                        vso.Expenses.SetCurrentLine(ix)
                        If vso.Expenses.ExpenseCode = _FreightExpCode Then
                            If vso.Expenses.Status = bost_Open Then
                                vDN.Expenses.BaseDocEntry = SODocEntry 'added 1/5/7 jc
                                vDN.Expenses.BaseDocLine = vso.Expenses.LineNum
                                vDN.Expenses.BaseDocType = SAPbobsCOM.BoAPARDocumentTypes.bodt_Order
                            End If
                            Exit Do
                        End If
                        ix += 1
                    Loop
    I'm looping through the target (order) document's freight records to find the matching one that I know is on it - you might be processing all - but then I load the sales order base docentry, base doc line# & base doc type to the delivery note freight line item.
    When getting this done, my source documents close OK.  In fact, I think they close even if the totals don't match on each record - just so long as every source doc record is pointed to by a target doc record.
    HTH

  • I need to create RFC function module which creates the IDOC

    Hi-
    Any idea how to create RFC function module which creates the outbound IDOC. If you have any sample code please forward to me.
    Thanks,
    Sony

    My Problem is
    Whenever they create Invoice using T-code's like FV65(Parked Document), automatically should create IDOC's...
    I have used message type FIDCC1 but this message type is usefull only for Posting documents.
    1. Whenever they create parked document, entries will be stored in BKPF(Parked Document-Filed-BKPF-BSTAT = 'V') and Bseg....
    2. I have to read entries from those tables and should create IDOC...
    3. I checked FM's(FI_IDOC_CREATE_FIDCC1, FI_IDOC_PREPARE) but are not useful...
    4. Now I need to write one RFC function module and that FM should create the IDOC's....
    Can anyone please help me out?
    Thanks,
    Sony

  • Function Module to create Delivery with JIT Calls

    Hi SAP Guru's,
    We are working on SAP 4.6C version.
    I am looking for a function module to create delivery with JIT Calls.
    We are currently using the SAP standard function module "SHP_VL10_DELIVERY_CREATE" to create Delivery with JIT Calls. Each JIT Calls has apx 60-80 materials in it and each material refers to a unique Scheduling Agreement. This function module is taking very long time in production server to create delivery, it does not take much time in dev or quality server.
    We have JITV setting profile (For Sold To Party and Partner Description Profile) set as RELACE (to summarize the line items in JIT Call).
    Is there another function module that we can use to create delivery with JIT Calls?
    Thanks in Advance,
    Amit

    Hi there,
    There is no such function module.
    Regards
    Sanju

  • Function modules to create the relationship for Reference Personnel IT0031

    I tried using BDC recording PA30 to create the relationship for reference personnel but it dun seems to work. Anyone knows of any standard function module to create that relationship instead.

    I have tried both and it doesnt work. The behaviour of this reference personnel number is different from the normal object relationships. Does anyone have experience using function module to create reference personnel relationship instead of giving the stand FM to create the records.

  • How to Create a Function module z_create and to track the error records?

    I want to create a function module z_create which will insert the data from the internal tables gt_model_master and gt_model  into the corresponding database custom tables y_model_master.
    Secondly if any error is encountered during the above updation, then how to track those error records ?

    HI,
    check the sy-subrc ,if it is zero the insertion is success,otherwise use 
    message class.
    if sy-subrc ne 0.
    message e052(zmessage).
    endif.
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM
    Edited by: rakesh dhudipala on Feb 12, 2008 2:33 PM

  • Function module to create and change delivery

    Hi,
    I need to create a function module to create and change delivery using the same function module.
    For this I want to call the bapi's BAPI_OUTB_DELIVERY_CREATE_SLS
    and BAPI_OUTB_DELIVERY_CHANGE.
    So what are the variables I need to declare in source code of my function module.
    Can anybody please suggest me.
    thanks,
    Sudheer

    Hi Sudheer,
                      Check this out
    In the BAPI BAPI_OUTB_DELIVERY_CREATE_SLS
    You need to provide
    SHIP_POINT - Goods receiving point for the returned goods.
    DUE_DATE - Delivery creation date selected as december 12
               9999 unless specified.
    DEBUG_FLAG makes analysis of the process earlier .
    call function 'BAPI_OUTB_DELIVERY_CREATE_SLS'
    DESTINATION logsys
    EXPORTING
    SHIP_POINT = 'MD01'
    DUE_DATE = sy-datum
    DEBUG_FLG = 'X'
    importing
    *delivery = lf_vbeln
    *num_deliveries = lf_num
    *tables
    *sales_order_items = lt_order
    *extension_in = lt_extin
    *deliveries = lt_deli
    *created_items = lt_itm
    *extension_out = lt_extout
    *return = lt_return
    For the BAPI_OUTB_DELIVERY_CHANGE.
    Please read the documentation of the function provided there.
    A Wiki To support your need.
    Link: [Wiki|https://wiki.sdn.sap.com/wiki/display/ABAP/Changeoutbounddelivery+%28VL02%29]
    hope your query resolves soon.
    Have a best day ahead.

  • Creating Excise Invoice from Sales Delivery using DI API.

    Hi Experts,
    I have been searching a lot for any Business Object for creating Excise Invoice base on Sales Delivery using DI API.. But have not yet found any one.
    I want to create Invoice for excisable items from Sales Delivery using DI API.,for Excisable items we cannot create standalone A/R Invoice . We need to create Excise Invoice also . But How to create Excise Invoice based on Sales Delivery using DI API. Is there any Business Object for that.
    Please suggest me.
    Thanks and Regards,
    Pooja Singh.

    Hi all,
    I have not received any reply for this thread. Does this mean that there is no provision for creating Excise Invoice from Sales Delivery ? Actually I was asked to create sales delivery and then Outgoing Excise Invoice and then Sales Invoice using DI API.
    But I don't find any Business Object for this in SDK ? Is it really not possible to create Outgoing Excise Invoice from Sales Delivery using DI API.? If possible then how?
    Please reply me if anyone has got any idea in this regard.
    Thanks and Regards,
    Pooja Singh.

  • Function module to create Inbound delivery with reference to Purchase Order

    Hi experts,
    I want to create Inbound delivery with refernce to Purchase Order. But I want to create item wise. For example If one purchase order is there with 10 line items. 10, 20, 30, 40, 50......100.
    If I am showing report for Purchase Order with select option and if I select first 5 line items 10, 20, 30, 40, 50 then my program should be create one Inbound delivery for selected line items only. I have tried BDC for Tcode VL31N, but its not worked. Is there any Function module to create Inbound delivery with reference to Purchase Order for selected line items????????

    Hi,
    Try FM RV_DELIVERY_CREATE or GN_DELIVERY_CREATE.
    For creating a delivery wrt PO u 1st need to have a sales order i guess.
    Regards,
    Amit

Maybe you are looking for