Dynamically Display table data

Hello all
Can anyone help me with the following. I am trying to display data as follows
          disc1   disc2    disc3    disc4
type1       23       24       25       11
type2       11        7         31       10etc where the disc is dynamic in that there could be more or less data in the database.
I have the following code so far (see below) but have been unable to combine them to produce the above, what I really need is someway to print out the the type once and the amount for each disc where the disc is variable. Any ideas anyone?
ResultSet disks;
disks = GetResultSet("SELECT Distinct Disks from Metrics where Branch='" + request.getParameter("Branch") + "' order by Disks");
out.println("<tr>");
while (disks.next()) {
     out.println("<td colspan=2>" + disks.getString("Disks") + "</td>");
out.println("</tr>");
rs = GetResultSet("SELECT Disks,Type,MB from Metrics where Branch='" + request.getParameter("Branch") + "' order by Disks");
String sDisks;
sDisks = rs.getString("Disks");
while (rs.next()) {
out.println("<td>" + rs.getString("Type") + "</td><td>" + rs.getInt("MB") + "</td>");

There are a couple of things that will affect the implementation of this.
Is there a value of "disc" for every type?
If so, you could do something like the following:
- order by type - every time you find a new type, start a new row.
rs = GetResultSet("SELECT Disks,Type,MB from Metrics where Branch='" + request.getParameter("Branch") + "' order by Type, Disks");
  String currentType = "";
  boolean first = true;
while (rs.next()){
  String type = rs.getString("Type");
  if (!currentType.equals(type)){
// start a new row
    if (first){
      first = false;
    else {
            out.println("</tr">);
     out.println("<tr>");
  out.println("<td>" + rs.getString("Type") + "</td><td>" + rs.getInt("MB") + "</td>");
out.println("</tr>");If there isn't a type of disc for each row, it will be a bit more complicated.
You might consider loading the data into an intermediate datastructure (2d array?)
This would make it much easier to display.
Good luck,
evnafets

Similar Messages

  • How to display table data without  using ALV  and table element.

    Hi,
            Its possible to display table data without using ALV  and table element.
           Every time i am fetching data based on (customer,status) fields and displaying these data in my output using alv
           (every time i am fetching single row data ),
           But problem is alv occupying more space in the output , i want to display data part only i dont want field names,
           settings and header data etc..things.
          Give solution to  display data part..
    Regards,
    Rakhi.

    Hi,
    Does you mean that you need ALV without default Function Toolbar...? If this is the case, the easy solution would have been to use Table Element rather. But, if you need to use ALV only without Function Toolbar, you can do away with that as well.
    In that case, after calling GET_MODEL, you need to add few more lines of codes to achieve your goal. Those lines are --
      DATA LV_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
        LV_VALUE = LO_INTERFACECONTROLLER->GET_MODEL(
    * Standard Filter Function setting to FALSE
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_COMPLEX_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_COMPLEX_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_FILTER_FILTERLINE_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_DISPLAY_SETTINGS_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_VIEW_LIST_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_SORT_HEADERCLICK_ALLOWED( ABAP_FALSE ).
        LV_VALUE->IF_SALV_WD_STD_FUNCTIONS~SET_HIERARCHY_ALLOWED( ABAP_FALSE ).
    * Standard Filter Function setting to FALSE Ends
    Here as you can easily notice that LV_VALUE is instantiated on CL_SALV_WD_CONFIG_TABLE. Now, using this LV_VALUE, you set standard functions as False to dis-allow their display.
    Hope this answers your query.
    Thanks.
    Kumar Saurav.

  • Dynamic Internal table data

    Hi All,
    I was created program to generate Dynamic field catalog and internal table, here is confusion how to display below mentioned internal table data to final dynamic internal table based on document type headings
    This is Statsic internal table Data
    1 0000123  GBP  DA  S  6265.45
    2 0000123  GBP  DA  H  240.51
    3 0000123  GBP  DA  S  35.82
    4 0000123  GBP  D1  H  281.85
    5 0000123  GBP  D1  S  23.41
    6 0000123  GBP  D1  S  34.23
    7 0000123  GBP  RV  H  97.02
    8 0000123  GBP  RV  S  52.90
    9 0000123  GBP  RV  S  148.31
    Can anybody suggest me how to populate the amount based on Document type and posting (credit or debit)
    For Example
    CUST DAC       DAD         D1C       D1D     RVC     RVD
    123                  6265.45   240.51
                            35.82
    Thanks in Advance
    Sekhar
    Moderator message: please do not open multiple threads for the same or similar issue.
    Edited by: Thomas Zloch on Dec 9, 2011 4:17 PM

    Hi All,
    I was created program to generate Dynamic field catalog and internal table, here is confusion how to display below mentioned internal table data to final dynamic internal table based on document type headings
    This is Statsic internal table Data
    1 0000123  GBP  DA  S  6265.45
    2 0000123  GBP  DA  H  240.51
    3 0000123  GBP  DA  S  35.82
    4 0000123  GBP  D1  H  281.85
    5 0000123  GBP  D1  S  23.41
    6 0000123  GBP  D1  S  34.23
    7 0000123  GBP  RV  H  97.02
    8 0000123  GBP  RV  S  52.90
    9 0000123  GBP  RV  S  148.31
    Can anybody suggest me how to populate the amount based on Document type and posting (credit or debit)
    For Example
    CUST DAC       DAD         D1C       D1D     RVC     RVD
    123                  6265.45   240.51
                            35.82
    Thanks in Advance
    Sekhar
    Moderator message: please do not open multiple threads for the same or similar issue.
    Edited by: Thomas Zloch on Dec 9, 2011 4:17 PM

  • Unable to display table data in Review View

    Hi Experts,
    I have one main view and one review View .In my main view i have one table (Normal Table) and several other input feilds and text views....
    If i click on review button in my main view, am able to see all the data in review view except table data.
    How can i get the table data which i have entered in main view.. the same should display in review view.
    I binded the same node in both main and review. and node is defined under component controller.
    Any ideas?
    Regards
    Farooq.

    Hi,
    I think you already binded in review view also with same node. right? So data will move automatically and display in
    review view also. In WDDOINIT of review veiw read data from that node and use bind_Table.
    Cheers,
    Kris.

  • Dynamic Internal Table - data type changed automatically

    Dear All,
    I have a requirement of craetion of dynamic inetrnal table which I have created referring to a custom table .
    In that custom table there is field ZDC002 of type DEC(16,7) which is converted to data type P(9,7) .
    Now it works fine if 2 digit and 7 decimals  value passed like 12.1234567 but it gives overflow error when passing more than 2 digit value .
    Please help me as I have no control to SAP standard functinality while creation of data-type . My piece of code :
    ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( 'ZBW_EE_DCONTR' ).
          idetails[] = ref_table_des->components[].
    In this idetails[] table filedname data type changed from DEC16,7 to data type P(9,7). => Total Length of Packed Data Type is 9 which allows to contain only 2 numericdigits and 7 decimals => puts overflow error if more than 2 numeric data passed.
    Any suggestions will be appreciated.
    Thanks,
    Sachin

    Did you try to view the code on the Data Source view and cube that it is reflecting the correct data type on both places? if not you can change there and save it.
    prajwal kumar potula

  • Reading dynamic html table data

    HI friends I am creating asp.net project and i want read html table data which is dynamically created.

    This forum is for language questions. For help in asp.net, visit forums.asp.net.
    Visual C++ MVP

  • select to display table data.

    I'm having some trouble displaying some data with a <select>
    What I am trying to do is to use <select> to displays the countries and have a table that shows the state selected (once as a heading), a list of all cities, country code, area code and phone numbers.
    This is the xml structure:
    <AccessNumbers>
        <AccessNumber>
            <country>Argentina</country>
            <city>Buenos Aires</city>
            <countryCode>54</countryCode>
            <areaCode>11</areaCode>
            <phone>52582114</phone>
        <AccessNumber>
    <AccessNumbers>
    The problem I have is that my xml has the countries and cities repeated multiple times so in my <select> I can't filter out duplicate countries. Also, don't understand how to tie the <select> info to the table to display the correct data in the table based on the country selected.
    Can anyone help?

    Olavarrieta wrote:
    The problem I have is that my xml has the countries and cities repeated
    multiple times so in my <select> I can't filter out duplicate
    countries.
    These will be your datasets listing the original data and listing the countries filtering out duplicate countries
    var dsAccessnumbers = new Spry.Data.XMLDataSet("accessnumbers.xml", "AccessNumbers/AccessNumber");
    var dsCountries = new Spry.Data.XMLDataSet("accessnumbers.xml", "AccessNumbers/AccessNumber/country", {distinctOnLoad: true});
    Olavarrieta wrote:
    Also, don't understand how to tie the <select> info to the table
    to display the correct data in the table based on the country selected.
    Have a look here to give you an idea http://labs.adobe.com/technologies/spry/samples/data_region/DataSetMasterDetailSample.html
    The above example uses a different XML data structure, but with a bit of juggling, you will be able to make it work for the structure that you have in place
    Other articles worth noting:
    http://labs.adobe.com/technologies/spry/samples/
    http://labs.adobe.com/technologies/spry/samples/data_region/SetURL.html
    http://labs.adobe.com/technologies/spry/articles/data_set_overview/

  • How to dynamically display the data from a table base on row selection of another table in ADF

    Hi ,
    I have a requirement in ADF. I need to change the data of a table  based on row selection of another Table . Both the table have a Parent Child relationship between them. They have a common attribute say department_id.
                                                                                         For this I created bind variable in view object of employees table and wrote a where clause in the sql query using that bind variable. Then I created method for selection listener of department Table in java bean.
    My method is following
        public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    It is printing the selected value of department id from department table in the log. But it is not able to pass the value to employees view. It is showing the following error in the log
    "Definition DepartmentId of type Variable is not found in EmployeesView1."
    I will be very thankful if someone helps me to solve this errror or is there any other way to achieve the same requirement.
    Thanks
    Nilesh

    Note quite sure why you simply wont create a viewlink for the viewobject the tables are based on..
    The viewlink attribute will be based on the departmentId and it's a simple master detail relationship which automatically uses ppr.
    However, if both tables are on the same page; using your hack about;
    On the underlying viewobject, define a viewcriteria e.g. "listById" and set your bind variable here.
    I would bind table two to a RichTable component:
    RichTable t2;
    public void onrowselection(SelectionEvent selectionEvent) {
            RichTable richTable = (RichTable)selectionEvent.getSource();
                            CollectionModel tableModel = (CollectionModel)richTable.getValue();
                            JUCtrlHierBinding adfTableBinding = (JUCtrlHierBinding)tableModel.getWrappedData();
                            Object selectedRowData = richTable.getSelectedRowData();
                            JUCtrlHierNodeBinding nodeBinding = (JUCtrlHierNodeBinding)selectedRowData;
                    oracle.jbo.domain.Number newVal = (oracle.jbo.domain.Number) nodeBinding.getAttribute("DepartmentId");
                    Number pallet = newVal.bigDecimalValue();
                    System.out.println("Selected values " + pallet);
                   refreshTable2(pallet);
            BindingContext bindingctx = BindingContext.getCurrent();
                          BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
                          DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
                  DCIteratorBinding dciter = bindingsImpl.findIteratorBinding("EmployeesView1Iterator");//access the iterator by its ID value in the PageDef file
                          ViewObject vo =dciter.getViewObject();
                          vo.setNamedWhereClauseParam("DepartmentId", pallet);//enter your value
                          vo.executeQuery();
    private void refreshTable2(Number pallet){
    RichTable x=getT2();
    CollectionModel cm=(CollectionModel)x.getValue();
    JUCtrlHierBinding jcb=(JUCtrlHierBinding)cm.getWrappedData();
    BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
    DCIteratorBinding dciter = bindingsImpl.findIteratorBinding(jcb.getName()+"Iterator");
    ViewObject vo =dciter.getViewObject();
    ViewCriteriaManager vcm=vo.getViewCriteriaManager();
    ViewCriteria vc=vcm.getViewCriteria("listById");
    vo.applyViewCriteria(vc);
    vo.setNamedWhereClauseParam("DepartmentId",pallet);
    vo.executeQuery();
    AdfFacesContext.getCurrentInstance().addPartialTarget(getT2());

  • How to read and display table data entries from ERP in CRM

    Hello experts,
    I am new to CRM. I need to read data base entries from ERP in CRM system. What would be the best way to do . The table is a standard SAP table with a custom include (several customer fields). Calling a web service would be the best way..? or is there any other way that I can do it too.
    Also, to display these entries what would be the best tool? Should I built my own transaction/report to do it?
    Any advise or guidance would be a great kick start to learn the CRM development environment.
    Regards,
    jaffery

    Hi,
    Check the below wiki link if it helps.
    http://wiki.sdn.sap.com/wiki/display/CRM/Howtodisplayaz-tableinanassignmentblock
    Also, you can try an option of transaction launcher.
    Hope this helps.
    Regards,
    Chandrakant

  • MySQL  will not display table data

    I correctly set the datasource connect to MySQL I can update the table from within creator but I cant get Creator to view the data.

    Duplicate of http://swforum.sun.com/jive/thread.jspa?threadID=51486&tstart=0

  • How to display a table data on Screen having a Table control

    Hi ,
    I am new to ABAP.I would like to display a table data (Eg: ZDemo) on a screen at run time.I have defined a Table control in screen. Now I want to populate data from ZDemo to table control.How can I do that?Please help moving forward in this regard.

    Hi Gayatri,
      After creating table control do the following steps.
    1. In the flow logic section write the following code:
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0200.
    LOOP AT I_LIKP WITH CONTROL LIKP_DATA CURSOR LIKP_DATA-CURRENT_LINE.
      MODULE ASSIGN_DATA.
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0200.
    LOOP AT I_LIKP.
    ENDLOOP.
    I_LIKP is the internal table which is used to display table data in the table control.
    2. In Process Before Output, in the module STATUS_0200 write the following code:
      DESCRIBE TABLE I_LIKP LINES FILL.
      LIKP_DATA-LINES = FILL.
      In Process After Input, in the module USER_COMMAND_0200 write the following code:
      CASE SY-UCOMM.
       WHEN 'LIPS'.
        READ TABLE I_LIKP WITH KEY MARK = 'X'.
        SELECT VBELN
               POSNR
               WERKS
               LGORT
               FROM LIPS
               INTO TABLE I_LIPS
               WHERE VBELN = I_LIKP-VBELN.
        IF SY-SUBRC = 0.
         CALL SCREEN 200.
        ENDIF.
       WHEN 'BACK'.
        SET SCREEN 200.
      ENDCASE.
    In Process Before Output and in the module ASSIGN_DATA which is there inside the loop write the following code:
    MOVE-CORRESPONDING I_LIKP TO LIKP.
    So, Totally your flow logic code should be like this.
    TABLES: LIKP, LIPS.
    DATA: BEGIN OF I_LIKP OCCURS 0,
           VBELN LIKE LIKP-VBELN,
           ERNAM LIKE LIKP-ERNAM,
           ERZET LIKE LIKP-ERZET,
           ERDAT LIKE LIKP-ERDAT,
           MARK  TYPE C VALUE 'X',
          END OF I_LIKP,
          BEGIN OF I_LIPS OCCURS 0,
           VBELN LIKE LIPS-VBELN,
           POSNR LIKE LIPS-POSNR,
           WERKS LIKE LIPS-WERKS,
           LGORT LIKE LIPS-LGORT,
          END OF I_LIPS,
          FILL TYPE I.
    CONTROLS: LIKP_DATA TYPE TABLEVIEW USING SCREEN 200,
              LIPS_DATA TYPE TABLEVIEW USING SCREEN 300.
    DATA: COLS LIKE LINE OF LIKP_DATA-COLS.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
      WHEN 'LIKP'.
       SELECT VBELN
              ERNAM
              ERZET
              ERDAT
              FROM LIKP
              INTO TABLE I_LIKP
              WHERE VBELN = LIKP-VBELN.
       IF I_LIKP[] IS INITIAL.
         CALL SCREEN 200.
       ENDIF.
      WHEN 'EXIT'.
       LEAVE PROGRAM.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  assign_data  OUTPUT
          text
    MODULE ASSIGN_DATA OUTPUT.
    MOVE-CORRESPONDING I_LIKP TO LIKP.
    ENDMODULE.                 " assign_data  OUTPUT
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      DESCRIBE TABLE I_LIKP LINES FILL.
      LIKP_DATA-LINES = FILL.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE USER_COMMAND_0200 INPUT.
      CASE SY-UCOMM.
       WHEN 'LIPS'.
        READ TABLE I_LIKP WITH KEY MARK = 'X'.
        SELECT VBELN
               POSNR
               WERKS
               LGORT
               FROM LIPS
               INTO TABLE I_LIPS
               WHERE VBELN = I_LIKP-VBELN.
        IF SY-SUBRC = 0.
         CALL SCREEN 200.
        ENDIF.
       WHEN 'BACK'.
        SET SCREEN 200.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    Save and Activate the program along with the screen in which you have included table control.
    Hope this will help you.
    Regards
    Haritha.

  • How to Copy data from field symbol to Dynamic Internal Table

    Hi,
    I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
    REPORT  ztest.
    DATA:
           gd_dref          TYPE REF TO data,
           gd_dref1          TYPE REF TO data.
    FIELD-SYMBOLS:  <fs1>   TYPE any,
                               <fs_wa> TYPE any,
                                <field>    TYPE any,                  
                                <fs_wa1> TYPE ANY TABLE.  * Contains data from p_src
    *Copy data from p_src to p_dest*
    PARAMETERS: p_src LIKE dd02l-tabname .    * Name of Dynamic Internal table *
                             p_dest LIKE dd02l-tabname .  * Name of Dynamic Internal table*
    *DATA : lt_csks LIKE p_dest WITH HEADER LINE.
    START-OF-SELECTION.
      CREATE DATA gd_dref TYPE (p_src).
      CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
       ASSIGN gd_dref->* TO <fs_wa>.
       ASSIGN gd_dref1->* TO <fs_wa1>.
       SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
    *Write out data from FIELD SYMBOLS TO Table.
       loop at <fs_wa1> into <fs_wa>.
         do.
           assign component  sy-index
              of structure <fs_wa> to <field>.
           if sy-subrc <> 0.
           exit.
           endif.
           if sy-index = 1.
             write:/ <field>.
           else.
           write: / <field>.
           endif.
         enddo.
       endloop.
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    *p_dest is a table having a similar structure to table p_src .
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    EXIT.
    Thanks in Advance.

    try this...
    I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
    Cheers...
    report  ztest.
    data:
      gd_dref type ref to data,
      gd_dref1 type ref to data,
      gd_dref_str type ref to data,
      gd_dref_tab type ref to data.
    field-symbols:
      <fs1> type any,
      <fs_wa> type any,
      <fs1_dest_str> type any,
      <fs_dest_tab> type any table,
      <field> type any,
      <fs_wa1> type any table.
    * contains data from p_src
    *Copy data from p_src to p_dest*
    parameters: p_src like dd02l-tabname default 'vbak',
    * name of dynamic internal table *
                p_dest like dd02l-tabname default 'vbap'.
    * name of dynamic internal table*
    *data : lt_csks like p_dest with header line.
    start-of-selection.
      create data gd_dref type (p_src).
      create data gd_dref1 type table of (p_src).
      assign gd_dref->* to <fs_wa>.
      assign gd_dref1->* to <fs_wa1>.
      select * from (p_src) into corresponding fields of table <fs_wa1>
      up to 3 rows
      where vbeln ne space.
      create data gd_dref_str type (p_dest).
      create data gd_dref_tab type standard table of (p_dest).
      assign gd_dref_str->* to <fs1_dest_str>.
      assign gd_dref_tab->* to <fs_dest_tab>.
    *write out data from field symbols to table.
      loop at <fs_wa1> into <fs_wa>.
        " break-point here - can see vbeln/waers/create date/ etc move over to new structure
        " the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
        " explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
        break-point.
        move-corresponding <fs_wa> to <fs1_dest_str>.
        insert <fs1_dest_str> into table <fs_dest_tab>.
    **    do.
    **      assign component  sy-index
    **         of structure <fs_wa> to <field>.
    **      if sy-subrc <> 0.
    **        exit.
    **      endif.
    **      if sy-index = 1.
    **        write:/ <field>.
    **      else.
    **        write: / <field>.
    **      endif.
    **    enddo.
      endloop.
      " write out some dest data from the dest table build from previous loop
      loop at <fs_dest_tab> assigning <fs1_dest_str>.
        do.
          assign component sy-index of structure <fs_wa> to <field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <field>.
          else.
            write: / <field>.
          endif.
        enddo.
      endloop.

  • Need information on Dynamic internal table

    Hi All,
    I need some information on dynamic internal table.
    I want what are the field names and the values in dynamic internal table.
    Is there any function module, which tells us the field names and values of corresponding fields from a dynamic internal table ?
    Thank you very much in advance.

    Hi,
    Program to display/edit database tables dynamically.
    REPORT  zdyn_table_display.
    PARAMETERS: p_table TYPE tabname OBLIGATORY,
                p_rows  TYPE I.
    * Creation of dynamic internal table
    DATA: lv_dref             TYPE REF TO data.
    FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE.
    DATA: lv_table  TYPE  string.
    START-OF-SELECTION.
    * Dynamic internal table.
      CREATE DATA lv_dref       TYPE TABLE OF (p_table).
      ASSIGN lv_dref->* TO <fs_table>.
      IF sy-subrc  EQ 0.
    *    EXIT.
      ENDIF.
    data i type i.
    * Get the data
      SELECT  *
            FROM (p_table)
            UP TO p_rows ROWS
            INTO TABLE <fs_table>.
      CONCATENATE 'Table contents : ' p_table INTO lv_table.
    * display the table control.
      CALL FUNCTION 'STC1_FULLSCREEN_TABLE_CONTROL'
        EXPORTING
          header            = lv_table
          tabname           = p_table
          no_button         = space
        TABLES
          table             = <fs_table>
        EXCEPTIONS
          no_more_tables    = 1
          too_many_fields   = 2
          nametab_not_valid = 3
          handle_not_valid  = 4
          OTHERS            = 5.
      IF sy-subrc  EQ 0.
        EXIT.
      ENDIF.
    Getting internal table definition 
    Try this...
    DATA : l_descr_ref TYPE REF TO cl_abap_structdescr.
    l_descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).
    Now l_descr_ref->components holds the entire list of fields in itab.
    Thanks & Regards,
    ShreeMohan

  • ALV-dynamic display

    I have to display the stock of store of the corresponding plant dynamically in ALV.
    I am using the data from LIPS,LIKP,MARA,MARD table.The problem is how to display the stock dynamically?

    Hi,
       Take the stock to be displayed dynamically into an internal table, the entries in internal table such that it depends on the selection made.
    Check the following code it will give you a very good idea of how to proceed for your case.
    DATA:BEGIN OF i_kschl OCCURS 0,
           kschl LIKE komv-kschl,
           END OF i_kschl.
    i_kschl is the internal table where the dynamic columns areinted to bestored.
    DATA: it_fldcat TYPE lvc_t_fcat.
      PERFORM build_dyn_itab.
    FORM build_dyn_itab.
      DATA: new_table TYPE REF TO data,
            new_line  TYPE REF TO data,
            wa_it_fldcat TYPE lvc_s_fcat.
    COLUMN COUNT TO CREATE DYNAMIC INTERNAL TABLE   **
      DATA: v_colpos TYPE i,
            v_colpos_new TYPE i.
    LOADING THE DYNAMIC FIELD CATELOG TO BE PASSED  **
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'VBELN'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'P_NAME1'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 35.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KUNGR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'FKART'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 4.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'BZIRK'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'PLTYP'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 2.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ERNAM'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 12.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'NAME1'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 35.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KVGRC'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 3.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KVGRD'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 3.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'AUART'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 4.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KWMENG'.
      wa_it_fldcat-datatype = 'QUAN'.
      wa_it_fldcat-intlen = 19.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'FKIMG'.
      wa_it_fldcat-datatype = 'QUAN'.
      wa_it_fldcat-intlen = 17.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'NONACC'.
      wa_it_fldcat-datatype = 'QUAN'.
      wa_it_fldcat-intlen = 19.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'BRGEW'.
      wa_it_fldcat-datatype = 'QUAN'.
      wa_it_fldcat-intlen = 19.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KDGRP'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 2.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'POSNR'.
      wa_it_fldcat-datatype = 'NUMC'.
      wa_it_fldcat-intlen = 6.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'PRSDT'.
      wa_it_fldcat-datatype = 'DATS'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'MVGR2'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 3.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ZNODNV'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'SOLD'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'BILL'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'SHIP'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'SHIPADDR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 45.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'WAERK'.
      wa_it_fldcat-datatype = 'CUKY'.
      wa_it_fldcat-intlen = 5.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'FKDAT'.
      wa_it_fldcat-datatype = 'DATS'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'AUBEL'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ERDAT'.
      wa_it_fldcat-datatype = 'DATS'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'XBLNR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 16.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'MATNR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ZTERM'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 4.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'NTGEW'.
      wa_it_fldcat-datatype = 'QUAN'.
      wa_it_fldcat-intlen = 19.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KZWI2'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'NETWR'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 21.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'HZTMS'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'PRODH'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'KVGR5'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 3.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'VGBEL'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'INCO1'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 3.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'LNAME1'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 35.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'BOLNR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 35.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'WADAT'.
      wa_it_fldcat-datatype = 'DATS'.
      wa_it_fldcat-intlen = 10.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'WAVWR'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 18.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ZDIS1'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 21.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ZTMS1'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 21.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'ZNOD1'.
      wa_it_fldcat-datatype = 'CURR'.
      wa_it_fldcat-intlen = 21.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos = v_colpos + 1.
      wa_it_fldcat-col_pos = v_colpos.
      wa_it_fldcat-fieldname = 'FLAGK'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 1.
      APPEND wa_it_fldcat TO it_fldcat .
      CLEAR wa_it_fldcat.
      v_colpos_new = v_colpos.
    CREATE DYNAMIC FIELD COLUMNS  **
      LOOP AT i_kschl.
        v_colpos_new = v_colpos_new + 1.
        wa_it_fldcat-col_pos = v_colpos_new.
        wa_it_fldcat-fieldname = i_kschl-kschl.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 4.
        APPEND wa_it_fldcat TO it_fldcat .
        CLEAR wa_it_fldcat.
        CLEAR i_kschl.
      ENDLOOP.
      METHOD USED TO OBTAIN DYNAMIC INTERNAL TABLE AS PER CATELOG  **
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
         I_STYLE_TABLE             =
          it_fieldcatalog           = it_fldcat
        IMPORTING
          ep_table                  = new_table
         E_STYLE_FNAME             =
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      ASSIGN new_table->* TO <dyn_table>.
      CREATE DATA new_line LIKE LINE OF <dyn_table>.
      ASSIGN new_line->* TO <dyn_wa>.
    ENDFORM.
    The above process is to create the dynamic internal table  **
    ASSIGN COMPONENT 'PLTYP'  OF STRUCTURE <dyn_wa> TO <fs2>.
          <fs2> =  wa_output_1-pltyp.
          ASSIGN COMPONENT 'ERNAM'  OF STRUCTURE <dyn_wa> TO <fs2>.
          <fs2> =  wa_output_1-ernam.
    FORM build_condtyp.
      FIELD-SYMBOLS: <fs1>.
      LOOP AT i_kschl WHERE kschl = wa_output_1-kschl.
        ASSIGN COMPONENT i_kschl-kschl OF STRUCTURE <dyn_wa> TO <fs1>.
        <fs1> =  wa_output_1-kwert.
      ENDLOOP.
    ENDFORM.
    Th aboveprocess is to populate the contents under the dynamic column **
    Reward if found help full.
    Regards,
    Rama Murthy.P

  • How to add new field into dynamic internal table

    Hello Expert.
    how to add new field into dynamic internal table.
    PARAMETERS: P_TABLE(30).    "table name
    DATA: I_TAB TYPE REF TO DATA.
    FIELD-SYMBOLS: <TAB> TYPE standard TABLE.
    *Create dynamic FS
    create DATA I_TAB TYPE TABLE OF (p_table).
      ASSIGN I_TAB->* TO <TAB>.
    SELECT * FROM (p_table) INTO TABLE <TAB>.
       here i want to add one more field into <TAB> at LAST position and my 
       Field name  =  field_stype     and
       Field type    =  'LVC_T_STYL'
    could you please helpme out .

    Hi,
    Please find the code below.You can add the field acc to your requirement.
    Creating Dynamic internal table
    TYPE-POOLS: slis.
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,  u201C Dynamic internal table name
                   <fs_dyntable>,                     u201C Field symbol to create work area
                   <fs_fldval> type any.              u201C Field symbol to assign values 
    PARAMETERS: p_cols(5) TYPE c.                     u201C Input number of columns
    DATA:   t_newtable TYPE REF TO data,
            t_newline  TYPE REF TO data,
            t_fldcat   TYPE slis_t_fldcat_alv,
            t_fldcat   TYPE lvc_t_fcat,
            wa_it_fldcat TYPE lvc_s_fcat,
            wa_colno(2) TYPE n,
            wa_flname(5) TYPE c. 
    Create fields .
      DO p_cols TIMES.
        CLEAR wa_it_fldcat.
        move sy-index to wa_colno.
        concatenate 'COL'
                    wa_colno
               into wa_flname.
        wa_it_fldcat-fieldname = wa_flname.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 10.
        APPEND wa_it_fldcat TO t_fldcat.
      ENDDO. 
    Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fldcat
        IMPORTING
          ep_table        = t_newtable. 
      ASSIGN t_newtable->* TO <t_dyntable>. 
    Create dynamic work area and assign to FS
      CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    Populating Dynamic internal table 
      DATA: fieldname(20) TYPE c.
      DATA: fieldvalue(10) TYPE c.
      DATA: index(3) TYPE c. 
      DO p_cols TIMES. 
        index = sy-index.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
    Set up fieldvalue
        CONCATENATE 'VALUE' index INTO
                    fieldvalue.
        CONDENSE    fieldvalue NO-GAPS. 
        ASSIGN COMPONENT  wa_flname
            OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
        <fs_fldval> =  fieldvalue. 
      ENDDO. 
    Append to the dynamic internal table
      APPEND <fs_dyntable> TO <t_dyntable>.
    Displaying dynamic internal table using Grid. 
    DATA: wa_cat LIKE LINE OF fs_fldcat. 
      DO p_cols TIMES.
        CLEAR wa_cat.
        MOVE sy-index TO wa_colno.
        CONCATENATE 'COL'
                    wa_colno
               INTO wa_flname. 
        wa_cat-fieldname = wa_flname.
        wa_cat-seltext_s = wa_flname.
        wa_cat-outputlen = '10'.
        APPEND wa_cat TO fs_fldcat.
      ENDDO. 
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = fs_fldcat
        TABLES
          t_outtab    = <t_dyntable>.

Maybe you are looking for

  • Anyone knows if it's possible to transmit raw data through jack plug of an iPhone/iPad?

    I have a dummy hardware that have a jack socket and a simple protocol. I want to send/receive serial data from this hardware on my iPhone/iPad, but I don't know if this is possible, because is a very low level protocol. I also have bluetooth, but is

  • What do I do to get Reader for a Mac?

    I bought the $199 version of Adobe XL but when I downloaded it was an .exe file.  As a mac user I need a .dmg file.  Any ideas on how to best correct this? 

  • How to activate a link in JOptionPane.showMessageDialog()

    i have the following code (the color of "Email Me" is blue) JOptionPane.showMessageDialog    parent,    "<html><a href=\"mailto:[email protected]\">Email Me </a></html>"    "dialog title",    JOptionPane.PLAIN_MESSAGE );"Email Me" is blue and underli

  • Cannot make a purchase!

    Im going through the education store, using my instant credit on my barclayscard, which I was approved for, and cannot make a purchase. I have made sure the fields are filled out a few times now but after the processing screen, I get redirected back

  • Can you restore OUTSIDE of iTunes?

    I have two of these: http://images.apple.com/support/ipod/fivers/elements/ipod_withdockon.gif (30GB B&W iPod) One of them started giving bunches of trouble today. It won't appear in iTunes when docked (but the other iPod does). I tried all of the "fi