Add DeliveyNotes and Invoice based on Sales Order

i can manage to do it but..the Sales Order is not closed..why?
when i try to do it manual, when it make Delivery..the respective Sales Order is Closed..
below some of my code
For Each FirstScanRow As DataRow In _oDataset.Tables(FIRSTSCAN_TABLE).Rows
            With oDeliveryNotes
                Select Case iBasedDoc
                    Case 0
                        iBasedDoc = FirstScanRow("DocNum")
                    Case Is = CInt(FirstScanRow("DocNum"))
                        .Lines.Add()
                        isAddedHeader = False
                End Select
                ' make an Invoice and Sales Delivery Order
                If isAddedHeader Then
                    .DocDate = Today.Date
                    .DocDueDate = Today.Date
                    .TaxDate = Today.Date
                    .CardCode = FirstScanRow("CardCode")
                End If
                .Lines.BaseLine = i
                .Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
                .Lines.BaseEntry = iBasedDoc
                '.Lines.ItemCode = FirstScanRow("ItemCode")
                '.Lines.Quantity = FirstScanRow("Quantity")
                '.Lines.VatGroup = "ZO"
                If FirstScanRow("IsUseBatch") Then
                    ' Add Batch
                    For x = 0 To FirstScanRow("Quantity") - 1
                        .Lines.BatchNumbers.BatchNumber = FirstScanRow("Scanned")
                        .Lines.BatchNumbers.Quantity = 1
                        .Lines.BatchNumbers.SetCurrentLine(x)
                        If x < FirstScanRow("Quantity") - 1 Then .Lines.BatchNumbers.Add()
                    Next
                Else
                    ' Add Serial
                    For x = 0 To FirstScanRow("Quantity") - 1
                        .Lines.SerialNumbers.SystemSerialNumber = FirstScanRow("SysSerial")
                        .Lines.SerialNumbers.InternalSerialNumber = FirstScanRow("Scanned")
                        .Lines.SerialNumbers.SetCurrentLine(x)
                        If x < FirstScanRow("Quantity") - 1 Then .Lines.SerialNumbers.Add()
                    Next
                End If
            End With
            i = i + 1
        Next
any insight?
thanks,
erick
Edited by: Erick Widya on May 13, 2008 10:52 AM

Not sure if this will help or not, however some things I have in similar code that does appear to close the order are:
1. Set the Reference1 field in the "header" to the order the delivery is based on
                        delivery.Reference1 = salesOrderDocumentId.ToString();
2. I had to add all the additional expenses to the delivery too - you may not have any, so this may be mute.
Robin

