Delivery Note Quantity in BAPI

Dear Gurus,
I am working in SAP-AFS 6.2 and using BAPI ( /AFS/BAPI_GOODSMVT_CREATE )  for Z-Development of Goods Recepit of RM and FG.
This BAPI I am using for Goods Receipt against Production Order, Purchase Order( Including Subcontracting Purchase Order).
I am not able to find the feild for "Delivery Note Quantity" in that BAPI , Can any one help me out ?
Regards
Siddharth

>
Kishore Kumar Chiluka wrote:
> Hi
>
> This field is not avialbal in the BAPI.
> LSMNG - Quantity in Unit of Measure from Delivery Note
>
> Why do you require this data, i think SAP has not provided this field as you will be receiving this data
> from interface and the delivery note qty is equal to Qty in unit of entry.
>
> Try finding out some enhancement point in this BAPI - hope it will be helpful but i am not sure how we can use that...
>
>
> Thanks & Regards
>
> Kishore
Is it really ok if the LSMNG field is left blank in the MIGO through BAPI_GOODSMVT_CREATE? I mean does it affect any other transaction?
pk

Similar Messages

  • Need BAPI for uploading "Qty in Delivery Note" in MIGO

    Hi All,
    Please find the details of my requirement as below :
    Goto T-code MIGO and select goods receipt for a PO , here under material Item tab there is a field as "Qty in Delivery Note" under Quantity tab.
    I need to update this field using my BAPI. Is there is any FM , RFC for getting this output.
    Right now i am using BAPI  BAPI_GOODSMVT_CREATE, please let me know if any field of this BAPI can be used for thid purpose.
    Thanks,
    Mahesh.Gattu
    9900380302

    It is been done by implementing one implicit enhancement in FM: MAP2I_B2017_GM_ITEM_TO_IMSEG
    I have added the below functionality at the end of the function module.
    Just i have maped the ERFMG i.e ent_qnt(Received quanity) with LSMNG i.e qty.in del note
    All best for others.
    $$-Start: (1)----
    $$
    ENHANCEMENT 1  Z_EV_IMP_GOODSMOVEMENT.    "active version
    Populate the delivery note quantity and UoM
    IF IMSEG-ERFMG IS NOT INITIAL.
      MOVE IMSEG-ERFMG TO IMSEG-LSMNG.
      MOVE IMSEG-ERFME TO IMSEG-LSMEH.
    ENDIF.
    ENDENHANCEMENT.
    Thanks,
    Mahesh.Gattu
    Edited by: Maheshkumar gattu on Dec 3, 2010 4:35 PM

  • Update qty in delivery note through bapi for migo

    hi im using bapi for migo upload
    my requiremnt is to update QTY IN DELIVERY NOTE in migo.
    i got the folowing error if i dont pass the quantity.
    qty and/0r delivery indicator or final issue indicator missing
    if i pass the quantity field then it is changing quantity in unity of entity and qty in SKU i dnt want to change this field
    here is my code,
    gmcode-gm_code = '01'.
        ls_GOODSMVT_HEADER-pstng_date = tdate . "sy-datum.
        ls_GOODSMVT_HEADER-doc_date   = sy-datum.
        ls_GOODSMVT_HEADER-pr_uname   = sy-uname.
    loop at itab.
      ls_GOODSMVT_HEADER-REF_DOC_NO = itab-LFSNR.
      it_goodsmvt-move_type  = itab-BWART.
      it_goodsmvt-po_number  = itab-EBELN.
      it_goodsmvt-PO_ITEM  = '10'.
      it_goodsmvt-STGE_LOC  = itab-LGORT.
    it_goodsmvt-QUANTITY  = itab-LSMNG.
    it_goodsmvt-BASE_UOM = 'KG'.
    it_goodsmvt-material = 'RC1092'.
    it_goodsmvt-entry_qnt = itab-LSMNG.
    it_goodsmvt-ENTRY_UOM  = 'KG'.
      it_goodsmvt-mvt_ind = 'B'.
      it_goodsmvt-plant = 'G001'.
    it_goodsmvt-NO_MORE_GR = 'X'.
    append it_goodsmvt.
    clear it_goodsmvt.
    CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
      EXPORTING
        goodsmvt_header               = ls_GOODSMVT_HEADER
        goodsmvt_code                 = gmcode-gm_code
      TESTRUN                       = ' '
      GOODSMVT_REF_EWM              =
    IMPORTING
      GOODSMVT_HEADRET              =
       MATERIALDOCUMENT              =  lf_MATERIALDOCUMENT
       MATDOCUMENTYEAR               = lf_MATERIALDOCYEAR
      tables
        goodsmvt_item                 = it_goodsmvt
      GOODSMVT_SERIALNUMBER         =
        return                        = return
      GOODSMVT_SERV_PART_DATA       =
      EXTENSIONIN                   =
    if return-type ca 'EA'.
          rollback work.
          message id '26' type 'I' number '000'
          with return-message.
        else.
          call function 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      WAIT          =
    IMPORTING
      RETURN        =
          wait up to 5 seconds.
        endif.
    select * fROM mseg
          INTO CORRESPONDING FIELDS OF TABLE IT_MSEG
                             where mblnr = lf_MATERIALDOCUMENT and
                                       MJAHR = lf_MATERIALDOCYEAR.
      LOOP AT IT_MSEG INTO WA_MSEG.
        IF WA_MSEG-LSMNG IS INITIAL.
          wa_mseg-lsmng = ITab-LSMNG.
          UPDATE MSEG from wa_mseg.
          commit work.
          wait up to 5 seconds.
        ENDIF.
      ENDLOOP.
    ENDLOOP.

    It is been done by implementing one implicit enhancement in FM: MAP2I_B2017_GM_ITEM_TO_IMSEG
    I have added the below functionality at the end of the function module.
    Just i have maped the ERFMG i.e ent_qnt(Received quanity) with LSMNG i.e qty.in del note
    All best for others.
    $$-Start: (1)----
    $$
    ENHANCEMENT 1  Z_EV_IMP_GOODSMOVEMENT.    "active version
    Populate the delivery note quantity and UoM
    IF IMSEG-ERFMG IS NOT INITIAL.
      MOVE IMSEG-ERFMG TO IMSEG-LSMNG.
      MOVE IMSEG-ERFME TO IMSEG-LSMEH.
    ENDIF.
    ENDENHANCEMENT.
    Thanks,
    Mahesh.Gattu
    Edited by: Maheshkumar gattu on Dec 3, 2010 4:35 PM

  • Delivery Note Qty Not populated to MIRO

    Hi,
    During MIGO GR, I have enter Qty in Unit of Entry: 1pc however I enter Del. Note Qty as 20 kg.
    In MIRO, the Del. Note Qty is not populated. It's value is 0 ?
    Anyone please kindly advice.
    Thanks

    Is there a relationship between your delivery note quantity and the GR unit of entry?

  • MIGO againts Inbound delivery: Qty in delivery note field

    Hi all,
    I wondered if it is possible to have the field Qty in delivery note in the trx MIGO NOT being populated. When doing a GR against a PO, the field Qty in delivery note is left blank. But when doing a GR against an Inbound delivery this field is populated.
    thanks a lot!

    Becasue the delivery note quanitty field wil be updated from your vendor confirmations controlled through confirmation control key in PO.Lets say your confirmation control key is defined to have an inbound delivery as a vendor confirmation (AB or LA ) for a PO, then the quantity in the inbound delivery will appear in the delivery note quantity in MOGO screen.
    In standard PO, the confirmation quantity from the vendor is recored anywhere and also there is no AB/LA confirmtions in PO, this is the reason the qnty in the delivery note will not appear when you try to book a GR with reference to PO.

  • How to restrict the excess quantity delivery from the delivery note ?

    Dear All,
    As we know we make the delivery note with the reference of sales order so ordered quantity will be copied in the delivery note automatically. At the time of picking we can reduce the delivery quantity and make the partial delivery.
    But for example I have the sales order of quantity 5 and I make the delivery with refernce of same Sales order so my delivery quantity comes 5 and now if I make the quantity 7 instead of 5 in delivery note only and do the picking of 7 quantity yet system is allowing me then PGI is also possible. It means I delivering excess good than the ordered quantity. Which should not happen to make the cycle full proof.
    I dont what setting is required to avoid this major error. please Gurus Reply soon.
    regards,
    Vojas

    Hi,
    Use t-code 0VLP, select your item category which u determining in delivery >>> Go to details>>>in fron of Min/Max Qty put option B
    Check minimum qty   --- B (Situation rejected with an error message)
    Check overdelivery  --- B (Situation rejected with an error message).
    When user try to change qty,system will give error.
    Kapil
    Edited by: Kapildev Farakte on Dec 28, 2009 10:33 AM

  • Delivery note with reference to sales order - 0 quantity items

    Hi all,
    our system allows items with quantity 0 to be created in delivery notes with reference to sales orders.
    This happens when some items in a sales order are out of stock while others are availiable. The unavailable items are included in the delivery note, but have quantity 0.
    The requirement is to eliminate this behavior and to create delivery notes with availiable items only.
    I would be grateful for any advice how to realise this.
    Best regards, Andreas

    Make the necessary configuration i.e. Check quantity 0 field value should be maintained as B in the respective delivery item category using transaction 0VLP.
    Regards,
    GSL.

  • BAPI to update delivery note

    hi all,
    Is there any BAPI available with which we can update a delivery note and also if possible do PGI using it.
    In case there are separate BAPI's for both the processes that will do for me.
    Kindly help
    Regards
    Varun

    Hi Varun,
    You can use <b>WS_DELIVERY_UPDATE</b> or <b>WS_DELIVERY_UPDATE_2</b> ..
    Following sample code works for Automatic PGI of an existing delivery. Use this as a basis and code for your requirement.
      DATA: ls_vbkok LIKE vbkok,
            lv_error_pgi TYPE xfeld,
            lt_prot LIKE prott OCCURS 0 WITH HEADER LINE,
            lwa_prot like prott.
      ls_vbkok-vbeln_vl = <your Delivery Note number>.
      ls_vbkok-wabuc = c_true.
      CALL FUNCTION 'WS_DELIVERY_UPDATE'
        EXPORTING
          vbkok_wa                           = ls_vbkok
          synchron                           = c_true
    *         NO_MESSAGES_UPDATE                 = ' '
          commit                             = c_true
          delivery                           = <your Delivery Note number>
    *         UPDATE_PICKING                     = ' '
    *         NICHT_SPERREN                      = ' '
    *         IF_CONFIRM_CENTRAL                 = ' '
    *         IF_WMPP                            = ' '
    *         IF_GET_DELIVERY_BUFFERED           = ' '
    *         IF_NO_GENERIC_SYSTEM_SERVICE       = ' '
    *         IF_DATABASE_UPDATE                 = '1'
    *         IF_NO_INIT                         = ' '
    *         IF_NO_READ                         = ' '
    *         IF_ERROR_MESSAGES_SEND_0           = 'X'
    *         IF_NO_BUFFER_REFRESH               = ' '
    *         IF_NO_MES_UPD_PACK                 = ' '
    *       IMPORTING
    *         EF_ERROR_ANY_0                     =
    *         EF_ERROR_IN_ITEM_DELETION_0        =
    *         EF_ERROR_IN_POD_UPDATE_0           =
    *         EF_ERROR_IN_INTERFACE_0            =
         ef_error_in_goods_issue_0          = lv_error_pgi
    *         EF_ERROR_IN_FINAL_CHECK_0          =
       TABLES
    *         VBPOK_TAB                          =
         prot                               = lt_prot[]
    *         VERKO_TAB                          =
    *         VERPO_TAB                          =
    *         VBSUPCON_TAB                       =
    *         IT_VERPO_SERNR                     =
    *         IT_PACKING                         =
    *         IT_PACKING_SERNR                   =
    *         IT_REPACK                          =
    *         IT_HANDLING_UNITS                  =
    *         ET_CREATED_HUS                     =
      IF NOT lt_prot[] IS INITIAL.
        READ TABLE lt_prot WITH KEY msgty = 'E'.
        IF sy-subrc EQ 0.
    ****Errors Exist
    ***      Goods Issue Failed
        ENDIF.
      ELSE.
    ***    Goods Issue posted sucessfully
      ENDIF.
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • Add ordered quantity to delivery note idoc desadv01 with user exit

    Hi,
    I am using the IDOC DESADV01 to output electronic delivery info when a user PGIs on a delivery note.
    The problem is I need some extra data like the original order qty, this exists in field VBAP-KWMENG
    So I think I would need to extend the idoc and do some kind of user exit to populate the value into the new idoc field.
    Unfortunately I have no experience with this, can anybody advise if its the correct way and how to get started?
    With thanks
    Rob.

    I apologies our system is totally different based on that I suggested.
    But current I guess you have to extend idoc.
    Below link is helpful for extending idoc.
    Let me know if still if you face any problem.
    http://www.intelligententerprise.com/channels/applications/feature/archive/kasturi.jhtml
    Thanks,
    Narayan

  • Please help!! update fields of delivery order by using BAPI.

    hi, any one can help me to update the fields of a delivery order.
    the fields in the delevery order are : Batch no. quantity. and Stock location.
    i cannot use any BDC to do that, BAPI is prefered in that report.
    batch number and quantity are easy to find in any BAPI,  but stock loc can not change from BAPI...
    i have tried BAPI_OUTB_DELIVERY_SAVEREPLICA , but it always give me errors. (VL 564 and VL 295. but i definitly gave the delevery type)
    so, is anyone can give me a better bapi?or give me a instance for using BAPI_OUTB_DELIVERY_SAVEREPLICA.
    thanks a lot.
    Chris

    Try:
    BAPI_INB_DELIVERY_CHANGE
    BAPI_OUTB_DELIVERY_CHANGE
    Rob

  • Delivery note in BAPI_GOODSMVT_CREATE

    I'm trying to do GR with purchase order using BAPI_GOODSMVT_CREATE, I need to fill in delivery note (I can fill in using MB01), however I can't find any field for delivery note in BAPI_GOODSMVT_CREATE, anybody knows which field need to fill in? or any other method to fill in?

    Hi All
    I also need to update the delivery note (and also the quantity in the delivery note) using the BAPI_GOODSMVT_CREATE.
    I tried filling the DELIV_NUMB DELIV_ITEM, as recommeded, but it didn't work out. Kindly sugest what is to passed here.
    And finally I was able to update the 'Delivery Note' field by filling the field goods_mvt_header-ref_do_no in the BAPI.
    But this worked only when I passed the Purcahse Order Number (as I am doing the GR against a PO) in goods_mvt_header-ref_do_no.
    If I give any other value, it gives an error M7-036.
    How shall I proceed, cause in the MIGO transaction, I am able to fill anything in the Delivery Note field, but using the BAPI, I can update this field only with the PO number.
    Thanks & Regards,
    Ankur Malhotra

  • DELIVERY NOTE Field missing in BAPI_GOOSDMVT_CREATE

    Hi, I'm trying to do a Goods Receipt from a Purchase Order using BAPI_GOODSMVT_CREATE and I need to fill the DELIVERY NOTE field that appears in MIGO (and in MB01) but I can't find this field in the Header or Item structures of the BAPI.
    Is there an OSS NOTE that fix this?
    Is the field I need already there but with a different name?
    I would be really appreciated if somebody could help (reward points available).
    Thanks in advance,
    Jose Pinedo

    Hi All
    I also need to update the delivery note (and also the quantity in the delivery note) using the BAPI_GOODSMVT_CREATE.
    I tried filling the DELIV_NUMB , as recommeded, but it didn't work out. Kindly sugest what is to passed here.
    And finally I was able to update the 'Delivery Note' field by filling the field goods_mvt_header-ref_do_no in the BAPI.
    But this worked only when I passed the Purcahse Order Number (as I am doing the GR against a PO) in goods_mvt_header-ref_do_no.
    If I give any other value, it gives an error M7-036.
    How shall I proceed, cause in the MIGO transaction, I am able to fill anything in the Delivery Note field, but using the BAPI, I can update this field only with the PO number.
    Thanks & Regards,
    Ankur Malhotra

  • Delivery note from sale order

    Hi all,
    While trying to create a delivery note against sale order in VL10G, the message "only 0 ea of  material XXX available".    In stock material quantity is available.  The material has some reservations against it.  Will this be resulting in not creating delivery note. 
    Regards
    sappy

    Hello,
    Is your material stock against order ie restricted to specific order  or is it make to stock ie in Unrestricted.
    Please check the availability check in sales order. It will show if any delivery is created but not done PGI. Either delete that delivery & then you will be able to create the delivery for this order.
    Let me know if the problem still continues.
    Thanks

  • Joining Sales Orders and Delivery Notes in Query

    Hi Experts
    Please could someone provide me with the correct SQL syntax for joining tables ORDR, RDR1, ODLN and DLN1 in a query?
    I need to show a list of the (rows of all open sales orders) and (closed sales order (which have a delivery note) between certain dates).
    Thanks
    Jon

    Hi Gordon
    Thanks for your help.  Could you help me a little further?  I am writing the query to show me a mixture of (Open Order rows which contain item code 'C&P') and (closed orders between 2 dates which also contain C&P) - both need to have the customer having property 54 set as 'Y'
    Working with what you sent me it almost works but for some reason I cannt fathom it won't show the open orders only the closed.  I think it may have some do with my last JOIN
    This is what I have:
    SELECT T0.DocNum 'Delivery No', T0.DocDate 'Delivery Date',  T3.Quantity 'Delivery Quantity', T1.DocNum 'S/O No', T1.DocDate 'SO Date', T1.DocStatus, T3.ItemCode, T3.Dscription, T2.Quantity 'SO Quantity', T2.Quantity-T3.Quantity 'Balance Quantity', T2.LineTotal'C&P Price After Discount', T2.DiscPrcnt, T2.Project, T4.QryGroup54'Carriage Deal', t2.freetxt, t1.comments
    FROM DBO.DLN1 T3
    INNER JOIN DBO.ODLN T0 ON T3.DOCENTRY = T0.DOCENTRY LEFT JOIN DBO.RDR1 T2 ON T3.BaseENTRY = T2.DOCENTRY AND T2.ItemCode = T3.ItemCode LEFT JOIN DBO.ORDR T1 ON T2.DOCENTRY = T1.DOCENTRY INNER JOIN OCRD T4 ON T0.CardCode = T4.CardCode
    WHERE (T2.ItemCode LIKE 'C&P%%' AND T1.DocStatus='O' and t4.qrygroup54='Y')  or (T2.[ItemCode] LIKE 'C&P%%' AND T1.[DocStatus] = 'C' and T4.QryGroup54='Y' and (T0.DocDate Between '[%0]' and '[%1]'))
    Thanks
    Jon

  • Delivery Notes Generation Via Pick List

    Am trying to generate delivery notes off pick tickets and i can't find any code example. I now came up with the following code but am having issues when items are in multiple Bin Locations.
    Public Sub Sales2Delivery() '(ByVal OrderID As String)
            Dim OrderID As String = ""
            Try
                Using connection As New SqlConnection(StaginConn)
                    'Dim command As New SqlCommand("SELECT DocEntry from ORDR with (nolock) WHERE NumAtCard = '" & OrderID & "'", connection)
                    Dim command As New SqlCommand("SET DATEFORMAT DMY; select distinct top 5 o.DocEntry, o.NumAtCard from ordr O with (nolock) join RDR1 R with (nolock) on R.DocEntry = O.DocEntry join OPKL P with (nolock) on P.AbsEntry = R.PickIdNo where u_shipstate = 'Delivered' and CAST(O.docdate as date) >= '30/04/2014' and P.Status = 'Y';", connection)
                    connection.Open()
                    Dim reader As SqlDataReader = command.ExecuteReader()
                    ' Call Read before accessing data.
                    While reader.Read()
                        Dim BusinessOrders As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oOrders), Documents)
                        Dim BusinessDelivery As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes), Documents)
                        Dim orders As Documents = BusinessOrders
                        orders.GetByKey(Convert.ToInt32(reader(0)))
                        OrderID = Convert.ToString(reader(1))
                        Dim Delivery As Documents = BusinessDelivery
                        Delivery.CardCode = orders.CardCode
                        Delivery.CardName = orders.CardName
                        Delivery.NumAtCard = orders.NumAtCard
                        'Delivery.DocNum = orders.DocNum
                        Delivery.HandWritten = BoYesNoEnum.tNO
                        Delivery.Series = 8
                        Delivery.DocDate = DateTime.Today
                        Delivery.DocDueDate = DateTime.Today
                        Delivery.TaxDate = DateTime.Today
                        Delivery.Address = orders.Address
                        Delivery.Address2 = orders.Address2
                        Delivery.Comments = "Based on Sales Order #" + orders.NumAtCard & "."
                        Delivery.DocCurrency = orders.DocCurrency
                        Delivery.DocDueDate = orders.DocDueDate
                        Delivery.DocObjectCode = SAPbobsCOM.BoObjectTypes.oDeliveryNotes
                        Delivery.ShipToCode = orders.ShipToCode
                        Dim lines As Document_Lines = orders.Lines
                        'If (count > 0) Then
                        '    lines.Add()
                        '    lines.SetCurrentLine((lines.Count - 1))
                        'End If
                        Dim oPickList As PickLists = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oPickLists), PickLists)
                        oPickList.GetByKey(orders.Lines.PickListIdNumber)
                        For i As Int32 = 0 To (lines.Count - 1)
                            If i > 0 Then
                                Delivery.Lines.Add()
                                Delivery.Lines.SetCurrentLine(i)
                            End If
                            ' Set the Current Lines on the order
                            orders.Lines.SetCurrentLine(i)
                            Try
                                oPickList.Lines.SetCurrentLine(i)
                                Delivery.Lines.BaseEntry = oPickList.Lines.OrderEntry
                                Delivery.Lines.BaseLine = oPickList.Lines.OrderRowID
                                Delivery.Lines.Quantity = oPickList.Lines.PickedQuantity
                                Delivery.Lines.BaseType = DirectCast(SAPbobsCOM.BoObjectTypes.oOrders, Integer)
                                Delivery.Lines.BinAllocations.BinAbsEntry = oPickList.Lines.BinAllocations.BinAbsEntry
                                Dim rs As SAPbobsCOM.Recordset = vCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                rs.DoQuery("select itemcode, price, dscription from RDR1 R where R.LineNum = " & oPickList.Lines.OrderRowID & " and R.PickIdNo = " & oPickList.Lines.AbsoluteEntry)
                                While (rs.EoF <> True)
                                    Delivery.Lines.ItemCode = rs.Fields.Item(0).Value.ToString 'orders.Lines.ItemCode
                                    Delivery.Lines.UnitPrice = CType(rs.Fields.Item(1).Value.ToString, Double) 'orders.Lines.UnitPrice
                                    Delivery.Lines.ItemDescription = rs.Fields.Item(2).Value.ToString 'orders.Lines.ItemDescription
                                    rs.MoveNext()
                                End While
                                rs = Nothing
                            Catch ex As Exception
                                Continue For
                                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                            End Try
                        Next
                        If Delivery.Add() <> 0 Then
                            ErrDetails.AppendLine(" Unable to create Delivery note for Order: " & OrderID & " <br /> " & vCompany.GetLastErrorCode() & ":" & vCompany.GetLastErrorDescription())
                        Else
                            ErrDetails.AppendLine("Successfully created Delivery note for Order:" & OrderID) ' & " as requested by " & UserEmail & ".")
                        End If
                        orders = Nothing
                        Delivery = Nothing
                        BusinessOrders = Nothing
                        BusinessDelivery = Nothing
                        My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                    End While
                    'orders = Nothing
                    'BusinessOrders = Nothing
                End Using
            Catch ex As Exception
                ErrDetails.AppendLine(" Error generating Delivery note for Order: " & OrderID & " <br /> " & ex.ToString())
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            Finally
                If Not String.IsNullOrWhiteSpace(ErrDetails.ToString) Then
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Errors encountered while registering data on " & System.DateTime.Now.ToString("F") & ".Errors:" & ChrW(13) & ChrW(10) & Me.ErrDetails.ToString), True)
                Else
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Application Ran successfully on " & System.DateTime.Now.ToString("F") & "."), True)
                End If
            End Try
        End Sub
    The Error message am getting is 1470000368 - The quantity allocated to bin locations must be positive.

    Am getting this error now is
    "1470000341 - Fully allocate item "1017494" to bin locations in warehouse "Isolo". Issue is we have items in multiple Bin locations and the items have been picked via the pick ticket. Is it also possible to generate the delivery note off the Pick List.
    The new code am using is
        Public Sub Sales2Delivery() '(ByVal OrderID As String)
            Dim OrderID As String = ""
            Try
                Using connection As New SqlConnection(StaginConn)
                    'Dim command As New SqlCommand("SELECT DocEntry from ORDR with (nolock) WHERE NumAtCard = '" & OrderID & "'", connection)
                    Dim command As New SqlCommand("SET DATEFORMAT DMY; select distinct top 5 o.DocEntry, o.NumAtCard from ordr O with (nolock) join RDR1 R with (nolock) on R.DocEntry = O.DocEntry join OPKL P with (nolock) on P.AbsEntry = R.PickIdNo where u_shipstate = 'Delivered' and CAST(O.docdate as date) >= '30/04/2014' and P.Status = 'Y' and o.DocStatus = 'O';", connection)
                    connection.Open()
                    Dim reader As SqlDataReader = command.ExecuteReader()
                    ' Call Read before accessing data.
                    While reader.Read()
                        Dim BusinessOrders As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oOrders), Documents)
                        Dim BusinessDelivery As Documents = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oDeliveryNotes), Documents)
                        Dim orders As Documents = BusinessOrders
                        orders.GetByKey(Convert.ToInt32(reader(0)))
                        OrderID = Convert.ToString(reader(1))
                        Dim Delivery As Documents = BusinessDelivery
                        Delivery.CardCode = orders.CardCode
                        Delivery.CardName = orders.CardName
                        Delivery.NumAtCard = orders.NumAtCard
                        'Delivery.DocNum = orders.DocNum
                        Delivery.HandWritten = BoYesNoEnum.tNO
                        'Delivery.Series = 8
                        Delivery.DocDate = DateTime.Today
                        Delivery.DocDueDate = DateTime.Today
                        Delivery.TaxDate = DateTime.Today
                        Delivery.Address = orders.Address
                        Delivery.Address2 = orders.Address2
                        Delivery.Comments = "Based on Sales Order #" + orders.NumAtCard & "."
                        Delivery.DocCurrency = orders.DocCurrency
                        Delivery.DocDueDate = orders.DocDueDate
                        Delivery.DocObjectCode = SAPbobsCOM.BoObjectTypes.oDeliveryNotes
                        Delivery.ShipToCode = orders.ShipToCode
                        Dim lines As Document_Lines = orders.Lines
                        'If (count > 0) Then
                        '    lines.Add()
                        '    lines.SetCurrentLine((lines.Count - 1))
                        'End If
                        Dim oPickList As PickLists = DirectCast(vCompany.GetBusinessObject(BoObjectTypes.oPickLists), PickLists)
                        oPickList.GetByKey(orders.Lines.PickListIdNumber)
                        For i As Int32 = 0 To (lines.Count - 1)
                            If i > 0 Then
                                Delivery.Lines.Add()
                                Delivery.Lines.SetCurrentLine(i)
                            End If
                            ' Set the Current Lines on the order
                            orders.Lines.SetCurrentLine(i)
                            Try
                                oPickList.Lines.SetCurrentLine(i)
                                Delivery.Lines.BaseEntry = oPickList.Lines.OrderEntry
                                Delivery.Lines.BaseLine = oPickList.Lines.OrderRowID
                                Delivery.Lines.Quantity = oPickList.Lines.PickedQuantity
                                Delivery.Lines.BaseType = DirectCast(SAPbobsCOM.BoObjectTypes.oOrders, Integer)
                                'Dim rs As SAPbobsCOM.Recordset = vCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                'rs.DoQuery("select itemcode, price, dscription from RDR1 R where R.LineNum = " & oPickList.Lines.OrderRowID & " and R.PickIdNo = " & oPickList.Lines.AbsoluteEntry)
                                'While (rs.EoF <> True)
                                Delivery.Lines.ItemCode = orders.Lines.ItemCode
                                Delivery.Lines.UnitPrice = orders.Lines.UnitPrice
                                Delivery.Lines.ItemDescription = orders.Lines.ItemDescription
                                '            rs.MoveNext()
                                '            End While
                                'rs = Nothing
                            Catch ex As Exception
                Continue For
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            End Try
                        Next
                        If Delivery.Add() <> 0 Then
                            ErrDetails.AppendLine(" Unable to create Delivery note for Order: " & OrderID & " <br /> " & vCompany.GetLastErrorCode() & ":" & vCompany.GetLastErrorDescription())
                        Else
                            ErrDetails.AppendLine("Successfully created Delivery note for Order:" & OrderID) ' & " as requested by " & UserEmail & ".")
                        End If
                        orders = Nothing
                        Delivery = Nothing
                        BusinessOrders = Nothing
                        BusinessDelivery = Nothing
                        My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
                    End While
                    'orders = Nothing
                    'BusinessOrders = Nothing
                End Using
            Catch ex As Exception
                ErrDetails.AppendLine(" Error generating Delivery note for Order: " & OrderID & " <br /> " & ex.ToString())
                My.Computer.FileSystem.WriteAllText(_LogPath, ErrDetails.ToString, True)
            Finally
                If Not String.IsNullOrWhiteSpace(ErrDetails.ToString) Then
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Errors encountered while registering data on " & System.DateTime.Now.ToString("F") & ".Errors:" & ChrW(13) & ChrW(10) & Me.ErrDetails.ToString), True)
                Else
                    My.Computer.FileSystem.WriteAllText(_LogPath, (ChrW(13) & ChrW(10) & ChrW(13) & ChrW(10) & "Application Ran successfully on " & System.DateTime.Now.ToString("F") & "."), True)
                End If
            End Try
        End Sub

