Need Help in Field Symbol for Dynamically passing  table field value

Hi All,
In my internal table I am having data.
I am dynamically forming table field name and substitute for the another table field name to pass DATA.
but I am getting the Variable name insted of Value ie Data.
I am using Field Symbol for this.
data:
Field-symbols <TS> type any.
field1 type string.
LOOP AT TABLEFIELDS INTO WA_TABLEFIELDS.
            READ TABLE  TEST  WITH KEY NAME = WA_TABLEFIELDS-FIELDNAME.
            IF SY-SUBRC = 0.
              CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO  Field1.
              Assign Field1 to <TS>.
                ALL_VAL-VALUE = <TS>
"After substituting the <TS>  into ALL_VAL-VALUE  field I need a DATA to be passed but the variable name is appending"*    
         APPEND ALL_VAL.
            ENDIF.
          ENDLOOP.
kindly how to pass the value into the table.
Thanks in advance.
San

Hi,
pls assign a break point in
CONCATENATE 'WA_' WA_TABLEFIELDS-TABNAME '-' WA_TABLEFIELDS-FIELDNAME INTO Field1.
Assign Field1 to <TS>.
ALL_VAL-VALUE = <TS>
   " Put a break point here and check for the value in <TS>.
if <TS> contains value then create a work area for ALL_VAL AND PASS the Field-Symbol to that and then  append thw wa into the table...
Hope this works out!!
thanks

