Write dynamic table

hello experts,
please help me with this.
i have a dynamic table and my output should be in a report format (write:).
how can i WRITE the output using the dynamic table? and another thing, i should write the heading or the column names also...
for example:
Material Number----Material Type-----Material Description    -
>column names
  0000000012--XXXX--
YYYYYY            -
>values
thank you.

we use Dynamic internal tables when we use ABAP oops
we create them by using Field symbols
There are a few declarations to make:
field-symbols: <table> type any.
types: fieldref type ref to data.
data: dyn_table type fieldref.
As for the actual code to generate the table:
create data dyn_table type (SAP Table).
assign dyn_table->* to table.
The table is now a field symbol which can be referenced in the normal way.
check out this prg
REPORT ZCLUST1 .
Example: how to create a dynamic internal table
The dynamic internal table stucture
DATA: BEGIN OF STRUCT OCCURS 10,
FILDNAME(8) TYPE C,
ABPTYPE TYPE C,
LENGTH TYPE I,
END OF STRUCT.
The dynamic program source table
DATA: BEGIN OF INCTABL OCCURS 10,
LINE(72),
END OF INCTABL.
DATA: LNG TYPE I, TYPESRTING(6).
Sample dynamic internal table stucture
STRUCT-FILDNAME = 'field1'. STRUCT-ABPTYPE = 'c'. STRUCT-LENGTH = '6'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field2'. STRUCT-ABPTYPE = 'd'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field3'. STRUCT-ABPTYPE = 'i'.
APPEND STRUCT. CLEAR STRUCT.
Create the dynamic internal table definition in the dyn. program
INCTABL-LINE = 'program zdynpro.'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
LOOP AT STRUCT.
INCTABL-LINE = STRUCT-FILDNAME.
LNG = STRLEN( STRUCT-FILDNAME ).
IF NOT STRUCT-LENGTH IS INITIAL .
TYPESRTING(1) = '('.
TYPESRTING+1 = STRUCT-LENGTH.
TYPESRTING+5 = ')'.
CONDENSE TYPESRTING NO-GAPS.
INCTABL-LINE+LNG = TYPESRTING.
ENDIF.
INCTABL-LINE+15 = 'type '.
INCTABL-LINE+21 = STRUCT-ABPTYPE.
INCTABL-LINE+22 = ','.
APPEND INCTABL.
ENDLOOP.
INCTABL-LINE = 'end of dyntab. '.
APPEND INCTABL.
Create the code processes the dynamic internal table
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''aaaaaa''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''19970814''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = 1.'. APPEND INCTABL.
INCTABL-LINE = 'append dyntab.'. APPEND INCTABL.
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'loop at dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'write: / dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'endloop.'. APPEND INCTABL.
Create and run the dynamic program
INSERT REPORT 'zdynpro'(001) FROM INCTABL.
SUBMIT ZDYNPRO.
or Just try out this simpler dynamic internal tables
DATA: itab TYPE STANDARD TABLE OF spfli,
wa LIKE LINE OF itab.
DATA: line(72) TYPE c,
list LIKE TABLE OF line(72).
START-OF-SELECTION.
*line = ' CITYFROM CITYTO '.
line = ' AIRPTO '.
APPEND line TO list.
SELECT DISTINCT (list)
INTO CORRESPONDING FIELDS OF TABLE itab
FROM spfli.
IF sy-subrc EQ 0.
LOOP AT itab INTO wa.
WRITE: / wa-cityfrom, wa-cityto.
WRITE :/ wa-airpto.
ENDLOOP.
ENDIF.
for more info visit
http://www.sap-img.com/ab030.htm
Regards
Chandru