Maybe you are looking for

  • Album Art Not Displaying/Disappearing

    I've had the iTouch for a week & all of a sudden most of the album art disappeared from the iTouch. I synced again, some came back but much of the album art does not display even though it's in the iTunes library. Also, album art is duplicated for ot

  • Phone attached to Freetalk Connect Me device rings...

    Is my device faulty? I purchased a FreeTalk Connect Me about two months ago. No matter what phone I attach, it rings for no reason every 10 minutes or so. This behavior didn't seem to occur when I was only using it as a Skype phone, but apparently ma

  • Setup error - internet explorer 5.0 or later required

    Hi... Sir, i face the subject problem when during installing hp color LJ 5550 printer with Windows 7 64 bit, I tried too many times but didn't installed and also didn't found any help from intenet.  I have the printer driver CD it did not work, i als

  • Rwcon60 fiails to compile in batch mode

    Not too sure where to place this. I've got some reports which I am using the 9ias rwcon60 utility to compile. Individually they compile ok, but in a multiple batch they fail with syntax errors. See the dump below... $ ls admin JOURNAL_DAY_BOOK.rep db

  • MenuBar in sapui5

    Hi All, I have been trying to develop a simple page with SAPUI5 controls. I have created a Menu Bar and Menu Bar Items with the following kind of code. var oMenuBar = new sap.ui.commons.MenuBar("menuBar"); var oMenuBarItem1 = new sap.ui.commons.MenuI