How to create a dynamic table?

Hello experts!
I would be very grateful for assistance with a complicated requirement I have gotten.
I am working within a user exit in BI-IP and one of the parameter in the method is a table (whose structure is dynamic):
C_TH_DATA     Changing     Type     HASHED TABLE     Transaction Data
Due to the requirements I have I need to create a table based on the C_TH_DATA table BUT with a few additional fields.
I have posted my first attempt below (it is syntactically correct).
Does my approach make sense???
Grateful for any suggestions.
Greetings,
Martin
method IF_RSPLFA_SRVTYPE_IMP_EXEC_REF~EXECUTE.
  field-symbols:
    <f_ref_data>        type  any,
    <f_interim_data>    type  any,
    <f_new_data>        type  any,
    <f_itab>            type  any table,
    <f_infoprov>        type  RSINFOPROV,
    <f_infoprov_ref>    type  RSINFOPROV,
    <f_ref_data_BCCMP07>  type  any,
    <f_ref_data_BCCMC02>  type  any,
    <f_spc>             type  /bic/oiBHSPC0,
    <f_spc_ref>         type  /bic/oiBHSPC0,
    <f_blcopem1>        type  /bic/oiblcopem1,
    <f_blcopem1_ref>    type  /bic/oiblcopem1,
    <f_blcalpo0>        type  /bic/oiblcalpo0,
    <f_blcalpo0_ref>    type  /bic/oiblcalpo0.
  data:
    l_r_data1            type  ref to data,
    l_r_data2            type  ref to data,
    l_d_sumcostpo        type  f,
    l_d_deltacostpo      type  f,
    l_d_sumdeltacostpo   type  f.
Generate new (empty record)
  create data l_r_data1 like line of c_th_data.
  assign l_r_data1->* to <f_new_data>.
  TYPES:
    BEGIN OF l_modif_c_th_data,
      l_r_itab    type  ref to data,
      thiscostpo  type  /bic/oiblcopem1,
      thiscostto  type  /bic/oiblcopem2,
      thiscostcm  type  /bic/oiblcopem3,
      thismanpo   type  /bic/oiblmansec1,
      thismanto   type  /bic/oiblmansec2,
      thismancm   type  /bic/oiblmansec3,
    END OF l_modif_c_th_data.
  data:
    l_r_itab    type  ref to data.
  create data l_r_itab type table of l_modif_c_th_data.
  assign l_r_itab->* to <f_itab>.
Generate new (empty record)
  create data l_r_data2 type l_modif_c_th_data.
  assign l_r_data2->* to <f_interim_data>.

Hi marcin,
thanks for your answer.
Im trying your examples ( /people/marcin.pciak/blog/2010/09/09/do-you-really-know-everything-about-typing--part-2 ) but your example dumps.
DATA gr_elemdescr_p   TYPE REF TO cl_abap_elemdescr.
DATA gr_elemdescr_i   TYPE REF TO cl_abap_elemdescr.
DATA: gt_components   TYPE cl_abap_structdescr=>component_table,
        wa_component    LIKE LINE OF gt_components.
  DATA: gr_structdescr  TYPE REF TO cl_abap_structdescr.
  wa_component-name = 'HEADCOUNT'.
  wa_component-type = gr_elemdescr_i.
  APPEND wa_component TO gt_components.
  wa_component-name = 'CAPACITY'.
  wa_component-type = gr_elemdescr_p.
  APPEND wa_component TO gt_components.
  gr_structdescr = cl_abap_structdescr=>create( gt_components ).  <= causes error CX_SY_STRUCT_COMP_TYPE
DATA gr_data TYPE REF TO data.
  CREATE DATA gr_data TYPE HANDLE gr_structdescr.
I suspect Im doin something wrong.

