Declare dynamic internal table during runtime error

Hi Gurus,
I have encounter a problem here. I would like to have several block of alv list output; for each customer open items details. Thus, i need to create dynamic internal table duirng runtime as i do not know how many customers that should be output before user enter from the selection screen field for customer code.
I tried to search in the forums and found this website [Runtime Declaration of Internal Table;.
But when i tried to execute it, i have an error. The field symbols that i passed into the call function REUSE_ALV_BLOCK_LIST_APPEND for parameter t_outtab does not match. May i know how do i go about it?
Or are there any other solutions to display this kind of reports? I ever think of using hierarchy list alv. But it does not match the requirement. I would like to display the total amount for each customer. Can hierarchy list able to do so? Or it can only display as the grand total at the end of the report? I think it would be best to display as alv block output.
Your help will be much appreciated. <offer removed by moderator>
Thanks
Edited by: Thomas Zloch on Oct 22, 2010 11:23 AM

the problem comes up, when there are fields in the table which represent numbers with decimals (type p). Best is to reference the field directly what comes from SAP. Replace the LOOP At idetails ... ENDLOOP with:
LOOP AT idetails INTO xdetails.
    CLEAR xfc.
    xfc-fieldname = xfc-ref_field = xdetails-name .
    xfc-ref_table   = p_table.
*    xfc-datatype = xdetails-type_kind.
*    xfc-inttype = xdetails-type_kind.
*    xfc-intlen = xdetails-length.
*    xfc-decimals = xdetails-decimals.
    APPEND xfc TO ifc.
  ENDLOOP.

Similar Messages

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

  • Xml to abap internal table by using a dynamic internal table at runtime

    Hi ,
          I have a requirement to convert xml to abap internal table . But the requirement is that i need to create internal table according to the XML .
    Ex : If my XML is :
    <?xml version="1.0" ?>
    - <flights>
    - <airline code="AA" name="American Airlines">
    - <flight number="0017">
      <from airport="JFK">NEW YORK,US</from>
      <to airport="SFO">SAN FRANCISCO,US</to>
      <departure>110000</departure>
      <arrival>140100</arrival>
      <type>Scheduled</type>
      </flight>
    - <flight number="0064">
      <from airport="SFO">SAN FRANCISCO,US</from>
      <to airport="JFK">NEW YORK,US</to>
      <departure>090000</departure>
      <arrival>172100</arrival>
      <type>Scheduled</type>
      </flight>
      </airline>
    So after conversion my abap internal table shoul have fields as :
    airline_code     Name      flight_number   from_airport    to_airport      departure         arrival      type
    and the field values should be corresponding field values .
    Thanks in advance .
    Regards .

    Hi Ujjwal,
    use
    CALL TRANSFORMATION
    Study the online documentation and if required do some search for CALL TRANSFORMATION and/or XML PARSER
    And, when coming back here with next question, tell us what searches you did with what results - please always follow the 'search before post' rule, thank you.
    Regards,
    Clemens

  • Error while creating a dynamic internal table refers to custom field

    Hi all,
    I am getting the exception TYPE_NOT_FOUND when I try to create a dynamic internal table using:-
    DATA: gr_desc TYPE REF TO cl_abap_typedescr.
    gr_desc = cl_abap_typedescr=>describe_by_name( p_field ).
    The field p_field is a Z-field inside a DB table, (e.g. a user added field in MARA). The statement fails at that point and gives a runtime exception. Any suggestions to how I may solve this problem? Or any alternatives for the same? I guess we face this issue for all custom fields..has SAP released a note for this??
    Thanks..

    that's just the wrong method, you should use DESCRIBE_BY_DATA
    gr_desc = cl_abap_typedescr=>describe_by_data( p_field ).
    Note: DESCRIBE_BY_NAME is to be used for referencing a DDIC type by its name. Example:
    gr_desc = cl_abap_typedescr=>describe_by_name( 'MARA-ZZFIELD' ).

  • Error while creating dynamic internal table.

    Hello Expert,
    While creating a dynamic internal table, it throw an run time error as :
    " LOAD PROGRAM NOT FOUND
      CX_SY_PROGRAM_NOT_FOUND"
    i tried to debug the program, it found this error comes while calling
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    please anyone help me out to resolve this problem.
    what could be the reason of error? and how to avoid it?
    <REMOVED BY MODERATOR>
    thanks in advance.
    ~ shweta.
    Edited by: Alvaro Tejada Galindo on Feb 28, 2008 2:41 PM

    Hi,
    Go through this program.
    Report z_dynamic.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table,
    <dyn_wa>,
    <dyn_field>.
    data: dy_table type ref to data,
    dy_line type ref to data,
    xfc type lvc_s_fcat,
    ifc type lvc_t_fcat.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'T001'.
    selection-screen end of block b1.
    start-of-selection.
    perform get_structure.
    perform create_dynamic_itab.
    perform get_data.
    perform write_out.
    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>.
    assign dy_line->* to <dyn_wa>.
    endform.
    Regards,

  • DYNAMIC INTERNAL TABLE CREATION BASED ON THE CONTENT OF ANOTHER INTERNAL TA

    Hi All
    I need to create an internal table at runtime.
    I have a selection screen parameter which is specific to country, Which can take values below
    eg:- IT_AREA for Italy(IT)
    FR_AREA for France(FR)
    IE_AREA for Ireland(IE).....And similary for other countries
    Based on the Above parameter, I need to create Internal Table as below
    DATA: itab TYPE italy_data Occurs 0.
    If I declare as above, Then itab has fields from italy_data. And this internal table i will be sending it to Function Module to get data into it.
    My Requirement is to Create the Internal table itab during runtime for tables italy_data OR france_data OR ireland_data based on selection screen parameter. Tables on Country may have different number of fields in it.
    Can anyone help me on this??

    Hi,
    Here is a sample code to create a dynamic internal table.
    REPORT ytrab03.
    TABLES: mara, makt.
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
    is_fcat LIKE LINE OF it_fcat,
    ls_layout TYPE slis_layout_alv.
    DATA: it_fieldcat TYPE lvc_t_fcat,
    is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data,
    new_line TYPE REF TO data,
    ob_cont_alv TYPE REF TO cl_gui_custom_container,
    ob_alv TYPE REF TO cl_gui_alv_grid,
    vg_campos(255) TYPE c,
    i_campos LIKE TABLE OF vg_campos,
    vg_campo(30) TYPE c,
    vg_tables(60) TYPE c.
    DATA: e_params LIKE zutsvga_alv_01.
    FIELD-SYMBOLS: <l_table> TYPE table,
    <l_line> TYPE ANY,
    <l_field> TYPE ANY.
    PARAMETERS: p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    is_fcat-fieldname = 'COL01'.
    is_fcat-ref_fieldname = 'MATNR'.
    is_fcat-ref_tabname = 'MARA'.
    APPEND is_fcat TO it_fcat.
    is_fcat-fieldname = 'COL02'.
    is_fcat-ref_fieldname = 'MAKTX'.
    is_fcat-ref_tabname = 'MAKT'.
    APPEND is_fcat TO it_fcat.
    LOOP AT it_fcat INTO is_fcat.
    is_fieldcat-fieldname = is_fcat-fieldname.
    is_fieldcat-ref_field = is_fcat-ref_fieldname.
    is_fieldcat-ref_table = is_fcat-ref_tabname.
    APPEND is_fieldcat TO it_fieldcat.
    CONCATENATE is_fieldcat-ref_table is_fieldcat-ref_field
    INTO vg_campos SEPARATED BY '~'.
    APPEND vg_campos TO i_campos.
    ENDLOOP.
    *... Create the dynamic internal table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_fieldcat
    IMPORTING
    ep_table = new_table.
    *... Create a new line
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    SELECT (i_campos) FROM mara INNER JOIN makt
    ON mara~matnr = makt~matnr
    UP TO p_max ROWS
    INTO TABLE <l_table>.
    LOOP AT <l_table> INTO <l_line>.
    LOOP AT it_fcat INTO is_fcat.
    ASSIGN COMPONENT is_fcat-fieldname
    OF STRUCTURE <l_line> TO <l_field>.
    IF sy-tabix = 1.
    WRITE: /2 <l_field>.
    ELSE.
    WRITE: <l_field>.
    ENDIF.
    ENDLOOP.
    ENDLOOP.
    Regards,
    Karuna.

  • Select query for picking data in a dynamic internal table

    Dear All,
    Please help.
    <u>The code is :</u>
    p_table1 = itab_final-tabname1.
            p_field1 = itab_final-fieldname1.         
            SELECT (p_field1) FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <dyntable1>.      
    It is working fine when the domain is of CHAR
    The piece of code is not working where domain is DATS, CURR, DEC, etc.
    What shall I do so that it works for other domains also. Please its urgent......
    <u>ERROR that came:</u>
    An exception occurred. This exception will be dealt with in more detail
    below. The exception, assigned to the class 'CX_SY_OPEN_SQL_DB', was not
    caught, which                                                         
    led to a runtime error. The reason for this exception is:             
    The data read during a SELECT access could not be inserted into the    
    target field.                                                          
    Either conversion is not supported for the target field's type or the  
    target field is too short to accept the value or the data are not in a 
    form that the target field can accept

    Check below code
    REPORT zpwtest .
    *** Tables
    DATA: lt_data TYPE REF TO data.
    DATA: lt_fieldcatalog TYPE lvc_t_fcat.
    data : p_field type string ,
           p_table type string .
    *** Structure
    DATA: ls_fieldcatalog TYPE lvc_s_fcat.
    *** Data References
    DATA: new_line TYPE REF TO data.
    *** Field Symbols
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_1> TYPE ANY TABLE,
                   <fs_2>,
                   <fs_3>.
    ls_fieldcatalog-fieldname = 'MANDT'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    APPEND ls_fieldcatalog TO lt_fieldcatalog.
    ASSIGN lt_data TO <fs_data>.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
         EXPORTING
           it_fieldcatalog = lt_fieldcatalog
         IMPORTING
           ep_table = <fs_data>
         EXCEPTIONS
           generate_subpool_dir_full = 1
           OTHERS = 2
    IF sy-subrc <> 0.
    ENDIF.
    *** So <FS_1> now points to our dynamic internal table.
    ASSIGN <fs_data>->* TO <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    CREATE DATA new_line LIKE LINE OF <fs_1>.
    *** A field-symbol to access that work area
    ASSIGN new_line->*  TO <fs_2>.
    <b>
    p_field = 'mandt carrid connid fldate price currency' .
    p_table = 'sflight' .
    *** And to put the data in the internal table
    SELECT (p_field)
      FROM (p_table)
      INTO CORRESPONDING FIELDS OF TABLE <fs_1>.
    </b>
    *** Access contents of internal table
    LOOP AT <fs_1> ASSIGNING <fs_2>.
      ASSIGN COMPONENT 5 OF STRUCTURE <fs_2> TO <fs_3>.
      WRITE: / <fs_3>.
    ENDLOOP.

  • Column names of a dynamic internal table

    Hi Friends,
    I have a dynamic internal table flowing in my ABAP program and I want to list down the column names of the this dynamic internal table.
    The declaration of this dynamic internal table :
       FIELD-SYMBOLS:
        <l_t_data>         TYPE STANDARD TABLE.
    Can you please tell me how to get the column names?
    Thanks,
    Gaurav

    Hi,
         You can use ABAP Runtime Type Identification to get the column names of the internal table.
    e.g >
    >lo_itab holds reference to description object of internal table whose column names i have to extract.
    >Using method describe_by_data of class cl_abap_typedescr export the field symbol assigned to the table and import the object reference into lo_itab.
    >Then using method get_table_line_type of lo_itab import line type description object reference into lo_line.
    >Check if lo_line is referring to a structure, if yes , downcast it to a object reference lo_struct of type cl_abap_structdescr.
    >The column description of all columns in the structure is stored in 'components' table of cl_abap_structdescr.
         So loop at the table to get all the column names stored in column 'name' of table 'components'.
    Thank You.

  • Creation of dynamic internal table is not synchronous

    In my code following lines are used to create a dynamic table.
    REFRESH : INCTABL .
      CLEAR INCTABL .
      INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
      INCTABL-LINE =   'zpltnamec like zvendplt-zpltnamec,'. APPEND INCTABL.
      INCTABL-LINE =   'sourcing like zopsdwbom-sourcing,'. APPEND INCTABL.
    INCTABL-LINE =   'zmatgrp like zrmrpmaterial-zmatgrp,'. APPEND INCTABL.
      INCTABL-LINE =   'zcollection like zrmrpmaterial-zcollection,'.
      APPEND INCTABL.
      INCTABL-LINE =   'fiscintrodt like zrmrpmaterial-zfiscintrodt,'.
      APPEND INCTABL.
      INCTABL-LINE =   'bednr like ekpo-bednr,'. APPEND INCTABL.
      INCTABL-LINE =   'revlv like ekpo-revlv,'. APPEND INCTABL.
      INCTABL-LINE =   'ematn like ekpo-ematn,'. APPEND INCTABL.
      INCTABL-LINE =   'menge like mara-eannr,'. APPEND INCTABL.
      INCTABL-LINE =   'stprs like mara-eannr,'. APPEND INCTABL.
    *inctabl-line =   'kbetr like cdred-f_new,'. append inctabl.
      DATA : T_KBETR(72) .
      DATA :CNT(2).
      DO LIN TIMES .
        CNT = SY-INDEX .
        CONCATENATE 'kbetr' CNT ' like cdred-f_new,' INTO T_KBETR .
        CONDENSE T_KBETR .
        INCTABL-LINE =   T_KBETR . APPEND INCTABL.
      ENDDO .
      INCTABL-LINE = 'end of dyntab. '. APPEND INCTABL.
      INSERT REPORT 'zcrchangereport_3'(001) FROM INCTABL.
    but during run time it is using the previously created dynamic internal table structure and then creating currently required internal table.
    how to overcome this problem/
    Thanks.

    Hello,
    Instead of creating report, create subroutine pool. Like
    INCTABL-LINE = 'report ztest.'. APPEND INCTABL.
    INCTABL-LINE = 'form main'. APPEND INCTABL.
    INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
    INCTABL-LINE = 'zpltnamec like zvendplt-zpltnamec.'. APPEND INCTABL.
    INCTABL-LINE = 'data: end of dyntab.'. APPEND INCTABL.
      CATCH SYSTEM-EXCEPTIONS GENERATE_SUBPOOL_DIR_FULL = 9.
        GENERATE SUBROUTINE POOL inctabl NAME l_name
                MESSAGE L_MESSAGE LINE L_LINE WORD L_WORD.
      ENDCATCH.
      IF L_MESSAGE IS INITIAL.
        PERFORM (L_FORM) IN PROGRAM (L_NAME).
      ELSE.
        WRITE : L_MESSAGE, L_LINE.
      ENDIF.
    You can get the message in L_message variable, if any error occurs.
    Regards,
    Naimesh

  • 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

  • Adding Specific columns of dynamic internal table row into another column

    Hi Gurus,
    I need to add  few columns of a dynamic internal table row into another column:
    Article description hy01 hy02 total
    101      panza         10     12      22
    102      masht         12     12     24
    dynamic internal table is created and columns hy01 hy02.... can increase
    How to add the the values in hy01 hy 02... into total.
    Regards,
    Dep

    Hi,
    If you really want to have a dynamic table, then you will have to find a way to generate a whole new table, and then copy the data from the old table to the new one. There is no way to modify a type during runtime in ABAP.
    Here an example how to generate a dynamic table based on another internal table, hope this will help you.
    TYPE-POOLS: slis.
    PARAMETERS: p_nb_hy TYPE i DEFAULT 2. "Number of new HY columns to be added
    * Type ZST_T:
    *   matnr  TYPE matnr
    *   maktx  TYPE maktx
    *   hy01   TYPE i
    *   total  TYPE i
    TYPES: ty_t TYPE STANDARD TABLE OF zst_s.
    PERFORM main.
    *&      Form  main
    *       text
    FORM main.
      DATA: lt_fieldcat     TYPE slis_t_fieldcat_alv,
            lt_t            TYPE ty_t,
            lr_new_t        TYPE REF TO data.
      FIELD-SYMBOLS: <lt_new_t> TYPE STANDARD TABLE.
      "Add some lines to LT_T just to have something to display on screen
      DO 10 TIMES.
        APPEND INITIAL LINE TO lt_t.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'ZST_S'
        CHANGING
          ct_fieldcat      = lt_fieldcat.
      "Copy LT_T to LR_NEW_T
      PERFORM extend_and_copy_table USING lt_t p_nb_hy CHANGING lr_new_t lt_fieldcat.
      CLEAR lt_t. "Not needed anymore...
      ASSIGN lr_new_t->* TO <lt_new_t>.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <lt_new_t>.
    ENDFORM.                    "main
    *&      Form  extend_and_copy_table
    FORM extend_and_copy_table USING ut_t           TYPE STANDARD TABLE
                                     uv_nb_hy       TYPE i
                               CHANGING cr_t        TYPE REF TO data
                                        ct_fieldcat TYPE slis_t_fieldcat_alv
                               RAISING cx_sy_struct_creation cx_sy_table_creation.
      DATA: lo_tabledescr      TYPE REF TO cl_abap_tabledescr,
            lo_structdescr     TYPE REF TO cl_abap_structdescr,
            lo_new_structdescr TYPE REF TO cl_abap_structdescr,
            lo_new_tabledescr  TYPE REF TO cl_abap_tabledescr,
            lt_components      TYPE cl_abap_structdescr=>component_table,
            ls_component       TYPE cl_abap_structdescr=>component,
            lv_field_cnt       TYPE numc2,
            ls_fieldcat        TYPE slis_fieldcat_alv,
            lr_fieldcat        TYPE REF TO slis_fieldcat_alv.
      FIELD-SYMBOLS: <ls_old_s> TYPE ANY,
                     <lt_new_t> TYPE STANDARD TABLE,
                     <ls_new_s> TYPE ANY.
      "Get the list of all components from UT_T line structure
      lo_tabledescr  ?= cl_abap_tabledescr=>describe_by_data( ut_t ).
      lo_structdescr ?= lo_tabledescr->get_table_line_type( ).
      lt_components  = lo_structdescr->get_components( ).
      "The new columns will be from type of column HY01
      ls_component-type = lo_structdescr->get_component_type( 'HY01' ).
      "The new columns will have the same fieldcat info as column HY01
      READ TABLE ct_fieldcat INTO ls_fieldcat WITH KEY fieldname = 'HY01'.
      "HY<lv_field_cnt> = new field name
      lv_field_cnt = uv_nb_hy + 1.
      "For each new column...
      DO uv_nb_hy TIMES.
        "Generate the new column field name
        CONCATENATE  'HY' lv_field_cnt INTO ls_component-name.
        ls_fieldcat-fieldname = ls_component-name.
        "Add the new field to the components of the new structure
        INSERT ls_component INTO lt_components INDEX 4.
        "Add the new field's fieldcat info to the fieldcat
        INSERT ls_fieldcat  INTO ct_fieldcat   INDEX 4.
        lv_field_cnt = lv_field_cnt - 1.
      ENDDO.
      "Adjust the COL_POS from fieldcat
      LOOP AT ct_fieldcat REFERENCE INTO lr_fieldcat.
        lr_fieldcat->col_pos = sy-tabix.
      ENDLOOP.
      "Create the new table
      lo_new_structdescr = cl_abap_structdescr=>create( p_components = lt_components ).
      lo_new_tabledescr  = cl_abap_tabledescr=>create( p_line_type = lo_new_structdescr ).
      CREATE DATA cr_t TYPE HANDLE lo_new_tabledescr.
      ASSIGN cr_t->* TO <lt_new_t>.
      "Copy all data from old to new table
      LOOP AT ut_t ASSIGNING <ls_old_s>.
        APPEND INITIAL LINE TO <lt_new_t> ASSIGNING <ls_new_s>.
        MOVE-CORRESPONDING <ls_old_s> TO <ls_new_s>.
      ENDLOOP.
    ENDFORM.                    "main

  • How to populate data in dynamic internal table

    Hi Expert,
    fyi. My dynamic internal table field is created base on data selected. Eg. select table qpcd has 5 records.  These 5 recods will become fieldname to my dynamic internal table. My dynamic internal table will be
    ...itab
          01
          02
          03
          04
          05
    The 5 records from qpcd is populated in another table call viqmel.  I need to find the occurance of each code in viqmel and populate the number of occurance in itab in each of column.  The final dynamic itab will be like this
    table itab
    01       02     03    04     05   -
    > field name
    2         0        1     0       1    -
    > data
    my source code like below
    Report ZPLYGRND2.
    TABLES: mara, makt.
    TYPE-POOLS: slis, sydes.
    DATA:it_fcat TYPE slis_t_fieldcat_alv,
         is_fcat LIKE LINE OF it_fcat,
         ls_layout TYPE slis_layout_alv.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data,
          new_line TYPE REF TO data,
          ob_cont_alv TYPE REF TO cl_gui_custom_container,
          ob_alv TYPE REF TO cl_gui_alv_grid,
          vg_campos(255) TYPE c,
          i_campos LIKE TABLE OF vg_campos,
          vg_campo(30) TYPE c,
          vg_tables(60) TYPE c.
    types : begin of t_qpcd,
             codegruppe like qpcd-codegruppe,
             code like qpcd-code,
            end of t_qpcd.
    data:wa_qpcd type t_qpcd,
         i_qpcd type standard table of t_qpcd initial size 0.
    FIELD-SYMBOLS: <l_table> TYPE table,
                   <l_line> TYPE ANY,
                   <l_field> TYPE ANY.
    select * into corresponding fields of wa_qpcd from qpcd
    where katalogart = 'D'
    and   codegruppe = 'OOT01'.
    append wa_qpcd to i_qpcd.
    endselect.
    loop at i_qpcd into wa_qpcd.
      is_fcat-fieldname = wa_qpcd-code.
      APPEND is_fcat TO it_fcat.
    endloop.
    LOOP AT it_fcat INTO is_fcat.
        is_fieldcat-fieldname = is_fcat-fieldname.
        is_fieldcat-ref_field = is_fcat-ref_fieldname.
        is_fieldcat-ref_table = is_fcat-ref_tabname.
        APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    *... Create the dynamic internal table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
            it_fieldcatalog = it_fieldcat
        IMPORTING
            ep_table = new_table.
    if sy-subrc = 0.
    endif.
    *... Create a new line
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    LOOP AT <l_table> INTO <l_line>.
    ENDLOOP.

    hello dear i m giving u a code in this a dynamic table is made on the basis of table in database , and u can download this data correct it , see it, or even change it....and upload in tht table help full if u dont know the table name...in advance.
    also the code to populate data in dynamic table is in this code like:
    SELECT * FROM (MTABLE_N)
    INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
    look at the whole program .hope this solve ur problem thanks.
    REPORT ZTESTA  MESSAGE-ID ZIMM    .
    TYPES : DATA_OBJECT TYPE REF TO DATA.
    DATA : MITAB TYPE REF TO DATA .
    TYPE-POOLS : SLIS .
    DATA : IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV
    WITH HEADER LINE .
    DATA : IT_FIELDCATALOG TYPE LVC_T_FCAT .
    DATA : WA_FIELDCATALOG TYPE LVC_S_FCAT .
    DATA : I_STRUCTURE_NAME LIKE DD02L-TABNAME .
    DATA : I_CALLBACK_PROGRAM LIKE SY-REPID .
    DATA : DYN_LINE TYPE DATA_OBJECT .
    FIELD-SYMBOLS : <FS_ITAB> TYPE STANDARD TABLE .
    DATA : TABLE_NAME_IS_VALID TYPE C .
    DATA : DYNAMIC_IT_INSTANTIATED TYPE C .
    CONSTANTS BUTTONSELECTED TYPE C VALUE 'X' .
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_TABL.
    PARAMETERS : MTABLE_N LIKE RSRD1-TBMA_VAL
    MATCHCODE OBJECT DD_DBTB_16 OBLIGATORY .
    DATA CHECKTABLED.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_FILE.
    PARAMETERS : MFILENAM LIKE RLGRAP-FILENAME .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_DOWN.
    PARAMETERS : P_DOWNLD RADIOBUTTON GROUP GRP1
    USER-COMMAND M_UCOMM .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_CHKF.
    PARAMETERS : P_CHKFIL RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_UPLD.
    PARAMETERS : P_UPLOAD RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 5(29) T_SHOW.
    PARAMETERS : P_SHOW_T RADIOBUTTON GROUP GRP1 .
    SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN OUTPUT .
      PERFORM CHECK_FILENAME .
    AT SELECTION-SCREEN.
      IF SY-UCOMM = 'ONLI'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
      IF SY-UCOMM = 'PRIN'.
        CHECKTABLED = MTABLE_N+0(1).
        IF CHECKTABLED NE 'Z'.
          MESSAGE I017.
          LEAVE TO SCREEN 1000.
        ENDIF.
        IF SY-UNAME NE 'KAMESH.K'.
          MESSAGE I023 WITH SY-UNAME.
          LEAVE TO SCREEN 1000.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR MFILENAM .
      PERFORM F4_FOR_FILENAME .
    INITIALIZATION .
      T_TABL = 'Table Name' .
      T_FILE = 'File Name' .
      T_DOWN = 'Download Table' .
      T_CHKF = 'Check File to Upload' .
      T_UPLD = 'Upload File' .
      T_SHOW = 'Show Table Contents' .
    START-OF-SELECTION .
      PERFORM CHECK_TABLE_NAME_IS_VALID .
    END-OF-SELECTION .
      IF TABLE_NAME_IS_VALID EQ ' ' .
        MESSAGE I398(00) WITH 'INVALID TABLE NAME' .
      ELSE .
        PERFORM INSTANTIATE_DYNAMIC_INTERNAL_T .
        CHECK DYNAMIC_IT_INSTANTIATED = 'X' .
        CASE BUTTONSELECTED .
          WHEN P_DOWNLD .
            PERFORM SELECT_AND_DOWNLOAD .
          WHEN P_CHKFIL .
            PERFORM CHECK_FILE_TO_UPLOAD .
          WHEN P_UPLOAD .
            PERFORM UPLOAD_FROM_FILE .
          WHEN P_SHOW_T .
            PERFORM SHOW_CONTENTS .
        ENDCASE .
      ENDIF .
    FORM CHECK_TABLE_NAME_IS_VALID.
      DATA MCOUNT TYPE I .
      TABLES DD02L .
      CLEAR TABLE_NAME_IS_VALID .
      SELECT COUNT(*) INTO MCOUNT FROM TADIR
      WHERE PGMID = 'R3TR'
      AND OBJECT = 'TABL'
      AND OBJ_NAME = MTABLE_N .
      IF MCOUNT EQ 1 .
        CLEAR DD02L .
        SELECT SINGLE * FROM DD02L WHERE TABNAME = MTABLE_N .
        IF SY-SUBRC EQ 0.
          IF DD02L-TABCLASS = 'TRANSP' .
            TABLE_NAME_IS_VALID = 'X' .
          ENDIF .
        ENDIF.
      ENDIF .
    ENDFORM. " CHECK_TABLE_NAME_IS_VALID
    FORM SELECT_AND_DOWNLOAD.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_DOWNLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                FILE_OPEN_ERROR         = 1
                FILE_WRITE_ERROR        = 2
                INVALID_FILESIZE        = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        MESSAGE I398(00) WITH 'Table' MTABLE_N
        'successfully downloaded to '
        MFILENAM .
      ENDIF.
    ENDFORM. " SELECT_AND_DOWNLOAD
    FORM UPLOAD_FROM_FILE.
      DATA : ANS TYPE C .
      DATA : LINES_OF_ITAB TYPE I .
      DATA : MSY_SUBRC TYPE I .
      CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
           EXPORTING
                TEXTLINE1 = 'Are you sure you wish to upload'
                TEXTLINE2 = 'data from ASCII File to DB table '
                TITEL     = 'Confirmation of Data Upload'
           IMPORTING
                ANSWER    = ANS.
      IF ANS = 'J' .
        PERFORM CHECK_FILENAME.
        CLEAR MSY_SUBRC .
        CALL FUNCTION 'WS_UPLOAD'
             EXPORTING
                  FILENAME                = MFILENAM
                  FILETYPE                = 'DAT'
             TABLES
                  DATA_TAB                = <FS_ITAB>
             EXCEPTIONS
                  CONVERSION_ERROR        = 1
                  FILE_OPEN_ERROR         = 2
                  FILE_READ_ERROR         = 3
                  INVALID_TYPE            = 4
                  NO_BATCH                = 5
                  UNKNOWN_ERROR           = 6
                  INVALID_TABLE_WIDTH     = 7
                  GUI_REFUSE_FILETRANSFER = 8
                  CUSTOMER_ERROR          = 9
                  OTHERS                  = 10.
        MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
        IF SY-SUBRC EQ 0.
          DESCRIBE TABLE <FS_ITAB> LINES LINES_OF_ITAB .
          IF LINES_OF_ITAB GT 0 .
            MODIFY (MTABLE_N) FROM TABLE <FS_ITAB> .
            MSY_SUBRC = MSY_SUBRC + SY-SUBRC .
          ENDIF .
        ENDIF.
        IF MSY_SUBRC EQ 0 .
          MESSAGE I398(00) WITH LINES_OF_ITAB
          'Record(s) inserted in table'
          MTABLE_N .
        ELSE .
          MESSAGE I398(00) WITH
          'Errors occurred No Records inserted in table'
          MTABLE_N .
        ENDIF .
      ENDIF .
    ENDFORM. " UPLOAD_FROM_FILE
    FORM F4_FOR_FILENAME.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                DEF_PATH         = 'C:\'
                MASK             = ',.,..'
                MODE             = '0'
           IMPORTING
                FILENAME         = MFILENAM
           EXCEPTIONS
                INV_WINSYS       = 1
                NO_BATCH         = 2
                SELECTION_CANCEL = 3
                SELECTION_ERROR  = 4
                OTHERS           = 5.
    ENDFORM. " F4_FOR_FILENAME
    FORM CHECK_FILENAME.
      IF MFILENAM IS INITIAL
      AND NOT ( MTABLE_N IS INITIAL )
      AND P_SHOW_T NE BUTTONSELECTED.
        CONCATENATE 'C:\'
        MTABLE_N '.TXT' INTO MFILENAM.
      ENDIF .
    ENDFORM. " CHECK_FILENAME
    FORM INSTANTIATE_DYNAMIC_INTERNAL_T.
      CLEAR DYNAMIC_IT_INSTANTIATED .
      I_STRUCTURE_NAME = MTABLE_N .
      CLEAR IT_FIELDCAT[] .
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_STRUCTURE_NAME       = I_STRUCTURE_NAME
           CHANGING
                CT_FIELDCAT            = IT_FIELDCAT[]
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
      IF SY-SUBRC EQ 0.
        LOOP AT IT_FIELDCAT .
          CLEAR WA_FIELDCATALOG .
          MOVE-CORRESPONDING IT_FIELDCAT TO WA_FIELDCATALOG .
          WA_FIELDCATALOG-REF_FIELD = IT_FIELDCAT-FIELDNAME .
          WA_FIELDCATALOG-REF_TABLE = MTABLE_N .
          APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG .
        ENDLOOP .
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
        IT_FIELDCATALOG = IT_FIELDCATALOG
        IMPORTING
        EP_TABLE = MITAB .
        ASSIGN MITAB->* TO <FS_ITAB> .
        DYNAMIC_IT_INSTANTIATED = 'X' .
      ENDIF.
    ENDFORM. " INSTANTIATE_DYNAMIC_INTERNAL_T
    FORM SHOW_CONTENTS.
      CLEAR : <FS_ITAB> .
      SELECT * FROM (MTABLE_N)
      INTO CORRESPONDING FIELDS OF TABLE <FS_ITAB> .
      I_CALLBACK_PROGRAM = SY-REPID .
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                IT_FIELDCAT        = IT_FIELDCAT[]
           TABLES
                T_OUTTAB           = <FS_ITAB>
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
    ENDFORM. " SHOW_CONTENTS
    FORM CHECK_FILE_TO_UPLOAD.
      PERFORM CHECK_FILENAME.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                FILENAME                = MFILENAM
                FILETYPE                = 'DAT'
           TABLES
                DATA_TAB                = <FS_ITAB>
           EXCEPTIONS
                CONVERSION_ERROR        = 1
                FILE_OPEN_ERROR         = 2
                FILE_READ_ERROR         = 3
                INVALID_TYPE            = 4
                NO_BATCH                = 5
                UNKNOWN_ERROR           = 6
                INVALID_TABLE_WIDTH     = 7
                GUI_REFUSE_FILETRANSFER = 8
                CUSTOMER_ERROR          = 9
                OTHERS                  = 10.
      IF SY-SUBRC EQ 0.
        I_CALLBACK_PROGRAM = SY-REPID .
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  I_CALLBACK_PROGRAM = I_CALLBACK_PROGRAM
                  IT_FIELDCAT        = IT_FIELDCAT[]
             TABLES
                  T_OUTTAB           = <FS_ITAB>
             EXCEPTIONS
                  PROGRAM_ERROR      = 1
                  OTHERS             = 2.
      ENDIF .
    ENDFORM. " CHECK_FILE_TO_UPLOAD
    Message was edited by:
            SAURABH SINGH
            SENIOR EXECUTIVE
            SAMSUNG INDIA ELECTRONICS LTD.,NOIDA

  • Accessing internal tables at runtime.

    Hi all,
    I am writing a code where in i have to transfer data from excel to database table.
    Iam getting the excel data in an itab. Can anybody help me with how to access internal tables at runtime ?
    i am using the following code with sy-tabix. here, when the sy-tabix is odd it picks up the value,
    but i want that within the same loop when i increment sy-tabix by 1, then it should fetch the second column of same row. But its not working as it shows an error that it does not permit subfield access.
    the code is as follows:
    LOOP AT t_tab[] into wa_tab .
      data: l_tabix type sy-tabix,
            name_index type sy-tabix.
            data: c type i.
            l_tabix = sy-tabix.
            name_index = l_tabix+1.
            c = ( l_tabix mod 2 ).
    ******to check if sy-tabix is odd**********
           if c ne 0.
             READ TABLE t_tab into wa_tab index l_tabix.
             wa_product1-product = wa_tab-VALUE.
    ************incrementing sy-tabix*************
             READ TABLE t_tab into wa_tab index name_index. (here it shows error)
             wa_product1-product_name = wa_tab-value.
           endif.
      endloop.
    Thanks in advance.

    Hi Omer,
    Copy and paste this code.
    =====================================
    REPORT ztest_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.

  • How to delete data from dynamic internal table

    Hi,
    I have dynamic internal table and I have some slection screen fields , using these selection screen fields
    (select -options), I have to filter the data? assigning will work with READ , but I have select options not the parametre,
    and also delete will not work for dynamic table..
    as we cannot use assigning with delete..
    So how to do this?
    and one more thing is , I cannot filter the data while selection( in select, I cannot filter the data-> as it's not coming directly from table, it's coming from buffer),
    so now after selection of data, I need to filter the data from dynamic table.
    Is there any way to do this?
    Regards,
    Mrunal

    Hi matt,
    I tried with below code as  you said. But I am getting dump. can you help?
    here is my piece of code.
    FIELD-SYMBOLS: <LS_DATA> type any,
                               <LT_DATA> TYPE table,
                                <L_FIELD> type any.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LS_DATA>.
        ASSIGN <l_buffer_entry>-dataptr->* TO <LT_DATA>.
    LOOP AT <LT_DATA> ASSIGNING <LS_DATA>.
    ASSIGN COMPONENT 'BUKRS' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BUKRS.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ASSIGN COMPONENT 'BELNR' OF STRUCTURE <LS_DATA> TO <L_FIELD>.
    IF <L_FIELD> NOT IN SO_BELNR.
    DELETE <LT_DATA>.
    ENDIF.
    UNASSIGN <L_FIELD>.
    ENDLOOP.
    and here is the description of my dump:->>>
    You attempted to access an unassigned field symbol
    (data segment 32772).
    This error may occur for any of the following reasons:
    - You address a typed field symbol before it is set using ASSIGN
    - You address a field symbol that points to a line in an internal table
      that has been deleted
    - You address a field symbol that had previously been reset using
      UNASSIGN, or that pointed to a local field that no longer exists
    - You address a global function interface parameter, even
      though the relevant function module is not active,
      that is it is not in the list of active calls. You can get the list
      of active calls from the this short dump.

  • How to use dynamic internal table when using gui_upload?

    Hi Experts,
    my scenario is like i have header data, item data and serial numbers.
    so with respect to the  quantity in unit of measure ,there will be number of serial numbers..
    i have declared the dynamic internal table,but i am not getting the logic to change the structure accordingly with respect to the flat file entries..
    is it possible to do or its not possible....any suggestion!!!!i have declared like this....
    TYPES: BEGIN OF ty_final,
          bldat TYPE string,      "Document Date
          budat TYPE string,      "Psting Date
          bktxt TYPE string,      "Document Header Text
          werks TYPE string,      "Plant
          lgort TYPE string,      "Storage Location
          matnr TYPE string,      "Material Number
          erfmg TYPE string,      "Quantity in Unit Of Entry
          anln1 TYPE string,      "Asset Number
          anln2 TYPE string,      "Asset Subnumber
          sernr TYPE string,      "serial Number
    END OF ty_final.
    DATA : it_final TYPE TABLE OF ty_final,
           wa_final TYPE ty_final.
    FIELD-SYMBOLS : <fs_final> TYPE table.
    ASSIGN it_final TO <fs_final>.
    after this i called gui upload and passed internal table it_final..
    but i have to change the internal table structure dynamically before the upload function.so that it will match with the flat file...
    Regards
    Karthick

    There are at least two approaches you can use to change/generate new dynamic-structured table. Either with [RTTI + RTTS|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI] or using [CL_ALV_TABLE_CREATE|http://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_alv_table_create] . In this one just determine fieldcatalog of current table and change it accordingly, then regenarate table.
    There are plenty of examples in SCN for this. You should not face difficulties applying this.
    Regards
    Marcin

Maybe you are looking for

  • How to clear fields used in SAP SCRIPT

    hi all,    i want to clear all fields which i have printed on my sap script. i have passed the values to these  fields by useing function module 'TEXT_SYMBOL_SETVALUE' in se38 abap program. i have also used clear statement in my abap program to clear

  • Cutover approach - new fields added to existing DataSources / DSOs / Cubes

    My current project has been phased across multiple releases. The phase 1 go-live was a few months ago and there is already a reasonable amount of data in the production environment. We will soon cutover from our QA to production environment. Some of

  • Load paid invoices to AP

    We have a requirement where we have to load paid invoices to AP. Oracle does not provide any functionality for this. on metalink they ask us to contact oracle consulting for solution. 1. Import invoices into AP invoice interface tables, 2. Run Open I

  • Create a user profile Flash SWF with a database?

    I have a project to create a SWF game, that requires registered users pegged to a database (eg: student ID and class) to logon to the SWF and play the game, and then they can save their progress and continue it next time. Below is just a sample that

  • Why iphone doesn't appear in i tunes?

    the i phone doen't appear in the i tune. who can HELP?