Cl_alv_table_create= create_dynamic_table is dumping

Dear Xperts,
cl_alv_table_create=>create_dynamic_table is dumping with message "LOAD_PROGRAM_NOT_FOUND"
Pls Help:
Thanks
Raj

My Code:
DATA: T_DATA TYPE REF TO DATA,
      T_FIELDCAT TYPE LVC_T_FCAT,
      T_HEADER  TYPE  SLIS_T_LISTHEADER,
      T_SORT    TYPE  SLIS_T_SORTINFO_ALV.
Field Symbols
FIELD-SYMBOLS : <FS_DATA> TYPE STANDARD TABLE," REF TO DATA,
                <FS_BATCH> TYPE STANDARD TABLE,
                <FS_FREE> TYPE STANDARD TABLE,
                <FS_STOR> TYPE STANDARD TABLE,
                <FS_WA_FREE>,
                <FS_WA_STOR>,
                <FS_WA_BATCH>,
                <FS_VAR>,
                <FS_VAL> TYPE KONP-KBETR .
To create the dynamic Internal Table.
The fields of this table are obtained at runtime
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
      EXPORTING
        IT_FIELDCATALOG = T_FIELDCAT
      IMPORTING
        EP_TABLE = T_DATA
      EXCEPTIONS
        GENERATE_SUBPOOL_DIR_FULL = 1
        OTHERS = 2
    IF SY-SUBRC <> 0.
      MESSAGE E074 WITH TEXT-015. " Error Creating int table.
      EXIT.
    ENDIF.
    ASSIGN T_DATA->* TO <FS_BATCH>.