Similar Messages

  • Creation of A/R Down Payment Invoice  based on Sales Order not logical

    When creating a A/R Down Payment Invoice based on a Sales Order you
    have the option to create multible ones. Which by itself could be
    usefull to create one of 50 % for a certain day and decide they need to
    pay another 25 % at a later date.
    But SBO does not track what already have been posted. Therefore you can
    create a sum more then a 100% without warning or blockage.
    Tested this in SBO 2007 A SP:00 PL:00
    Scenario:
    Sales - AR>Sales Order
    Create and post a Sales Order
    Sales - AR>A/R Down Payment Invoice
    Create an A/R Down Payment
    Select the BP and copy the Sales Order
    Set DPM to 40%
    Post the A/R Down Payment
    Sales - AR>A/R Down Payment Invoice
    Create an A/R Down Payment
    Select the BP and copy the Sales Order
    Set DPM to 100%
    Post the A/R Down Payment
    Sales - AR>A/R Down Payment Invoice
    Create an A/R Down Payment
    Select the BP and copy the Sales Order
    Set DPM to 70%
    Post the A/R Down Payment
    Making the total for the Sales Order 210% worth of Down Payment
    Invoices without warning/blocking. I would expected that you would only
    be able to set the rest sum %. For instance first scenario I entered
    60% therefore setting the second Down Payment Invoice to a max of 40%
    Untill you have used up the 100% and you cannot select the Sales Order
    in question..
    If multible users do the same work, SBO doesn't show that it has
    already been done. Same if you forgot you already created it you can
    still create one. Plus sometimes it will happenyou create the Down
    Payment Invoice and not paying attention you create the first one with
    a 100% and later with the intended percentage..

    Hello Petronella,
    you are right that B1 is not checking the total value of DP created from the Sales Order.
    The logic and checking procedure here is only between Sales Order -> Delivery/Invoice.
    DP Invoice is considered as transaction related to document the receipt of the money (parallel to the sales process). Between the moment of basing of DP to Sales Order it is still possibility to adjust Sales Order as there is no posting behind Sales Order.
    The question is what would be a checking  procedure in case that on Sales Order there is based Delivery and DP? What would be the system priority to take into a consideration?
    Regards,
    Martin Slavik
    Regional Solution Manager

  • Wrong tax in delivery and invoice (different from sales order)

    Dear All experts/gurus,
    I am curretly facing a problem relate to big error in SBO 2004A SP00 PL 16. It is disgusting actually. the problem is I create Sales order (SO) with 0 % tax (tax code: 0tax). however after I create delivery from this SO,  the price including tax is different from price including tax in the sales order, it raised to be 20%, that is also happened in AR invoice meanwhile I never change the tax code and create 20% in the define tax group form.It is only happened in creation date on 16 february 2007,after that it is all okay, nothing happened. There is none allowed to change tax grup form.
    I am afraid there are bugs or something wrong that made it happened especially relate to technical/developper. I have check company settings, BP settings and other but find out nothing that made this wrong comes. pls help me to solve this situation. I appreciate your answers so much. tks
    Rgds,
    Message was edited by:
            steve andre

    Dear Eddy, Experts/Gurus,
    The problem has appeared again. It happened on 8 March 2007, all deliveries are subjected to have 20% tax meanwhile in column tax % of  define tax groups form is zero. The big problem is how to take back all the error AR invoices sent to customer sites.
    How to cancel the invoices with wrong tax without using credit memo? could I just use querry generator to delete all the taxes created by system ? I want to reprint it and send again to customers but I don't want to use credit memo, I consider to use DTW, but I am not so sure and I wanna ask what Gurus/Experts suggestions in this forum before do that. I appreciate your answer so much. TIA

  • Logic to fetch delivered and invoiced Qty using sales order and line no

    Hi Experts,
    I am creating a Sales Order report in which I need to Fetch the delivered Quantity and Invoiced Quantity fields.
    I am currently going to VBFA table and pass SO and line item number and fetch all data. Then I perform addition/ subtraction to remove cancelled quantities. this is making the logic complicated.
    Is there any standard Function module/ or table or BAPI which can fetch the Delivered and Invoiced quantities directly?
    Regards,
    Onkar B

    Hi,
    First pass the sales order number into "VBFA" table into the field "VBELV".
    Execute or Press F8.
    Get the document number of the delivery from "VBELN".
    Pass the same delivery document numebr into "LIPS" table into the field "VBELN".
    Execute.
    Get the value of the delivery quantity from the field "LFIMG" in this table.
    Next got the table "VBFA".
    Pass the delivery document number into the field "VBELV".
    Execute or Press F8.
    Get the document number of the billing document from "VBELN".
    Pass the same billing document numebr into "VBRP" table into the field "VBELN".
    Execute.
    Get the value of the invoiced quantity from the field "FKIMG" in this table.
    Like this we have to get the delivery and invoice quantities.
    Regards,
    Krishna.

  • Function module for Delivery and billing based on sales order

    Hi Friends
    I am developing an object which has to create the sales order, delivery for that sales order and billing for it at the same time.
    I have tried for few function modules to create the delivery and billing but I am not able to achieve.
    Would you please help me by providing the correct function modules for these 2 activities?
    Thanks
    Praveen

    Hi Nikhil
    Thanks for reply,
    i am creating the sales order using the BAPI "BAPI_SALESORDER_CREATEFROMDAT1" only, but the billing document bapi
    "BAPI_BILLINGDOC_CREATE" is for online creation, it will call the t-code 'VF01'.
    I need to create the billing document with out calling the t-code like using bapi for sales order. Please suggest me if there are function modules to achieve this.
    Thanks
    Praveen

  • How to Add Delivery Note based on sales Order

    How to add a delivery note based on sales order.
    say i have a order no. 10 and linenumber 0 to 3.
    each time i book with order no 10 and line no.3,i need to add to delivery note.
    i also in need of adding just one Header and Multiple lines(Header for order Number - 10 and multiple lines for each Booking ).
    How can i achieve this.

    Hi
    You can search the samples....C:\-->Program files->SAP----->SDK->Samples->DiAPI----->OrderandInvoice...
    Here invoice is added for a particular sales order.....the same can be done for delivery.....
    Hope it helps

  • What setting to mandate that invoice is created based on sales order NOT...

    Hi,everyone
    Could you tell me the detailed configuration  to mandate that invoice is created based on sales order NOT delivery documents.
    Additionaly, I need to define this rule at headquarter and apply it all lower-level companies.  how to do it.
    thanks you very much

    Dear Humility,
    Could you tell me the detailed configuration to mandate that invoice is created based on sales order NOT delivery documents.
    This is quite possible through copy control settings between sales order and billing document
    In standard billing type F1 will billed with reference to the sales order OR,so you can copy those settings then rename to your document types and itemcategory.
    Go to VTFA transaction click n change icon then select billing type F1 and order type OR then click on Copy As icon (F6)and change the document types(maintain your docuemnt types).
    To copy item level settings
    Now you come back to initial screen agin you select billing type F1 and order type OR then click on item here you select standard item category then click on Copy as Icon (F6) here you maintain your itemcategory.
    Note:- Don't change the satndard settings you just copy
    Additionaly, I need to define this rule at headquarter and apply it all lower-level companies. how to do it.
    For this you can take help of your BASIS people they will full fill with the roles and authorisation settings.
    I hope this will help you,
    Regards,
    Murali.

  • Unable to add Invoice from a sales order draft.

    Hi all,
    I have a customer who is trying to add an A/R Invoice from a sales order draft and is receiving this error, "applied amount cannot be negative in the base document [Message 439-182]"
    If anyone has seen this before or has any suggestions that would be great.
    Best Regards,
    Jeff Haldeman
    Support One

    Hi Jeff,
    Can you also let us know what where the contents in Sales Order and the resultant AR Invoice?
    The Quantity , Price and the Total
    Regards,
    Jitin
    SAP Business One Forum Team

  • Hide the cost and margin fields on Sales Orders and Invoices

    Hi all,
    I need to hide the cost and margin fields in Sales Orders and Invoices. We sell our products to our employees sometimes, hence we don't want them to know cost and margin information.
    Can this be done?
    Cheers

    Go to VOV7 & as per the Item category ,de - select the Check Box Determine Cost.
    Else remove the Condition Type VPRS & Margin Condition type from the Pricing Procedure
    Best Regards,
    Ankur

  • Invoice Receipt document (TABLE RBKP) based on Sales Order (table VBAK).

    Hi Folks,
       I have to find Invoice Receipt document (Table RBKP) based on Sales Order (table VBAK).
       Please tell me how the two documents are linked.
    Thanks,
    Punit

    I don't know table RBKP, but I would start by seeing if I could find the value of RBKP-BELNR or XBLNR as the next document in table VBFA.  If found, then you know how to read VBFA forward from sales order (VBAK) to VBFA with correct next document type, then to RBKP with the document number....
    Don't know if this will work, but this is the first approach I would take.

  • Lock and release procedure of sales order - Based on Value

    Hello Gurus,
    I am having the following requirement in SD, let me explain with one example.
    If users creating Sales orders with value less than Rs.1000/- means, System should not allow to proceed further to save the
    sales orders (need the same to specific Sales areas).
    I tried with condition type "AMIW" / User exits where we can able to block/lock the further process but in general we may need to proceed further even if its below the value(Rs.1000/) considering the genuine and regular order from customer.
    Pls suggest your ideas to achieve the Lock and release procedure based on Sales Order Value.
    Regs
    S.Ramesh
    Edited by: Lakshmipathi on Oct 31, 2011 5:49 PM
    Thread Locked - Reason Duplicate Post

    Hi,
    Instead to going for user exits, you can control this by
    1. Field VBAK-NETWR (Net Value) as a part of incompletion procedure.
    2. In VUA2 check u201CIC boxu201D
    3. Create a Customer discount condition ZDIS with scales. In V/06 maintain scale basis as B=value, Check value B= Ascending and Scale type as B= to scale. Calculate it on the Price condition
    4 .In VK11 Maintain record as -100% up to say Value INR1000/-
    You can fine tune according to your requirement by adding tables with relevant fields.
    The idea is simple. As long as the PR00 condition value is below INR1000/- discount condition type ZDIS will calculate discount as 100% and Document net value will become Zero.
    If the document value is Zero Incompletion log will not allow saving the document.
    You can maintain records for ZDIS as per your requirement (for genuine customers). Or you can close the condition record by changing the validity when it is not necessary for other customers.
    Hope this helps.
    Regards,
    Sharan

  • Sort out the invoices based on Sales Org, Dist Channel, Div while printing

    Hi all,
    My User required to run the program - RV60SBAT
    for creating batch job : FR_INVOICING.
    When we check the steps in the job FR_INVOICING we could find 10 steps with different variants.
    On running this job, system will provide the printing of Invoices for different Sales Organizations, Distribution Channel, Division and Invoice Numbers. However this out put is not generating in a sorted manner currently.
    User requirement is to sort out the invoices based on Sales Organizations, Distribution Channel, Division and Invoice Numbers.
    Kindly look into this and help me  how to address/approach this problem.
    Thanking you in advance
    Best Regards
    TRS GUPTA

    Assign fields KOMKBV3-VKORG KOMKBV3-VTWEG KOMKBV3-SPART to output type config sort order fields sort field1, sort field2, sort field3 respectively.
    Use user exit include RSNASTZZ and add the following code
    under when '50'.
      insert NAST-SORT1 NAST-SORT2 NAST-SORT3 NAST-OBJKY  INTO HEADER.
    Change RSNAST00 job step variant to incluce 50 in the sort field.
    Regards
    Sridhar
    Message was edited by: Sridhar K

  • Restriction for items from Purchase Order based on Sale Order

    Hi !
           We create PO directly from Sale Order ( by ticking Option under Logistic tab, 'Purchase Order') for customer C01 (for eg).
    From the PO created, we post GRPO.
    Now our need is,
    Assume if 10 Qty is been ordered in such a way and been received (GRPO posted). it 'll add on to the stock account i.e will increase stock qty at our whse.
    is it possible to restrict these 10 qty of item from being sold to any other Customer other than whom hav ordered i.e if we create sale order for C02 the SBO should not take the items received from PO created based on Sales Order created for C01?
    Meera.

    Meera,
    Which version of SBO are you using 2005 or 2007?
    I don't think Serial numbers can help in this scenario.  There is no hard allocation or blocking possible using Serial numbers.
    This is the Work around I am thinking about.
    Set the items to be Batch Managed - On Every Transaction
    When performing Goods Receipt, enter the Sales Order Number as the Batch Number
    When creating the delivery, using SBO_SP_TransactionNotification we can easily check the Batch of the Item being selected and verify it with the BaseRef of Delivery lines to match with Sales Order number.
    If the numbers don't match we can warn user with message, "The items batch reserved for Sales Order xyz"
    Even if you make a mistake when entering the batch number same as Sales Order number when doing a goods receipt. It can still be traced and blocked during delivery.
    Hint: The Batch table records the Goods Receipt transaction along with the BaseDocument number, Base Ref, etc
    If you decide to go this route, I could help you further.
    Let me know
    Suda

  • Single invoice for multiple sales orders

    Hi all,
    When delivery order is created based on Collective processing, Billing document is created based on delivery order for delivery based billing.
    But, is it possible to filter the line items in the Collective delivery order further for billing? Based on customer PO number, etc.
    That is, one Invoice for each Sales order or each customer PO number from the delivery document.
    Billing based on Sales order is one solution, which is not possible in the current Bussiness scenario.
    Could anyone suggest some other solution?
    Regards,
    Jennifer Smily.

    Hello Jennifer,
    if I understood well you have: more sales orders (everyone wiht its PO number), delivered togheter within one delivery.
    Then you bill the delivery, and you need to create one billing document for every sales order.
    Is it right my understanding ?
    If so you could simply customize the copy control (transaction VTFL) at header level setting field 'Assignment Number' and/or field 'Reference number' with 'A' or 'B'.
    In this way field VBRK-ZUONR and/or VBRK-XBLNR of billing document is filled with PO number or sales order number, and one billing document for every sales order will be created.
    Best regards,
    Ivano.

  • Revenue Account Determination based on Sales Order Document Type & Service Order Type

    Hi Expert,
    I have Customer Service Module with Resource Related Billing for services attached with SD.
    When DP90 runs sales document debit memo request is created & then debt memo is created.
    I need to configure Revenue Account Determination based on Sales Order Type and also based on Service Order Type.
    I did not see any field catalogue in revenue account determination for order type, For communication structure KOMKCV Header and KOMPCV Item level there is no field for sales order type nor service order type.
    Is it possible to bring in both order types? Can ABAP person do it?
    How to bring these fields?
    Is it possible & recommendd to have service order type filed AURAT for service order into this sturcture?
    Is this configuration is OK acceptable by SAP? If so is there any chnace for issues errors & wrong determination from FI CO view?
    Your valued input is highly appreciated.
    Thanks
    Prakash Parikh

    Hi Prakash,
    Yes, you can certainly add new table fields into the field catalog KOMKCV and KOMPCV and use it during account determination. You will also have to add these new fields in the user exit RV60AFZZ for it to work. I believe you will need ABAPer's help to make this work. The abaper will have to crate a ZZFIELD (ZZAUART for example) and put it in the structure and use the same in the user exit to pass the values.
    In your case, what I am not sure is, are you looking to modify the existing standard tables or creating new ones. My suggestion is to create the new condition tables with these new fields (like document type) after adding it to the field catalog. Only modify the access sequence (KOFI) in such a way that your new tables are access first before it goes into standard tables (or you can adjust it according to your scenario.
    We have done it in our company and it is working fine. Basically what we have done is to create new tables instead of modifying the standard ones. We have adjusted the access sequence in such a way that some of our custom tables are accessed first before the standard SAP tables (C001 to C005).
    I found a similar requirement on SCN. This might help.
    Adding New Field in Account Determination
    Hope this helps.
    Regards,
    Mukund S

Maybe you are looking for

  • How to get USB device in the list of VISA resource Name field of VISA Open VI

    I have followed the below tutorial to communicate with my device using USB port. But i didn't get the name of the USB port in Measurement & Automation Explorer devices list. How to get it? Can anyone suggest something? http://zone.ni.com/devzone/cda/

  • Time/LEave approval in Business Package for Manager Self-Service 60.1

    Hi all, Currently implementing ESS MSS on 4.7 system with EP 6.0 SP19. The BP we plan to use is Business Package for Manager Self-Service 60.1. My basic question is, we approve leave requests in BP for my SAP ERP (2004s) in the Universal worklist. Ho

  • Partial Billing w.r.t Sales Order

    Hi, My requirement is as follows: 1. I need to create a material sales order of 500 qty 2. I want to bill the customer on partial quantity basis. Pls. note that there is no deliveries involved. We cannot use third party sales order process as the use

  • Error using BI EE with Essbase

    Hi all, I'm using BI EE 10.1.3.3.2 with Essbase 9.3.1.1. No problem importing metedata with Administrator; I can also use administrator in online mode. When I try to use answer to view data I have the following error: ===============================

  • I can't install Flash Player 13. Please help ...

    I notice this when I open some websites. The pages looks weird, looks like it won't load properly. So, I tried to check whether I have the updated flash player or not. I do have the updated version (on Google Chrome browser) However, it still the ver