DI UI : fill matrix with a query from user table data

hello,
I create a user table.
I want to fill a matrix on a form with some aggregated data of this user table.
I do :
Public Sub SetMatrixRep()
  Dim oRecordSet As SAPbobsCOM.Recordset
  Dim oCentre As SAPbouiCOM.EditText
  Dim oCompte As SAPbouiCOM.EditText
  Dim oBudget As SAPbouiCOM.EditText
  Dim oDepense As SAPbouiCOM.EditText
  Dim oSolde As SAPbouiCOM.EditText
  Dim i As Long
  i = 0
  Set oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
  oRecordSet.DoQuery ("select * from [@CAP_OPRC_BUDGET]")
  While oRecordSet.EOF = False
    ' filling the matrix
    Set oCentre = oMatrixRep.Columns("clCentre").Cells.Item(i).Specific
    oCentre.String = oRecordSet.Fields.Item(0).Value
    'oMatrixRep.Columns("clCentre").Cells(1).Specific.String = oRecordSet.Fields.Item(0).Value
    'SBO_Application.MessageBox (oRecordSet.Fields.Item(0).Value)
    oMatrixRep.AddRow
    oRecordSet.MoveNext
    i = i + 1
  Wend
End Sub
I've got an error : Row - Index invalid.
Could you help me please ?
Thanks.
Romeo.

Hi
This is a routine that I call from my Item Event handler
Hope it can help you
Public Sub PopolaMatrice(oApplicazione As SAPbouiCOM.Application, pVal As SAPbouiCOM.IItemEvent)
    Dim oForm               As SAPbouiCOM.Form
    Dim oMatrix             As SAPbouiCOM.Matrix
    Dim oDBDataSource       As SAPbouiCOM.DBDataSource
    Dim oConditions         As New SAPbouiCOM.Conditions
    Dim oCondition          As SAPbouiCOM.Condition
    Dim oDocNum             As SAPbouiCOM.EditText
    Dim lIndice             As Long
    Set oForm = oApplicazione.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
    Set oDBDataSource = oForm.DataSources.DBDataSources.Item("MyUserTableName")
    Set oMatrix = oForm.Items("MyMatrixName").Specific
    oMatrix.Clear
    'setting the condition object
    'this is equal to the following SQL statement
    'WHERE UserFieldName1 = "MyCriteria1" and UserFieldName2 = "MyCriteria2"
    Set oCondition = oConditions.Add()
    oCondition.BracketOpenNum = 2
    oCondition.Alias = "UserFieldName1"
    oCondition.Operation = co_EQUAL
    oCondition.CondVal = "MyCriteria1"
    oCondition.BracketCloseNum = 1
    oCondition.Relationship = cr_AND
    Set oCondition = oConditions.Add()
    oCondition.BracketOpenNum = 1
    oCondition.Alias = "UserFieldName2"
    oCondition.Operation = co_EQUAL
    oCondition.CondVal ="MyCriteria2"
    oCondition.BracketCloseNum = 2
    oDBDataSource.Query oConditions
    'filling the matrix
    For lIndice = 0 To oDBDataSource.Size - 1
        oDBDataSource.Offset = lIndice
        oMatrix.AddRow
    Next lIndice
End Sub