Similar Messages

  • How to create a dynamic table were the JTable columns keep varying

    How to create a dynamic table were the JTable columns keep varying based on the input to the jtable

    Oooh, I lied. DefaultTableModel has an API for adding and
    removing columns. I didn't know that. You should have read
    the API.
    As for preferring to extend AbstractTableModel rather than
    DefaultTableModel, I think it's more correct. DefaultTableModel
    is a simple implementation of Abstract for basic cases. It isn't
    intended to be extended. I figure most people extending
    DefaultTableModel are also extending JFrame, JPanel, and Thread
    instead of encapsulating the first two and implementing
    Runnable for the third.

  • How to create a Dynamic table without knowing fieldcat size

    Hi all, i'm trying to insert a (Jointer) of 3 selections form diffrent tables in an other dynamic table but i dont know the size of my final table, so i dont know how to create a fieldcatalog.
    Can we create an internal table with those caractiristics ????

    Hi,
    If you know which fields (ABAP Dictionary) you're selecting then you know their size; use the following FM call: DD_NAMETAB_TO_DDFIELDS
    Then you can use the following method to create your dynamic table: cl_alv_table_create=>create_dynamic_table
    Arash

  • How to create a dynamic table region with dynamic VO

    Hi All,
    I have a requirement to create a dynamic table region with a dynamic VO.
    I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
    I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
    Thanks in Advance.
    Thanks and Regards,
    Myvizhi

    Hi All,
    I have a requirement to create a dynamic table region with a dynamic VO.
    I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
    I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
    Thanks in Advance.
    Thanks and Regards,
    Myvizhi

  • How to create a dynamic table region with dynamic VO in processFormRequest

    Hi All,
    I have a requirement to create a dynamic table region with a dynamic VO.
    I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
    I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
    Thanks in Advance.
    Thanks and Regards,
    Myvizhi
    Edited by: Myvizhi Selvi on May 20, 2013 6:21 PM

    Hi,
    You can use following sample code to create advance table columns dynamically with colum groups as well.
    It assumes that you have already created advance table with ID EmpTblRN.
    Below code returns column heading dynamically and if you keep your VO column names and attributes
    same in all the cases (COL1, COL2.....) then you can easily use a loop to create advance table columns.
    It is attaching VO attributes to OAMessageStyledText bean in the last.
    Hope it helps.
    OAAdvancedTableBean advTable = (OAAdvancedTableBean)webBean.findChildRecursive("EmpTblRN");
    Serializable [] param = {currentWindowSeq.toString()};
    Datum[] colHeadingArray = (Datum[])am.invokeMethod("getColumnHeading", param);
    String oldGrpName = null;
    String newGrpName = null;
    OAColumnGroupBean columnGroup = null;
    DictionaryData columnFormat = new DictionaryData();
    columnFormat.put(WIDTH_KEY, "4%");
    for (int i = 0; i < colHeadingArray.length; i++)
    try
    oracle.sql.STRUCT os = (oracle.sql.STRUCT)colHeadingArray;
    Object[] colHeadAttr = os.getAttributes();
    newGrpName = (String)colHeadAttr[0];
    if(newGrpName!=null)
    if(!newGrpName.equals(oldGrpName))
    // Create a column group, create the set the column header,
    // and add the column group under the advanced table
    columnGroup = (OAColumnGroupBean)createWebBean(pageContext, COLUMN_GROUP_BEAN, null, "ColGroup"+i);
    OASortableHeaderBean columnGroupHeader = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "ColGroupHeader"+i);
    columnGroupHeader.setText(newGrpName);
    // Retrieve from message dictionary
    columnGroup.setColumnHeader(columnGroupHeader);
    advTable.addIndexedChild(columnGroup);
    oldGrpName = newGrpName;
    // Create a column, create the set the column header, and add the column
    // under the column group
    OAColumnBean column1 = (OAColumnBean)createWebBean(pageContext, COLUMN_BEAN, null, "Column"+i);
    OASortableHeaderBean column1Header = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "Column1Header"+i);
    column1Header.setText(colHeadAttr[1].toString());
    column1.setColumnHeader(column1Header);
    column1.setColumnFormat(columnFormat);
    columnGroup.addIndexedChild(column1);
    // Create the actual leaf item under the first column
    OAMessageStyledTextBean leaf1 = (OAMessageStyledTextBean)createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, "Leaf"+i);
    //OARawTextBean leaf1 = (OARawTextBean)createWebBean(pageContext, RAW_TEXT_BEAN, null, "Leaf"+i);
    leaf1.setViewAttributeName("Week"+(i+1));
    String destination = "OA.jsp?page=/xxqc/oracle/apps/per/leaveadvance/webui/EmployeeLeaveDetailPG&personId={@PersonId}";
    destination = destination + "&startDate="+colHeadAttr[1].toString()+"-"+(String)colHeadAttr[0];
    destination = destination + "&addBreadCrumb=Y&retainAM=Y";
    leaf1.setDestination(destination);
    OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(leaf1,"Color"+(i+1));
    //leaf1.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
    leaf1.setAttributeValue(UIConstants.RENDERED_ATTR, cssjob);
    column1.addIndexedChild(leaf1);
    catch(Exception e)
    System.out.println("e"+e);

  • How to create a dynamic table (repeating) with static header?

    Hello
    My purpose is to create a table which should be dynamically filled at runtime depending on the number of elements in the datasource($record.list). If the list is empty, the table shouldn't be displayed at all.
    I created a subform which holds a table, ticking "Repeat Subform for each data item" and I set the binding of the table elements to $record.list[*].myelement. This works fine so far.
    For the table header I created a second subform with a table having exactly the same size like the other table with text fields that contain the table header texts.
    My problem now is that I would like to control the display of the subform which serves as table header row depending on whether $record.list is empty or not.
    What's the best way to do this? How can I have access to the datasource for a form?
    Thank you very much for your help!!!
    Best regards
    Bettina Hepp

    Hi,
    Instead of creating the header row outside the table.
    Create it inside the same table as header row.
    So when you create a condition then automatically applicable for the header row also.
    This is the best option.
    Regards,
    sasi

  • Creating a Dynamic table

    Could anyone please help me,
    how to create a dynamic table. That is a table where the user can insert his own text.
    thanks

    Well quicly you can create a jtable whose fields in each columns are editable.
    I use sun's forte to do that.

  • How to create a transparent table(z table) dynamically

    Hi,
    Can anyone explain me how to create a transparent table(z table) dynamically in the program.
    Any function module or suggestions welcome.

    Hi Mithun
                 we will not create transparent table in the program . you could do it by using native SQL in the ABAP Program . the sample is show in below .
    This is a sample that show how to connect to Database directly and can use the native SQL to select , create or delete table.
    PARAMETERS dbs TYPE dbcon-con_name default 'SDB'.
    DATA carrid_wa TYPE scarr-carrid.
    DATA lv_int  TYPE i.
    *Types
    data: begin of ty_equi,
    equipment(25) type c,
    SERIALENERGY(25) type c,
    end of ty_equi.
    *Internal Tables
    data it_equi like table of ty_equi.
    data wa_equi like line of it_equi.
    DATA dbtype TYPE dbcon_dbms.
    SELECT SINGLE dbms
           FROM dbcon
           INTO dbtype
           WHERE con_name = dbs.
    IF dbtype = 'ORA'.
      TRY.
          EXEC SQL.
            CONNECT TO :dbs
          ENDEXEC.
          IF sy-subrc <> 0.
            RAISE EXCEPTION TYPE cx_sy_native_sql_error.
          ENDIF.
          EXEC SQL.
            OPEN dbcur FOR
              SELECT
                     EQUIPMENT,
                     SERIALENERGY
                     FROM emd.meter
          ENDEXEC.
          DO.
            EXEC SQL.
              FETCH NEXT dbcur INTO :wa_EQUI
            ENDEXEC.
            IF sy-subrc <> 0.
              EXIT.
            ELSE.
              WRITE: /
              wa_equi-equipment,
              wa_equi-SERIALENERGY.
            ENDIF.
          ENDDO.
          EXEC SQL.
            CLOSE dbcur
          ENDEXEC.
          EXEC SQL.
            DISCONNECT :dbs
          ENDEXEC.
        CATCH cx_sy_native_sql_error.
          MESSAGE `Error in Native SQL.` TYPE 'I'.
      ENDTRY.
    ENDIF.
    Regards
    Wiboon

  • How to use JSTL create a dynamic table according to a database???

    How to use JSTL create a dynamic table according to a database in a web page? Who can help me? Thanks.

    How to use JSTL create a dynamic table according to a
    database in a web page? Who can help me? Thanks.???
    Could you rephrase your quesion?
    Do you want to display records by reading from a table in DB?

  • How to Create Event polling table

    hi,
    1)How to Create Event polling table
    2) wahts RPD stands for.
    3) when we are prefer Dynamic variables.
    thanks.
    raj

    1) http://obiee101.blogspot.com/2008/07/obiee-managing-cache-emptyingpurging.html
    2) Repository Project Design ?
    - More than likely the extension RPD was not used by anything else when Siebel Analytics first started using it, no doubt the 'RP' is repository, so use 'Definition' or 'Design' as you like. Im pretty sure there is nothing in the documentation but i've not checked, maybe you could check and let us know?
    3) Dynamic variables would be something like 'CURRENT_MONTH' where the same query does not need to fire per user (ie SESSION variable) but needs to be periodically refreshed. Another use of you dynamic variable might be 'LAST_ETL_DATE' or somethng similar which might implement with your event polling table. By including the Variable within a Business Model, all cache for the Business Model is purged whenever the Variable's value changes.

  • How to create variant for table/view ?

    Hi,
    When I go through SM30, I find a radio button called variant. I don't know the effect.
    Can anyone tell me how to create variant for table / view ?
    I want to know when we need to create variant for table/view.
    Best regards,
    Chris Gu

    hi ,
    Whenever you start a program in which selection screens are defined, the system displays a set of input fields for database-specific and program-specific selections. To select a certain set of data, you enter an appropriate range of values.
    For further information about selection screens, refer to Selection Screens in the ABAP User's Guide.
    If you often run the same program with the same set of selections (for example, to create a monthly statistical report), you can save the values in a selection set called a variant
    Procedure
    To create a new variant:
           1.      On the ABAP Editor initial screen, enter the name of the program for which you want to create a variant, select Variants, and choose Change.
           2.      On the variant maintenance initial screen, enter the name of the variant to be created.
    Note the naming convention for variants (see below).
           3.      Choose Create.
    If the program has more than one selection screen, a dialog box for screen assignment appears. The dialog box does not appear if the program only has one selection screen. The selection screen appears in this case.
           4.      If there is more than one selection screen, select the screens for which you want to create the variant
    5.      Choose Continue.
    The (first) selection screen for the report appears.
    If your program has more than one selection screen, use the scroll buttons in the left-hand corner of the application toolbar to navigate between them and to fill the fields with values. If you keep scrolling forwards, the Continue button appears on the last selection screen.
           6.      Enter the desired selection values, including multiple selection and dynamic selection.
           7.      Choose Continue.

  • How to create a dynamic mapping of columnar at the Runtime using ADF or JSF

    How to create a dynamic GUI at the Runtime using ADF or JSF in JDeveloper 11g.
    What I am trying to build is to allow the user to map one column to another at the run time.
    Say the column A has rows 1 to 10, and column B has rows 1 to 15.
    1. Allow the user to map rows of the two tables
    2. An dhte rows of the two columns are dynamically generated at the run time.
    Any help wil be appreciated.....
    Thnaks

    Oracle supports feedback form metalink was; "What you exactly want to approach is not possible in Htmldb"
    I can guess that it is not
    exactly possible since I looked at the forums and documantation etc. but
    couldnt find anything similar than this link; "http://www.oracle.com/technology/products/database/htmldb/howtos/tabular_form.h
    t". But this is a very common need and I thought that there must be at least a workaround?
    How can I talk or write to Html Db development team about this since any ideas, this is very important item in a critial project?
    I will be able to satisfy the need in a functional way if I could make the
    select lists in the tabular form dynamic with the noz_id;
    SELECT vozellik "Özellik",
    htmldb_item.select_list_from_query(2, t2.nozellik_deger, 'select vdeger
    a,vdeger b from tozellik_deger where noz_id = 10') "Select List",
    htmldb_item.text(3, NULL, t2.vcihaz_oz_deger) "Free Text"
    FROM vcihaz_grup_ozellik t1, tcihaz_oz t2
    WHERE t1.noz_id = t2.noz_id
    AND t2.ncihaz_id = 191
    AND t1.ngrup_id = 5
    But what I exactly need i something like this dynamic query;
    SELECT
    vozellik "Özellik",
    CASE
    WHEN (t2.nozellik_deger IS NULL AND t2.vcihaz_oz_deger IS NOT NULL) THEN
    'HTMLDB_ITEM.freetext(' || rownum || ', NULL) ' || vozellik
    WHEN (t2.nozellik_deger IS NOT NULL AND t2.vcihaz_oz_deger IS NULL) THEN
    'HTMLDB_ITEM.select_list_from_query(' || rownum ||
    ', NULL, ''select vdeger a,vdeger b from tozellik_deger where noz_id = ' ||
    t1.noz_id || ''' ) ' || vozellik
    END AS "Değer"
    FROM vcihaz_grup_ozellik t1, tcihaz_oz t2
    WHERE t1.noz_id = t2.noz_id
    AND t2.ncihaz_id = 191
    AND t1.ngrup_id = 5
    Thank you very much,
    Best regards.
    H.Tonguc

  • Javascript error occurred when create a dynamic table

    Hi all,
    I try to create a dynamic table using the created recordset,
    but I get the javascript error message "While executing insertObject in DynamicTable.htm, a Javascript error occurred."
    How to fix it? I tried to delete the cache file in Configuration folder but it is not work..
    Any idea? Thanks a lot!

    http://helpx.adobe.com/dreamweaver/kb/troubleshoot-javascript-errors-dreamweaver-cs4.html
    Try 12 & 4 and then go through the rest.

  • How to create Hyperlink dynamically

    Hi All,
    In my application , iam using one table , one of the field in that table is input field,
    when i entered data in that field at runtime, automatically that field value should become hyperlink, to show another table.
    is it possible to do, if possible please help me in this how to create field dynamically.
    regards,
    sush

    Hi Sushma,
    What I get is that at runtime, you will fill the input field with some value & wish to have the field changed to a link.
    Adding to what Armin has said, keep the input field as it is. Add a new column in the table, create the TableCellEditor of type LinkToURL (if it is a URL value) or LinkToAction (if some value).
    For LinkToURL type, set the 'reference' property to the same context value attribute as the input field.
    For LinkToAction type, set the onAction event where you call the appropriate code.
    You can also set the 'text' property as Link or bind it to this context value attribute as well.
    Hope this works.
    Kind Regards,
    Nitin
    Edited by: Nitin Jain on Mar 25, 2009 9:14 AM

  • Question on how to create a pivot table

    Hi,
    I am trying to create a dynamic pivot table (the number of column and row layers change for each request) and I cannot use a data base structure to back it up.
    I thought of doing it through a managed bean but in order to do it I need to know how to create the PivotTableModel.
    The pivot table model requires a data source object and I do not know how to create it to support multiple row and column layers.
    Is there a default data source object that I can extend, or better yet is there a written example on how to create a pivot table model using a managed bean.
    Thanks,
    Or

    Hi,
    duplicate of ADF -11g : Question on how to create a pivot table

Maybe you are looking for