Similar Messages

  • Dump  after 36 times in CL_ALV_TABLE_CREATE= CREATE_DYNAMIC_TABLE.

    Hi friends,
    I have a problem while creating dynamic table by using
    CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE.
    this method is only executing for 36 times, i saw some threads which were on similar topic but none was answered fully.
    i have to execute this method more times not exactly like 36 times it will not be senseful in my application if i execute it only 36 times.
    Some one suggest me that i'll have  to use was 6.0 but it's a limitation for me that i have to use 4.7 so pls suggest me according to keep in mind 4.7 n in my application none one isstatic all things in my application is dybanic.
    how to solve this problem?
    I will be thankful for your replies,
    regards,

    hi anuj
    try this example may be it wil help you.
    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.      *********Creates a dyanamic internal table*********
      perform get_data.
      perform write_out.
      form get_structure.
      data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
      data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?= 
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
        loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
      endform.
      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.
      form get_data.
    Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
      endform.
       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.
    one more
    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.
    thanks & regards
    pardeep kharb
    Edited by: pardeep kumar on Jul 29, 2008 5:18 PM

  • Field names for cl_alv_table_create= create_dynamic_table

    Morning All
    My client is currently implementing SAP QM at one of the labs and I have come across a situation where the fieldnames required for a dynamic table creation can potentially contain spaces and special characters.  So far I have urged them to remove all such characters as the call to the cl_alv_table_create=>create_dynamic_table method will dump if they are present.
    My question therefore is, is there a definitive list of characters that cannot be used as part of a fieldname?  I intend to use such a list to then search and replace the special characters to enable me to match fieldnames.
    For those of you that know QM, we cannot use internally assigned numbers for master characteristics (client decision) and special characters are frequently used as names in the lab.  My client sees it as a limitation to remove the spaces and special characters from the names but unfortunately it causes problems for me if they don't.
    I need to match the names to determine results for a report so substition seems to be the way forward - unless some else has another suggestion?
    Thanks in advance
    Ian

    There is a form called SAACHECK in module pool RDDU0001 that the data dictionary program uses to check the validity of field names.  You should probably have a look at the logic.
    But why use the Master characteristics as the field name anyway?  Why not instead create a cross reference in an internal table and generate a simple sequence for each unique master characteristic.  That way your field names are just the sequence number, but you can still match up your data with a binary read on the cross reference internal table.

  • Cl_alv_table_create= create_dynamic_table error

    Hi  Gurus,
    Method cl_alv_table_create=>create_dynamic_table
    is giving dump.When i am trying to create internal table from fieldcatalog values.Program"  "not found.
    Please suggest some solution.
    Good answers will be rewarded with points.
    Thanks,
    Twinkle

    Check this program as reference .
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: alv_fldcat type slis_t_fieldcat_alv,
          it_fldcat type lvc_t_fcat.
    type-pools : abap.
    data : it_details type abap_compdescr_tab,
           wa_details type abap_compdescr.
    data : ref_descr type ref to cl_abap_structdescr.
    data: new_table type ref to data,
          new_line  type ref to data,
          wa_it_fldcat type lvc_s_fcat.
    selection-screen begin of block b1 with frame title text .
    parameters: p_table(30) type c.
    selection-screen end of block b1.
    * Get the structure of the table.
    ref_descr ?= cl_abap_typedescr=>describe_by_name( p_table ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_details.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = wa_details-name .
      wa_it_fldcat-datatype = wa_details-type_kind.
      wa_it_fldcat-inttype = wa_details-type_kind.
      wa_it_fldcat-intlen = wa_details-length.
      wa_it_fldcat-decimals = wa_details-decimals.
      append wa_it_fldcat to it_fldcat .
    endloop.
    * 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>.
    * Select Data from table.
    select * into corresponding fields of table <dyn_table>
               from (p_table).
    * 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

  • Cl_alv_table_create= create_dynamic_table

    Hi,
    When I use this method it is dumping
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fieldcat
        IMPORTING
          ep_table        = <new_table>.
    The error What I am getting is "LOAD_PROGRAM_NOT_FOUND" "CX_SY_PROGRAM_NOT_FOUND" MESSAGE IS  ' Program " " Not Found '.
    Please help us in this issue
    Thanks & Regards,
    Sivaram Kandula

    Dear Rich,
    I am facing very similar problem to the solution you gave here, but I couldn't get through with this, Hope you can certainly help me and I am pasting my code here: pls look into it.
    Awards will be rewarded for sure...
    Material Field properties are set here
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT = TEXT-018.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-INTLEN = 18.
      WA_FIELDCAT-OUTPUTLEN = 18.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    Material Desc properties are set here
      WA_FIELDCAT-FIELDNAME = 'MAKTX'.
      WA_FIELDCAT-SELTEXT = TEXT-019.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-INTLEN = 35.
      WA_FIELDCAT-OUTPUTLEN = 35.
      WA_FIELDCAT-JUST = 'X'.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    *added by sarath Dt:03.08.06,Ticket#483.
      IF P_BATCH = 'X' OR P_FREEST = 'X'.
        WA_FIELDCAT-FIELDNAME = 'CAT_DESC'.
        WA_FIELDCAT-SELTEXT = TEXT-041.
        WA_FIELDCAT-INTTYPE = 'C'.
        WA_FIELDCAT-INTLEN = 35.
        WA_FIELDCAT-OUTPUTLEN = 35.
        WA_FIELDCAT-JUST = 'X'.
        APPEND WA_FIELDCAT TO T_FIELDCAT.
        CLEAR WA_FIELDCAT.
      ENDIF.
    *end of additoin by sarath Dt:03.08.06,Ticket#483.
    Plant properties are set here
      WA_FIELDCAT-FIELDNAME = 'WERKS'.
      WA_FIELDCAT-SELTEXT = TEXT-020.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-INTLEN = 4.
      WA_FIELDCAT-OUTPUTLEN = 4.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    Plant properties are set here
    *added by sarath Dt:03.08.06,Ticket#483.
      IF P_BATCH = 'X' OR P_FREEST = 'X'.
        WA_FIELDCAT-FIELDNAME = 'SPART'.
        WA_FIELDCAT-SELTEXT = TEXT-042.
        WA_FIELDCAT-INTTYPE = 'C'.
        WA_FIELDCAT-INTLEN = 35.
        WA_FIELDCAT-OUTPUTLEN = 35.
        WA_FIELDCAT-JUST = 'X'.
        APPEND WA_FIELDCAT TO T_FIELDCAT.
        CLEAR WA_FIELDCAT.
      ENDIF.
    *end of additoin by sarath Dt:03.08.06,Ticket#483.
      WA_FIELDCAT-FIELDNAME = 'MVGR1'.
      WA_FIELDCAT-SELTEXT = TEXT-026.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-INTLEN = 9.
      WA_FIELDCAT-OUTPUTLEN = 9.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    Storage Location properties are set here
      IF P_STOR = 'X'.
        WA_FIELDCAT-FIELDNAME = 'LGORT'.
        WA_FIELDCAT-SELTEXT = TEXT-021.
        WA_FIELDCAT-INTTYPE = 'C'.
        WA_FIELDCAT-INTLEN = 4.
        WA_FIELDCAT-OUTPUTLEN = 4.
        APPEND WA_FIELDCAT TO T_FIELDCAT.
        CLEAR WA_FIELDCAT.
    Stock Type properties are set here
        WA_FIELDCAT-FIELDNAME = 'STOCKTYP'.
        WA_FIELDCAT-SELTEXT = TEXT-022.
        WA_FIELDCAT-INTTYPE = 'C'.
        WA_FIELDCAT-INTLEN = 15.
        WA_FIELDCAT-OUTPUTLEN = 15.
        APPEND WA_FIELDCAT TO T_FIELDCAT.
        CLEAR WA_FIELDCAT.
      ENDIF.
    added by gopal for ticket#536
    This is for sorting the numeric fields only
      DATA: IDX TYPE SY-TABIX,
            D_IND TYPE SY-TABIX.
      LOOP AT T_SIZES INTO T1 WHERE SIZE CO TEXT-043.
        IDX = SY-TABIX.
        IF T1-SIZE < 10.
          CONCATENATE '0' T1-SIZE INTO T1-SIZE.
        ELSEIF T1-SIZE = '9.5'.
          CONCATENATE '0' T1-SIZE INTO T1-SIZE.
        ENDIF.
        APPEND T1.
        CLEAR T1.
        DELETE T_SIZES INDEX IDX .
        CLEAR : IDX.
      ENDLOOP.
      CLEAR : IDX.
      LOOP AT T_SIZES INTO T2 WHERE SIZE CO TEXT-044.
        IDX = SY-TABIX.
        APPEND T2.
        CLEAR T2.
        DELETE T_SIZES INDEX IDX .
        CLEAR : IDX.
      ENDLOOP.
      SORT T2 BY SIZE .
      APPEND LINES OF T2[] TO T1[].
      SORT T1 BY SIZE .
      IF T_SIZES[] IS INITIAL.
        T_SIZES[] = T1[].
      ELSE.
        APPEND LINES OF  T_SIZES[] TO T1[].
        DESCRIBE TABLE T1[].
        D_IND = SY-TABIX.
        DELETE T_SIZES[] FROM 1 TO D_IND.
        T_SIZES[] = T1[].
      ENDIF.
    **end of addition by gopal for ticket#536
      LOOP AT T_SIZES INTO WA_SIZES.
        IF WA_SIZES-SIZE CA '.'.
    DEIK905030 for Ticket#691 by harsha on 31052007
         REPLACE '.' WITH '_' INTO WA_SIZES-SIZE .
    **End of changes for  DEIK905030.
        ENDIF.
    Sizes of the material field properties are set here
        WA_FIELDCAT-FIELDNAME = WA_SIZES-SIZE.
        WA_FIELDCAT-SELTEXT = WA_SIZES-SIZE.
        WA_FIELDCAT-INTTYPE = 'I'.
        WA_FIELDCAT-INTLEN = 11.
        WA_FIELDCAT-DO_SUM = 'X'.
        WA_FIELDCAT-OUTPUTLEN = 11.
        WA_FIELDCAT-NO_ZERO = 'X'.
        APPEND WA_FIELDCAT TO T_FIELDCAT.
        CLEAR WA_FIELDCAT.
      ENDLOOP.
    Total Field properties are set here
      WA_FIELDCAT-FIELDNAME = 'TOTAL'.
      WA_FIELDCAT-SELTEXT = TEXT-023.
      WA_FIELDCAT-INTTYPE = 'I'.
      WA_FIELDCAT-INTLEN = 13.
      WA_FIELDCAT-OUTPUTLEN = 13.
      WA_FIELDCAT-DO_SUM = 'X'.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    maximum Retail Price field properties are set here
      WA_FIELDCAT-FIELDNAME = 'MRPRT'.
      WA_FIELDCAT-SELTEXT = TEXT-028.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-DECIMALS = 2.
      WA_FIELDCAT-INTLEN = 13.
    WA_FIELDCAT-OUTPUTLEN = 13.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    maximum Retail Price field properties are set here
      WA_FIELDCAT-FIELDNAME = 'MRP'.
      WA_FIELDCAT-SELTEXT = TEXT-024.
      WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-DECIMALS = 2.
      WA_FIELDCAT-INTLEN = 13.
    WA_FIELDCAT-OUTPUTLEN = 13.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    Moving Average Value properties are set here
      WA_FIELDCAT-FIELDNAME = 'MAV'.
      WA_FIELDCAT-SELTEXT = TEXT-025.
      WA_FIELDCAT-DO_SUM = 'X'.
      WA_FIELDCAT-INTTYPE = 'C'.
      WA_FIELDCAT-DECIMALS = 2.
      WA_FIELDCAT-INTLEN = 13.
    WA_FIELDCAT-OUTPUTLEN = 13.
      APPEND WA_FIELDCAT TO T_FIELDCAT.
      CLEAR WA_FIELDCAT.
    To create the dynamic Internal Table.
    The fields of this table are obtained at runtime
        CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
          EXPORTING
            IT_FIELDCATALOG = T_FIELDCAT
          IMPORTING
            EP_TABLE = T_DATA
          EXCEPTIONS
            GENERATE_SUBPOOL_DIR_FULL = 1
            OTHERS = 2
        IF SY-SUBRC <> 0.
          MESSAGE E074 WITH TEXT-015. " Error Creating int table.
          EXIT.
        ENDIF.
        ASSIGN T_DATA->* TO <FS_BATCH>.
        CREATE DATA WA_NEWTAB LIKE LINE OF <FS_BATCH>.

  • Issue in  using CL_ALV_TABLE_CREATE= CREATE_DYNAMIC_TABLE

    Hi,
    I am using  CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE to create dynamic internal table. I am displaying a tree in the output, based on the value selected in the tree, dynamic internal table is generated. If I continuously select the tree value for more than 36 times. This method is giving me a dump.
    Kindly help me in resolving this issue.
    Thanks in advance.
    Regards.

    once you build the field catalog use the following code to create the itab. this doesnt have the limitation of 36
    data: struct_type type ref to cl_abap_structdescr,
    tab_type type ref to cl_abap_tabledescr ,
          comp_tab type cl_abap_structdescr=>component_table,
          comp like line of comp_tab,
          dref type ref to data ,
          dref1 type ref to data ,
          op_len type i .    
    clear: comp , comp_tab ,is_fieldcat .
          refresh comp_tab .
          loop at it_fieldcat into is_fieldcat .
            clear op_len .
            op_len = is_fieldcat-outputlen .
            comp-name = is_fieldcat-fieldname.
            comp-type = cl_abap_elemdescr=>get_c( op_len ).
            append comp to comp_tab.
            clear : is_fieldcat , comp .
          endloop .
          clear struct_type .
    call method cl_abap_structdescr=>create
      exporting
        p_components = comp_tab
        p_strict     = cl_abap_structdescr=>false
      receiving
        p_result     =  struct_type .
    *      struct_type = cl_abap_structdescr=>create( comp_tab ).
          clear tab_type .
          call method cl_abap_tabledescr=>create
            exporting
              p_line_type  = struct_type
              p_table_kind = cl_abap_tabledescr=>tablekind_std
    *    P_UNIQUE     = ABAP_FALSE
    *    P_KEY        =
    *    P_KEY_KIND   = KEYDEFKIND_DEFAULT
            receiving
              p_result     = tab_type .
          create data dref1 type handle tab_type.

  • Table Type in cl_alv_table_create= create_dynamic_table

    Hi guys,
    The method create_dynamic_table from  cl_alv_table_create has as exporting parameter a fielcatalog table. I want to insert a table type in this table, basically the field INTTYPE from LVC_S_FCAT can do that if u put the value 'h' in it. But I notice, that in method implementations all the cases are considered:
    C
    Character String
    N
    Character String with Digits Only
    D
    Date (Date: YYYYMMDD)
    T
    Time (Time: HHMMSS)
    X
    Byte Sequence (heXadecimal)
    I
    Integer number (4-byte integer with sign)
    b
    1-byte integer, integer number <= 254
    s
    2-byte integer, only for length field before LCHR or LRAW
    P
    Packed number
    F
    Floating point number to accuracy of 8 bytes
    and other, but not 'h'.
    Does anybody knows how create a dynamic table with a table type inside ? The table type has the structure from data dictionary  lvc_t_scol.
    Ionut.

    cl_alv_table_create=>create_dynamic_table( ) is no longer recommended to build dynamic tables.
    RTTC classes are very intuitive and quite easy to maintain.
    DATA:
          gt_struct_fields TYPE cl_abap_structdescr=>component_table,
          gwa_struct_field TYPE cl_abap_structdescr=>component.
    DATA:
          goref_table TYPE REF TO cl_abap_tabledescr,
          gdref_table TYPE REF TO data.
    FIELD-SYMBOLS <gt_dynamic> TYPE STANDARD TABLE.
    TRY.
    *   f1 TYPE c LENGTH 10
        gwa_struct_field-name = `F1`.
        gwa_struct_field-type = cl_abap_elemdescr=>get_c( 10 ).
        APPEND gwa_struct_field TO gt_struct_fields.
        CLEAR gwa_struct_field.
    *   f2 TYPE bukrs
        gwa_struct_field-name = `F2`.
        gwa_struct_field-type ?= cl_abap_typedescr=>describe_by_name( `BUKRS` ).
        APPEND gwa_struct_field TO gt_struct_fields.
        CLEAR gwa_struct_field.
    *   f3 TYPE flighttab
        gwa_struct_field-name = `F3`.
        gwa_struct_field-type ?= cl_abap_typedescr=>describe_by_name( `FLIGHTTAB` ).
        APPEND gwa_struct_field TO gt_struct_fields.
        CLEAR gwa_struct_field.
    *   Use the structure object to build the table
        goref_table = cl_abap_tabledescr=>get(
                      cl_abap_structdescr=>get( gt_struct_fields )
        CREATE DATA gdref_table TYPE HANDLE goref_table.
        ASSIGN gdref_table->* TO <gt_dynamic>.
      CATCH ##no_handler
        cx_sy_struct_creation
        cx_parameter_invalid_range
        cx_sy_table_creation.
    ENDTRY.
    BR,
    Suhas

  • Cl_alv_table_create= create_dynamic_table in ALV Grid

    Hallo everybody
    i have created a dynamic_table with cl_alv_table_create class. Now i want this dynamic_table integration in my ALV Grid. I try this, but without successfull
    Can anybody help?
    PROGRAM zliefervolu.
    * Definition                                                          *
    TABLES: likp, "Vertriebsbeleg: Lieferung: Kopfdaten
            lips, "Vertriebsbeleg: Lieferung: Positionsdaten
            kna1, "Kundenstamm (allgemeiner Teil)
            marm. "Mengeneinheiten zum Material
    FIELD-SYMBOLS: <fs_data> TYPE REF TO data,
                   <fs_1> TYPE ANY TABLE,
                   <fs_2>,
                   <fs_3>.
    DATA: BEGIN OF i_vbeln OCCURS 1,
          faktor(5) TYPE n,
          END OF i_vbeln.
    DATA: BEGIN OF v_lief OCCURS 1,
          faktor TYPE string,
          END OF v_lief.
    DATA: BEGIN OF lieferschein OCCURS 1,
          vbeln TYPE vbeln,
          END OF lieferschein.
    DATA: ok_code LIKE sy-ucomm, "Bildschirmbilder, Funktionscode, der PAI ausgelöst hat
          v_volurech(10) TYPE n, "Volumenberechnung
          volutot TYPE string,
          v_debit TYPE kunnr,
          v_lifg TYPE vrkme,
          v_datumkl TYPE wadat,
          v_datumgr TYPE wadat,
          v_faktor(5) TYPE n,
          v_faktors TYPE string,
          v_datum TYPE string,
          v_count TYPE i,
          lt_fieldcatalog TYPE lvc_t_fcat,
          ls_fieldcatalog TYPE lvc_s_fcat,
          new_table TYPE REF TO data,
          new_line  TYPE REF TO data,
          lt_data TYPE REF TO data,
          v_datumlow(10) TYPE c,
          v_datumhigh(10) TYPE c,
          v_text TYPE string,
          name_catolog TYPE lvc_t_fcat, "Ändern von Spaltenname
          l_field LIKE LINE OF name_catolog, "Kurzspeicher für Spaltenname
          g_container TYPE scrfname VALUE 'BCALV_GRID_CONTROL',
          grid1 TYPE REF TO cl_gui_alv_grid, "ALV Grid Definition
          creattable TYPE REF TO cl_alv_table_create,
          g_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: i_tabledata TYPE TABLE OF zvolutable.
    SELECT-OPTIONS: s_kunnr FOR likp-kunnr, "Lieferung
                    s_wadat FOR likp-wadat OBLIGATORY, "Geplantes Datum der Warenbewegung
                    s_vbeln FOR likp-vbeln. "Warenempfänger
    * Main Program                                                        *
    START-OF-SELECTION.
      CLEAR: likp.
    * Selektion Vertriebsbeleg: Lieferung: Kopfdaten
      SELECT * FROM likp WHERE vbeln IN s_vbeln
                         AND wadat IN s_wadat
                         AND kunnr IN s_kunnr
                         ORDER BY vbeln.
    *    CLEAR: kna1.
    **   Selektion Kundenstamm (allgemeiner Teil)
    *    SELECT SINGLE * FROM kna1 WHERE kunnr EQ likp-kunnr.
    *    CONCATENATE likp-kunnr ` ` kna1-name1 INTO i_datatable-kunnr.
    *    CLEAR: lips.
    *   Selektion Vertriebsbeleg: Lieferung: Positionsdaten
        SELECT * FROM lips WHERE vbeln EQ likp-vbeln.
          CLEAR: marm.
    *     Selektion Mengeneinheiten zum Material
          SELECT SINGLE * FROM marm WHERE matnr EQ lips-matnr
                                    AND meinh EQ lips-vrkme.
          CLEAR v_volurech.
          v_volurech = lips-lfimg * marm-hoehe.
    *     Volumentotal
          volutot = volutot + v_volurech.
          MOVE lips-umvkz TO i_vbeln-faktor.
          APPEND i_vbeln.
        ENDSELECT.
        MOVE likp-vbeln TO lieferschein-vbeln.
        APPEND lieferschein.
      ENDSELECT.
      CLEAR: i_vbeln, lieferschein.
      SORT i_vbeln BY faktor.
    * Datumsfeld             *
      MOVE s_wadat-low TO v_datumkl.
      v_datumlow = v_datumkl+6.
      WRITE '.' TO v_datumlow+2.
      WRITE v_datumkl+4(2) TO v_datumlow+3.
      WRITE '.' TO v_datumlow+5.
      WRITE v_datumkl(4) TO v_datumlow+6.
      LOOP AT s_wadat WHERE high IS NOT INITIAL.
        MOVE s_wadat-high TO v_datumgr.
      ENDLOOP.
      v_datumhigh = v_datumgr+6.
      WRITE '.' TO v_datumhigh+2.
      WRITE v_datumgr+4(2) TO v_datumhigh+3.
      WRITE '.' TO v_datumhigh+5.
      WRITE v_datumgr(4) TO v_datumhigh+6.
      IF v_datumgr IS NOT INITIAL.
        CONCATENATE v_datumlow '-' v_datumhigh INTO v_datum.
      ELSE.
        MOVE v_datumlow TO v_datum.
      ENDIF.
      CLEAR v_text.
      v_text = 'DATUM'.
      MOVE v_text TO v_lief-faktor.
      APPEND v_lief.
    * Faktorfelder           *
      CLEAR: v_count.
      LOOP AT i_vbeln.
        IF i_vbeln-faktor NE v_faktor.
          MOVE i_vbeln-faktor TO v_faktor.
          PACK i_vbeln-faktor TO v_faktors.
          CONDENSE v_faktors.
          MOVE v_faktors TO v_lief-faktor.
          v_count = v_count + 1.
          APPEND v_lief.
        ENDIF.
      ENDLOOP.
      CLEAR v_text.
      v_text = 'VOLUMEN'.
      MOVE v_text TO v_lief-faktor.
      APPEND v_lief.
      CLEAR: v_lief.
    * Erstellen von Dym. Struktur *
      LOOP AT v_lief.
        ls_fieldcatalog-fieldname = v_lief-faktor.
        APPEND ls_fieldcatalog TO lt_fieldcatalog.
      ENDLOOP.
      ASSIGN lt_data TO <fs_data>.
      IF v_count NE 0.
        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.
    *    CALL METHOD cl_alv_table_create=>table_copy
    *      EXPORTING
    *        it_outtab       = i_tabledata
    *        it_fieldcatalog = lt_fieldcatalog
    *      IMPORTING
    *        ep_table        = <fs_data>.
        IF sy-subrc <> 0.
        ENDIF.
        ASSIGN <fs_data>->* TO <fs_1>.
        CREATE DATA new_line LIKE LINE OF <fs_1>.
        ASSIGN new_line->* TO <fs_2>.
      ELSE.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT_LO'
          EXPORTING
            titel        = text-tit
            textline1    = text-feh
            start_column = 15 "Abstand von Links
            start_row    = 6. "Abstand von Oben
      ENDIF.
      CALL SCREEN 100.
    END-OF-SELECTION.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'MAIN100'.
    *** Definition von Feldkatalog
    *  l_field-fieldname = 'DEBITOR'.
    *  l_field-coltext = v_datum4.
    *  APPEND l_field TO name_catolog.
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
               EXPORTING container_name = g_container.
        CREATE OBJECT grid1
               EXPORTING i_parent = g_custom_container.
    *   ALV Methode aufruf für Ausgabe
        CALL METHOD grid1->set_table_for_first_display
    *      EXPORTING
    *        i_structure_name = 'lvc_t_fcat'
          CHANGING
            it_outtab        = <fs_1>
            it_fieldcatalog  = lt_fieldcatalog.
      ENDIF.
    ENDMODULE.                    "PBO OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
    *   to react on oi_custom_events:
      CALL METHOD cl_gui_cfw=>dispatch.
      CASE ok_code.
        WHEN 'EXIT'.
          PERFORM exit_program.
        WHEN OTHERS.
    *     do nothing
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                    "PAI INPUT
    *       FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    *  CALL METHOD G_CUSTOM_CONTAINER->FREE.
    *  CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.                    "EXIT_PROGRAM
    thx & regards paul

    Hi,
    Herewith i am sending the sample report for the dynamic report. Kindly go through it.
    REPORT  YMS_DYNAMICDEMO
                 NO STANDARD PAGE HEADING
                 MESSAGE-ID zcs_c2c_001.
    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 get_structure.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
      loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    endform.
    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.
    form get_data.
    Select Data from table.
      select * into table <dyn_table>
                 from (p_table).
    endform.
    form write_out.
    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.
    endform.
    Thanks,
    Shankar

  • Duplicate dynamic table in - cl_alv_table_create= create_dynamic_table

    Hi Gurus,
    I have done the following code, but it is not treating <alv_table> and <alv_table_new> as different tables.
    How can I create a duplicate table of <alv_table> in the below context ??
    DATA :   ldtab         TYPE REF TO data,
                  ldtab_NEW      TYPE REF TO data.
    FIELD-SYMBOLS: <alv_table> TYPE table,
                   <alv_table_NEW> TYPE table.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = gt_fcat
        IMPORTING
          ep_table        = ldtab.
      IF sy-subrc = 0.
         ldtab_new = ldtab.
        ASSIGN ldtab->* TO <alv_table>.
        ASSIGN ldtab_new->* TO <alv_table_new>.
      ENDIF.
    Regards,
    Sandip.

    hi,
    Both field symbols i.e. <alv_table> and <alv_table_new> are pointing to same memory area because of the statements
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = gt_fcat
    IMPORTING
    ep_table = ldtab.
    IF sy-subrc = 0.
    ldtab_new = ldtab.                    <----
    do not perform this step
    ASSIGN ldtab->* TO <alv_table>.
    ASSIGN ldtab_new->* TO <alv_table_new>.
    endif.
    instead write -
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = gt_fcat
    IMPORTING
    ep_table = ldtab.
    IF sy-subrc = 0.
      ASSIGN ldtab->* TO <alv_table>.
    endif.
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = gt_fcat
    IMPORTING
    ep_table = ldtab_new.
    IF sy-subrc = 0.
      ASSIGN ldtab_new->* TO <alv_table_new>.
    endif.
    try the above mentioned code.
    I hope this will resolve your issue.
    Regards,
    Sambaran Ray

  • Decimals on CALL METHOD cl_alv_table_create= create_dynamic_table

    Hello experts:
    I have a little problem, I want to create an ALV field with 4 decimales, it's a dinamic table, but when the alv report shows the fields it shows only 2 decimals, here the main code for explaining me better:
    Here the code for create the field with decimals:
    * Netpr
      lv_cols = lv_cols + 1.
      MOVE lv_cols TO wa_it_fldcat-col_pos.
      MOVE 'NETPR'      TO wa_it_fldcat-fieldname.
      MOVE 'Net Price'  TO wa_it_fldcat-scrtext_l.
      MOVE 'Net Price'  TO wa_it_fldcat-scrtext_m.
      MOVE 'Net Pr'     TO wa_it_fldcat-scrtext_s.
      MOVE 'CURR'       TO wa_it_fldcat-datatype.
      MOVE 'P'          TO wa_it_fldcat-inttype.
      MOVE 11           TO wa_it_fldcat-intlen.
      MOVE 4            TO wa_it_fldcat-decimals.
      MOVE ''           TO wa_it_fldcat-ref_field.
      MOVE ''           TO wa_it_fldcat-ref_table.
      APPEND wa_it_fldcat TO t_fldcat.
    After create more fields, here the code for create the dinamic ALV table:
    * Create dynamic internal table and assign to FS
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = t_fldcat
        IMPORTING
          ep_table        = t_newtable.
      ASSIGN t_newtable->* TO <t_dyntable>.
    * Create dynamic work area and assign to FS
      CREATE DATA t_newline  LIKE LINE OF <t_dyntable>.
      ASSIGN t_newline->* TO <fs_dyntable>.
    After this method, the structure of the work area having the data type of the fields and all the atributes, the decimals of the NETPR fields just have 2 decimals =(
    I hope my explanation it's clear.
    Any help with this issue it's very welcome, thank you very much for your time.
    Miriam

    Hi
    Xiaonan Hu is right: u need to delete the row where u transfer CURR as type:
    * Netpr
      lv_cols = lv_cols + 1.
      MOVE lv_cols TO wa_it_fldcat-col_pos.
      MOVE 'NETPR'      TO wa_it_fldcat-fieldname.
      MOVE 'Net Price'  TO wa_it_fldcat-scrtext_l.
      MOVE 'Net Price'  TO wa_it_fldcat-scrtext_m.
      MOVE 'Net Pr'     TO wa_it_fldcat-scrtext_s.
      *MOVE 'CURR'       TO wa_it_fldcat-datatype.
      MOVE 'P'          TO wa_it_fldcat-inttype.
      MOVE 11           TO wa_it_fldcat-intlen.
      MOVE 4            TO wa_it_fldcat-decimals.
      MOVE ''           TO wa_it_fldcat-ref_field.
      MOVE ''           TO wa_it_fldcat-ref_table.
      APPEND wa_it_fldcat TO t_fldcat.
    If you transfer CURR, the method will defined a type p with 2 decimals by default, so it's useless to indicate the decimals in this case.
    Infact the method calls the fm ALV_TABLE_CREATE, and here the abap code is:
    - for CURR type:
    elseif ls_fieldcat-datatype = 'CURR'.
            concatenate 'DATA:'
                        ls_fieldcat-fieldname
                        'TYPE'
                        ls_fieldcat-inttype
                        'DECIMALS 2.'
                        into lt_source-line separated by space.
    - for P type
    if ls_fieldcat-inttype = 'P' and not ls_fieldcat-decimals is
               initial.
              replace '.' with 'DECIMALS' into lt_source-line.
              concatenate lt_source-line ls_fieldcat-decimals '.' into
                          lt_source-line separated by space.
            endif.
    Max

  • Create dynamic table CALL METHOD cl_alv_table_create= create_dynamic_table

    Hi gurus i have a problem i have created a dinamic internal table but the lenght of the internal table fields is 10 i need longer fields
    here is my code thanks
    data: begin of it_campos OCCURS 0,
                campo1(12) type c,
            END OF it_campos.
    do n times.
           clear nocamptmp.
           add 1 to incont.
           CONDENSE incont NO-GAPS.
           cont = incont.
           CONCATENATE nocamp cont  into nocamptmp.
           wa_campos-campo1 = nocamptmp.
           append wa_campos to it_campos.
        enddo  .
        loop at  it_campos into wa_campos.
          t_fieldcat_wa-col_pos = SY-TABIX.
          t_fieldcat_wa-fieldname = wa_campos-campo1.
          APPEND t_fieldcat_wa TO t_fieldcat.
        endloop  .
    CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
            it_fieldcatalog           = t_fieldcat
        IMPORTING
            ep_table                  = tabla
        EXCEPTIONS
            GENERATE_SUBPOOL_DIR_FULL = 1
        others                         = 2.
    ASSIGN tabla->* TO <l_table>.
        CREATE DATA ep_line LIKE LINE OF <l_table>.
    all is fine but the fields of  <l_table>  are char(10) and my data is longer than 10 how can i increase the lenght of the table fields
    any idea thanks

    Modify the fieldcatalog accordingly for e.g.,
    LOOP AT it_campos INTO wa_campos.
      t_fieldcat_wa-col_pos = sy-tabix.
      t_fieldcat_wa-fieldname = wa_campos-campo1.
      t_fieldcat_wa-inttype = 'C'. " Character Type
      t_fieldcat_wa-intlen = '50'. "50 character length
      APPEND t_fieldcat_wa TO t_fieldcat.
    ENDLOOP .
    BR,
    Suhas

  • Program with 2 dynamic i_tabs (cl_alv_table_create= create_dynamic_table)

    Dear Expers
    I created a ABAP with dynamic internal table using cl_alv_table_create=>create_dynamic_table more or less according to this example here:
    cl_alv_table_create=>create_dynamic_table error
    Now I need a second dynamic internal table in the same program. So in a first try I just process the same code a second time (copy+paste) with new variables and new fieldsymbols. But when the program runs and the method is called a second time there is this error: "LT_GENTAB-xyz has laready been declared 7 xyz".
    I believe I must free/initialize/delete/undeclare LT_GENTAB before calling the method a second time. Can anybody tell me how to do that? Or is there any other advice on how to create 2 internal tables dynamically in the same program (if possible using the same approach)?
    Many thanks

    Hi,
    Here is the sample code from the link in your message :
    Filling a table for field declarations :
    loop at it_details into wa_details.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = wa_details-name .
      wa_it_fldcat-datatype = wa_details-type_kind.
      wa_it_fldcat-inttype = wa_details-type_kind.
      wa_it_fldcat-intlen = wa_details-length.
      wa_it_fldcat-decimals = wa_details-decimals.
      append wa_it_fldcat to it_fldcat .
    endloop.
    Call the method for dynamic creation :
    call method cl_alv_table_create=>create_dynamic_table
                 exporting
                    it_fieldcatalog = it_fldcat
                 importing
                    ep_table        = new_table
    I meant you didn't refresh table it_fldcat as you fields declaration table.
    Did u refresh this table before your second copy code?

  • Call method "cl_alv_table_create= create_dynamic_table"

    Hi SDN Community,
    Is it possible to create dynamic tables. I tried it by call method "cl_alv_table_create=>create_dynamic_table", but the "new_table" of output parameters is empty after the call is executed.
    Please suggest.
    Thank You.
    Pankaj.

    Hi Pankaj,
    Try the code written below and let me know whether it works?
    report  z_dynamic_itab_test .
    include z_table_fs_top.
    include z_table_fs_forms.
    initialization.
      perform clear_fields.
    start-of-selection.
      perform fetch_data.
    end-of-selection.
    *&  Include           Z_TABLE_FS_TOP
    Type Pools                                                           *
    type-pools: slis,
                rsds.
    Tables                                                               *
    tables :sscrfields,                "Fields on selection screens
            dd03l.                     "Table Fields
    Types                                                                *
    types: begin of t_dd03l,
            tabname like dd03l-tabname,              "Table Name
            fieldname like dd03l-fieldname,          "Field Name
            keyflag   like dd03l-keyflag,            "Key Flag
            rollname  like dd03l-rollname,           "Roll Name
            position like dd03l-position,            "Position
            ddtext(30),                              "Description
           end of t_dd03l.
    types : begin of t_fname,                        "To hold the field names
              fld like dd03l-fieldname,
            end of t_fname.
    Internal Tables                                                      *
    data : it_dd03l   type table of t_dd03l,       "To hold the field names of dd03l.
           it_flds    type table of rsdsfields,    "To hold the field names
           it_fields  type table of dd03l,         "To hold the field names
           it_cat     type table of lvc_s_fcat,    "To hold Field Catalog
           it_fname   type table of t_fname.
    Work areas                                                           *
    data: wa_dd03l  like line of it_dd03l,     "Workarea for IT_DD03L
          wa_flds   like line of it_flds,      "Workarea for IT_FLDS
          wa_fields like line of it_fields,    "Workarea for IT_FIELDS
          wa_cat    like line of it_cat ,      "Workarea for IT_CAT
          wa_fname  like line of it_fname.     "Workarea for IT_FNAME
    *SELECTION SCREEN WITH BLOCK DEFINITION.
    selection-screen begin of block b2 with frame title text-004.
    parameters: p_tbname type dd03l-tabname.
    select-options: s_field for dd03l-fieldname no intervals.
    selection-screen end of block b2.
    Variables                                                            *
    data : lv_where type string,
           lv_cnt   type i value '1',
           v_records type i.
    data : gv_where_cl(100) type c.              "Variable to hold Where clause
    data: wa_flname(5) type c.
    data: wa_fldcat type lvc_s_fcat.
    data: it_fldcat type lvc_t_fcat.
    data: it type ref to data.
    DECLARATION OF FIELD SYMBOLS :
    field-symbols: <fs_table> type table.
    field-symbols: <fs_temp> type any,
                   <fs_final> type any.
    *&  Include           Z_TABLE_FS_FORMS
    *&      Form  clear_fields
         To clear all work areas and refresh all internal tables.
    form clear_fields .
      clear wa_dd03l.
      clear wa_flds.
      clear wa_fields.
      clear wa_cat.
      clear wa_fname.
      refresh it_dd03l.
      refresh it_flds.
      refresh it_fields.
      refresh it_cat.
      refresh it_fname.
    endform.                    " clear_fields
    *&      Form  FETCH_DATA
          Fetch data from different tables
    form fetch_data .
      describe table s_field lines v_records.
    Populate it_flds from s_field, to hold the fields to be Selected.
      if s_field is not initial.
        loop at s_field.
          wa_flname = s_field-low.
          write: s_field-low.
        BUILD FIELD CATALOG FOR ALL FIELDS.
          wa_flds-fieldname = wa_flname.
          append wa_flds to it_flds.
        endloop.
      endif.
    Populate the Where clause as a string.
    if s_where[] is not initial.
       loop at s_where.
         concatenate lv_where s_where-low into lv_where separated by space.
       endloop.
    endif.
    Populate it_dd03l, to hold the field names from DD03L.
      select tabname
             fieldname
             keyflag
             rollname
             position
             from dd03l
             into table it_dd03l
             where tabname eq p_tbname
                   and fieldname ne 'MANDT'.
      if sy-subrc = 0.
        sort it_dd03l by position.
        delete it_dd03l where fieldname cp '.INCLU*'.          ""CP = Covers Pattern
      endif.
    Populate it_fname, with fields which have to be selected (entered in selection).
      loop at it_dd03l into wa_dd03l.
      Read table it_flds.
        read table it_flds into wa_flds with key fieldname = wa_dd03l-fieldname.
        if sy-subrc = 0.
        Move data from it_dd03l to it_fname
          wa_fname-fld = wa_dd03l-fieldname.
          append wa_fname to it_fname.
          clear wa_fname.
        endif.
      endloop.
    *TO CHECK IF TABLE EXISTS.
      call function 'SCPR_DB_TABLE_EXIST'
        exporting
          tabname        = p_tbname
        exceptions
          tab_dont_exist = 1
          others         = 2.
      if sy-subrc <> 0.
        if sy-subrc = 1.
        GIVE A POP UP.
          call function 'POPUP_TO_DECIDE_INFO'
            exporting
              textline1    = 'Table Does Not Exist !'
              titel        = 'Invalid Table Name'
              start_column = 25
              start_row    = 6.
        endif.
      endif.
    SELECT ALL RECORDS FROM DD03L.
      select *
      into table it_fields
      from dd03l
      where tabname = p_tbname.
      if sy-subrc = 0.
        sort it_fields by position.
        delete it_fields where fieldname cp '.INCLU*'.         "CP = Covers Pattern.
      endif.
    Populate IT_CAT with fields which are REQUIRED.
    Display upto 150 fields only.
      loop at it_fields into wa_fields to 150.
      Read table it_fname
        read table it_fname into wa_fname with key fld = wa_fields-fieldname.
        if sy-subrc = 0.
        Move data from it_fields
          wa_cat-tabname = p_tbname.
          wa_cat-fieldname = wa_fields-fieldname.
          wa_cat-col_pos = lv_cnt.
          wa_cat-inttype    = wa_fields-inttype.
          wa_cat-datatype = wa_fields-datatype.
          wa_cat-intlen = wa_fields-intlen.
          wa_cat-seltext = wa_fields-fieldname.
          wa_cat-decimals = wa_fields-decimals.
          wa_cat-ref_field = wa_fields-fieldname.
          wa_cat-ref_table = p_tbname.
          append wa_cat to it_cat.
          clear wa_cat.
          lv_cnt = lv_cnt + 1.
        endif.
      endloop.
    CREATE A DYNAMIC INTERNAL TABLE.
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = it_cat
        importing
          ep_table        = it.
    ASSIGN IT TO <FS>.
      assign it->* to <fs_table>.
    *Select the data from the table given as input and populate
    it into the dynamic internal table created based on the where
    condition.
      select (it_fname)
             from (p_tbname)
             into table <fs_table>
             where (lv_where).
      if sy-subrc <> 0.
        message 'No data found' type 'I'.
      endif.
    *Displaying dynamic internal table .
      loop at <fs_table> assigning <fs_temp>.
       write:/ <fs_temp> quickinfo 'CONTENTS'.
      endloop.
    endform.                    " FETCH_DATA
    Best Regards,
    Deepa Kulkarni

  • Dump Error

    Dump Msg
                                                                                    With ABAP/4 Open SQL array select, the output table is too small.                                                                               
    What happened?                                                                               
    Error in ABAP application program.                                                                               
    The current ABAP program "ZFLEXI" had to be terminated because one of the               
    statements could not be executed.                                                               
    This is probably due to an error in the ABAP program.             
    My logic is :
    *& Report  : ZDLYDSPHNEW                                               *
    *& Purpose : Daily Godown dispatches with condition valu details       *
    REPORT ZDLYDSPH NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 30(10)
    MESSAGE-ID SK .
    TYPE-POOLS: SLIS,ABAP.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    TABLES : VBRK,     "Billing document header detail
             VBRP,     "Billing document item details
             MAKT,     "Material Description
             BHDGD,
             MARA,     "Material Master
             KNA1,     "Customer Master Table
             TSPA,
            J_1IEXCHDR.
    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,
          DYN_TABLE TYPE STANDARD TABLE OF KOMG WITH HEADER LINE.
    DATA: P_TABLE(30) TYPE C VALUE 'VBRK'.
    Selection Screen Started
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK B_1 WITH FRAME TITLE TEXT-010.
    SELECT-OPTIONS : S_FKDAT FOR VBRK-FKDAT OBLIGATORY,
                     S_SPART FOR VBRK-SPART OBLIGATORY,
                     S_VBELN FOR VBRK-VBELN,
                     S_KUNAG FOR VBRK-KUNAG,
                     S_FKART FOR VBRK-FKART,
                     S_WERKS FOR VBRP-WERKS," obligatory,
                       S_VKBUR FOR VBRP-VKBUR,
                     S_VKORG FOR VBRK-VKORG OBLIGATORY,
                        S_VKGRP FOR VBRP-VKGRP, " sales group
                     S_RFBSK FOR VBRK-RFBSK OBLIGATORY DEFAULT 'C'.
    SELECTION-SCREEN END OF BLOCK B_1.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK B_2 WITH FRAME TITLE TEXT-011.
    PARAMETERS : P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B_2.
    START-OF-SELECTION.
    PERFORM GET_FIELDS.
      PERFORM GET_STRUCTURE.
      PERFORM NEW_DYNAMIC_TABLE.
      PERFORM GET_OUTPUT_DATA.
      PERFORM OUTPUT_WRITE.
      PERFORM GENERATE_OUTPUT.
    *&      Form  NEW_DYNAMIC_TABLE
          text
    -->  p1        text
    <--  p2        text
    FORM NEW_DYNAMIC_TABLE .
    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>.
    PERFORM ASSIGN_VALUES-SELECTED.
    ENDFORM.                    " NEW_DYNAMIC_TABLE
    *&      Form  GENERATE_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM GENERATE_OUTPUT .
    ENDFORM.                    " GENERATE_OUTPUT
    *&      Form  GET_BILLING_HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM GET_BILLING_HEADER .
    SELECT * INTO CORRESPONDING FIELDS OF TABLE I_VBRK
       FROM VBRK
        WHERE VBELN IN S_VBELN
          AND FKART IN S_FKART
          AND VKORG IN S_VKORG
          AND FKDAT IN S_FKDAT
          AND RFBSK IN S_RFBSK
          AND KUNAG IN S_KUNAG
          AND SPART IN S_SPART ORDER BY FKDAT.
    LOOP AT I_VBRK.
       ASSIGN I_VBRK TO <HEADER>.
      ASSIGN I_VBRK TO <DATA_TAB>.
       ASSIGN I_VBRK TO <F>.
       CASE TITEL-FELDNAME.
         WHEN OTHERS.
           READ TABLE G_T_TEXTS_ALL
         WITH KEY TABNAME   = TITEL-TABNAME
                  FIELDNAME = TITEL-FIELD
         INTO G_S_TEXT.
           DATEN-DATEN = <HEADER>.
           DATEN-DATEN = <DATAIN>.
           MOVE-CORRESPONDING <HEADER> TO DATEN.
           CLEAR DATEN-DATEN.
       if titel-tabname+0(5) = 'VBRK'.
           ASSIGN (TITEL-FELDNAME) TO <HEADER>.
           DATEN-DATEN = <HEADER>.
       ENDIF.
       ENDCASE.
       DATEN-ZEILE = ZEILE.
       APPEND DATEN.
    ENDLOOP.
    ENDFORM.                    " GET_BILLING_HEADER
    *&      Form  GET_STRUCTURE
          text
    -->  p1        text
    <--  p2        text
    FORM GET_STRUCTURE .
      DATA : IDETAILS TYPE ABAP_COMPDESCR_TAB,
      XDETAILS TYPE ABAP_COMPDESCR.
      DATA : REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.
    Get the structure of the table.
      REF_TABLE_DES ?=
      CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).
      IDETAILS[] = REF_TABLE_DES->COMPONENTS.
      LOOP AT IDETAILS INTO XDETAILS.
        CLEAR XFC.
        XFC-FIELDNAME = XDETAILS-NAME .
        XFC-DATATYPE = XDETAILS-TYPE_KIND.
        XFC-INTTYPE = XDETAILS-TYPE_KIND.
        XFC-INTLEN = XDETAILS-LENGTH.
        XFC-DECIMALS = XDETAILS-DECIMALS.
        APPEND XFC TO IFC.
      ENDLOOP.
    ENDFORM.                    " GET_STRUCTURE
    *&      Form  GET_OUTPUT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM GET_OUTPUT_DATA .
    Select Data from table.
      SELECT * INTO TABLE <DYN_TABLE>
          FROM ( VBRK )
           WHERE VBELN IN S_VBELN
             AND FKART IN S_FKART
             AND VKORG IN S_VKORG
             AND FKDAT IN S_FKDAT
             AND RFBSK IN S_RFBSK
             AND KUNAG IN S_KUNAG
             AND SPART IN S_SPART ORDER BY FKDAT.
    ENDFORM.                    " GET_OUTPUT_DATA
    *&      Form  OUTPUT_WRITE
          text
    -->  p1        text
    <--  p2        text
    FORM OUTPUT_WRITE .
      LOOP AT <DYN_TABLE> INTO <DYN_WA>.
        DO.
          ASSIGN COMPONENT SY-INDEX
          OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
          IF SY-SUBRC EQ 0.
            EXIT.
          ENDIF.
          IF SY-INDEX = 1.
            WRITE:/ <DYN_FIELD>.
          ELSE.
            WRITE: <DYN_FIELD>.
          ENDIF.
        ENDDO.
      ENDLOOP.
    ENDFORM.                    " OUTPUT_WRITE
    Edited by: ABHUT on May 27, 2008 11:34 AM

    Dump Msg
    With ABAP/4 Open SQL array select, the output table is too small.
    What happened?
    Error in ABAP application program.
    The current ABAP program "ZFLEXI" had to be terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    My logic is :
    *& Report : ZDLYDSPHNEW *
    *& Purpose : Daily Godown dispatches with condition valu details *
    REPORT ZDLYDSPH NO STANDARD PAGE HEADING LINE-SIZE 255 LINE-COUNT 30(10)
    MESSAGE-ID SK .
    TYPE-POOLS: SLIS,ABAP.
    CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
    TABLES : VBRK, "Billing document header detail
    VBRP, "Billing document item details
    MAKT, "Material Description
    BHDGD,
    MARA, "Material Master
    KNA1, "Customer Master Table
    TSPA,
    J_1IEXCHDR.
    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,
    DYN_TABLE TYPE STANDARD TABLE OF KOMG WITH HEADER LINE.
    DATA: P_TABLE(30) TYPE C VALUE 'VBRK'.
    Selection Screen Started
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK B_1 WITH FRAME TITLE TEXT-010.
    SELECT-OPTIONS : S_FKDAT FOR VBRK-FKDAT OBLIGATORY,
    S_SPART FOR VBRK-SPART OBLIGATORY,
    S_VBELN FOR VBRK-VBELN,
    S_KUNAG FOR VBRK-KUNAG,
    S_FKART FOR VBRK-FKART,
    S_WERKS FOR VBRP-WERKS," obligatory,
    S_VKBUR FOR VBRP-VKBUR,
    S_VKORG FOR VBRK-VKORG OBLIGATORY,
    S_VKGRP FOR VBRP-VKGRP, " sales group
    S_RFBSK FOR VBRK-RFBSK OBLIGATORY DEFAULT 'C'.
    SELECTION-SCREEN END OF BLOCK B_1.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF BLOCK B_2 WITH FRAME TITLE TEXT-011.
    PARAMETERS : P_VARI LIKE DISVARIANT-VARIANT.
    SELECTION-SCREEN END OF BLOCK B_2.
    START-OF-SELECTION.
    PERFORM GET_FIELDS.
    PERFORM GET_STRUCTURE.
    PERFORM NEW_DYNAMIC_TABLE.
    PERFORM GET_OUTPUT_DATA.
    PERFORM OUTPUT_WRITE.
    PERFORM GENERATE_OUTPUT.
    *& Form NEW_DYNAMIC_TABLE
    text
    --> p1 text
    <-- p2 text
    FORM NEW_DYNAMIC_TABLE .
    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>.
    PERFORM ASSIGN_VALUES-SELECTED.
    ENDFORM. " NEW_DYNAMIC_TABLE
    *& Form GENERATE_OUTPUT
    text
    --> p1 text
    <-- p2 text
    FORM GENERATE_OUTPUT .
    ENDFORM. " GENERATE_OUTPUT
    *& Form GET_STRUCTURE
    text
    --> p1 text
    <-- p2 text
    FORM GET_STRUCTURE .
    DATA : IDETAILS TYPE ABAP_COMPDESCR_TAB,
    XDETAILS TYPE ABAP_COMPDESCR.
    DATA : REF_TABLE_DES TYPE REF TO CL_ABAP_STRUCTDESCR.
    Get the structure of the table.
    REF_TABLE_DES ?=
    CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME( P_TABLE ).
    IDETAILS[] = REF_TABLE_DES->COMPONENTS.
    LOOP AT IDETAILS INTO XDETAILS.
    CLEAR XFC.
    XFC-FIELDNAME = XDETAILS-NAME .
    XFC-DATATYPE = XDETAILS-TYPE_KIND.
    XFC-INTTYPE = XDETAILS-TYPE_KIND.
    XFC-INTLEN = XDETAILS-LENGTH.
    XFC-DECIMALS = XDETAILS-DECIMALS.
    APPEND XFC TO IFC.
    ENDLOOP.
    ENDFORM. " GET_STRUCTURE
    *& Form GET_OUTPUT_DATA
    text
    --> p1 text
    <-- p2 text
    FORM GET_OUTPUT_DATA .
    Select Data from table.
    SELECT * INTO TABLE <DYN_TABLE>
    FROM ( VBRK )
    WHERE VBELN IN S_VBELN
    AND FKART IN S_FKART
    AND VKORG IN S_VKORG
    AND FKDAT IN S_FKDAT
    AND RFBSK IN S_RFBSK
    AND KUNAG IN S_KUNAG
    AND SPART IN S_SPART ORDER BY FKDAT.
    ENDFORM. " GET_OUTPUT_DATA
    *& Form OUTPUT_WRITE
    text
    --> p1 text
    <-- p2 text
    FORM OUTPUT_WRITE .
    LOOP AT <DYN_TABLE> INTO <DYN_WA>.
    DO.
    ASSIGN COMPONENT SY-INDEX
    OF STRUCTURE <DYN_WA> TO <DYN_FIELD>.
    IF SY-SUBRC EQ 0.
    EXIT.
    ENDIF.
    IF SY-INDEX = 1.
    WRITE:/ <DYN_FIELD>.
    ELSE.
    WRITE: <DYN_FIELD>.
    ENDIF.
    ENDDO.
    ENDLOOP.
    ENDFORM. " OUTPUT_WRITE
    Edited by: ABHUT on May 27, 2008 11:34 AM

  • Dump in include LSKBHF06 of  SAPLSKBH program while creating dynamic internal table.

    Hello Guys,
    We are facing a issue and expecting a support to resolve it.
    Brief Info about the issue:
    We have developed a code which downloads some specific information from database tables from client's system in excel file.
    For that we have used below mentioned method to create the dynamic table.
    cl_alv_table_create=>create_dynamic_table.
    Now this code is successfully executing in our system and giving us the required output. But when client is running this code in their system they are getting a dump.
    Dump Details:
    Runtime Errors LOAD_PROGRAM_NOT_FOUND
    Exception              CX_SY_PROGRAM_NOT_FOUND
           Occurred on     12.03.2014 at 11:01:51
    Program " " not found.
    What happened?
    There are several possible reasons for the error:
    or
    The current ABAP program had to be terminated because the
    ABAP processor detected an internal system error.
    The current ABAP program "SAPLSKBH" had to be terminated because the ABAP
    processor discovered an invalid system state.
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_PROGRAM_NOT_FOUND', was
    neither
    caught nor passed along using a RAISING clause, in the procedure
    "FB_TABLE_CREATE_STRING" "(FORM)"
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.
    The reason for the exception is:
    On account of a branch in the program
    (CALL FUNCTION/DIALOG, external PERFORM, SUBMIT)
    or a transaction call, another ABAP/4 program
    is to be loaded, namely " ".
    However, program " " does not exist in the library.
    System environment
    SAP Release.............. "620"
    Application server....... "gs-sh110"
    Network address.......... "10.2.95.17"
    Operating system......... "Linux"
    Release.................. "2.6.16.60-0.39.3-smp"
    Hardware type............ "x86_64"
    Character length......... 16 Bits
    Pointer length........... 64 Bits
    Work process number...... 1
    Short dump setting....... "full"
    Database server.......... "gs-sh110"
    Database type............ "ORACLE"
    Database name............ "H15"
    Database owner........... "SAPORA"
    As per the dump we  have tried to find the root cause of the issue and found in debug mode that in 'SAPLSKBH' program in SE38 in include 'INCLUDE LSKBHF06' program name SAPLSKBH is converted in some random generated program by sap ex. '%_T008F0' which is passed in the perform 'TABLE_CREATE' of the program generated dynamically.
    If this program name does not exists in the system then system will generate the dump
    Program " " not found as show in the dump received.
    Please find the short dump attached.
    Please help to solve the issue.
    Regards.
    Abhinav Goel.

    Hi Abhinav,
    I tried it myself in our system in debug mode. If SY_REPID is empty, l_name is set to %_T0000L (in our system) by GENERATE SUBROUTINE POOL and code line
       perform (l_form) in program (l_name).
    is a
       perform TABLE_CREATE in program %_T0000L.
    This works fine.
    But in your dump field l_name is still empty. This shouldn't be after a successfully processed GENERATE SUBROUTINE POOL.
    But SY-SUBRC seems to be 0 and l_message seems to be empty.
    In Your client's system, please try to check it
    - on a DEV system with open system settings (system client should allow changes)
    - with an user, who has developer's authorities and a registered developer key in table DEVACCESS
    Please tell us, if the issue remains after that.
    Regards,
    Klaus

Maybe you are looking for