Similar Messages

  • Are field symbols and Dynamic internal tables consistant?

    Hi,
    Are field symbols and Dynamic internal tables
    always consistent?
    In my program I m creating a dynamic itab and assignig values to it using <FS>, sometimes the program fails to execute assign <Fs> statement...
    this happens once in 3 to 4 runs
    any solution...
    I have proper clear and refresh statements in program.
    Thanks,
    Hardik

    Anurag,
    Thanks for a quick reply. Here I am sending a small piece of my code.
    MOVE-CORRESPONDING OUTTAB TO DYNTAB.
          CLEAR IT_UDATE.
          CLEAR : T_KBETR .
          READ TABLE IT_UDATE WITH KEY UDATE = OUTTAB-UDATE.
          CONCATENATE 'DYNTAB-KBETR' IT_UDATE-CO_POS INTO T_KBETR.
          ASSIGN (T_KBETR) TO <FS> .
          SUBRC5 = SY-SUBRC .
          IF SUBRC5 = 0 .
              <FS> =  OUTTAB-KBETR .
          ENDIF .
    read statement will always return CO_POS .
    while debuging this code a few times
    <b>ASSIGN (T_KBETR) TO <FS> .</b>
    returns sy-subrc = 4
    and that was leading the program to short dump earlier.
    now, as I have a check DYNTAB-KBETR holds no value on display.
    this happens very few times. (most of the times report is displaying desired output)
    Thanks,
    Hardik

  • 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.

  • Building Field-Catalog for dynamic internal tables

    Hi All,
    I  created a dynamic internal table(<fs_final>,<fs_final_line>)  and populated data into it.Now I want to provide field catalog to these dynamic internal table.
    Can anyone suggest me the how to create a field catalog for existing dynamic internal table.Thanks in advance.
    Regards,
    Chakradhar.
    Moderator message - Please use proper subject line in future.
    Message was edited by: Suhas Saha

    Use this code to get all components of internal table.
    Then build fieldcatlog.
    DATA: tab_return type abap_compdescr_tab,
              components like line of tab_return.
    perform get_int_table_fields using    <fs_it> changing  tab_return.
    loop at tab_return into components.
      wa_fldcat-fieldname  = components-name.               "Field Name
      wa_fldcat-scrtext_m  = components-name.              "Column Heading
      wa_fldcat-inttype    = components-type_kind.     "Data Type
      wa_fldcat-intlen      = components-length.          "Data Lenght
      wa_fldcat-decimals = components-decimals.     "Data Decimal Places
    append wa_fldcat to it_fldcat.
    endloop.
    form get_int_table_fields  using    t_data type any table
                                changing t_return type abap_compdescr_tab.
       data:
       oref_table type ref to cl_abap_tabledescr,
       oref_struc type ref to cl_abap_structdescr,
       oref_error type ref to cx_root,
       text type string.
    *Get the description of data object type
       try.
           oref_table ?=
           cl_abap_tabledescr=>describe_by_data( t_data ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
    *Get the line type
       try.
           oref_struc ?= oref_table->get_table_line_type( ).
         catch cx_root into oref_error.
           text = oref_error->get_text( ).
           write: / text.
           exit.
       endtry.
       append lines of oref_struc->components to t_return.
    endform.
    Regards
    Sreekanth

  • Field Texts for Dynamic Internal Tables

    Hi All,
    I want to know whether there is any way to get the field Headings (Not the field names)
    Below is my CODE
    For ex :
    CLASS lvl_met DEFINITION.
       PUBLIC SECTION.
         METHODS : l_met IMPORTING m_itab TYPE STANDARD TABLE.
    ENDCLASS.
    CLASS lvl_met IMPLEMENTATION.
    METHOD l_met.
    data : l_t_fields TYPE abap_compdescr_tab." WITH HEADER LINE.
    field-symbols:
        <p_data>      type any,
        <p_field>     type any,
        <p_component> type abap_compdescr.
    CREATE DATA MY_WA LIKE LINE OF m_itab.
    ASSIGN MY_WA->* TO <P_DATA>.
    DESC_STRUC ?= CL_ABAP_TYPEDESCR=>DESCRIBE_BY_DATA( <P_DATA> ).
    *I want the field Headings(Field Text) - In this case i want some thing like Material Number and Plant
    I can read this texts if i know atleast the data element
    At this point i see <p_data> in degbug mode under absolute type column i see \TYPE=WERKS_D aganst werks field
    I don't know how to capture the \TYPE=WERKS_D this thing so atleast i can read field Text based on Data Element
    Is there any other way to find out the field text
    ENDCLASS.
    TABLES : marc.
    DATA : l_met TYPE REF TO lcl_met.
    types : BEGIN OF t_itab,
      matnr like marc-matnr,
      werks like marc-werks,
      end of t_itab.
    data  : itab type table of t_itab.
    START-OF-SELECTION.
      IF l_met IS INITIAL.
        CREATE OBJECT l_met.
      ENDIF.
    select matnr werks from marc into TABLE itab up to 10 rows.
    l_met->get_headertext( EXPORTING m_itab = itab ).
    Thanks
    David

    Hi  Naimesh,
    I tried exactly what you said
    lt_comp = desc_struc->get_components( ). "Get the fields of the structure
    loop at lt_comp into ls_comp.
    lo_elem_desc ?= cl_abap_elemdescr=>describe_by_name( ls_comp-name ).
    lf_dfies = lo_elem_desc->get_ddic_field( ).
    WRITE: / lf_dfies-scrtext_s,
           / lf_dfies-scrtext_m,
           / lf_dfies-scrtext_l.
    WRITE:/ ls_comp-name. " Write the column names
    endloop.
    It Works fine for Matnr because field name and data element are same but when it comes to werks it gives me a dump because the date element is different werks_d
    I just tried hard coding werks_d and it works fine
    lo_elem_desc ?= cl_abap_elemdescr=>describe_by_name( 'WERKS_D' ).
    lf_dfies = lo_elem_desc->get_ddic_field( ).
    WRITE: / lf_dfies-scrtext_s,
           / lf_dfies-scrtext_m,
           / lf_dfies-scrtext_l.
    Let me know how
    Thanks
    David
    Edited by: DAVID KITSO on Nov 23, 2009 10:09 PM

  • I am stuck in FIELD-SYMBOLS and dynamic tables.

    Hi guys,
                I am trying to create dynamic table. My requirement is as follows--
    I have to display grid layout report in depending on given input.
    In input i have fields for DC and STORE.
    In output i have to display columns depending on number of DC and STORE paased in input.
    For example if in input, i have 2 DCs DC01 and DC02 and in STs i have say 1 input - ST01
    then in outpt grid report there will be 3 columns.
    So my columns to be displayed depends on number of input values given while running it.
    I am trying to use dynamic table.
    My output report contains fields from different table...so i cant use
    FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE
    instead i m trying to use
    FIELD-SYMBOLS: <DYN_TABLE> LIKE T_ARTMAS  "T_ARTMAS is declared as types : begin of....end of .... .
    but it is giviing an error in following form
    FORM CREATE_DYNAMIC_ITAB.
    Create dynamic internal table and assign to FS
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = IFC
        IMPORTING
          EP_TABLE        = DY_TABLE.
      ASSIGN DY_TABLE->* TO <DYN_TABLE>.
    Create dynamic work area and assign to FS
      CREATE DATA DY_LINE LIKE LINE OF <DYN_TABLE>........error on this line.
      ASSIGN DY_LINE->* TO <DYN_WA>.
    ENDFORM.                    "create_dynamic_itab
    saying "<DYN_TABLE>" is not an internal table - the "OCCURS n" specification is missing.          
    Kindly help me...
    thx in advance...

    Hi
    .FIELD-SYMBOLS: <DYN_TABLE> LIKE T_ARTMAS "T_ARTMAS is declared as types : begin of....end of .... .
    but it is giviing an error in following form.....
    Just as Sasha wrote, the problem could be you've defined a flat structure and u need a table, but now just a little a question: why do u want to use a dynamic table but your field-symbol is like a certain type?
    That means u know how the table is so u don't need to use a dynamic table, your issue seems not to make sense.
    Max

  • Need help in developing BADI for IT0001

    Hi All,
    I need help in developing BADI for IT0001.
    On IT0001 create or change, there is need to update IT0017 with following data from IT0001
    -Company Code
    -Cost center
    -Business Area
    -Begin and End Date.
    Other fields from IT0017 need to be derived from Position and update in IT0017.
    Please guide me how I can address this. I do not want to go for dynamic action, as it is not getting evoked during background jobs.
    I am new to BADI development and will appreciate step by step instructions.
    Thanks

    Hi,
         follow the below steps to achive
    Steps:
    1.     Execute Business Add-In(BADI) transaction SE18
    2.     Enter BADI name i.e. HRPAD00INFTY and press the display
            button
    3.     Select menu option Implementation->Create
    4.     Give implementation a name such as Z_HRPAD00INFTY
    5.      You can now make any changes you require to the BADI within this
            implementation, for example choose the Interface tab there are 3 methods avialble
    6.     Double click on the method you want to change, you can now enter
            any code you require.
    7.      Please note to find out what import and export parameters a
            method has got return the original BADI definition
            (i.e. HRPAD00INFTY) and double click on the method name
            for example within HRPAD00INFTY contract is a method
    8.      When changes have been made activate the implementation
    <b>Reward points</b>
    Regards

  • Coloring of Particular Cells in a dynamic internal table(field symbols)

    Hi,
         I have a requirement to introduce color into some particular cells in a dynamic internal table(Field symbol) based on some conditions.I know that color can be introduced at cell level in the case of static internal table.But, can anybody tell me whether it is possible to introduce color to particular cells in the dynamic internal table(Field Symbol) .Please suggest me on this issue.
    Thanks in advance,
    Rajesh

    Hi,
    This is the sample coding for the colour cell report.
    Kindly go through it. It will helps u.
    REPORT YMS_COLOURTEST .
    DATA: BEGIN OF TP OCCURS 10, ID, NR(8), TEXT(255), END OF TP.
    DATA: LENGTH TYPE I VALUE 8, " Length of list
    TESTSTRING(15) TYPE C VALUE '012345678901234',
    WIDTH TYPE I. " Width of list
    DATA: TXT_REPORT LIKE DOKHL-OBJECT.
    START-OF-SELECTION.
    PERFORM HEADING.
    PERFORM OUTPUT_BODY.
    FORM HEADING.
    FORMAT INTENSIFIED OFF. " Remove any INTENSIFIED
    ULINE AT (WIDTH). " Upper frame border
    FORMAT COLOR COL_HEADING INTENSIFIED." Title color
    WRITE: / SY-VLINE. " Left border
    WRITE: 'No |Colour |intensified |intensified off|',
    'inverse' NO-GAP.
    WRITE: AT WIDTH SY-VLINE. " Right border
    ULINE AT (WIDTH). " Line below titles
    FORMAT COLOR OFF.
    ENDFORM.
    FORM OUTPUT_BODY.
    DO LENGTH TIMES.
    PERFORM WRITE_LINE USING SY-INDEX.
    ENDDO.
    ENDFORM.
    FORM WRITE_LINE USING COUNT TYPE I.
    DATA: HELP(14) TYPE C,
    COUNT1 TYPE I.
    COUNT1 = SY-INDEX - 1.
    WRITE: / SY-VLINE NO-GAP.
    WRITE: (4) COUNT1 COLOR COL_KEY INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    CASE COUNT1.
    WHEN '0'.
    HELP = 'COL_BACKGROUND'.
    WHEN '1'.
    HELP = 'COL_HEADING'.
    WHEN '2'.
    HELP = 'COL_NORMAL'.
    WHEN '3'.
    HELP = 'COL_TOTAL'.
    WHEN '4'.
    HELP = 'COL_KEY'.
    WHEN '5'.
    HELP = 'COL_POSITIVE'.
    WHEN '6'.
    HELP = 'COL_NEGATIVE'.
    WHEN '7'.
    HELP = 'COL_GROUP'.
    ENDCASE.
    WRITE: HELP COLOR COL_KEY INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INTENSIFIED OFF NO-GAP.
    WRITE: SY-VLINE NO-GAP.
    WRITE: TESTSTRING COLOR = COUNT1 INVERSE NO-GAP.
    WRITE AT WIDTH SY-VLINE NO-GAP.
    ENDFORM.
    Thanks,
    Shankar

  • Build field catalog for dynamic data objects

    Hi
    Could you please tell me how to build a field catalog (ooops alv)  for an internal table which is a dynamic data object.
      TYPES: BEGIN OF t_addsubty,
             subty TYPE subty,
             pernr TYPE persno,
             END OF t_addsubty.
      TYPES: ty_addsubty type t_addsubty occurs 1.
    i have data object using these
            CREATE DATA dref3 TYPE (g_type1).
            ASSIGN dref3->* TO <fs_dp>.
    where g_type1 refers a data type which i defined in the program. g_type1 = ty_addsubty. 
    now <fs_dp> refers to an internal table.
    now i want to build a field catalog for this internal table.
    In my program <fs_dp> structure is not always the same. i.e now it is ty_addsubty but for some other conditions the structure is different.
    please help me out.
    regards
    badri

    Here some piece of code, which shows how it works:
    <SNIP>
    type-pools:
         abap.
    DATA:
      lr_tabledescr          TYPE REF TO cl_abap_tabledescr,
      lr_structdescr     TYPE REF TO cl_abap_structdescr.
    field-symbols:
      <lw_component>     type abap_compdescr_tab.
    TYPES:
         BEGIN OF t_addsubty,
              subty TYPE subty,
              pernr TYPE persno,
         END OF t_addsubty.
    TYPES:
         ty_addsubty type t_addsubty occurs 1.
    CREATE DATA dref3 TYPE (g_type1).
    ASSIGN dref3->* TO <fs_dp>.
    lr_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <fs_dp> ).
    assert condition lr_tabledescr is bound.
    lr_structdescr ?= lr_tabledescr->get_table_line_type( ).
    loop at lr_structdescr->components assigning <lw_component>.
    *     do whatever you want with the information about
    *     the components of the structure
    endloop.
    </SNIP>
    Do not forget to reward points...

  • How to use field symbols in dynamic select query

    I have a requirement to take the table name from selection screen and get data from that table 
      SELECT * FROM (P_TBLNM)
      INTO TABLE  <ITAB>
      WHERE <condition>.
    I have declared field symbol as type any table , but i am getting dump saying fieldsymbol is not getting assigned .
    Any pointers , please help.

    Hi laxmi,
    for your second question, try this one:
    DATA : ref_table_des TYPE REF TO cl_abap_structdescr,
    <itab> TYPE STANDARD TABLE,
    <wtab> TYPE ANY,
    dref TYPE REF TO DATA.
    DATA: <knumh>.
    ref_table_des ?= cl_abap_typedescr=>describe_by_name( P_TBLNM ).
    create data dref type handle ref_table_des.
    assign dref->* to <wtab>.
    create data dref like standard table of <wtab>.
    assign dref->* to <itab>.
    SELECT * FROM (P_TBLNM)
    INTO TABLE <itab>
    WHERE <condition>.
    LOOP AT <itab> ASSIGNING <wtab>.
    assign component 'KNUMH' of structure <wtab> to <knumh>.
    SELECT * FROM KONP
    APPENDING TABLE GI_KONP
    WHERE KNUMH = <knumh>.
    ENDLOOP.
    Regards,
    Richard
    Edited by: richard santos on Nov 17, 2009 8:16 AM

  • Field symbols for fetching ME51N screen data

    Hi,
    I need to fetch ME51N or ME52N screen data.
    In old Transaction (ME51,ME52) there is this code that work:
    data:wa_eban like eban.
    data:wa_rm06b like rm06b.
    data:va_epstp like rm06b-epstp.
    data:va_knttp like eban-knttp.
    field-symbols <va_eban> structure eban default  wa_eban.
    field-symbols <va_rm06b> structure rm06b default wa_rm06b.
    assign ('(SAPMM06B)EBAN') to <va_eban>.
    assign ('(SAPMM06B)RM06B')  to <va_rm06b>.
    move <va_rm06b>-epstp to va_epstp.
    move <va_eban>-knttp to va_knttp.
    if not <va_eban>-loekz  is initial.
          exit.
    endif.
    This code is used in a FIELD EXIT for compare Data in some Fields.
    In the New Transaction i can't use this code because EBAN and RM06B is empty and return null.
    Can any one tell me if there are Program/Structure combination that return EBAN and RM06B Data?
    Or alternatively whether any better method available for fetching screen data?
    Thanks & Regards
    Angelo

    For more Info see this thread, similar problem is solved, but in ME52N change some things.
    Re: Field symbols for fetching ME21N screen data
    Thanks & Regards
    Angelo

  • Field symbols for tables used under tables tabstrip in bapi

    Hi all,
    I am created a bapi and under tables tabstrip i have given  3 tables,
    Inside the bapi , i have written a perform statement which returns these 3 tables .
    PERFORM bapi_sales TABLES it_valid it_error it_errorc USING testrun.
    how can we create field symbols for these tables ?
    Regards
    Nagarah

    hi,
    goto: system-utilities- debug system
    A.
    Message was edited by: Andreas Mann

  • I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

    I need help scrolling and highlighting for a vast amount of pics that I'm trying to transfer. I have a macbook pro osx 10.5.8

  • I still need help with the Dictionary for my Nokia...

    I still need help with the Dictionary for my Nokia 6680...
    Here's the error message I get when trying to open dictionary...
    "Dictionary word information missing. Install word database."
    Can someone please provide me a link the where I could download this dictionary for free?
    Thanks!
    DON'T HIT KIDS... THEY HAVE GUNS NOW.

    oops, im sorry, i didnt realised i've already submitted it
    DON'T HIT KIDS... THEY HAVE GUNS NOW.

  • To create a deep structure for dynamic internal table.

    Hello
    My ALV has fields which are defined dynamically during execution.
    so, i did it in the following way,
    Declared Field symbolds, DREF and fieldcatalog as,
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
                  <fs_dyntable>.
    DATA:   dref_dyntab    TYPE REF TO data,
            dref_dynwa     TYPE REF TO data.
    DATA: ts_fieldcatalog TYPE lvc_t_fcat.
    DATA: wa_fieldcatalog TYPE lvc_s_fcat.
    Updated Fieldcatalog dynamically as,
    *function module to read segment structure
        CALL FUNCTION 'SEGMENT_READ'
          EXPORTING
            segmenttyp           = v_segment_name
          TABLES
            segmentstructure     = ts_seg_structure
          EXCEPTIONS
            no_authority         = 1
            segment_not_existing = 2
            OTHERS               = 3.
        IF sy-subrc <> 0.
          CASE sy-subrc.
            WHEN '1'.
              MESSAGE e024.
              STOP.
            WHEN '2'.
              MESSAGE e025 WITH v_segment_name.
              STOP.
            WHEN OTHERS.
              MESSAGE e023.
          ENDCASE.
        ENDIF.
    *FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
    EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
        LOOP AT ts_seg_structure INTO wa_seg_structure.
          ADD 1 TO v_counter.
          wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
          wa_fieldcatalog-col_pos   = v_counter.
          wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
          APPEND wa_fieldcatalog TO ts_fieldcatalog.
          CLEAR wa_fieldcatalog.
        ENDLOOP.
    and generated dynamic internal table using fieldcatalog as,
    *--Method to get the structure of table using fieldcatalog.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ts_fieldcatalog
        IMPORTING
    *--Variable of type REF TO DATA.
          ep_table        = dref_dyntab.
      IF sy-subrc <> 0.
        MESSAGE e023.
      ENDIF.
    *--Dynamic internal tables required when show segments selected
      IF p_selseg IS NOT INITIAL.
        ASSIGN dref_dyntab->* TO <t_dyntable>.
    *--Create dynamic work area and assign to FS
      CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
        ASSIGN dref_dynwa->* TO <fs_dyntable>.
    And then i populated this <t_dyntable> which is being passed as data-table to method
    CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
    for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
    Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
    As you might be aware, we need a field
            TS_STYLEROW  TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
    in the output internal table <t_dyntable> to meet our requirement.
    My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
    I tried in the following way by adding one such field to fieldcatalog :
    *Field for Styling
      ADD 1 TO v_counter.
      wa_fieldcatalog-fieldname   = 'TS_STYLEROW'.
      wa_fieldcatalog-tabname     = 'TS_STYLE'.
      wa_fieldcatalog-col_pos     = v_counter.
      wa_fieldcatalog-no_out      = 'X'.
      wa_fieldcatalog-inttype     = 'h'.      " I even mentioned this
      APPEND wa_fieldcatalog TO ts_fieldcatalog.
      CLEAR  wa_fieldcatalog.
    But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
    Guyz and respected,
    Please advice me with the solution or ur ideas....
    Note : The overall requirement is create a deep structure for dynamically generated internal table.
    Your help is highly appreciated and unforgettable..!!!!!!!

    hi,
    Dynamic append
    Dynamic internal table
    Dynamic internal table
    dynamic columns in ALV
    Variant for dynamic selection
    thanks

Maybe you are looking for