Purchase Order  - matrix

Hi,
  I would like to place some data from an array in my code to the matrix in Purchase Order Screen.But the Below code is throwing "Invalid Column" error
If oApplication.Forms.ActiveForm.TypeEx = "142" Then
                oMatrix = oApplication.Forms.ActiveForm.Items.Item(38).Specific
                If oMatrix.RowCount <= 0 Then
                    oMatrix.AddRow()
                End If
                oEText = oMatrix.Columns.Item("ItemCode").Cells.Item(oMatrix.RowCount).Specific
                str = aClist(0)
                oEText.Value = str
            End If
How to solve this?
Manojkumar

Hi Ad,
My Doubt is below?
In my form i have a matrix.On load of this form i need to fill the matrix with columns from two differrent tables.So i have created a view in my code and i would like it to be binded to the matrix.
Below is the code
ssql = "create view HPreq as select a.docnum as DocNum,a.U_prdt as prdt,a.U_from as frm,b.U_item as item,b.u_Qty as Qty from [@PREQ] a,[@PREQ1] b"
olinrec.DoQuery(ssql)
If olinrec.RecordCount > 0 Then
oDBDataSource = oForm.DataSources.DBDataSources.Add("HPreq")
End If
oMatrix.Clear()
oDBDataSource.Query()
For iLoop = 0 To oDBDataSource.Size - 1
oDBDataSource.Offset = iLoop
oUSDataSource.Value = iLoop + 1
oMatrix.AddRow()
Next
The Problem i face here is
1.On executing the below line
olinrec.DoQuery(ssql)
it throws "Object already exist"
2.It means the view has been already created. So i commented these lines. But on On executing the below line
oForm.DataSources.DBDataSources.Add("HPreq")
It throws "DataTable not found"
How to solve this error?
ManojKumar