Similar Messages

  • Matrix with Info Columns from different Table

    Hi, how can i manage to have a column in a matrix that doesn't represent a value of the table the other columns are using?
    For example, i have a matrix and this matrix has values of the UDT (@Table) and one column contains the projectcode. now i want one column in my matrix to show the project name of the OPRJ. how can i manage that, so that the value of this column in the matrix changes when i change the value of the other column with the project code?
    best regards
    Philipp

    Hi
    1) You can fill the matrix from Recordset.
    For example: UDT is [@O01_USERTABLE].
    PrjCode foreign key to the Projects table (OPRJ - not exposed through the DI API).
    So, if you type correctly PrjCode, you can fetch description using method below.
    Dim sSql As String = ""
    sSql = " SELECT U.PrjCode AS PrjCode, S.PrjName As PrjName" & _
               " FROM [@O01_USERTABLE] AS U, OPRJ AS S" & _
               " WHERE U.PrjCode = S.PrjCode"
    oRS = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    oRS.DoQuery(sSql)
    If oRS.RecordCount > 0 Then
      Dim i As Integer = 0
      oRS.MoveFirst()
      While oRS.EoF = False
        i = i + 1
        oForm.DataSources.UserDataSources.Item("uNr").Value = i     ' 1" matrix column for row number
        oForm.DataSources.UserDataSources.Item("uPrjCode").Value = oRS.Fields.Item("PrjCode").Value
        oForm.DataSources.UserDataSources.Item("uPrjName").Value = oRS.Fields.Item("PrjName").Value
        oMatrix.AddRow()
        oRS.MoveNext()
      End While
    End If
    2) On ManageDataEvent, call Matrix_FetchDescriptions(...)
    Public Sub ManageDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
      Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)
      If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
        If Not BusinessObjectInfo.BeforeAction Then
          Try
           oForm.Freeze(True)
         Dim oMatrix As SAPbouiCOM.Matrix
         oMatrix = oForm.Items.Item("mtx00").Specific
         If oMatrix.RowCount > 0 Then
           Call Matrix_FetchDescriptions(oForm, -1)
         End If
          Catch ex As Exception
          Finally
         oForm.Freeze(False)
         oForm.Update()
          End Try
        End If
      End If
      oForm = Nothing
    End Sub
    ' Update column Name
    Private Sub Matrix_FetchDescriptions(ByRef oForm As SAPbouiCOM.Form, ByVal iRow As Integer)
      Dim oMatrix As SAPbouiCOM.Matrix
      Dim oColumn As SAPbouiCOM.Column
      Dim oCell As SAPbouiCOM.Cell
      Dim oEdit As SAPbouiCOM.EditText
      Try
        If SBO_Company.Connect Then
         oMatrix = oForm.Items.Item("mtx00").Specific
         If oMatrix Is Nothing Then Throw New Exception("ERROR: matrix object is nothing")
         Dim iNrRows As Integer = oMatrix.RowCount ' iRow
         If iNrRows > 0 Then
           Dim i As Integer = 1
           For i = 1 To iNrRows
             Dim sCode As String = ""
             Dim sName As String = ""
             Try
                  ' Matrix column PrjCode
               oColumn = oMatrix.Columns.Item("ePrjCode")
               oCell = oColumn.Cells.Item(i)
               oEdit = oCell.Specific
               sCode = oEdit.Value
               sName = GetNameByCode(sCode)
               If Not sName.Equals("") Then
                     ' Matrix column PrjName
                oColumn = oMatrix.Columns.Item("ePrjName")
                oCell = oColumn.Cells.Item(i)
                oEdit = oCell.Specific
                oEdit.Value = sName
               End If
               If iRow = i Then Exit Sub
             Catch ex As Exception
             Finally
             End Try
           Next
           oForm.Refresh()
         End If
        End If
      Catch ex As Exception
        ' log exception
      Finally
        oMatrix = Nothing
        oColumn = Nothing
        oCell = Nothing
        oEdit = Nothing
        System.GC.Collect() 'Release the handle to the table
      End Try
    End Sub
    To get Name using Code...
    Private Function GetNameByCode(ByVal sCode As String) As String
      If sCode.Trim.Equals("") Then Return ""
      Dim sName As String = ""
      Dim oRS As SAPbobsCOM.Recordset
      Try
        oRS = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        Dim sSql As String = "SELECT PrjName FROM OPRJ WHERE PrjCode = '" & sCode.Trim & "'"
        oRS.DoQuery(sSql)
        oRS.MoveFirst()
        While oRS.EoF = False
          sName = oRS.Fields.Item("PrjName").Value()
          Exit While
        End While
      Catch ex As Exception
      Finally
        If Not oRS Is Nothing Then
          System.Runtime.InteropServices.Marshal.ReleaseComObject(oRS)
          oRS = Nothing
        End If
      End Try
      Return sName
    End Function
    Note: Matrix_FetchDescriptions() have second argument (iRow As Integer) what may be used to indicate in what row you need to update PrjName column.
    May be ItemManagment event when item pressed can be used... Try
    HTH
    BR
    Sierdna S.

  • How to fill matrix with the output of recordset query?

    Hi all,
    I want a user matrix to load data when I hit a button and the data to be filled is the output of an sql query. binding the matrix columns with table columns and then load the matrix with DBDatasource attached to that table will not do in this case as the columns in the sql query are from several different tables or views. 
    writing following line to do this takes several minutes to load the data:
    For j = 0 To Reordset.RecordCount - 1
    Matrix.AddRow()
    Matrix.Columns.Item("col1").Cells.Item(i).Specific.value =  Recordset.Fields.Item("cardcode").Value
    Recordset.movenext()
    next
    Is there any other way to fill the matrix in this case, which loads the data faster?
    Regards,

    Hello Binita,
    I've tested the CFL for DataTable-Matrixes in my test-AddOn. But there's still one problem left. Maybe you find it out (I will need this in the future too...).
    The ChooseFromList must be added behind the DataTable-Bind, which is done on every MTX-Load (it's not from the sample above, so the UIDs are new ones):
                oDt = oDts.Item("dt_test")
                query = "SELECT  * FROM [@T_CONVTOOLS01]"
                oDt.ExecuteQuery(query)
                oMtx.Columns.Item("0").DataBind.Bind("dt_test", "Code")
                oMtx.Columns.Item("1").DataBind.Bind("dt_test", "U_Alpha01")
                oMtx.Columns.Item("2").DataBind.Bind("dt_test", "U_Price01")
                oMtx.Columns.Item("3").DataBind.Bind("dt_test", "U_Quant01")
                oMtx.Columns.Item("4").DataBind.Bind("dt_test", "U_Date01")
                AddChooseFromLists()
                oMtx.LoadFromDataSource()
    ...where AddChooseFromLists() is...
      Private Shared Sub AddChooseFromLists()
            Try
                Dim oCfls As SAPbouiCOM.ChooseFromListCollection
                Dim oCons As SAPbouiCOM.Conditions
                Dim oCon As SAPbouiCOM.Condition
                Dim oCfl As SAPbouiCOM.ChooseFromList
                Dim oCflCreationParams As SAPbouiCOM.ChooseFromListCreationParams
                Dim oBtn As SAPbouiCOM.Button
                Dim oMtx As SAPbouiCOM.Matrix
                Dim oCol As SAPbouiCOM.Column
                Dim oEtx As SAPbouiCOM.EditText
                oMtx = oForm.Items.Item("MTX_TEST02").Specific
                oCfls = oForm.ChooseFromLists
                oCflCreationParams = SboCon.SboUI.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
                oCflCreationParams.MultiSelection = False
                oCflCreationParams.ObjectType = SAPbouiCOM.BoLinkedObject.lf_BusinessPartner
                oCflCreationParams.UniqueID = "CFL_C1"
                oCfl = oCfls.Add(oCflCreationParams)
                '### OPTION:
                '# Shown ChooseFromList restricted by Conditions
                oCons = oCfl.GetConditions()
                oCon = oCons.Add()
                oCon.Alias = "CardType"
                oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCon.CondVal = "C"
                oCfl.SetConditions(oCons)
                oCol = oMtx.Columns.Item("1")
                oCol.ChooseFromListUID = "CFL_C1"
                oCol.ChooseFromListAlias = "CardCode"
            Catch e As Exception
                Microsoft.VisualBasic.MsgBox(className & ".AddChooseFromLists()" & vbCrLf & "Exception:" & vbCrLf & e.Message.ToString)
            End Try
        End Sub
    But I'm running into problems when trying to set the MTX-Cell via DataTable at the CFL-Event (see comment):
                If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                    Dim oMtx As SAPbouiCOM.Matrix
                    Dim oCFLEvent As SAPbouiCOM.IChooseFromListEvent
                    Dim oCFL As SAPbouiCOM.ChooseFromList
                    Dim oDataTable As SAPbouiCOM.DataTable
                    Dim cflID As String
                    Dim oDt As SAPbouiCOM.DataTable = oForm.DataSources.DataTables.Item("dt_test")
                    oCFLEvent = pVal
                    cflID = oCFLEvent.ChooseFromListUID
                    'Dim oForm As SAPbouiCOM.Form
                    'oForm = SboConnection.SboUI.Forms.Item(FormUID)
                    oCFL = oForm.ChooseFromLists.Item(cflID)
                    If Not oCFLEvent.BeforeAction Then
                        oDataTable = oCFLEvent.SelectedObjects
                        If oDataTable Is Nothing Then Exit Sub
                        '############## Matrix Test #######################################################################
                        If (oCFLEvent.ItemUID = "MTX_TEST02") Then
                            oMtx = oForm.Items.Item("MTX_TEST02").Specific
                            '### CFL Results to UserForm
                            oDt.Rows.Offset = oCFLEvent.Row - 1
                            MsgBox(oDt.GetValue("U_Alpha01", oCFLEvent.Row - 1))
                            MsgBox(oDataTable.GetValue("CardCode", 0))
                            ' PROBLEM - can't get this working - don't know at the moment:
                            ' on other forms SetValue works....
                            oDt.SetValue("U_Alpha01", oCFLEvent.Row - 1, oDataTable.GetValue("CardCode", 0))
                            ' this also gives me problems...:
                            'oMtx.Columns.Item("1").Cells.Item(oCFLEvent.Row).Specific.value = oDataTable.GetValue("CardCode", 0)
                            oForm.Update()
                        End If
                    End If
                End If
    The CFL-Form opens and returns the choosen value(s) at the CFL-event. But writing to MTX still not works with this code...
    Maybe you find the last piece. If so: please write here.
    Cheers,
    Roland
    p.s.:
    David Nussböck wrote
    LOL - ROLAND WAS FASTER ))
    ...just one minute...

  • LightSwitch Fill Form with a Query

    Hi,
    I added a button in an add and edit screen to edit information related to the paticular id I am editing but need to launch another edit screen so I can edit the information stored in another non relational table with the id in the previous screen. Since
    I do not have an entity information of that table I needed to pass the id and the edit form be fill in with a query so I can edit that table after.
    Anyone has an idea would appreciate it.
    Thanks,

    Yeah, the way I usually go about doing that sort of thing is by overloading the main constructor of the Form which does the editing..
    So for example:
    public Form1(){
    Initialise();
    You'd also make another like this:
    public Form1(int id){
    Initialise();
    LoadRecord(id);
    To open up the form you'd write this in the event handler of the original form:
    Form frm = new Form(123);
    frm.Show();/frm.Visible=true; (whatever it is)
    Hope this helps,
    Antony
    :D

  • Dbms_xmlgen.newcontext query from multiple tables and ||

    I have two questions
    How do I get a dbms_xmlgen.context to query from multiple tables? I have been able to make it work with using one table only, but not with multiple tables.
    And how to get the || (concat) to work within my query for my output to an xml file?
    Here is my current query:
    create or replace function get_xml return clob is
    result clob;
    qryctx dbms_xmlgen.ctxHandle;
    SELECT DBMS_XMLGEN.getxml('select prefix, suffix, fiscal_yr
    FROM rcv.recv_accessions ra
    where ra.prefix = 8 and ra.fiscal_yr = 11')xml into result FROM dual;
    result := DBMS_XMLGEN.getXML(qryCtx);
    This is what I desire:
    SELECT DBMS_XMLGEN.getxml('select ra.prefix||'-'|| ra.suffix||'-'|| ra.fiscal_yr accession, ss.date_in, st.test
    FROM rcv.recv_accessions ra, ser.sero_samples ss, ser.sero_tests st
    where ra.prefix = 8 and ra.fiscal_yr = 11 and ss.raid = ra.id and st.ssid = ss.id')xml into result FROM dual;
    On this both the reference to multiple tables and the concat function cause errors.
    Thank you
    Edited by: user583094 on Mar 2, 2011 3:36 PM

    Hi,
    for the concat do I use xmlconcat?No, XMLConcat is used to concatenate XMLType fragments.
    The || operator will do fine, but you must escape any single quote inside the string :
    SELECT DBMS_XMLGEN.getxml(
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id'
    INTO result
    FROM dual;Or, use the quoting operator to define a custom string delimiter :
    SELECT DBMS_XMLGEN.getxml(
    q'{SELECT ra.prefix ||'-'|| ra.suffix ||'-'|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = 8
    AND ra.fiscal_yr = 11
    AND ss.raid = ra.id
    AND st.ssid = ss.id
    INTO result
    FROM dual;BTW, a good practice would be to use bind variables for the query. DBMS_XMLGEN can handle them nicely :
    CREATE OR REPLACE FUNCTION get_xml
    RETURN CLOB
    IS
    qryctx   DBMS_XMLGEN.ctxHandle;
    v_out    CLOB;
    qrystr   VARCHAR2(4000) :=
    'SELECT ra.prefix ||''-''|| ra.suffix ||''-''|| ra.fiscal_yr as accession,
            ss.date_in,
            st.test
    FROM rcv.recv_accessions ra,
          ser.sero_samples ss,
          ser.sero_tests st
    WHERE ra.prefix = :b_prefix
    AND ra.fiscal_yr = :b_fiscal_yr
    AND ss.raid = ra.id
    AND st.ssid = ss.id';
    BEGIN
    qryctx := DBMS_XMLGEN.newContext(qrystr);
    DBMS_XMLGEN.setBindValue(qryctx, 'b_prefix', '8');
    DBMS_XMLGEN.setBindValue(qryctx, 'b_fiscal_yr', '11');
    -- to generate empty elements if necessary :
    DBMS_XMLGEN.setNullHandling(qryctx, DBMS_XMLGEN.EMPTY_TAG);
    v_out := DBMS_XMLGEN.getXML(qryctx);
    DBMS_XMLGEN.closeContext(qryctx);
    RETURN v_out;
    END;

  • BDC with MM01/ MM02 from MARA table

    Can anybody suggest me for the following problem.
    I want to construct a BDC with MM01/ MM02 from MARA table.
    And I want the source file to be a notepad or Excel sheet. But i am not
    getting, that how to write the data in Notepad/Excel sheet, to feed to the
    master table according to the MM01/MM02 fields .

    This is the sample code for creation of flatfile for MM01 this will be definetly helping you to create a flatfile.
    REPORT  ZBDC_FF MESSAGE-ID BCTRAIN .
    TYPES: BEGIN OF STU,
           MATNR LIKE RMMG1-MATNR,
           MBRSH LIKE RMMG1-MBRSH,
           MTART LIKE RMMG1-MTART,
           MAKTX LIKE MAKT-MAKTX,
           MEINS LIKE MARA-MEINS,
           END OF STU.
    DATA WA_ITAB TYPE STU.
    DATA ITAB TYPE TABLE OF STU.
    WA_ITAB-MATNR = 'T1'.              "MATERIAL NUMBER"
    WA_ITAB-MBRSH = 'K'.                 "INDUSTRY SECTOR"
    WA_ITAB-MTART = 'VKHM'.              "MATERIAL TYPE"
    WA_ITAB-MAKTX = 'TOOLEMATERIAL'.     "MATERIAL DESCRIPTION"
    WA_ITAB-MEINS = 'EE'.                "BASE UNIT OF MEASURE"
    APPEND WA_ITAB TO ITAB.
    CLEAR WA_ITAB.
    *WA_ITAB-MATNR = 'TOL2'.              "MATERIAL NUMBER"
    *WA_ITAB-MBRSH = 'M'.                 "INDUSTRY SECTOR"
    *WA_ITAB-MTART = 'VKHM'.              "MATERIAL TYPE"
    *WA_ITAB-MAKTX = 'TOOLEMATERIAL'.     "MATERIAL DESCRIPTION"
    *WA_ITAB-MEINS = 'EA'.                "BASE UNIT OF MEASURE"
    *APPEND WA_ITAB TO ITAB.
    *CLEAR WA_ITAB.
    *WA_ITAB-MATNR = 'TOL3'.              "MATERIAL NUMBER"
    *WA_ITAB-MBRSH = 'M'.                 "INDUSTRY SECTOR"
    *WA_ITAB-MTART = 'VKHM'.              "MATERIAL TYPE"
    *WA_ITAB-MAKTX = 'TOOLEMATERIAL'.     "MATERIAL DESCRIPTION"
    *WA_ITAB-MEINS = 'EA'.                "BASE UNIT OF MEASURE"
    *APPEND WA_ITAB TO ITAB.
    *CLEAR WA_ITAB.
    *WA_ITAB-MATNR = 'TOL4'.              "MATERIAL NUMBER"
    *WA_ITAB-MBRSH = 'M'.                 "INDUSTRY SECTOR"
    *WA_ITAB-MTART = 'VKHM'.              "MATERIAL TYPE"
    *WA_ITAB-MAKTX = 'TOOLEMATERIAL'.     "MATERIAL DESCRIPTION"
    *WA_ITAB-MEINS = 'EA'.                "BASE UNIT OF MEASURE"
    *APPEND WA_ITAB TO ITAB.
    *CLEAR WA_ITAB.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    FILENAME     = 'C:\Documents and Settings\chiranjeevi\Desktop\BDC.TXT'
      TABLES
        DATA_TAB     = ITAB
    IF SY-SUBRC <> 0.
    MESSAGE S999 WITH 'EXECUTED'.
    ENDIF.
    Cheers!!!

  • How to bind the data from user table into user report

    Hi All,
      Please assist me to bind the data from user table into user report. I did create an user table with data and create a user report template (using Query Print Layout). How can I display my data into report format which I created before? Any sample program or document I can refer?
    Platform: SAPB1 2005A
    Add On Language: VB.Net 2003
    Thanks.
    rgds
    ERIC

    Hi Ibai,
      Thanks for your feed back. I give you an example.
    Let say now i wanna print employee list, so i will go
    1. Main Menu -> Reports -> HR -> Employee List
    2. Choose the Selection Criteria -> OK
    3. Matrix will display (Employee List)
    4. I can print the report click on print button
    5. Printing report
    My target
    1. Main Menu -> Eric_SubMenu -> Employee List
    2. Matrix will display (Employee List)
    3. Print button
    4. Print report
    My problem
    Now I would like to use my own report format. My own report format means I wanna add on my logo or do some customization within the employee report. So how I am going to do? I only able to display the employee list in matrix. How do I create a new report format and display it.
    Thanks.
    rgds
    ERIC

  • Insert Multiple rows into the table from that table data

    Hi All,
    I have a requirement like to insert mulitple rows into the table from that table data only(I need to replicate the data).
    In this table primary key is composite primary key with all foreign keys.primary key also including the Date foreign key.I need to change that date at the of insertion.
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    VALUES
    (SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510
    But it is giving the error like missing Expression.
    Could anyone please help to me.
    Thanks and Regards
    Swetha.

    You can have either VALUES or SELECT not both
    INSERT
    INTO myschema.Fact_page_performance
    time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available ,
    date_sk
    SELECT time_sk ,
    batch_id ,
    delta_msec ,
    delta_user_msec,
    error_code_sk ,
    content_errs ,
    element_count ,
    page_bytes ,
    Available
    FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
    WHERE date_sk=20090509,20090510;

  • How to find that from which table data is coming in datasource?

    Hi friends
    I want to find that from which tables data is coming into datasource 2LIS_04_P_COMP,2LIS_04_P_MATNR..
    I have searched in forums.. I also have checked in sap.help.. but I didnt get any tablename in field "Table of origin"..
    Please tell me how can I find that data is coming from which table into these datasources..
    I dont want name of the setup tables.. I want name of the original tables (in R/3)which has data..
    Regards
    Swati

    Hi......
    For  data source 2LIS_04_P_COMP............MCAFKO, MCAFPO, MCCOMP are the R3 communication structures...........
    Check these commonication Structure in SE11............I think u will get the required information........
    2LIS_04_P_MATNR is Material View from PP/PP-PI ..........check this..........
    http://help.sap.com/saphelp_nw70/helpdata/EN/88/7fc73c0c52085be10000000a114084/frameset.htm
    Check this each field in SE11....from there try to find out these fields belongs to which table..........as I hav explained u in another thread..........
    May be the extractor is using these fields from different tables.....
    Regards,
    Debjani........

  • Fill matrix with query

    Hi,
    I have a query that I want to display in a matrix. The query is based on the tables: OINV, INV1, OITM, OCRD. I would like to know what is the best way to bind this query to a matrix? Should I create a recordset with the query and iterate it and fill the matrix line by line and column by columns, or can I use something like a datasource with query (even if there are more than one table) and bind it?
    And also, can I create this query using the DI API (I haven't worked with it so far) or do I have to create it myself (my own SELECT)?
    Thank you so much,
    Irina

    hi,
    create one temporary table called TEMP with all necessary fields which u r going to insert in Matrix.
    Use the following code.
    delete the existing values in @TEMP table
    RS = Nothing
                    RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                    RS.DoQuery("Select * from OITM,OITW,ITT1 where Conditions")
    For i as integer = 1 To RS.RecordCount
    RS1 = Nothing
    RS1 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    RS1.DoQuery("INSERT INTO [@TEMP](DocEntry,U_X,U_Y,U_Z)values(" & i & "," & RS.Fields.Item("ItemCode").Value & "','" & RS.Fields.Item("Quantity").Value & "','" & RS.Fields.Item("UoM").Value & "')")
    End If
                    DSource = Nothing
                    oMatrix = oForm.Items.Item("MatrixUID").Specific
                    oColumns = oMatrix.Columns
                    DSource = oForm.DataSources.DBDataSources.Add("@TEMP")
                    oColumn = oColumns.Item("0") ' # Column
                    oColumn.DataBind.SetBound(True, "@TEMP", "DocEntry")
                    oColumn = oColumns.Item("1")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_X")
                    oColumn = oColumns.Item("2")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_Y")
                    oColumn = oColumns.Item("3")
                    oColumn.DataBind.SetBound(True, "@TEMP", "U_Z")
                    oMatrix.Clear()
                    oMatrix.AutoResizeColumns()
                    DSource.Query()
                    oMatrix.LoadFromDataSource()
    or u can use a virtual data source table.this is better.
    oForm.DataSources.DataTables.Add("TEMP") 'Virtual data table. You can use as is.
    Dim SQLSTR as String  = "SELECT fields FROM tables WHERE Conditions"
    oForm.DataSources.DataTables.Item("TEMP").ExecuteQuery(SQLSTR )
                    DSource = Nothing
                    oMatrix = oForm.Items.Item("MatrixUID").Specific
                    oColumns = oMatrix.Columns
                    oColumn = oColumns.Item("1")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_X")
                    oColumn = oColumns.Item("2")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_Y")
                    oColumn = oColumns.Item("3")
                    oColumn.DataBind.SetBound(True, "TEMP", "U_Z")
                    oMatrix.Clear()
                    oMatrix.AutoResizeColumns()
                    DSource.Query()
                    oMatrix.LoadFromDataSource()
    regards,
    varma
    Edited by: Varma on Oct 18, 2008 9:53 AM

  • Filling matrix with Dummy Data

    I am doing a demo screen for a client and I need to fill a matrix with hard coded data. I followed the sample code and I have the following code but it is not working for me (it throws a matrix-line exists exception):
    // Now get the matrix Item.
    SAPbouiCOM.Item matrixItem  = oForm.Items.Item("v33_Grid");
    theMatrix = (SAPbouiCOM.Matrix) matrixItem.Specific;
    Form.Freeze(true);
    SAPbouiCOM.UserDataSource uds;
    uds = oForm.DataSources.UserDataSources.Add("salesUds",SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 10);
    theMatrix.AddRow(1, theMatrix.RowCount);
    SAPbouiCOM.Column     col      = null;
    // Ready Matrix to populate data
    theMatrix.AutoResizeColumns();
    col = theMatrix.Columns.Item("desc1");
    col.DataBind.SetBound(true, "", "salesUds");
    uds.Value = "Test description";
    // setting the user data source data
    theMatrix.LoadFromDataSource();
    oForm.Freeze(false);
    oForm.Update();     
    I really need to get this working. ANyone got any ideas what I am doing wrong?

    Hi Laura,
    You should use theMatrix.SetLineData() which is the avaiable statement for user matrixes.
    Here is some code that loads a form with a matrix from an XML. This way you can edit form values in the XML, instead of hard coding.
    Dim oXMLDoc1 As Xml.XmlDocument = New Xml.XmlDocument
    oXMLDoc1.Load("C:BaseForm.xml")
    App.LoadBatchActions(oXMLDoc1.InnerXml)
    Dim oForm As SAPbouiCOM.Form = App.Forms.GetForm("ITA0002", 1)
    Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("5").Specific()
    Dim Informes As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("Informes")
    Dim ID As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("ID")
    Dim i As Int16 = 1
    oMatrix.AddRow(ListaInformes.Length)
    For Each Informe As String In NameList
       Informes.ValueEx = Informe
       ID.ValueEx = i.ToString
       oMatrix.SetLineData(i)
       i = i + 1
    Next
    The xml is this one:
    <?xml version="1.0" encoding="UTF-16"?>
    <Application>
         <forms>
              <action type="add">
                   <form AutoManaged="1" BorderStyle="4" FormType="ITA0002" ObjectType="-1" SupportedModes="1" appformnumber="ITA0002" client_height="284" client_width="291" color="0" default_button="1" height="316" left="363" mode="1" pane="1" title="Informes" top="149" type="4" visible="1" width="297">
                        <datasources>
                             <userdatasources>
                                  <action type="add">
                                       <datasource size="254" type="9" uid="Informes"></datasource>
                                  </action>
                                  <action type="add">
                                       <datasource size="10" type="9" uid="ID"></datasource>
                                  </action>
                             </userdatasources>
                        </datasources>
                        <items>
                             <action type="add">
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="6" linkto="" right_just="1" supp_zeros="0" tab_order="10" text_style="0" to_pane="0" top="260" type="4" uid="1" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="OK"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="77" linkto="" right_just="1" supp_zeros="0" tab_order="20" text_style="0" to_pane="0" top="260" type="4" uid="2" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="Cancelar"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="20" left="5" linkto="" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="5" type="99" uid="3" visible="1" width="80">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific AffectsFormMode="1" caption="Informes" val_off="0" val_on="1">
                                            <databind alias="Informes" databound="1" table=""></databind>
                                       </specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="1" height="224" left="8" linkto="" right_just="0" supp_zeros="0" tab_order="60" text_style="0" to_pane="1" top="28" type="127" uid="5" visible="1" width="276">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific SelectionMode="2" layout="0" titleHeight="0">
                                            <columns>
                                                 <action type="add">
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="2" type="16" uid="2" val_off="N" val_on="Y" visible="1" width="20">
                                                           <databind alias="ID" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="Nombre" type="16" uid="1" val_off="" val_on="" visible="1" width="255">
                                                           <databind alias="Informes" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                 </action>
                                            </columns>
                                       </specific>
                                  </item>
                             </action>
                        </items>
                        <items>
                             <action type="group">
                                  <item uid="3"></item>
                                  <item uid="4"></item>
                             </action>
                        </items>
                        <FormMenu></FormMenu>
                        <DataBrowser></DataBrowser>
                   </form>
              </action>
         </forms>
    </Application>
    Regards,
    Ibai Peñ

  • How to fill the first column '#' of matrix  with row id in user form?

    Hi All,
    I am having a user defined form in which, I m having a matrix and m populating the matrix with the output of an sql query.
    something like this:
    SQL_Str= "select col1,col2,......from.... "
    OPopDBTable.ExecuteQuery(SQL_Str)
    oMatrix.AddRow()
    oMatrix.Columns.Item("Col3").DataBind.Bind("PopTable", "col1")
    oMatrix.Columns.Item("Col2").DataBind.Bind("PopTable", "col2")
    oMatrix.LoadFromDataSource()
    Now, in this, how can I assign row number to first column ('#' column ) ??
    regards,
    Binita

    Ah...the ROW_NUMBER() was posted by Petr - also thank you (again)
    With my example-query from the other thread:
    SELECT
         CAST(
                 ROW_NUMBER() OVER (ORDER BY T1.U_LogNo ASC) AS INT
            ) AS RowCnt,
         T1.Code,
         T1.U_ParcelNo,
         T1.U_LogNo
    FROM
         [@XXX_EXAMPLE] T1
    WHERE
         T1.U_ParcelNo='132006' 
    ORDER BY
         T1.U_LogNo ASC
    ...this works for me (it's quickly copied from several subs/func. - I hope it's not too much disordered):
    DtLogs.ExecuteQuery(query)
    oMtxLogs.Columns.Item("0").DataBind.Bind("DT_LOGS", "RowCnt")
    oMtxLogs.Columns.Item("1")........
    oMtxLogs.LoadFromDataSource()

  • Spatial Query with multiple geometries from 2 tables

    Hi,
    I'm using Oracle 8.1.7. I am trying to do a spatial query on two tables with multiple geometries. There are two spatial tables. One made up of points and one made up of polygons. There are 829551 rows in the table of points and 1817795 rows in the table with polygons...
    I want to find all polygons where one of this points is within it...
    This query is pretty intensive querying two large spatial tables against each other and so I need to find the most efficient way of running this query. I've been running variations of my query for the last two week and every time it's bombed out with various errors after 12-24 hrs processing like out of memory, out of tablespace, out of processing, invalid index etc etc etc. I need to get this query run asap... Any tips would be gratefully appreciated..
    For the session running the query I've allocated 16M sort area with
    ALTER SESSION SET SORT_AREA_SIZE=16777216;
    Below is the query I'm running... How can I improve this please? BTW PARCEL_OVERLAPS contains the points and TP$_PARCEL_AREAS the polygons.
    SELECT lu.LNU_PARCEL_ID
         FROM
              seventy.PARCEL_OVERLAPS po,
              imap_topol.TP$_PARCEL_AREAS pa,
              TP$_PARCEL_CENTROID_AREA pca,
              TDCR_LAND_UNIT lu
         WHERE
              SDO_FILTER(po.geometry, pa.area,
              'querytype=WINDOW') = ’TRUE’ and
              sdo_within_distance(po.geometry,pa.area,'distance=0')='TRUE' and
              pa.delete_date is null and
              Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
              pa.AREA_ID = pca.AREA_ID and
              pca.DELETE_DATE IS NULL and
              pa.DELETE_DATE IS NULL;

    Albert,
    Thanks for your reply and the tips you've given. The tp$_parcel_areas table will always be bigger so I've changed the order to sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE'. The requested counts for those queries are
    12:26:29 [email protected]:SQL> select count(*)
    13:46:22 2 from seventy.PARCEL_OVERLAPS;
    COUNT(*)
    612
    13:48:12 [email protected]:SQL> select count(*)
    13:48:17 2 from imap_topol.TP$_PARCEL_AREAS pa,
    13:48:21 3 TP$_PARCEL_CENTROID_AREA pca
    13:48:21 4 where pca.DELETE_DATE IS NULL
    13:48:21 5 and pa.DELETE_DATE IS NULL
    13:48:21 6 and pa.AREA_ID = pca.AREA_ID;
    COUNT(*)
    1310665
    There was no reason for both filter and within_distance. I did try use the anyinteract but for some reason that does not return the desired results(I've added one id row as a test to make sure it returns desired results). Plus Oracle have recomended using the within distance for better performance..
    so the explan plan for
    14:38:37 [email protected]:SQL> EXPLAIN PLAN FOR
    14:38:50 2 SELECT lu.LNU_PARCEL_ID
    14:38:50 3 FROM
    14:38:50 4 seventy.PARCEL_OVERLAPS po,
    14:38:50 5 imap_topol.TP$_PARCEL_AREAS pa,
    14:38:50 6 TP$_PARCEL_CENTROID_AREA pca,
    14:38:50 7 TDCR_LAND_UNIT lu
    14:38:50 8 WHERE
    14:38:50 9 sdo_within_distance(pa.area,po.geometry,'distance=0')='TRUE' and
    14:38:50 10 pa.delete_date is null and
    14:38:50 11 Lu.LNU_LAND_UNIT_UNIQUE_NUM = pca.CENTROID_ID and
    14:38:50 12 pa.AREA_ID = pca.AREA_ID and
    14:38:50 13 pca.DELETE_DATE IS NULL and
    14:38:50 14 pa.DELETE_DATE IS NULL;
    is
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 4G|32920G| 547M| | |
    | NESTED LOOPS | | 4G|32920G| 547M| | |
    | MERGE JOIN | | 547M| 2029G| 230124 | | |
    | SORT JOIN | | 1M| 36M| 85014 | | |
    | MERGE JOIN | | 1M| 36M| 50019 | | |
    | SORT JOIN | | 1M| 17M| 21650 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 1M| 17M| 485 | | |
    | SORT JOIN | | 1M| 22M| 28369 | | |
    | TABLE ACCESS FULL |TDCR_LAND | 1M| 22M| 2127 | | |
    | SORT JOIN | | 42K| 160M| 145111 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 42K| 160M| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    14:43:14 [email protected]:SQL> explain plan for
    14:43:23 2 SELECT pa.AREA_ID
    14:43:23 3 FROM seventy.PARCEL_OVERLAPS po,
    14:43:23 4 imap_topol.TP$_PARCEL_AREAS pa
    14:43:23 5 WHERE SDO_RELATE(po.geometry, pa.area,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:43:23 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 10M| | |
    | NESTED LOOPS | | 6M| 50G| 10M| | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    14:45:03 [email protected]:SQL> explain plan for
    14:45:04 2 SELECT pa.AREA_ID
    14:45:05 3 FROM seventy.PARCEL_OVERLAPS po,
    14:45:05 4 imap_topol.TP$_PARCEL_AREAS pa
    14:45:05 5 WHERE SDO_RELATE(pa.area, po.geometry,'mask=ANTINTERACT querytype=WINDOW') = 'TRUE'
    14:45:05 6 and pa.DELETE_DATE IS NULL;
    Plan Table
    | Operation | Name | Rows | Bytes| Cost | Pstart| Pstop |
    | SELECT STATEMENT | | 6M| 50G| 863554 | | |
    | NESTED LOOPS | | 6M| 50G| 863554 | | |
    | TABLE ACCESS FULL |TP$_PARCE | 850K| 3G| 12697 | | |
    | TABLE ACCESS FULL |PARCEL_OV | 817 | 3M| 1 | | |
    --------------------------------------------------------------------------------

  • Excel issues with importing CSV or HTML table data from URL - Sharepoint? Office365?

    Greetings,
    We have a client who is having issues importing CSV or HTML table data as one would do using Excel's Web Query import from a reporting application.  As the error message provided by Excel is unhelpful I'm reaching out to anyone who can help us begin to
    troubleshoot problems affecting what is normal standard Excel functionality.  I'd attach the error screenshot, but I can't because my account is not verified....needless to say it says "Microsoft Excel cannot access  the file https://www.avantalytics.com/reporting_handler?func=wquery&format=csv&logid=XXXX&key=MD5
    Where XXXX is a number and MD5 is an md5 code.  The symptoms stated in the error message are:
    - the file name or path does not exist
    -The file is being used by another program
    -The workbook you are trying to save has the same name as a currently open workbook.
    None of these symptoms are the case, naturally. The user encountered this with Excel2010, she was then upgraded to Excel2013 and is still experiencing the same issue. The output of this URL in a browser (IE, Chrome, Firefox) is CSV data for the affected
    user, so it is not a network connectivity issue.  In our testing environment using both Excel2010 or 2013 this file is imported successfully, so we cannot replicate.  The main difference I can determine between our test environment and the end-user
    is they have a Sharepoint installation and appear to have Office365 as well.
    So,  my question might more appropriately be for Sharepoint or Office365 folks, but I can't be sure they're  a culprit.  Given this - does anyone have any knowledge of issues which might cause this with Sharepoint or Office365 integrated with
    Excel and/or have suggestions for getting more information from Excel or Windows other than this error message?  I've added the domain name as a trusted publisher in IE as I thought that might be the issue, but that hasn't solved anything.  As you
    can see its already https and there is no authentication or login - the md5 key is the authentication.  The certificate for the application endpoint is valid and registered via GoDaddy CA.
    I'm at a loss and would love some suggestions on things to check/try.
    Thanks  -Ross

    Hi Ross,
    >> In our testing environment using both Excel 2010 and 2013 this file is imported successfully, so we cannot replicate.
    I suspect it is caused by the difference of web server security settings.
    KB: Error message when you use Web query to a secure Web page (HTTPS://) in Excel: "Unable to open"
    Hope it will help.
    By the way, this forum is mainly for discussing questions about Office Development (VSTO, VBA and Apps for Office .etc.). For Office products feature specific questions, you could consider posting them on
    Office IT Pro forum or Microsoft Office Community.
    Regards,
    Jeffrey
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Issue with file download from BLOB type data

    i have been using this for a while, with no problems, including on hosted machines.
    the upload to the database works fine.. not the issue, and the download script also works fine, on the local WAMP machine.
    but once moved to the server it fails.. the query does not work.
    i have a feeling that it is something to do with the managed hosting i am using, but they say no, i have tried it on 2 seperate hosted machines (different providers), with no joy.
    if i run the select query on the hoisting server via phpmyadmin, the query runs ok.
    any suggestions as to what may be causing the problem on the server compared to the local WAMP machine?
    i really don't know where to start looking, or where to point the hosting company.
    This is the php code to download the blob data, works fine on local WAMP setup, browser asks if you want to save the file/open etc. as expected.
    <?php require_once('Connections/connTracker.php'); ?>
    <?php
    // if id is set then get the file with the id from database
    if(isset($_GET['docindex']))
               {$id    = $_GET['docindex'];
            $query = "SELECT document_name, document_type, document_size, document_content " .
               "FROM tracker_documents WHERE document_index = ".$id;
    *** seems to be failing here when running the query ***
    $result = mysql_query($query) or die('Error, query failed');
               list($name, $type, $size, $content) = mysql_fetch_array($result);
         header("Cache-Control: maxage=1"); //In seconds
       header("Pragma: public");
         header("Content-length: $size");
               header("Content-type: $type");
               header("Content-Disposition: attachment; filename=$name");
               echo html_entity_decode ($content);}
    exit;
    ?>

    Hi Gun,
    You are the only one responded to my issue. I have allocated some points.
    Yes. I have checked the assignment in CRM organizational model.
    I did download the org. structure from ECC 5.0
    All objects including sales offices are activated for determination and I have verified with green light
    As per your suggestion if the sales area data is not matched between the two systems, then how come the error will not reappear during the bdoc reprocess?
    What is missing during the first time bdoc process? Looks something is missing for validation module?
    Any inputs?
    Thanks,
    Raj

Maybe you are looking for

  • Curve 8530 no longer works

    My Curve 8530 decided to overheat and kill the hardware on my phone. I can replace the battery, but it immediately dies. I walk into US Cellular to their service center to see whats up, I am told this is an issue that has created headaches for many p

  • Connecting 22" ACD (1999) to laptop VGA

    From reading other posts I gather my old 22" ACD has an ADC connector (used my old G4 400). I had to move on to a PC laptop for work and now would like to use the ACD as a second screen for the PC (sony with Radeon AGP 345M) which only has VGA output

  • S10 webcam problem

    I can't get my webcam to work. I have an S10, still under warranty. I never tried the webcam until recently. I have installed  all of the software upgrades that are offered for all components on the computer. I have the latest BIOS version. I am runn

  • HT1222 Need help.

    Hi,Need your help. i can't update my 2nd iPhone 4S to new Update system iOS 7.my current system iOS 6..I'm trying yo update my iPhone to new syatem. but System pause. Any body know why?

  • Validation of new objects created

    Hi all!   We have created all the objects in our proj. Is there any way to validate the objects created?