DI - Pick list creation

Hi all,
I've seen a few examples of creating Pick Lists through the DI, and I can't understand why my version won't work...
If anyone can notice anything obvious and point it out to me that would be of great help!
Using SAPB1 v9 PL10.
MSSQL 2012.
BoObjectTypes.BoRecordset)
Dim sqlstring As String = "select t0.DocNum, t1.DocEntry,t1.ItemCode, t1.Quantity, t1.DocDate, t1.LineNum, t1.LineStatus, t1.Price from ordr t0 inner join rdr1 t1 on t0.docentry = t1.DocEntry where docnum = 448 and t1.LineStatus = 'O'"
"DocEntry").Value
"DSV Interface"
Do Until OrderRs.EoF
"ItemCode").Value
"Price").Value
"17" ' Sales order
"LineNum").Value
Loop
If PLIST.Add = 0 Then
'success!
Else
"SOWMS03, generate picklist", "Error creating PickList!")
End If

Dim PLIST As SAPbobsCOM.PickLists = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists)
Dim DocEntry, qty As Integer 'SO docentry & line qty
Dim ItemCode As String ' Itemcode for SO line
Dim price As Double
Dim LineNum As Integer
Dim OrderRs As SAPbobsCOM.Recordset
OrderRs.DoQuery(sqlstring)
DocEntry = OrderRs.Fields.Item("DocEntry").value
PLIST.PickDate = Today
PLIST.Name = "Name"
PLIST.OwnerCode = 1
Do Until OrderRs.EOF
ItemCode = OrderRs.Fields.Item("ItemCode").Value
price = OrderRs.Fields.Item("Price").value
PLIST.LINES.BaseObjectType = "17" ' from a sales order
PLIST.Lines.OrderEntry = DocEntry
LineNum = OrderRs.Fields.Item("LineNum").value
PLIST.Lines.ReleasedQuantity = OrderRs.RecordCount
PLIST.Lines.Add()
OrderRs.MoveNext()
Loop
if PLIST.Add = 0 then
'Success!
Else
Err.Raise(vbObjectError, "blah blah blah", "blah")
end if
I had to copy this out by hand as copy&paste cuts out the code. You can assume that the sql query being executed to fill the OrderRs recordset returns everything I need, I've also skipped out a few echoes that I use for debugging, which indicate that none of these values are NULL or Nothing.
Thanks for the interest in my issue!
Cal.