Similar Messages

  • Add Invoice from Purchase Order

    Hi experts,
    I add the Button in Purchase order .and bind the Vendor codes and items, qty, price in matrix(Purchase order matrix) . Now i want to add the Invoice separately  for all vendors who are exist in row level when i click the userdefined button in Purchase order (I need not to open a Invoice). How is it possible
    With Best Regards,
    M.Thippa Reddy

    Hi Vassu,
    Thanks for your reply. I use the following code for adding the invoice but i getting error"-5002 Chooseb BP is not a custome [OINV.Cardcode]{Line:1], "V1010"
    Please rectify me i am done any mistake.
    Dim RetVal As Long
            Dim ErrCode As Long
            Dim ErrMsg As String
            'Create the Documents object
            Dim vInvoice As SAPbobsCOM.Documents
            vInvoice = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
            'Set values to the fields
            vInvoice.Series = 0
            vInvoice.CardCode = "V1010"
            'vInvoice.HandWritten = "No"
            vInvoice.DocNum = 84
            vInvoice.PaymentGroupCode = "-1"
            vInvoice.DocDate = System.DateTime.Today.Date
            vInvoice.Lines.ItemCode = "A00001"
            '  vInvoice.Lines.ItemDescription = "Banana"
            vInvoice.Lines.TaxCode = "NY"
            vInvoice.Lines.Quantity = 50
            'vInvoice.Lines.DiscountPercent = 10
            vInvoice.Lines.UnitPrice = 5.0
            vInvoice.Lines.Add()
            'Add the Invoice
            RetVal = vInvoice.Add
            'Check the result
            If RetVal <> 0 Then
                oCompany.GetLastError(ErrCode, ErrMsg)
                MsgBox(ErrCode & " " & ErrMsg)
            End If
    Regards,
    M.Thippa Reddy

  • Problem in matrix on purchase order form

    Hi ,
    After filling the records ,I am trying to make the whole matrix non-editable on purchase order form .It works perfectly.when I again about to fill the matrix , It does not let me make the columns editable through code.
    I don't want to use the Form settings.. from the menu,where i can make the columns active.
    please tell me , how can i make the matrix editable after making it non editable.
    please help..
    thanx

    Barend,
    when I make it editable = true the it gives me an eror
    that "item is not a user defined item"
    I am using the following code..
    oMatrix.Columns.Item(i).Editable  =true;

  • DTW Problem ---- Goods Receipt and Purchase Order

    Hi Owen Slater and Suda
    Your reply helped me a lot in loading in linking the GR with PO via DTW.But still i m having a small problem.
    In Document_Lines of Purchase Order and Purchase Delivery Notes i specifed two Taxcode as "Exempt" and "VAT@4" under the column "Taxcode" and initially loaded the purchase order,the tax code get added correctly to the purchase order and when i tried to load the GR for the same line item with same tax code,the tax code is not getting added to the GR line item and the tax amount get deducted in the GR.
    For more information: SAP Business One SDK
    Edited by: Rui Pereira on Nov 7, 2008 1:23 PM

    Purchase Order Documents
    Recordkey  Cardcode  DiscountPercent  DocDate   DocDueDate  DocNum  DocTotal
    Recordkey  Cardcode  DiscountPercent  DocDate   DocDueDate  DocNum  DocTotal
       1         AA01        0            20080912   20080912     1       
    oPurchaseOrder:Document_Lines
    Recordkey  LineNum AccountCode DiscountPercent     ItemCode  Linetotal  Price  Quantity  Taxcode   WarehouseCode
    Recordkey  LineNum AccountCode DiscountPercent     ItemCode  Linetotal  Price  Quantity  Taxcode   WarehouseCode
       1                1211005        0           ITM01                850     45        VAT@4     Godown1
       1                1211005        0           ITM02                750     55        VAT@4     Godown1
    As per your suggestion i left the "DocTotal" column of  PO --- Document and "Line Total" and "Line Num" column of PO ---Document_Lines as blank and also the Discount column is assigned to 0 and this get imported correctly.
    oPurchaseDeliveryNotes:Documents
    Recordkey  Cardcode  DiscountPercent  DocDate   DocDueDate  DocNum  DocTotal
    Recordkey  Cardcode  DiscountPercent  DocDate   DocDueDate  DocNum  DocTotal
       1         AA01        0            20080912   20080912     1       
    oPurchaseDeliveryNotes:Document_Lines
    Recordkey  LineNum AccountCode  BaseEntry  BaseLine  BaseType  DiscountPercent      ItemCode  Linetotal  Price  Quantity   Taxcode   WarehouseCode
    Recordkey  LineNum AccountCode  BaseEntry  BaseLIne  BaseType  DiscountPercent      ItemCode  Linetotal  Price  Quantity   Taxcode   WarehouseCode
       1                1211005        1          0          22           0             
       1                1211005        1          1          22           0             
    When it is imported like this ,it get imported successfully.
    But when i change the WarehouseCode or give new WarehouseCode in oPurchaseDeliveryNotes ---> Document_Lines
    like this
    oPurchaseDeliveryNotes:Document_Lines
    Recordkey  LineNum AccountCode  BaseEntry  BaseLine  BaseType  DiscountPercent      ItemCode  Linetotal  Price  Quantity   Taxcode   WarehouseCode
    Recordkey  LineNum AccountCode  BaseEntry  BaseLIne  BaseType  DiscountPercent      ItemCode  Linetotal  Price  Quantity   Taxcode   WarehouseCode
       1                1211005        1          0          22           0                                                                Godown1
       1                1211005        1          1          22           0                                                                Godown2
    1)Here i m chaging the Warehousecode of  ITM02 to Godown 2,its getting imported successfully.But when this imported record is viewed in Purchasing - A/P ->Goods Receipt PO of  SAP B1 GUI , the matrix (GR_DocumentLines) does not have the taxcode  i.e the TaxCode column is left empty.
    2)Also even when the taxcode is specified under the oPurchaseDeliveryNotes_DocumentLines and importing the same problem occurs ,the matrix (GR_DocumentLines) does not have the taxcode  i.e the TaxCode column is left empty when it is viewed through SAP B1 GUI.
    Edited by: Rui Pereira on Dec 9, 2008 5:10 PM
    Edited by: Rui Pereira on Apr 28, 2009 12:18 PM
    Edited by: Paulo Calado on Jun 18, 2009 5:20 PM

  • Problem in creating purchase order document

    Hi,
    I created a new business document : Purchase request that once it is validated we can copy it to Puchase order.
    when i save the purchase order doc and then launch the creation of the purchase order the operation succed.
    But when i try to copy an already created purchase request i get the error :
    Object reference not set to an instance of an object
    Does any have a clue?
    Thanks a lot.

    This is my code
    Form = _SboApplication.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount);
                                                            Documents _Documents =
                                                                (Documents)
                                                            _SboCompany.GetBusinessObject(BoObjectTypes.oPurchaseOrders);
                                                            // Add PO Header
                                                            _Documents.CardCode =
                                                                ((EditText) _Form.Items.Item("3").Specific).Value.ToString();
                                                            _Documents.CardName =
                                                                ((EditText)_Form.Items.Item("4").Specific).Value.ToString();
                                                            // Add PO Lines
                                                            Matrix matrix = (Matrix)Form.Items.Item("37").Specific;
                                                            if (_matrix.RowCount > 0)
                                                                _Documents.Lines.ItemCode =
                                                                    ((EditText)
                                                                     _matrix.Columns.Item("35").Cells.Item(1).Specific).
                                                                        Value;
                                                                string value =
                                                                    ((EditText)
                                                                     _matrix.Columns.Item("38").Cells.Item(1).Specific).
                                                                        Value.Replace(".", ",");
                                                                double val = Convert.ToDouble(value);
                                                                _Documents.Lines.Quantity =
                                                                    double.Parse(
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("38").Cells.Item(1).Specific).
                                                                            Value.Replace(".", ","));
                                                                _Documents.Lines.Price =
                                                                    double.Parse(
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("39").Cells.Item(1).Specific).
                                                                            Value.Replace(".", ","));
                                                                _Documents.Lines.DiscountPercent =
                                                                    double.Parse(
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("40").Cells.Item(1).Specific).
                                                                            Value.Replace(".", ","));
                                                                _Documents.Lines.VatGroup =
                                                                    ((ComboBox)
                                                                     _matrix.Columns.Item("41").Cells.Item(1).Specific).
                                                                        Selected.Value;
                                                                _Documents.Lines.Price =
                                                                    double.Parse(
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("39").Cells.Item(1).Specific).
                                                                            Value.Replace(".", ","));
                                                                _Documents.Lines.DiscountPercent =
                                                                    double.Parse(
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("40").Cells.Item(1).Specific).
                                                                            Value.Replace(".", ","));
                                                                                    _Documents.Lines.VatGroup =
                                                                    ((ComboBox)
                                                                     _matrix.Columns.Item("41").Cells.Item(1).Specific).
                                                                        Selected.Value;
                                                                                    for (int i = 2; i < _matrix.RowCount + 1; i++)
                                                                    _Documents.Lines.Add();
                                                                    _Documents.Lines.ItemCode =
                                                                        ((EditText)
                                                                         _matrix.Columns.Item("35").Cells.Item(i).
                                                                             Specific).
                                                                            Value;
                                                                    _Documents.Lines.Quantity =
                                                                        double.Parse(
                                                                            ((EditText)
                                                                             _matrix.Columns.Item("38").Cells.Item(i).
                                                                                 Specific).Value.Replace(".", ","));
                                                                    _Documents.Lines.Price =
                                                                        double.Parse(
                                                                            ((EditText)
                                                                             _matrix.Columns.Item("39").Cells.Item(i).
                                                                                 Specific).Value.Replace(".", ","));
                                                                    _Documents.Lines.DiscountPercent =
                                                                        double.Parse(
                                                                            ((EditText)
                                                                             _matrix.Columns.Item("40").Cells.Item(i).
                                                                                 Specific).Value.Replace(".", ","));
                                                                    string val1 = ((ComboBox)
                                                                                    _matrix.Columns.Item("41").Cells.Item
                                                                                    i).Specific).
                                                                        Selected.Value;
                                                                    _Documents.Lines.VatGroup =
                                                                        ((ComboBox)
                                                                         _matrix.Columns.Item("41").Cells.Item(i).
                                                                             Specific).
                                                                            Selected.Value;
                                                                int err = _Documents.Add();
                                                                GC.Collect();
    thanks for your attention

  • Pop up new form(Purchase Order) with current data

    Dear All,
    i have created a COPY TO button in my addon form. Now my quiry is that when ever i press the COPY TO button the purchase order form will open with my addon form data. Kindly suggest me the code.
    Thanx
    Sanjoy Paul

    Hi...
             use this code...
    Try
    SBO_Application.ActivateMenuItem("2305")
           oForm = SBO_Application.Forms.ActiveForm
                OItem = oForm.Items.Item("4")
                Oedit = OItem.Specific
                Oedit.Value = vendor.ToString()
                rs1 = Nothing
                rs1 = OCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                'rs1.DoQuery(" Select Ur Table")
                'OItem = OPOForm.Items.Item("aaa")
                'Oedit = OItem.Specific
                'Oedit.Value = rs1.Fields.Item("Ur - Field").Value & ""
                OItem = OPOForm.Items.Item("bbb")
                Oedit = OItem.Specific
                Oedit.Value = rs1.Fields.Item("Ur - Field").Value & ""
            Catch ex As Exception
                SBO_Application.MessageBox(ex.Message)
            End Try
    REM Matrix
    OItem = oForm.Items.Item("38")
            oMatrix = OItem.Specific
            oCols = oPoMat.Columns REM Columns
    Oedit = oCols.Item("1").Cells.Item(1).Specific 'item no
                Oedit.Value = itmcd.ToString()
    It Will Work...
    Regards...
    Billa 2007

  • Creating Purchase Order Using Procurement Confirmation Wizard

    Dear All,
    I am trying to add the Purchase Orders using the Procurement Confirmation Wizard. Now I want to get those Purchase Orders list that are added using this Procurement Confirmation Wizard. How can I do that ? By this I mean, I do not know on which event I should use this and How to get the DocNum or DocEntry of the added Purchase Orders ?
    Please help me to solve this.
    Any Kind of help would be appreciated.
    Thanks & Regards
    Ankit Chauhan

    Hi Ankit,
    Catch the event of form 540010007
    On the After Item Pressed event
    do this :
                Select Case pVal.ItemUID
                    Case "_wiz_next_"
                        If form.PaneLevel = 8 Then
                            Dim bDraft As Boolean = False
                                Dim oMtx As SAPbouiCOM.Matrix = form.Items.Item("540000036").Specific
                                Try
                                    Dim oChb As SAPbouiCOM.CheckBox = form.Items.Item("540000020").Specific 'Draft check box
                                    If oChb.Checked Then bDraft = True     'Means only draft document created
                                Catch ex As Exception
                                End Try
                                Dim oColPOEntry As New Collections.Generic.List(Of Integer)
                                For i As Integer = 1 To oMtx.RowCount
                                    If oMtx.Columns.Item("540000011").Cells.Item(i).Specific.String <> "0" Then     'This column stores the doc entries - not visible to user
                                        oColPOEntry.Add(oMtx.GetCellSpecific("540000011", i).String)
                                    End If
                                Next
                        End If
                End Select
    If you are using SBO 9, I believe there should be another column in matrix 540000036 that stores the object type of the created document.
    In older version, the procurement only create a PO/Draft object.
    In latest version, you are allowed to create PO/PQ/Prod Order object.
    Regards
    Edy

  • Passing Data to the Purchase Order Style Sheet

    I am new to oracle so please pardon my ignorance.
    I was tasked with switching the Purchase Order from transmitting via a 3rd party application to using XML Publisher.
    I was able to get the PO to generate successfully and I have made a few minor changes to the standard XSL-FO. What I would like to do is send down additional fields (messages that can be changed more easily from within the application without code changes).
    We are on version 11.5.10.2. but this is a layered upgrade, so their report builder version is 6.0.8.25.0.
    I think I figured out how to get the data i want to be added to the xml created by POXPRPOP.rdf.
    My confusion stems from a lack of understanding of how the xml created from POXPRPOP is translated into XML Publisher.
    The original report was generating the following XML before I switched the PO Output Format in Purchasing Options/Control from Text to PDF:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <!-- Generated by Oracle Reports version 6.0.8.28.0
    -->
    - <POXPRPOP>
    - <LIST_G_INIT_INFO>
    - <G_INIT_INFO>
    <MANUAL_PO_NUM_TYPE>ALPHANUMERIC</MANUAL_PO_NUM_TYPE>
    <C_COMPANY></C_COMPANY>
    <C_ORGANIZATION_ID></C_ORGANIZATION_ID>
    <BASE_CURRENCY_CODE></BASE_CURRENCY_CODE>
    <STRUCTURE_ACC></STRUCTURE_ACC>
    <STRUCTURE_CAT></STRUCTURE_CAT>
    <C_CATEGORY_SET_ID></C_CATEGORY_SET_ID>
    <C_YES>Yes</C_YES>
    <C_NO>No</C_NO>
    - <LIST_G_HEADERS>
    - <G_HEADERS>
    <SHIP_VIA />
    <POH_SHIP_TO_ORG></POH_SHIP_TO_ORG>
    <POH_BUYER_PHONE />
    <POH_VENDOR_ID></POH_VENDOR_ID>
    <POH_PO_NUM></POH_PO_NUM>
    <POH_REVISION_NUM></POH_REVISION_NUM>
    While, the PO stylesheet appears to be expecting the following format as defined in the PO_STANDARD_PO.xml document defined in the Standard PO Data Definitions:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- $Header: PO_STANDARD_PO.xml 115.0 2004/08/12 15:33:28 nipagarw noship $ -->
    <!-- dbdrv: none -->
    <!-- GSCC_Category="Xdo Data Definition" -->
    <PO_DATA>
    <TYPE_LOOKUP_CODE>STANDARD</TYPE_LOOKUP_CODE>
    <SEGMENT1>21263</SEGMENT1>
    <REVISION_NUM>0</REVISION_NUM>
    <PRINT_COUNT>0</PRINT_COUNT>
    <CREATION_DATE>12-AUG-2004 00:08:06</CREATION_DATE>
    <PRINTED_DATE/>
    <REVISED_DATE/>
    <START_DATE/>
    <END_DATE/>
    <NOTE_TO_VENDOR>Terms Supplier Note</NOTE_TO_VENDOR>
    <DOCUMENT_BUYER_FIRST_NAME>Pat</DOCUMENT_BUYER_FIRST_NAME>
    Is the XML that was originally being generated from POXPRPOP different now that I changed the output format? If not, how is the original XML being translated to match the correct format as required by the stylesheet?
    Thanks,
    -Tim

    Try
                                oForms.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE
                                oForms.Items.Item("4").Enabled = True
                                oForms.Items.Item("38").Enabled = True
                                oMatrix = DirectCast(oForms.Items.Item("38").Specific, SAPbouiCOM.Matrix)
                                oMatrix.Columns.Item("1").Editable = True
                                Dim oEditText As SAPbouiCOM.EditText = DirectCast(oMatrix.Columns.Item("1").Cells.Item(i).Specific, SAPbouiCOM.EditText)
                                oEditText.Value = TempTbl1.GetValue("ItemCode", j)
                            Catch ex As Exception
                                oApplication.MessageBox(ex.Message.ToString)
                            End Try
    No it coming as Not editable see the above code.
    Thanks,
    Ruheena

  • Purchase Order Printing on Pre-printed stationary

    I feel very difficult to print my purchase order
    on our pre printed stationary using 6i report.
    Is Text_IO utility help me .. or any other tool is
    there to print critical report on preprinted stationay.
    Presently, I am printing my PO by ORACLE RPT tool. old version.
    Pleae Help Me ..
    Regards
    Milind Nikumbh
    KSPL
    Pune

    Hi Milind
    I see what you've got.
    It is not uncommon to use character mode output for pre-printed stationery.
    This would appear as draft output from a Dot Matrix printer. I hope you understand what I mean here. It is somthing like printing using fixed width font.
    Design and run the report with MODE=CHARACTER from the command line.
    You need to figure out and design the layout in such a way that you are printing in the empty spaces provided in the pre-printed stationery. This is usually by trial and error method. You may probably blow several pre-printed stationery sheets before you get it right.
    Regards
    Sripathy

  • How to get Line Number in Purchase Order

    Hi Experts
    I want to get Line Number of Matrix of Purchase Order. How I get it ?
    I want to compare Matrix Line Number with Line Number of POR1 in DB.
    Please Help me.
    Hepil Doshi

    Hi Hepil,
    Linenum in Matrix "38" is Columns.Item("110").Value
    SBO application doesnot show it, but you can get the linenum from that column.
    You can test by getting the column title. omatrix.columns.item("110").Title
    Hope it helps.
    Regards
    Edy

  • How efective set price to purchase order

    I have created purchase order with 600 lines where isnt set price for each item.
    Now I want through UI API set the correct price to each price cell in row based on width and height of item. Now Im going through all lines in matrix, get dimensions, calculate the price, click on the specific cell with blank price in matrix and through SendKeys Im sending the price - till now its everything ok.
    The problem is, when I go on next line and emulate click to next cell, the sap calculates the total price and when is there hundreds of items in order, its too slow. When is there less items, its acceptable, but for hundreds of records isnt useable.
    So my question is:
    Is there any possibility how to set that sap will not recalculate the total and after setting each price call some function, which will the total price correctly recalculate?
    or
    Is there any other way how to set price with UI (because user want to check it before upodate) which is quicker?
    Thanks a lot for suggestions

    Hi Petr,
    The UI unfortunately is always going to be really slow for this type of update. If the user needs to see the values, I think I'd create a separate screen that shows only the PO header and line fields that you need to show to the user for updating pricing. Because it's a user form you've got more control on what gets triggered when the user tabs out of a field. You can then use the DI API to update the PO when the user clicks on Update.
    Is there any scope to break the PO down to a number of smaller POs? I always recommend to my clients to keep the number of rows below 100 and preferably below 50 because performance can really degrade after that.
    Kind Regards,
    Owen

  • Printing Purchase Order in Bulk

    Hi all,
    Is there any way to print the purchase order in Bulk.
    I have a list of Purchase Order Primary key, and i have to print all the purchase order in bulk, with a click of button .
    Regards
    Bikram

    Hi, thanks for your advice,
    But i have a situation that i have to do it with sdk, I need to list all the unapproved PO in Matrix (Separate Form) and then make all/selected PO approved and in the same time i have to print all the approved PO, that is why i need to print PO in Bulk using SDK.
    Regards
    Bikram

  • Capture DocEntry of purchase order created by Proc. Confirmation Wizard

    Dear all,
    in SAP B1 2007 I developed a UI DI API addon to read the docentry of all purchase orders created by Procurement Confirmation Wizard.
    I used the et_FORM_DATA_ADD  event created by the wizard when I confirmed the creation of the purchase order.
    In this event, the BusinessObjectInfo.ObjectKey string contained the DocEntry of the new purchase order.
    But now, with SAP 8.81 PL 06, this event is not raised anymore.
    So... now... how can I know the DocEntry  (not DocNum) of the new purchase orders created by Procurement Confirmation Wizard?
    Can someone help me, please?
    Regards
        Emanuele

    Dear all,
    I solved the problem analyzing the event raised by SAP B1 8.81 Proc. Confirmation Wizard.
        Const CONFIRM_PURCHASE_ORDER_FORM_TYPE As String = "540010007"
        Const ERROR_STRING As String = "ERRORE: "
        Const WIZARD_MATRIX_PO_DOCNUM_MESSAGE As String = "540010007-36]"
        Const WIZARD_MATRIX_FORMID As String = "540000036"
        Const WIZARD_LINK_COLUMN_ID As String = "540000005"
        Const WIZARD_VALIDATE_COLUMN_ID As String = "540000003"
    Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
                                              ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
            Try
                If pVal.FormType = CONFIRM_PURCHASE_ORDER_FORM_TYPE Then
                    ' event activated by the matrix element
                    If pVal.ItemUID = WIZARD_MATRIX_FORMID And pVal.BeforeAction = True Then
                        ' if event is "matrix link pressed" or "form/matrix validate"
                        If (pVal.EventType = SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED And pVal.ColUID = WIZARD_LINK_COLUMN_ID) Or _
                            (pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE And pVal.ColUID = WIZARD_VALIDATE_COLUMN_ID) Then
                            Dim recordsetTemp As SAPbobsCOM.Recordset = Nothing
                            Dim recordsetTemp2 As SAPbobsCOM.Recordset = Nothing
                            Dim recordsetTemp3 As SAPbobsCOM.Recordset = Nothing
                            Dim oform As SAPbouiCOM.Form
                            Try
                                oform = SBO_Application.Forms.GetForm(CONFIRM_PURCHASE_ORDER_FORM_TYPE, 1)
                                Dim sQuery As String
                                Dim oMatrix As SAPbouiCOM.Matrix = oform.Items.Item(WIZARD_MATRIX_FORMID).Specific
                                Dim ocolumn As SAPbouiCOM.Column = oMatrix.Columns.Item(WIZARD_LINK_COLUMN_ID) ' ("540000005")
                                If oMatrix.RowCount > 0 Then
                                    For iRow As Integer = 1 To oMatrix.RowCount
                                        Dim oEditText As SAPbouiCOM.EditText
                                        oEditText = ocolumn.Cells.Item(iRow).Specific ' pVal.Row
                                        If Not oEditText.Value.Contains(WIZARD_MATRIX_PO_DOCNUM_MESSAGE) Then
                                            Continue For
                                        End If
                                        Dim DocNum As Integer = 0
                                        Dim stemp As String = oEditText.Value
                                        Dim stemp2 As String = ""
                                        Dim iterRow As Integer = 0
                                        ' loop in the string searching for the purchase order docnum
                                        While 1 = 1
                                            If stemp.Contains(" ") Then
                                                stemp2 = stemp.Substring(0, stemp.IndexOf(" "))
                                                Try
                                                    DocNum = CInt(stemp2)
                                                    Exit While
                                                Catch ex As Exception
                                                    stemp = stemp.Substring(stemp.IndexOf(" ") + 1)
                                                    DocNum = 0
                                                End Try
                                            Else
                                                Exit While
                                            End If
                                        End While
                                        If DocNum = 0 Then
                                            Continue For
                                        End If
                                        Dim PO_DocEntry As String = ""
                                        recordsetTemp2 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                        sQuery = "SELECT MAX(DocEntry) As MaxDocEntry from OPOR where DocNum = " & DocNum
                                        ' execute SQL query
                                        recordsetTemp2.DoQuery(sQuery)
                                        If recordsetTemp2 IsNot Nothing Then
                                            If recordsetTemp2.RecordCount = 0 Then
                                                Continue For
                                            End If
                                            recordsetTemp2.MoveFirst()
                                            PO_DocEntry = recordsetTemp2.Fields.Item("MaxDocEntry").Value
                                        End If
                                        If PO_DocEntry <> "" Then
                                            ' check if this Purchase Order has already some textlines
                                            ' If it already has text lines, then we don't need to add them to it
                                            recordsetTemp3 = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                            sQuery = "SELECT count(*) As ExistYN from POR10 where DocEntry = " & PO_DocEntry
                                            recordsetTemp3.DoQuery(sQuery)
                                            If recordsetTemp3 IsNot Nothing Then
                                                If recordsetTemp3.RecordCount > 0 Then
                                                    recordsetTemp3.MoveFirst()
                                                    Dim numOfTextLinesForThis_PO As Integer = CInt(recordsetTemp3.Fields.Item("ExistYN").Value)
                                                    If numOfTextLinesForThis_PO > 0 Then
                                                        Continue For
                                                    End If
                                                End If
                                            End If
                                        End If
                                        ' if this PO still hasn't any texlines, then we try to add to it reading the textlines of Sales Order
                                        ' reopen the purchase order
                                        Dim oPurchaseOrder As SAPbobsCOM.Documents
                                        oPurchaseOrder = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseOrders)
                                        oPurchaseOrder.GetByKey(CInt(PO_DocEntry))
                                        ' loop on every lines
                                        For i As Integer = 0 To oPurchaseOrder.Lines.Count - 1
                                            oPurchaseOrder.Lines.SetCurrentLine(i)
                                            ' if purchase order line was generetated from a sales order
                                            If oPurchaseOrder.Lines.BaseType = 17 Then
                                                recordsetTemp = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                                ' search the text lines in the sales order
                                                sQuery = "SELECT t11.LineText As LineText "
                                                sQuery &= " from RDR10 t11 "
                                                sQuery &= " Where t11.DocEntry = '" & oPurchaseOrder.Lines.BaseEntry & "' "
                                                sQuery &= "  AND t11.AftLineNum = " & oPurchaseOrder.Lines.BaseLine
                                                sQuery &= "  AND t11.LineType = 'T' and t11.ObjType = " & oPurchaseOrder.Lines.BaseType
                                                sQuery &= " order by t11.LineSeq "
                                                ' execute SQL query
                                                recordsetTemp.DoQuery(sQuery)
                                                If recordsetTemp IsNot Nothing Then
                                                    If recordsetTemp.RecordCount = 0 Then
                                                        Continue For
                                                    End If
                                                    recordsetTemp.MoveFirst()
                                                    ' loop on each text lines found
                                                    While recordsetTemp.EoF = False
                                                        If recordsetTemp.Fields.Item("LineText").Value <> String.Empty Then
                                                            oPurchaseOrder.SpecialLines.LineType = BoDocSpecialLineType.dslt_Text
                                                            oPurchaseOrder.SpecialLines.LineText = recordsetTemp.Fields.Item("LineText").Value
                                                            oPurchaseOrder.SpecialLines.AfterLineNumber = oPurchaseOrder.Lines.LineNum
                                                            oPurchaseOrder.SpecialLines.Add()
                                                        End If
                                                        recordsetTemp.MoveNext()
                                                    End While ' recordsetTemp.EoF = False
                                                End If ' recordsetTemp IsNot Nothing
                                            End If ' oPurchaseOrder.Lines.BaseType = 17
                                        Next ' end-loop on every lines
                                        ' update the purchase order
                                        oPurchaseOrder.Update()
                                    Next
                                End If
                            Catch ex As Exception
                            Finally
                                recordsetTemp = Nothing
                                recordsetTemp2 = Nothing
                                recordsetTemp3 = Nothing
                            End Try
                        End If
                    End If
                End If
            Catch ex As Exception
            End Try
        End Sub
    Regards
        Emanuele
    Edited by: Emanuele Croci on Aug 29, 2011 5:05 PM

  • Show Todays Purchase order list

    Hello Experts,
    I want to show todays purchase order list in foll manner in Grid or Matrix of customized form.
    Customer Name PoNo PODate DocTotal
    Is it possible?
    Plz give me some solution.

    Hello freind
      try this code for youe custmised form for grid
    pass form date and end date from your form in date1 and date 2 parameter in sql query
    oItem = oForm.Items.Item("code")
                                            a = oItem.Specific
                                            PID = a.Value
                                            Dim oRS As SAPbobsCOM.Recordset
                                            Dim ocol As GridColumn
                                            oRS = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                            str = "select *,T0.CardCode,T0.CardName,T0.DocNum,T0.DocTotal,T0.DocDate from [OPOR] T0 where T0.DocDate between 'Date1' and 'date2'"
                                            oDataTable = oForm.DataSources.DataTables.Item("MOV1")
                                            oDataTable.Clear()
                                            oDataTable.ExecuteQuery(str)
                                            objGrid = oForm.Items.Item("actv").Specific
                                            objGrid.DataTable = oDataTable
                                            ocol = objGrid.Columns.Item("ACT_ID")
                                            ocol.LinkedObjectType = "33"
                                            objGrid.CollapseLevel = 0
                                            objGrid.AutoResizeColumns()

  • Sales Order specific Purchase Order

    Dear Experts,
    our client has scenario which is sales order centric, which mean that when PO is created it has to be with reference to sales order, however this is not a third party scenario. How do we link sales order details on PO ? How can we do sales order specific receiving ? suggestions on standard configuration are welcome.
    Thks,

    AHD,
    ???? What you are describing sounds like standard Make to Order.  Nothing special required.  Probably a third of all SAP Finished Goods planning implementations are set up this way.  If you wish, it is possible to carry the sales order reference all the way down to the raw materials.
    In Make to order, all the supply elements (including stock) are planned in a separate segment, one segment for each sales order/item.  The planned orders, production orders, purchase requisitions, and purchase orders are all specific to a single planning  segment.  These non-stock supply elements may not be received to any other segment.  Stock may not be issued to any other segment.
    Here is one of the most common MTO scenarios, 'Make to Order without Variant', SAP Best Practices
    http://help.sap.com/bp_bl604/BBLibrary/HTML/148_EN_IN.htm
    As always, for Best Practices, don't forget the Prerequisite matrix.
    http://help.sap.com/bp_bl604/BL_IN/Documentation/Prerequisites_Matrix_BL_EN_IN.xls
    Best Regards,
    DB49

Maybe you are looking for