Similar Messages

  • HR Logical database PNP. OO to fill table dynamic table  from PNP  ?

    Hi all
    I want to get some stuff from the HR logical database into a dynamic table
    Here's a real simple example that writes info out to a normal list.
    (report is based on using Logical DB PNP)
    tables: pernr.
    INFOTYPES: 0001,                     "Organizational Assignment
               0002.                     "Personal Data
    SELECT-OPTIONS: language FOR p0002-sprsl.
    INITIALIZATION.
      pnptimed = 'D'.
    GET pernr.
      PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda.
        CHECK language.
        WRITE: / p0002-pernr,
                 sy-vline,
                 p0001-ename,
                 sy-vline,
                 p0002-sprsl,
                 sy-vline,
                 p0002-gbdat.
      ENDPROVIDE.
    endform.
    Now what I want to do is replace the write stuff by appending the entries into a dynamic table which I will display as an ALV Grid.
    so I add my structure in the data declarations
    types:  begin of s_elements,
       pernr  type  p0002-pernr,
       ename  type p0001-ename,
       sprsl  type p0002-sprsl,
       gbdat   type p0002-gbdat.
      drop_down_handle  type int4.
    types: end of    s_elements.
    include zz_jimbo_incl.
    build the dynamic table
    create data dref type s_elements.
      assign dref->* to <fs>.
      i_routine = 'POPULATE_DYNAMIC_ITAB'.*
    i_names   = 'NAME_COLUMNS'.
      i_gridtitle = 'HR  TEST'.
    invoker = sy-repid.
    i_zebra = 'X '.
    i_edit = '  '.
    call function 'ZZ_CALL_SCREEN'
         exporting
              invoker     = invoker
              my_line     = <fs>
              i_gridtitle = i_gridtitle
              i_edit      = i_edit
              i_zebra     = i_zebra
              i_names     = i_names
              i_routine   = i_routine
         importing
              z_object    = z_object
              dy_table    = dy_table.
    Now to populate the dynamic Itab the routine below is entered.
    form populate_dynamic_itab changing dy_table.
      assign dy_table->* to <dyn_table>.
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    However I can't use GET / PROVIDE / ENDPROVIDE in a Form.
    Anyway round this ---seems HR has an aversion to OO.
    Cheers
    jimbo

    Hi,
    well, GET_PERNR is a so called event_statement. It has nothing to do with ABAP 00.
    Normally it will be like this:
    START-OF-SELECTION.
    GET_PERNR.
    PROVIDE ....
    END-OF-SELECTION.
    -> and here the CALL SCREEN NNNN for ALV-Display.
    Provide-statements you can use in forms of course, and as many times you want during GET and END-OF-SELECTION.
    But as I understood : you just want to save the write-statements?
    I always develop a DDIC-Structure, declarate the data objects in the programm, read the data via Provide into the infotypes, and then make a move-corresponding to my structure. and display it.
    Normally no problem.
    kind regards
    maik

  • Hide multiple rows in a dynamic table based on the row value.

    Hi,
    I need to hide multiple rows in a dynamic table based on the specific value of that row.
    I cant find the right expression to do that.
    please help

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • How to know or check the type of a field when processing a dynamic table?

    Dear all,
        When processing a dynamic table i have a short dump because of a convert_of_type incorrect, so i would like to check the type of field-symbol <f> before moving the data (type char) to this field-symbol <f>.
    Could you please help me how to check or get the type of field-symbol <f> (because field-symbol <f> is assigned dynamic, so this <f> can be type char, unit, or quantity, ...)?
    The source code same as below:
       ASSIGN COMPONENT lc_field OF STRUCTURE ls_data TO <f>.
       MOVE lv_field TO <f>. (Dump is here when lv_field is char type and <f> is quantity type => could i check the type of <f> if it's char type before using this instruction "MOVE ..."?)
    Thanks a lot in advance,
    Vinh Vo

    Try to use this way
    WRITE lv_field TO <f>.
    Instead of
    MOVE lv_field TO <f>.

  • Error while creating dynamic Table

    Hi All,
    I have a node 'SEG' with 3 attributes, ATTR1.2.3, I am tring to crate dynamic table using this context node. Initialy i am displaying view with button, when click on this button i want to create table dynamically.. if click again one more table i have to create.. its giving dump... here is the code... How to do this???
    data: wd_node_info type ref to if_wd_context_node_info,
            wd_node type ref to if_wd_context_node,
            lr_container type ref to cl_wd_uielement_container,
            lv_tablename type string,
            lt_db_data type ref to data,
            lr_table type ref to cl_wd_table.
      field-symbols: <lt_data> type any table.
      wd_node_info = wd_context->get_node_info( ).
      wd_node = wd_context->get_child_node( name = 'SEG' ).
    lr_container ?= view->get_root_element( ).
      cl_wd_matrix_layout=>new_matrix_layout( container = lr_container ).
    " Creating internal table with the same structure as our dynamic
      context node
      CALL METHOD CL_WD_DYNAMIC_TOOL=>CREATE_TABLE_FROM_NODE
        EXPORTING
          UI_PARENT = lr_container
          TABLE_ID  = 'MY_TABLE'
          NODE      = wd_node
        RECEIVING
          TABLE     = lr_table.
      cl_wd_matrix_data=>new_matrix_data( element = lr_table ).
      lr_table->bind_data_source( path = 'SEG' ).
    Thanks'
    Madhan.

    Hi Sarbjeet,
    The code is working fine, when i use in wddomodify view method without button click on first time.( I checked this by creating another component). But I am creating dynamic table when click on button(view contains one button initially), for this i created two attributes FLAG OF TYPE wdy_boolean and count of type int1. and in button action i write this code :
      DATA lo_el_context TYPE REF TO if_wd_context_element.
        DATA ls_context TYPE wd_this->element_context.
        DATA lv_flag LIKE ls_context-flag.
      get element via lead selection
        lo_el_context = wd_context->get_element( ).
      get single attribute
        lo_el_context->set_attribute(
            name =  `FLAG`
            value = abap_true ).
      DATA lv_count LIKE ls_context-count.
    get element via lead selection
      lo_el_context = wd_context->get_element(  ).
    get single attribute
      lo_el_context->get_attribute(
        EXPORTING
          name =  `COUNT`
        IMPORTING
          value = lv_count ).
    lv_count = lv_count + 1.
    lo_el_context->set_attribute(
        EXPORTING
          name =  `COUNT`
          value = lv_count ).
    and in wddomodify view method following code..
    Method WDDOMODIFYVIEW
    DATA lo_el_context TYPE REF TO if_wd_context_element.
      DATA ls_context TYPE wd_this->element_context.
      DATA lv_flag LIKE ls_context-flag.
      get element via lead selection
        lo_el_context = wd_context->get_element(  ).
      get single attribute
        lo_el_context->get_attribute(
          EXPORTING
            name =  `FLAG`
          IMPORTING
            value = lv_flag ).
      DATA lv_count LIKE ls_context-count.
    get element via lead selection
      lo_el_context = wd_context->get_element(  ).
    get single attribute
      lo_el_context->get_attribute(
        EXPORTING
          name =  `COUNT`
        IMPORTING
          value = lv_count ).
    if lv_flag = abap_true. ......
    Remaining code same post previously************8
    get element via lead selection
      lo_el_context = wd_context->get_element(  ).
    get single attribute
      lo_el_context->set_attribute(
        EXPORTING
          name =  `FLAG`
          value = abap_false ).
    endif.
    endmethod...
    I created like this i am not getting other UI elements(input, ddbykey,button).
    And if i click view button again it going to dump..
    Thanks,
    Madhan.

  • How to identify the last instance of a dynamic table row

    Hi all,
    I am trying to figure out how to create an action for my form in Livecycle Designer ES2 that will affect the most recent instance of a dynamic table row. I have a table with a repeatable row where the user will enter information about a purchased part and I have buttons that allow the user to add and remove rows. I need to create an additional add row button that will add a new instance of the repeatable table row (this is not an issue) and will disable and change the background color of the first cell in the added row. The problem I am having is how to have an action that affects the last instance of a row.
    If anyone knows how to do this in Javascript I would appreciate some advice/help.

    Hi,
    I think this is beyond what an action will provide. You will a have to write some JavaScript directly.  When you call the addInstance method it returns the new row, so you can do something like;
    var row = Table1._Row1.addInstance();
    row.TextField1.border.fill.color.value = "255,0,0";
    row.TextField1.access = "protected";
    To find the last row and do the same thing you can do something like;
    var row = Table1.resolveNode("Row1[" + (Table1._Row1.count - 1) + "]");
    row.TextField1.border.fill.color.value = "255,0,0";
    row.TextField1.access = "protected";
    Regards
    Bruce

  • How can i insert into dynamic table  ?

    i have regular internal table with data  .
    i have dynamic table <dyn_tab>
    i insert the data from itab
    MOVE-CORRESPONDING ITAB TO <LS_LINE>.
        INSERT <LS_LINE> INTO TABLE <DYN_TABLE>.
    OK  , NOW I WANT TO ADD THE DATA FROM OTHER TABLE
    THAT HOLD THE DATA THAT ALL THE DYNAMIC TAB BUILD FOR
    HOW CAN I DO THIS INSERT  ?
    I NEED TO INSERT "KOSTL" TO MATCH LINE in <DYN_TABLE>
    THIS WHAT I TRIED TO DO :
          SHIFT INDX1 LEFT DELETING LEADING SPACE.
          CONCATENATE 'KOSTL' INDX1 INTO FIELD .
    ASSIGN COMPONENT FIELD  OF STRUCTURE <DYN_TABLE> TO <FS>.
    <FS> = IT_EKKN-KOSTL.
      but i get dump that <FS> not been assign .

    hi, 
    pls chk the sample code below.
    REPORT zmaschl_create_data_dynamic .
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
    is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
    is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
    <l_line> TYPE ANY,
    <l_field> TYPE ANY.
    * Build fieldcat
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'SYST'
    CHANGING
    ct_fieldcat = it_fcat[].
    LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
    MOVE-CORRESPONDING is_fcat TO is_fieldcat.
    is_fieldcat-fieldname = is_fcat-fieldname.
    is_fieldcat-ref_field = is_fcat-fieldname.
    is_fieldcat-ref_table = is_fcat-ref_tabname.
    APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    * Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_fieldcat
    IMPORTING
    ep_table = new_table.
    * Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    * Test it...
    DO 30 TIMES.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    <l_field> = sy-index.
    INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    WRITE <l_field>.
    ENDLOOP.
    Regards
    Anver
    <i>if hlped pls mark points</i>

  • Read a csv file, fill a dynamic table and insert into a standard table

    Hi everybody,
    I have a problem here and I need your help:
    I have to read a csv file and insert the data of it into a standard table.
    1 - On the parameter scrreen I have to indicate the standard table and the csv file.
    2 - I need to create a dynamic table. The same type of the one I choose at parameter screen.
    3 - Then I need to read the csv and put the data into this dynamic table.
    4 - Later I need to insert the data from the dynamic table into the standard table (the one on the parameter screen).
    How do I do this job? Do you have an example? Thanks.

    Here is an example table which shows how to upload a csv file from the frontend to a dynamic internal table.  You can of course modify this to update your database table.
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: it_fldcat type lvc_t_fcat,
          wa_it_fldcat type lvc_s_fcat.
    type-pools : abap.
    data: new_table type ref to data,
          new_line  type ref to data.
    data: xcel type table of alsmex_tabline with header line.
    selection-screen begin of block b1 with frame title text .
    parameters: p_file type  rlgrap-filename default 'c:Test.csv'.
    parameters: p_flds type i.
    selection-screen end of block b1.
    start-of-selection.
    * Add X number of fields to the dynamic itab cataelog
      do p_flds times.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = sy-index.
        wa_it_fldcat-datatype = 'C'.
        wa_it_fldcat-inttype = 'C'.
        wa_it_fldcat-intlen = 10.
        append wa_it_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    * Upload the excel
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = p_file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
    * Reformt to dynamic internal table
      loop at xcel.
        assign component xcel-col of structure <dyn_wa> to <dyn_field>.
        if sy-subrc = 0.
         <dyn_field> = xcel-value.
        endif.
        at end of row.
          append <dyn_wa> to <dyn_table>.
          clear <dyn_wa>.
        endat.
      endloop.
    * Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    REgards,
    RIch Heilman

  • Rp_provide_from_last dynamic table

    Hi,
    I have a report which uses logical database PNPCE to fetch employee data and macros like rp_provide_from_last to read infotypes.
    INFOTYPES: 0001 name gtab1,
    002 name gtab2.
    rp_provide_from_last gtab1 space pn-begda pn-endda
    rp_provide_from_last gtab2 space pn-begda pn-endda.
    I want to use a dynamic fieldname instead of gtab1 / gtab2. Basically i want to use this above macro statement to check if the infotype exists for a employee. So if there are 50 infotypes to be checked, i donot want to write this macro 50 times with 50 tables, is there a way to use a dynamic table name in the macro statement ?
    Thanks
    Subha

    Your requirement can be met by modelling the program based on the below source code. This program will list all infotypes that have been maintained for a PERNR. This proram excludes certain infotypes like PD infotypes. The source code can be changed to include all desired infotypes.
    *& Report  ZTEST_CHECK_INFY
    REPORT  ZTEST_CHECK_INFY.
    tables: t777d.
    DATA SUBRC LIKE SY-SUBRC.
    DATA PAR1 LIKE SY-MSGV1.
    DATA: BEGIN OF SELTAB OCCURS 5.
            INCLUDE STRUCTURE PRELP AS prelp.                   "UC
    DATA:   OPERA(1).
    DATA: END OF SELTAB.
    data: it_777d like t777d occurs 0.
    data: wa_777d type t777d.
    data: ls_index(4) type n.
    select-options: so_infty for t777d-infty.
    select-options: so_inft1 for t777d-infty no intervals.
    Initialization.
      so_infty-sign = 'I'.
      so_infty-option = 'BT'.
      so_infty-low = '0000'.
      so_infty-high = '9999'.
      append so_infty.
      select * from t777d into corresponding fields of table it_777d where infty in so_infty.
      loop at it_777d into wa_777d.
        so_inft1-sign = 'I'.
        so_inft1-option = 'EQ'.
        so_inft1-low = wa_777d-infty.
        append so_inft1.
      endloop.
    start-of-selection.
      CALL FUNCTION 'HR_INITIALIZE_BUFFER'
        EXPORTING
          TCLAS  = 'A'
          PERNR  = '40101017'
        EXCEPTIONS
          OTHERS = 1.
      Loop at so_inft1 where not low between '1000' and '8999'.
        REFRESH SELTAB.
        CLEAR   SELTAB.
        CALL FUNCTION 'HR_READ_INFOTYPE'
          EXPORTING
            TCLAS           = 'A'
            PERNR           = '40101017'
            INFTY           = so_INFT1-low
            BEGDA           = '19000101'
            ENDDA           = '99991231'
          IMPORTING
            SUBRC           = SUBRC
          TABLES
            INFTY_TAB       = SELTAB
          EXCEPTIONS
            INFTY_NOT_FOUND = 1
            OTHERS          = 2.
        if subrc eq 0.
          write:/ so_inft1-low, 'has been maintained for employee: ', '40101017'.
        endif.
      endloop.

  • ABAP dynamic tables add fields

    Hi, i have to extend a dynamic table like this:
    FIELD-SYMBOLS: <g_data> TYPE table.
    I have to build a custom structure with all the fields
    of g_data plus some other fixed fields.
    In other words if g_data looks like this
    AUFNR POSNR
    100   10
    200   20
    My structure must be:
    AUFNR POSNR F1  F2
    100   10    23  21
    200   20    234 32
    Thanks in advance.
    Is anybody here who haves some ideas

    Here is a sample program of how to build a dynamic internal table.
    report zrich_0003
           no standard page heading.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_check type c.
    selection-screen end of block b1.
    start-of-selection.
      perform build_dyn_itab.
      perform build_report.
      loop at <dyn_table> into <dyn_wa>.
        write:/ <dyn_wa>.
      endloop.
    *  Build_dyn_itab
    form build_dyn_itab.
      data: index(3) type c.
      data: new_table type ref to data,
            new_line  type ref to data,
            wa_it_fldcat type lvc_s_fcat.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname  = 'AUFNR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 12.
      append wa_it_fldcat to it_fldcat .
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname  = 'POSNR'.
      wa_it_fldcat-datatype = 'CHAR'.
      wa_it_fldcat-intlen = 6.
      append wa_it_fldcat to it_fldcat .
    * Create fields
      clear index.
      do 2 times.
        index = sy-index.
        clear wa_it_fldcat.
        concatenate 'Field' index into
                 wa_it_fldcat-fieldname .
        condense  wa_it_fldcat-fieldname no-gaps.
        wa_it_fldcat-datatype = 'CHAR'.
        wa_it_fldcat-intlen = 5.
        append wa_it_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    *      Form  build_report
    form build_report.
      data: fieldname(20) type c.
      data: fieldvalue(5) type c.
      data: index(3) type c.
      field-symbols: <fs1>.
      assign component  'AUFNR'  of structure <dyn_wa> to <fs1>.
      <fs1> =  '123456789'.
      assign component  'POSNR'  of structure <dyn_wa> to <fs1>.
      <fs1> =  '000001'.
      do 2 times.
        index = sy-index.
    * Set up fieldname
        concatenate 'FIELD' index into
                 fieldname .
        condense   fieldname  no-gaps.
    * Set up fieldvalue
        concatenate 'FLD' index into
                 fieldvalue.
        condense   fieldvalue no-gaps.
        assign component  fieldname  of structure <dyn_wa> to <fs1>.
        <fs1> =  fieldvalue.
      enddo.
    * Append to the dynamic internal table
      append <dyn_wa> to <dyn_table>.
    endform.
    Regards,
    Rich Heilman
    Message was edited by: Rich Heilman
    I have modified the sample to include your requirement

  • Update multiple rows in a dynamic table Dreamweaver CS5.5

    hello there
    i want to update multiple rows which comes from a dynamic table in Dreamweaver CS5 (a loop in php) here is my Mysql table :
    sql code
    CREATE TABLE `register`.`s_lessons` (
    `lid` int( 5 ) NOT NULL ,
    `sid` int( 9 ) NOT NULL ,
    `term` int( 5 ) NOT NULL ,
    `tid` int( 5 ) NOT NULL ,
    `point` double NOT NULL DEFAULT '0',
    PRIMARY KEY ( `lid` , `sid` , `term` ) ,
    KEY `tid` ( `tid` ) ,
    KEY `point` ( `point` )
    ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_persian_ci;
    and this is my page source code:
    php file
    <?php require_once('../Connections/register.php'); ?>
    <?php
    session_start();
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $colname1_rs1 = "-1";
    if (isset($_GET['term'])) {
      $colname1_rs1 = $_GET['term'];
    $colname_rs1 = "-1";
    if (isset($_GET['lid'])) {
      $colname_rs1 = $_GET['lid'];
    $colname2_rs1 = "-1";
    if (isset($_SESSION['tid'])) {
      $colname2_rs1 = $_SESSION['tid'];
    mysql_select_db($database_register, $register);
    $query_rs1 = sprintf("SELECT s_lessons.sid, s_lessons.lid, s_lessons.term, s_lessons.tid, s_lessons.point FROM s_lessons WHERE s_lessons.lid = %s AND s_lessons.term = %s AND s_lessons.tid  = %s", GetSQLValueString($colname_rs1, "int"),GetSQLValueString($colname1_rs1, "int"),GetSQLValueString($colname2_rs1, "int"));
    $rs1 = mysql_query($query_rs1, $register) or die(mysql_error());
    $row_rs1 = mysql_fetch_assoc($rs1);
    $totalRows_rs1 = mysql_num_rows($rs1);
    $count=mysql_num_rows($rs1);
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    for ($j = 0, $len = count($_POST['lid']); $j < $len; $j++) {
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE s_lessons SET point=%s WHERE tid=%s, lid=%s, sid=%s, term=%s",
                           GetSQLValueString($_POST['point'] [$j], "double"),
                                GetSQLValueString($_SESSION['tid'], "int"),
                           GetSQLValueString($_POST['lid'] [$j], "int"),
                                GetSQLValueString($_POST['sid'] [$j], "int"),
                                GetSQLValueString($_POST['term'] [$j], "int"));
      mysql_select_db($database_register, $register);
      $Result1 = mysql_query($updateSQL, $register) or die(mysql_error());
      $updateGoTo = "student_lists.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
      header(sprintf("Location: %s", $updateGoTo));
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>r</title>
    <link href="styles/style.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="styles/in_styles.css" rel="stylesheet" type="text/css" media="screen" />
    </head>
    <body>
    <div id="wrapper">
         <div id="header-wrapper">
         </div>
         <!-- end #header -->
         <div id="page">
              <div id="page-bgtop">
                   <div id="page-bgbtm">
                        <div id="content">
                             <div class="post">
                               <div style="clear: both;">
                            <form name="form1" id="form1" method="post" action="<?php echo $editFormAction; ?>">
                            <table border="1" align="center">
                              <tr>
                                <th>Student ID</th>
                                <th>Lesson ID</th>
                                <th>Semester</th>
                                <th>Point</th>
                              </tr>
                              <?php do { ?>
                                <tr>
                                  <td class="data"><label for="sid[]"></label>
                                  <input name="sid[]" type="text" id="sid[]" value="<?php echo $row_rs1['sid']; ?>" size="9" readonly="readonly" /></td>
                                  <td class="data"><label for="lid[]"></label>
                                  <input name="lid[]" type="text" id="lid[]" value="<?php echo $row_rs1['lid']; ?>" size="5" readonly="readonly" /></td>
                                  <td class="data"><label for="term[]"></label>
                                  <input name="term[]" type="text" id="term[]" value="<?php echo $row_rs1['term']; ?>" size="4" readonly="readonly" /></td>
                                  <td><label for="point[]"></label>
                                    <input name="point[]" type="text" id="point[]" value="<?php echo $row_rs1['point']; ?>" size="4" />                             
                              </tr>
                                <?php } while ($row_rs1 = mysql_fetch_assoc($rs1)); ?>
                            </table>
                            <p>
                              <input type="submit" name="Submit" id="Submit" value="Submit" />
                              <input type="hidden" name="MM_update" value="form1" />
                            </p>
                            </form>
                               </div>
                             </div>
                        <div style="clear: both;">
                    </div>
                        </div>
                        <!-- end #content -->
                        <!-- end #sidebar -->
                        <div style="clear: both;"> </div>
                   </div>
              </div>
         </div>
         <!-- end #page -->
    </div>
    <!-- end #footer -->
    </body>
    </html>
    <?php
    mysql_free_result($rs1);
    ?>
    All i want is that when users click on SUBMIT button values of point column in s_lessons(database table) be updated by new entries from user.
    i did my best and result with that code is :
    You  have an error in your SQL syntax; check the manual that corresponds to  your MySQL server version for the right syntax to use near ' lid=888,  sid=860935422, term=902' at line 1
    I would appreciate any idea.
    with prior thanks

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • Dynamic table with strange XML

    Probably I should write my problem before, instead of asking "part-questions".<br /><br />I have an XML like this:<br /><Root><br />  <Elem1 value="ss"><br />  <Elem2 value="ss2"><br />  <ElemInTable1 value="s" index="0"><br />  <ElemInTable2 value="s" index="0"><br />  <ElemInTable1 value="s" index="1"><br />  <ElemInTable2 value="s" index="1"><br /></Root><br /><br />Explanation: <br />Elements: <br />a) ElemX are normal fields. <br />b) ElemInTableX are elements which represent a table. All elements with the same attribute index are in the same row.<br /><br />I am trying to create a form which will allow me to have an dynamic table (adding and deleting rows), which will fill both attributes ('value' and 'index'). <br />I am out of ideas who to bind fields to textfields, or how to "repair" XML with javascript. Still something does not work correctly.

    Hello,<br />you have to change your XML to smth like this:<br /><br /><?xml version="1.0" encoding="iso-8859-1"?><br /><root>          <br />  <Elem1 value="ss"/> <br />  <Elem2 value="ss2"/> <br />  <table1><br />     <ElemInTable1 value="s" index="0"/> <br />     <ElemInTable1 value="s" index="1"/> <br />  </table1>     <br />  <br />  <table2><br />  <ElemInTable2 value="s" index="0"/>   <br />  <ElemInTable2 value="s" index="1"/> <br /></table2><br />     <br /></root><br /><br />and make this file as source for DataConnection.<br /><br />After that you will be able to bind tables and add instances.

  • Dynamic table in Run time

    Hi,
    I need to create a dynamic table in run time
    Input from user will be like
    Param1---->'tablename'
    Param2---->'col1name datatype,col2name datatype,col3name datatype,col4name datatype,col5name datatype,col6name datatype........................'
    Param3---->returnCode OUT NUMBER
    Param4---->errorMessage OUT VARCHAR2
    how to write a script to execute the above statement.
    The input will be from java page, it has connection string of the database
    Thanks!

    After remove *:*
    Error report:
    ORA-06550: line 4, column 6:
    PLS-00103: Encountered the symbol "CREATE_TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "CREATE_TABLE" to continue.
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Dynamic Table Width for XML Renderer

    Hi Guys,
    I'm looking for a way to get a XML documents with a dynamic table width.
    Using a dynamic result table doesn't work.
    The test program looks like this.
    REPORT  xml_test.
    TYPE-POOLS: ixml.
    DATA: go_ixml TYPE REF TO if_ixml.
    go_ixml = cl_ixml=>create( ).
    DATA:  go_xml_document TYPE REF TO if_ixml_document.
    go_xml_document = go_ixml->create_document( ).
    DATA: go_xml_root_elm TYPE REF TO if_ixml_element.
    go_xml_root_elm  = go_xml_document->create_simple_element(
               name = 'flights'
             parent = go_xml_document
             value  = 'Texas Flight' ).
    DATA: go_xml_main_elm TYPE REF TO if_ixml_element.
    go_xml_main_elm  = go_xml_document->create_simple_element(
                  name = 'airline'
                parent = go_xml_root_elm  ).
    DATA: lv_rc TYPE i.
    lv_rc = go_xml_main_elm->set_attribute( name = 'code' value = 'LH401' ).
    DATA: go_xml_streamfactory TYPE REF TO if_ixml_stream_factory.
    go_xml_streamfactory = go_ixml->create_stream_factory( ).
    * Static Creation of X tab ---------------------------------------------
    DATA: BEGIN OF gs_xml_line,
             data(255) TYPE x,
           END OF gs_xml_line.
    DATA:  gt_xml_table       LIKE TABLE OF gs_xml_line,
           gv_xml_size        TYPE i,
           go_ostream         TYPE REF TO if_ixml_ostream.
    * END Static Creation of X tab ------------------------------------------
    * Dynamic Creation of X tab ---------------------------------------------
    FIELD-SYMBOLS: <lf_x_tab>  TYPE STANDARD TABLE,
                   <lf_x_stru> TYPE ANY.
    DATA: lt_fldcat TYPE lvc_t_fcat.
    DATA: lr_tab TYPE REF TO data,
          lr_stru  TYPE REF TO data,
          ls_fldcat TYPE lvc_s_fcat,
          lv_dyn_width TYPE i.
    lv_dyn_width = 255.
    * Append Dynamic Field.
    CLEAR ls_fldcat.
    ls_fldcat-fieldname = 'DATA' .
    ls_fldcat-datatype  = 'X'.
    ls_fldcat-inttype   = 'X'.
    ls_fldcat-intlen    = lv_dyn_width.
    APPEND ls_fldcat TO lt_fldcat .
    * Create dynamic internal table and assign to FS
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = lt_fldcat
      IMPORTING
        ep_table        = lr_tab.
    ASSIGN lr_tab->* TO <lf_x_tab>.
    * Create dynamic work area and assign to FS
    CREATE DATA lr_stru LIKE LINE OF <lf_x_tab>.
    ASSIGN lr_stru->* TO <lf_x_stru>.
    CHECK sy-subrc  = 0.
    * END Dynamic Creation of X tab ------------------------------------------
    * Static Table works
    go_ostream = go_xml_streamfactory->create_ostream_itable( table = gt_xml_table ).
    * Dynamic Table doesn't work
    go_ostream = go_xml_streamfactory->create_ostream_itable( table = <lf_x_tab> ).
    * Show result
    DATA: go_renderer        TYPE REF TO if_ixml_renderer.
    go_renderer = go_ixml->create_renderer( ostream  = go_ostream
                                            document = go_xml_document ).
    lv_rc = go_renderer->render( ).
    gv_xml_size = go_ostream->get_num_written_raw( ).
    DATA: lv_str  TYPE string,
          lv_xstr TYPE xstring.
    LOOP AT gt_xml_table INTO gs_xml_line.
      lv_xstr = gs_xml_line-data.
      CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
        EXPORTING
    *                          FROM_CODEPAGE       = '8500'
          in_xstring          = lv_xstr
    *                          OUT_LEN             =
       IMPORTING
         out_string          = lv_str.
      WRITE: / lv_str.
    ENDLOOP.
    If the static table is used, the program gets a result, but it doesn't work with the dynamic table.
    * Static Table works
    go_ostream = go_xml_streamfactory->create_ostream_itable( table = gt_xml_table ).
    * Dynamic Table doesn't work
    go_ostream = go_xml_streamfactory->create_ostream_itable( table = <lf_x_tab> ).
    Any Ideas?
    Thanks in advance
    Dominik

    I've never used dynamically changing popup items variable before, and I'm not sure it will work(?)
    But, if it's displaying a long string, it does not sound like 'items' is being assigned a proper table yet.
    I don't know what you mean by a  "chunk" of values. I assume you mean table.
    In any case, if SYPNEventResults[1].title is a string, then SYPNEventResults[1].value can be any legal lua type.
    Likewise for SYPNEventResults[2], SYPNEventResults[3], ...
    If you can index/display the title with this syntax, e.g. LrDialogs.message( SYPNEventResults[1].title ), then the popup should be initialized thusly:
    viewFactory:popup_menu {
           items = SYPNEventResults,
           value = LrView.bind('eventname2'),
           width_in_chars = 40,
    if a function is returning multiple values, then to get it into a table "array", do this:
    local tableArray = { myTableArrayFunc( myTableArrayParameters ) }
    Does this help?
    Rob

  • Dynamic table with field type table

    Hi,
    I´m using "cl_alv_table_create=>create_dynamic_table" to create a dynamic table for ALV Grid.
    But...I need to use colors in ALV, then I need to declare a field type LVC_S_SCOL in dynamic table from "cl_alv_table_create=>create_dynamic_table".
    How can I declare this in fieldcat?
    The code:
    Creating dynamic table
    DATA: table_agrup TYPE REF TO data,
            line_agrup  TYPE REF TO data.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fieldcat
        IMPORTING
          ep_table                  = table_agrup
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
        ASSIGN table_agrup->* TO .
    Printing ALV
      CALL METHOD obj_grid->set_table_for_first_display
        EXPORTING
          is_variant                    = w_variant
          i_save                        = 'A'
          is_layout                     = w_layout
        CHANGING
          it_outtab                     =
          it_fieldcatalog               = t_fieldcat
          it_sort                       = t_sort
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
    Thanks.

    It is not possible with the  METHOD cl_alv_table_create=>create_dynamic_table to include another table inside that newly generated table.
    I have tried to do it with the code and I got the dynamic table created after at the end of the program.
    In the code,
    <DYN_TABLE> has same effect as your <table> variable
    <DYN_WA> has same effect as your <HEADER>
    REPORT  ZTEST_NP_DYNAMIC.
    DATA: DY_TABLE TYPE REF TO DATA,
          DY_LINE  TYPE REF TO DATA.
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
                   <DYN_WA>,
                   <DYN_FIELD>.
    FIELD-SYMBOLS: <FS> TYPE ANY.
    * To generate the Dyanmic table with the COLOR
    DATA: LS_SOURCE TYPE STRING.
    DATA: LT_SOURCE LIKE STANDARD TABLE OF LS_SOURCE WITH HEADER LINE.
    DATA: L_NAME LIKE SY-REPID.
    DATA: L_MESSAGE(240) TYPE C,
          L_LINE TYPE I,
          L_WORD(72) TYPE C.
    DATA: L_FORM(30) TYPE C VALUE 'TABLE_CREATE'.
    LT_SOURCE = 'REPORT ZTEST_SUBROUTINE_POOL.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'FORM  TABLE_CREATE USING I_FS TYPE ANY.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BEGIN OF LT_GENTAB OCCURS 0.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BUKRS TYPE BUKRS. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: BKTXT TYPE BKTXT. '.
    APPEND LT_SOURCE.
    * you can add your fields here.....
    LT_SOURCE = 'DATA: COLOR TYPE lvc_t_scol. '.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: END OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'DATA: POINTER TYPE REF TO DATA.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'CREATE DATA POINTER LIKE STANDARD TABLE OF LT_GENTAB.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'I_FS = POINTER.'.
    APPEND LT_SOURCE.
    LT_SOURCE = 'ENDFORM. '.
    APPEND LT_SOURCE.
    L_NAME = 'ZTEST_SUBROUTINE_POOL'.
    CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
      GENERATE SUBROUTINE POOL LT_SOURCE NAME L_NAME
               MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.  "#EC CI_GENERATE
    ENDCATCH.
    IF NOT L_MESSAGE IS INITIAL.
      MESSAGE E000(0K) WITH L_MESSAGE L_LINE L_WORD.
    ENDIF.
    ASSIGN DY_TABLE TO <FS>.
    PERFORM (L_FORM) IN PROGRAM (L_NAME) USING <FS>.
    ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    * Create dynamic work area and assign to FS
    CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>.
    ASSIGN DY_LINE->* TO <DYN_WA>.
    Write: 'bye'.
    Regards,
    Naimesh Patel

Maybe you are looking for

  • About ERROR ITMS-3000

    Hello, I am going to upload my Accessory Application, but have encountered some problems when submitting. Followings are the error message: Apple's web service operation was not successful Unable to authenticate the package: 123456-7890.itmsp ERROR I

  • Loading data from SAP Business One to BW

    We need to load data from several SAP Business One databases to BW. I find some special objects for SAP Business One in the Business Content And a short description in Help: The source for the data upload is a file system. The relevant files can be g

  • Printing in reader

    In Windows 7 I have installed my printer twice, once with the default tray 2 (white paper) and once with default tray 3 (for color paper). So when I select a printer, it will print eighter on white or color paper. But this doesn't work for Adobe Read

  • How Text Messages Are Stored on Palm Centro and possible recovery

    I come from an extensive IT and programming background with emphasise on databases.  I need some high level understanding of the text messaging system on a Plam Centro system with ATT. Questions are related to Recoverying Deleted Text Messages 1.  Do

  • Urgent!!How to restart a database

    Hi, I need to restart a database and i'm afraid if i miss any step ay my senior is not around. Pls correct me if i'm wrong ya.Following are the steps:- 1) stop the litsener by lscrctl stop 2) connect to sqlplus as sysdba and shutdown immediate. 3) th