Similar Messages

  • Pick list creation

    i would like to create a pick list from a process order and would like to choose what locations to get the stock from what is the tcode for this

    i would like to create a pick list from a process order and would like to choose what locations to get the stock from what is the tcode for this

  • TO (Pick LIst) Creation before GI for Reservation

    Hi Experts,
    We have a requirement that we should create the TO (Pick List) first for a reservation and after physical picking perfomr the GI. Is there standard SAP functionality to cater this requirement? If we do teh GI first then process is standard but teh requirement is that  we wanted to create the TO without doing GI.
    Please advice.
    Thanks,
    KHAN

    Hi Khan,
    If I understand you right, you would like to do the TO before doing the PGI. This is standard. For this, you must either have Lean WM or full WM active.
    Hope this answers your question.
    Regards
    Nikhilesh

  • Pick List Creation Released quantity exceeds open quantity

    Hi all,
    I'm getting the following error when trying to create pick lists through the SAPB1 DI:
    "Released quantity exceeds open quantity "
    Every time, the stock quantity in the warehouse that the code concerns is by far enough when compared to the released quantity.
    I cannot turn off the warehouse setting recommended on another post on here.
    Any ideas?
    Thanks
    Cal.

    Hi, sorry for my delayed response!
    This is still an issue, I already have a condition to check against the warehouse's current stock, this is being successful but still generates the above error when we get to PLIST.add()
    Here's the SQL I'm using to gather my data:
    select distinct t3.docnum,t4.listName as'Price List',(select isnull(sum(1),0) from pkl1 S99 where S99.orderentry = T0.docentry
    and S99.orderline = T0.linenum) as 'cupid',t0.DocEntry, t3.Confirmed, DATEDIFF(DAY,GETDATE(),t3.DocDueDate)
    as 'DateDifference' from rdr1 t0 inner join oitm t2 on t0.ItemCode = t2.ItemCode inner join ORDR t3
    on t3.DocEntry = t0.DocEntry inner join OCRD t1 on t3.CardCode = t1.cardcode inner join OPLN t4
    on t1.listnum = t4.listNum where T0.[WhsCode] = 'xxx' and  T2.[OnHand] > 0 and  T0.[OpenQty] > 0 and T2.InvntItem = 'y'
    and t3.Confirmed = 'y' and (select isnull(sum(1),0) from pkl1 S99 where S99.orderentry = T0.docentry and S99.orderline = T0.linenum) = 0
    and t4.ListName <> 'EconoSupplies Sales' and t4.ListName <> 'EconoSupplies Sales (EUR)'
    and DATEDIFF(DAY,GETDATE(),t3.DocDueDate) < case when datepart(WEEKDAY,getdate()) = 6 then 4 else 2 end group by t3.docnum,t0.docEntry,
    t3.Confirmed , t0.LineNum, t4.listname, DATEDIFF(DAY,GETDATE(),t3.DocDueDate) order by t0.DocEntry
    This returns a list of all the picks that I am interested in. I have changed the warehouse code for privacy.
    Next, we loop through each pick and extract the data:
    SELECT T1.[DocNum], T1.[DocEntry],T0.[LineNum],  T1.[CardCode],T0.[ItemCode], T0.[Dscription], T0.[OpenQty], (SELECT sum(s99
    .[OpenQty]) FROM RDR1 s99 WHERE s99.[DocEntry] = T0.[DocEntry] and  s99.[ItemCode] = T0.[ItemCode]) as 'TotalQty',T3.
    [OnHand] FROM RDR1 T0 INNER JOIN ORDR T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER
    JOIN OITW T3 ON T0.ItemCode = T3.ItemCode and T0.WhsCode = T3.WhsCode WHERE T0.[WhsCode] = 'DSV' and  T3.[OnHand] > 0 and 
    T0.[OpenQty] > 0 and T2.InvntItem = 'y' and t0.docEntry =  <<<VB VARIABLE HERE>>>
    ORDER BY T1.[DocEntry], T0.[LineNum]
    These two sql commands are stored in a table and called from the VB code, for soft code re-usability.
    The SQL returns the results I am expecting, and I don't think the problem lies here.
    Here's the VB code:
            Dim PLIST As SAPbobsCOM.PickLists
            PLIST = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPickLists)
            Dim RS, RS1, RS2, RS12 As SAPbobsCOM.Recordset
            Dim i, ii As Integer
            RS = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            RS1 = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            RS12 = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            Dim WhsCode As String = GetCompanyNamedConfigValue("xxxxx", "xx")
            Dim SQLText As String
            Dim nErr, errMsg As String
            Dim DocDate As Date = Now
            Dim tempI As Integer = 1
            Dim executeBody As Boolean = True
            Dim ExecuteHead As Boolean = True
            Dim picklistcheck, picklistcheck1 As String
            Dim Type As String
            'CJB---- AUTO GENERATE PICK LIST-------------------------------------
            Dim OCHAPPCFGValue As String = GetAPPCFGEntry("GeneratePicks")
            If OCHAPPCFGValue = "Y" The
                Dim DocEntry, qty, docnum As Integer 'SO docentry & line qty
                Dim ItemCode As String ' Itemcode for SO line
                Dim price As Double
                Dim LineNum As Integer
                Dim OrderRs, ORderRs1 As SAPbobsCOM.Recordset
                Dim HashTable As New Hashtable
                Dim HashArray(2) As String
                OrderRs = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                ORderRs1 = GetDIConnection.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                Dim sqlstring1 As String = GetAPPCFGEntry("SQLSTRING1SOWMS03")
                Echo("Debug, sqlstring1: " & sqlstring1)
                OrderRs.DoQuery(sqlstring1) ' just assume the SQL brings back what I need
                Dim Attemptcount As Integer = 1
                'We now have the docEntries we need, so we loop through each docEntry and extract the lines
                Do Until OrderRs.EoF
                    DocEntry = OrderRs.Fields.Item("DocEntry").Value
                    EchoBanner("NEW RECORD, attempt count: " & Attemptcount)
                    Echo("DocEntry: " & DocEntry)
                    Dim sqlstringPart1, SqlStringPart2 As String
                    sqlstringPart1 = GetAPPCFGEntry("SQLSTRINGSOWMS03P1")
                    SqlStringPart2 = GetAPPCFGEntry("SQLSTRINGSOWMS03P2")
                    Dim sqlstring As String = sqlstringPart1 & " '" & DocEntry & "' " & SqlStringPart2
                    Echo("Debug: SOFT CODED SQL STRING FROM OCHAPPCFG FOR PICK LIST SELECTION CRITERIA:")
                    Echo(sqlstring)
                    ORderRs1.DoQuery(sqlstring)
                    If ORderRs1.RecordCount = 0 Then
                        'Error!
                        EchoBanner("No records found under docEntry: " & DocEntry)
                    End If
                    PLIST.PickDate = Today
                    PLIST.Name = "DSV Interface"
                    PLIST.OwnerCode = 1
                    Dim icount As Integer = 0
                    Dim onHand, TotalQty As Integer
                    Dim LineAdded As Boolean = False
                    Do Until ORderRs1.EoF
                        docnum = ORderRs1.Fields.Item("DocNum").Value
                        'PLIST.Lines.SetCurrentLine(icount)
                        ItemCode = ORderRs1.Fields.Item("ItemCode").Value
                        ' price = OrderRs1.Fields.Item("Price").Value
                        onHand = CInt(ORderRs1.Fields.Item("onHand").Value)
                        TotalQty = CInt(ORderRs1.Fields.Item("TotalQty").Value)
                        Echo("DocNum: " & docnum)
                        Echo("Debug: Onhand: " & onHand)
                        Echo("Debug: TotalQty: " & TotalQty)
                        If TotalQty > onHand Then
                            'WE CANNOT RAISE THIS PICK LIST, MORE REQUESTED THAN IN STOCK!
                            Echo("Unable to generate Pick List, not enough stock for item: " & ItemCode)
                            Exit Do
                        End If
                        PLIST.Lines.SetCurrentLine(icount)
                        Echo("Line set to " & icount)
                        PLIST.Lines.BaseObjectType = SAPbobsCOM.BoObjectTypes.oOrders
                        PLIST.Lines.OrderEntry = DocEntry
                        'CJB
                        LineNum = ORderRs1.Fields.Item("LineNum").Value
                        PLIST.Lines.OrderRowID = LineNum
                        'PLIST.Lines.ReleasedQuantity = OrderRs1.RecordCount ' quantity from the line in SO - OpenLineQty
                        PLIST.Lines.ReleasedQuantity = ORderRs1.Fields.Item("OpenQty").Value
                        '  PLIST.Lines.TaxCode = OrderRs1.Fields.Item("VatGroup").Value
                        Echo("Record count : " & ORderRs1.RecordCount)
                        Echo("Icount: " & icount)
                        Echo("Details...")
                        Echo("Debug: LineNum: " & LineNum)
                        Echo("Debug: DocNum: " & docnum)
                        Echo("Debug: ItemCode: " & ItemCode)
                        Echo("Debug: Released Quantity: " & PLIST.Lines.ReleasedQuantity)
                        Echo("Debug: Picked Quantity: " & PLIST.Lines.PickedQuantity)
                        Echo("Debug: OnHand: " & onHand)
                        Echo("Debug: PickDate: " & PLIST.PickDate)
                        PLIST.Lines.Add()
                        Echo("Pick List line added!")
                        icount += 1
                        ORderRs1.MoveNext()
                        LineAdded = True
                    Loop
                    ' OrderRs.DoQuery("select t0.absentry, t0.pickentry, t0.orderEntry, t1.DocEntry, t0.PickQtty from pkl1 t0 inner join ordr t1 on t0.OrderEntry = t1.DocEntry where t1.DocEntry = '" & DocEntry & "'"
                    ' If OrderRs.RecordCount = 0 Then
                    If LineAdded = True Then
                        Echo("Adding Pick List...")
                        Dim lretcode As Integer = PLIST.Add()
                        If lretcode = 0 Then
                            'success!
                            EchoBanner("Success")
                            Dim LastPickEntry As String = GetDIConnection.GetNewObjectKey()
                            Echo("Enitre Pick List created! See Pick & Pack -> Pick List in SAPB1")
                            Echo("Pick Entry: " & LastPickEntry)
                        Else
                            EchoBanner("ERROR! UNABLE TO GENERATE PICKLIST!!   " & GetDIConnection.GetLastErrorDescription)
                        End If
                    Else
                        Echo("NO LINES FOUND TO ADD TO THE PICK LIST!")
                        ' Err.Raise(vbObjectError, "SOWMS03, generate picklist", "Error creating PickList!  Error Description:  " & GetDIConnection.GetLastErrorDescription & "    Error Code: " & GetDIConnection.GetLastErrorCode)
                        'need a way of logging this error without jumping out of the loop.
                    End If
                    OrderRs.MoveNext()
                    Attemptcount += 1
                Loop

  • Change Pick List Output Format with automated Output format  froTO creation

    hi.,
    When creating TO for delivery using VL06P or LT03 there is no opportunity to print the Company Custom  Format(X1) of the pick list.
    But if it is reprinted in LT31, Print Code X1(Company defined picking list Output format) can be selected. This is our custom formatted TO output format.
    The delivery address is on the document, so if X1 format is used with the automated output from TO creation, Warehouse personel will have the Hardcopy of the delivery address.
    Question: How can i have the Print Code X1 to default when i am creating delivery using VL06P or LT03.
    All help is much appreciated.
    Tx

    Resolved by Myself

  • Item in sales order not being picked into picking list

    Hi Gurus,
    Could you please tell me the possible reasons as why an item in the sales order which has enough stock not being picked into the picking list?
    Many Thanks
    Choudry

    Hi
    Delivery creation that is selection date is controlled by the schedule line of the line item in the sales order
    Try by changing the schedule lines in sales order in VA02
    there you try to change the delivery date to past
    It might be possible if you had enough stocks at that time
    Regards
    Raja

  • Infoview pick list values and CR parameter values are not the same

    Hello All
    We have created created Crystal Reports based upon BW Query using Static Parameters as recomended by SAP. When we run the query in InfoView the Pick List is dynamically updated and returns the correct data for selection. When The Crystal Report opens and you wish to navigate through the report using the parameter selection the selection criteria has not been maintained by BW and does not match the Pick List.
    Can you please advise if there is any way to make this work?
    We ar using Crystal Reports 2008 version 12.3.1.684
    on BOBJ XI 3.1
    Any help would be appreciated,
    Phillip

    Hello Ingo
    What is strange that in InfoView the pick list is only dynamic the Parameters when the document is open (in InfoView) are not dynamic. An example would be Searching on Material. In Info view the pick list provides all the materials to select from. Once though the report is open the parameter list on the left hand side could be seen as blank as it refers to the static list that is not manually maintained within Crystal Reports or provide a list of details that has no reference to the dynamic selection as returned from BW as it is a static list that was loaded with Crystal Reports Designer on creation.
    What we are wanting to achieve is that Info View Pick List is Dynamic and the Parameter list that can be used to navigate within the document once opened is dynamically refreshed to be the same as the Pick List provided by BW and InfoView.
    Is this possible?
    With CR Designer if we use Do Not Show, Info View no longer provides this parameter on the left hand side.
    If we use Editable the list provided in InfoView is equal to the static list as maintained within CR Designer.
    We have not tested Read Only Yet so I am not sure if this could be the solution or not.
    Any ideas would be of great benefit
    Phillip
    Edited by: Phillip L on Nov 26, 2010 5:22 PM
    Edited by: Phillip L on Nov 26, 2010 5:23 PM

  • Printing immedietely of Putaway list or Pick list in SAP WM

    Hi
    We have one requirement in WMS rollout is:
    For automatic background printing of Putaway list or Pick list in SAP WM, System doesnt recognize Printer name as LOCL (settings in T code- OMLV). In OMLV we must have a network printer name for automatic printing the Putaway List after MIGO transaction and also for automatic printing the Pick List in Background with WMTA out put type - which triggers during delivery creation.
    If we configure LOCL in OMLV screen the spool gets generated but it doesnt execute automatically and that needs to be triggered manually using T code SP02 or SP01.
    We want to print these putaway or pick list automatically(either thru LOCL or network printer) immediate after generating a spool(without any user interaction).
    Regards,
    MM

    Hi MM,
    Inorder to get automatic put away list after GR you need to define the printer in OMLV settings.
    Step 1:
    If you are using Ricoh printer (Paper print out of TO) and Zebra Printer (Label printer for printing labels), you need define this combination under the icon "Printer pool/Labels".
    Warehouse - Ricoh printer name - Zebra printer name (Pre-condition : Both the Ricoh and Zebra printers needs to be configured in SAP by your Basis team).
    Step 2:
    Under icon "Warehouse Movement" in the Assignment section, you need to define the condition for printing.
    For example
    Warehouse no: Source str type  Destination str. type  Printername
    AB1                    902                         ***                         Ricoh printer name1
    AB1                    Q01                         ***                         Ricoh printer name2
    The above situation prints all put away list for receiving area to Ricoh printer name 1 & all put away list cleared by QA people to Ricoh printer name 2.
    Step 3:
    Analyze the condition set under the icon "Analyze" (print control tables).
    You can re-check the conditions set by you in the above section. specify the warehouse number, source str type, dest. str type and execute you should be getting the printer name correctly assigned in the earlier section.
    Hope the above explanation helps. Pls award points if you feel appropriate.

  • Picking List output

    Hello Experts,
    I have configured the picking List output type to print the picking list at the time of delivery creation. However, when i change the delivery quanitity or picking quantity, it is printing the output document. How can i avoid this situation, i want it to be printed only at creation not on changes to the delivery document. Please advise
    Thanks

    Hi!
    I think you need to ensure that "Multiple issuing" check box in v/34 is switched off for the corresponding output type.
    Regards,
    Raghukul Tilak Mokirala

  • Picking, pick list & TOs

    Hi Experts,
    I need some advice/help on possible transactions and possibilities for automation for the following functionality/process (steps 2&3). This is for WM.
    1. Sales orders are logged and outbound deliveries are created (these deliveries may be up to a month in the future).
    2. Transfer orders should be created, preferably automatic. 
    3. Every morning in the warehouse a pick list need to be extracted with all picks for the day. Sorting options for this is needed. (The volumes are large).
    Also, for pick waves:
    - How is a pick list generated?
    - Can the creation of pick waves be trigger automically (for example every morning)?
    Edited by: johlin76 on Jan 30, 2012 10:53 AM

    Please tell me the procedure to get standard pick list for delivery. Picking has to be done from warehouse.
    To select outbound deliveries due for picking, :
    From shipping, choose Picking , Create transfer order  Via Outb. Delivery Monitor.
    The Outbound Deliveries for Picking screen appears.
    In the Organization data section, enter
    1.the shipping point,
    2.in the Output proposal section,
    3.relevant shipping documents
    If, in the same overview, you want to display deliveries due for fixed bin picking as well as check deliveries to be passed on to the WM System for picking in the same overview, select the Both picking types indicator in the Picking data section. Otherwise, you must enter an indicator for the picking type according to which selections are to be made.
    Then just Execute.Day's Workload for Picking screen appears.
    In this list, the system displays the deliveries for picking, sorted by shipping point and picking date
    Regards
    Saurabh

  • Picking List output for WM

    Hello,
    Can you tell if there is a standard Pickling list output type for a Sales Order Outbound delivery for a WM activated plant.(EK00 is no longer in application V2)
    How can a Transfer Order creation trigger this Picking List (output type?)
    Please let me know
    Thanks
    SAP FAN.....

    Hi,
    You can do this in the transaction OMLV -> 'Print Code',  Form name depends on the print code.  Few are here with.
    Single print / TO item          LVSTAEINZEL
    Multiple print / TO          LVSTALISTE
    Single print for ref.no.          LVSTAEINZEL
    Multiple print ref.no.          LVSTALISTE
    Picking list version 1          LVSKOMMIL1
    Picking list version 2          LVSKOMMIL2
    Posting change notice          LVSUMBUCHEN
    Single printout w. kanban          LVSTOSOLOKANBAN
    Single printout w.kanban          LVSSAMMELKANBAN
    Best Regards,

  • Bar code shipment numbers on picking lists

    Dear All,
    I want to add Bar code to shipment numbers on picking lists so warehouse/shippers can scan the bar code instead of type in the number.  This would really save time on UPS shipments.  Currently the warehouse/shippers have to type each UPS shipment number twice (one time to confirm pick and one time to print packing list).  Since there are 50 - 100 UPS shipments daily, a lot of time could be saved with scanning the shipment number instead of keying.
    What can be the resolution for this? Can this be automated at  the configuration level?
    Or can it be done through the help of coding? Any ideas on this issue?
    Advises are welcome.
    Regards,

    The t.o. confirmation can be automatic at the time of t.o. creation (autoconfirm) if you desire and/or you could make the print output  to trigger at time of t.o. confirmation.
    Another option would be to paste the shipment numbers into an excel file and convert the numbers to bar code for scanning.
    You can get a very popular bar code "font" (3 of 9 barcode) free online and use it just like any other font in excel.

  • Print a "Pull Sheet" or "Pick List" when Transfer Order Created

    How do I automatically print a "Pull Sheet" or "Pick List" upon creating a transfer order?
    Is this the same thing as going into LT31?

    Production Schedulling Profile - WM request are set to TR & TO automatically created on Release
    Goto IMG
    gotot Production >>> shop floor control>> Master data >> define Production scheduling profile.
    We can see screen
    we can define
    in transport
    WM request
    options available
      No creation of transfer requirements on order release
    X  Only creation of transfer requirements on release
    1  Transfer requirement and transfer order on release
    Please tell me if u face any problem
    Sunil Singh

  • 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

  • BW Hierarchies sometimes not showing as pick list

    Hi,
    we have created a Crystal Report that uses a parameter that should be picked from a BW hierarchy (a cost center group). We created the report and published it via the BW publisher to BO and then included it with an iView in the BW Portal.
    Now when I log on to the portal and call the report, I'm presented with the static pick list (top 200 values) most of the time instead of the hierarchy view (as described in http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsandBWquery+elements in the lower part of the article)
    When I then log on to the CMC and call the report there, I first get the flat list, too, but when I call the report 2 or 3 times, I get the hierarchy view. When I now go back to the BW Portal, I get thet hierarchy view there as well...
    any idea what causes this issue? How can I influence which selection screen is being displayed? (particularly as I don't want everyone to have to log on to CMC first...)
    Thanks...

    Hi Duncan,
    thank you for your reply. It's really sort of tricky.
    After the pick list is up and ready once, It'll be shown fine from that point on until, I assume, my CMC login expires.
    So maybe it's some permission problem?
    I just tested the following:
    <ul>
    <li>log into portal, call report -> flat list
    <li>log into CMC -> call report (does not have to be the same, just has to have a hierarchy pick list, a simple report does not do the trick) -> check that it has the hierarchy pick list
    <li>go back to the portal, call the report again -> hierarchy pick list comes up ok
    <li>log off from CMC
    <li>go back to the portal, call the report again -> flat list again...
    </ul>
    the whole thing works the same when I replace CMC by InfoView. The strange thing is that I have to log in to Infoview the first time I call the report from the portal (even though we have SAP credentials in BO), but this does not seem to be sufficient. I have to call one of the reports in Infoview or CMC first to make it work from the portal.
    Concerning the trace, I'll have to look into this together with our sysadmins, but I'll see what I can get.
    Thanks again for your ideas,
    cheers
    MU

Maybe you are looking for