Dynamic internal table, programming problem

Hello,
i have following problem,to bash some hardcoding.
so i created a table 1, with the form:
A      B
A1     B1
A2     B2
A3     B3
A4     B4
now i need some working field, my new internal table should be in the form like:
A      B       AA       AB        AC         AD
A1     B1     A1A     A1B     A1C     A1D
A2     B2     A2A     A2B     A2C     A2D
A3     B3     A3A     A3B     A3C     A3D
A4     B4     A4A     A4B     A4C     A4D
the internal table must be dynamic, because when i add an entry in table 1 like:
A      B
A5     B5
i need another col in my internal table
AE
A5E
What would be the best, to solve this problem? Some coding will be good, i'm new with
abap.
greetings Christian.
Edited by: Christian Cricker on Feb 9, 2008 10:46 AM

Hello
Most likely there is just a problem with the writing of the method call:
DATA:
  lt_fcat    TYPE lvc_t_fcat,
  ldo_itab  TYPE REF TO data.
"... fill fieldcatalog
CALL METHOD cl_alv_table_create=>create_dynamic_table
  IMPORTING
    it_fieldcatalog = lt_fcat
  EXPORTING
   ep_table          = ldo_itab.
This coding should be syntactically correct. Perhaps you just need to add the following statement to your report (at the beginning):
CLASS cl_alv_table_create DEFINITION LOAD.
On 4.6c the system is not always able to do this itself. You need to explicitly make the class known.
Regards
  Uwe

Similar Messages

  • Dynamic Internal Table synatax Problem

    Hi Experts.
    I am creating the Dynamic Internal table by using the method:cl_alv_table_create=>create_dynamic_table.
    we are using the 4.6 version.
    it is showing an error that 'Statemant cl_alv_table_create=>create_dynamic_table ( is not defined, Please check your spelling.
    but the same thing , working in ecc 6.0.
    Thanks in advance,
    Regards,

    Hello
    Most likely there is just a problem with the writing of the method call:
    DATA:
      lt_fcat    TYPE lvc_t_fcat,
      ldo_itab  TYPE REF TO data.
    "... fill fieldcatalog
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      IMPORTING
        it_fieldcatalog = lt_fcat
      EXPORTING
       ep_table          = ldo_itab.
    This coding should be syntactically correct. Perhaps you just need to add the following statement to your report (at the beginning):
    CLASS cl_alv_table_create DEFINITION LOAD.
    On 4.6c the system is not always able to do this itself. You need to explicitly make the class known.
    Regards
      Uwe

  • Dynamic internal table with problem

    Hi,
    I have developed a program to update standard table. I am using dynamic internal table creation concept. But my dynamic internal table is having width only 1200 bytes. But many standard tables have more than that width. Do you have any input create dynamic internal table with more than 1200 bytes width..
    Have a look at the error.
    [http://3.bp.blogspot.com/_O5f8iAlgdNQ/SjYXTBpO92I/AAAAAAAAErI/Fs996_APHbE/s1600-h/error-792463.JPG|http://3.bp.blogspot.com/_O5f8iAlgdNQ/SjYXTBpO92I/AAAAAAAAErI/Fs996_APHbE/s1600-h/error-792463.JPG]
    Expecting reply
    Thanks
    Venkat

    Hi,
    DATA: IT_TABSTRUC     TYPE STANDARD TABLE OF DFIES INITIAL SIZE 0,
            V_REF        TYPE REF TO DATA,
              V_I_AVL_CAT  TYPE TABLE OF LVC_S_FCAT.
    FIELD-SYMBOLS : <F_FS_DATA>   TYPE STANDARD TABLE.
    SELECTION-SCREEN:BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001
    NO INTERVALS.
    PARAMETERS: P_TABNAM TYPE X_TABNAME.
    SELECTION-SCREEN:END OF BLOCK B1.
      CALL FUNCTION 'DDIF_FIELDINFO_GET'
        EXPORTING
          TABNAME        = p_tabnam
          LANGU          = SY-LANGU
        TABLES
          DFIES_TAB      = IT_TABSTRUC
        EXCEPTIONS
          NOT_FOUND      = 1
          INTERNAL_ERROR = 2
          OTHERS         = 3.
      LOOP AT IT_TABSTRUC .
        V_LS_AVL_CAT-FIELDNAME = IT_TABSTRUC -FIELDNAME.
        V_LS_AVL_CAT-REF_TABLE = P_TABNAM.
        V_LS_AVL_CAT-REF_FIELD = IT_TABSTRUC -FIELDNAME.
        APPEND V_LS_AVL_CAT TO V_I_AVL_CAT.
      ENDLOOP.
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = V_I_AVL_CAT
        IMPORTING
          EP_TABLE        = V_REF.
      ASSIGN V_REF->* TO <F_FS_DATA>.
      FREE V_REF.
      SELECT * FROM (P_TABNAM) INTO CORRESPONDING
              FIELDS OF TABLE <F_FS_DATA> .
    Hope this resolves ur probs....

  • Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS

    Dear All,
    I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..
    Please suggest me on the way to overcome this problem..
    We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions
    So in my program I have the parameters to accept
    P_BEGDA - 01.10.2007
    P_INFTY - P0008
    P_ACTIO - COPY
    I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE
    BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP
    The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION
    ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode
    It gives the below possiblities
    "ASSIGN_BASE_TOO_SHORT" C 
    "SAPLHRMM" or "LHRMMU03"  
    "HR_INFOTYPE_OPERATION"   
    But If I use the below internal table
    Data : g_t_0008 like P0008 occurs 0 with header line.
    And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table
    field-symbols: <dyn_table> type standard table.
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat.
    to get the srurcute
    perform get_structure using l_f_table.
    perform create_dynamic_itab .
    assign dy_table->* to <dyn_table>.
    perform get_data tables <dyn_table01>
                      using pernr-pernr p_infty.
    below are the forms routine….
    form get_structure using p_table.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    clear : ifc[], dy_table.
    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.
    endform.
    *&      Form  get_data
    form get_data  tables   p_table
                   using    p_pernr
                            p_infty.
    clear : p_table, p_table[].
      CALL FUNCTION 'HR_READ_INFOTYPE'
           EXPORTING
                PERNR           = P_PERNR
                INFTY           = p_infty
                BEGDA           = p_datum
                ENDDA           = p_datum
           TABLES
                INFTY_TAB       = p_table
           EXCEPTIONS
                INFTY_NOT_FOUND = 1
                OTHERS          = 2.
      CHECK SY-SUBRC EQ 0.
    IF lines( p_table ) GT 0.
    *write :/'Record exist' , 'IT', p_infty.
    clear p_table.
    PERFORM hr_operation tables  p_table
                         using  g_t_t588d-actio g_t_t588d-INFTY
                                g_t_t588d-SUBTY.
    else.
    PERFORM append_status using g_t_itab-pernr p_infty ' '
                                'Error' 'No records'.
    ENDIF.
    endform.                    " get_data
    form hr_operation  tables    p_table
                       using     p_actio P_INFTY P_SUBTY.
    data: l_f_return    LIKE bapireturn1.
    ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.
          <l_field> = p_begda.
            CALL FUNCTION 'HR_INFOTYPE_OPERATION'
              EXPORTING
                infty         = P_infty
                number        = G_T_ITAB-PERNR
                subtype       = P_subty
                validityend   = g_f_endda
                validitybegin = P_datum
                record        = P_TABLE
                operation     = p_actio
              IMPORTING
                return        = l_f_return.
    IF sy-subrc NE 0.
    ENDIF.
    ENDFORM.

    try
    using field symbol for a wrk area instead of Field symbol for a table
    loop your inernal table (again a field symbol) assigning to <fs_wrkarea>
    in loop call HR_INFO.._OP..
    reward if helpful

  • Passing Dynamic Internal Table values to another program

    Hi,
    I have a program ZSAPNEW.
    In this I have created a Dynamic internal table <fs_emp>. The number of fields differ for each run. The values are passed into <fs_emp> in this program.  Now I need to submit thsi program from a main program ZHEAD and then display the values got from ZHEAD. For this I need to access the values retrieved from ZSAPNEW in <fs_emp> in ZHEAD. I cant figure out how to do this. I tried IMPORT ing the reference of teh field symbol too/ But its not allowing references in IMPORT/EXPORT. And since the table is of type ANY( as structure varies) I cant assign it to an internal table and then pass. Can some one suggest a solution please.
    Suzie

    Hi
    You need to know how the strcture of your table is generated In both programm:
    - Calling program:
    DATA: LR_VALUE_DESCR  TYPE REF TO CL_ABAP_ELEMDESCR,
          COMPONENT       TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
          LT_COMPONENTS   TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
    DATA: LT_STRUC        TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_TAB          TYPE REF TO CL_ABAP_TABLEDESCR.
    DATA: L_INDEX TYPE C.
    DATA: W_LINE          TYPE REF TO DATA,
          INT_TABLE       TYPE REF TO DATA.
    FIELD-SYMBOLS: <WA>    TYPE ANY,
                   <ITAB>  TYPE TABLE,
                   <VALUE> TYPE ANY.
    DO 4 TIMES.
      CLEAR COMPONENT.
      MOVE SY-INDEX TO L_INDEX.
      CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
      MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
      COMPONENT-TYPE = LR_VALUE_DESCR.
      INSERT COMPONENT INTO TABLE LT_COMPONENTS.
    ENDDO.
    * Workarea
    LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
                                                       P_STRICT     = 'X' ).
    CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
    ASSIGN W_LINE->* TO <WA>.
    * Table
    LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
    CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
    ASSIGN INT_TABLE->* TO <ITAB>.
    DO 3 TIMES.
      CLEAR <WA>.
      DO 4 TIMES.
        MOVE SY-INDEX TO L_INDEX.
        CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
        ASSIGN COMPONENT COMPONENT-NAME OF STRUCTURE <WA> TO <VALUE>.
        MOVE SY-INDEX TO <VALUE>.
      ENDDO.
      APPEND <WA> TO <ITAB>.
    ENDDO.
    DATA: WA_INDX TYPE INDX.
    WA_INDX-USERA = SY-UNAME.
    WA_INDX-PGMID = 'MAXMAX'.
    EXPORT TAB = <ITAB>
      TO DATABASE INDX(XY)
      FROM WA_INDX
      CLIENT SY-MANDT
      ID 'TABLE'.
    Called program:
    DATA: LR_VALUE_DESCR  TYPE REF TO CL_ABAP_ELEMDESCR,
          COMPONENT       TYPE CL_ABAP_STRUCTDESCR=>COMPONENT,
          LT_COMPONENTS   TYPE CL_ABAP_STRUCTDESCR=>COMPONENT_TABLE.
    DATA: LT_STRUC        TYPE REF TO CL_ABAP_STRUCTDESCR,
          LT_TAB          TYPE REF TO CL_ABAP_TABLEDESCR.
    DATA: L_INDEX TYPE C.
    DATA: W_LINE          TYPE REF TO DATA,
          INT_TABLE       TYPE REF TO DATA.
    FIELD-SYMBOLS: <WA>    TYPE ANY,
                   <ITAB>  TYPE TABLE,
                   <VALUE> TYPE ANY.
    DO 4 TIMES.
      CLEAR COMPONENT.
      MOVE SY-INDEX TO L_INDEX.
      CONCATENATE 'FIELD' L_INDEX INTO COMPONENT-NAME.
      MOVE CL_ABAP_ELEMDESCR=>GET_C( P_LENGTH = 4 ) TO LR_VALUE_DESCR.
      COMPONENT-TYPE = LR_VALUE_DESCR.
      INSERT COMPONENT INTO TABLE LT_COMPONENTS.
    ENDDO.
    * Workarea
    LT_STRUC = CL_ABAP_STRUCTDESCR=>CREATE( P_COMPONENTS = LT_COMPONENTS
                                                       P_STRICT     = 'X' ).
    CREATE DATA W_LINE TYPE HANDLE LT_STRUC.
    ASSIGN W_LINE->* TO <WA>.
    * Table
    LT_TAB = CL_ABAP_TABLEDESCR=>CREATE( P_LINE_TYPE = LT_STRUC ).
    CREATE DATA INT_TABLE TYPE HANDLE LT_TAB.
    ASSIGN INT_TABLE->* TO <ITAB>.
    DATA: WA_INDX TYPE INDX.
    WA_INDX-USERA = SY-UNAME.
    WA_INDX-PGMID = 'MAXMAX'.
    IMPORT TAB = <ITAB>
      FROM DATABASE INDX(XY)
      TO WA_INDX
      CLIENT SY-MANDT
      ID 'TABLE'.
    LOOP AT <ITAB> ASSIGNING <WA>.
      WRITE: / <WA>.
    ENDLOOP.
    The sample above use IMPORT/EXPORT from database: if the called program can't know the structure of the dynaic table, you need to transfer it by the same way you transfer the data
    Max

  • Problem with grid display in ALV for dynamic internal tables

    Hi,
    I am using dynamic internal tables in my program. To display it in grid format after populating it, I have used the following class and method. Here Im getting sy-subrc = 0 but, the grid is not getting displayed. Can some one pls help me with this.,
    DATA: W_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: w_tabname TYPE w_tabname.
    CREATE OBJECT W_GRID
    EXPORTING I_PARENT = CL_GUI_CONTAINER=>SCREEN0.
    CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = W_TABNAME
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
       IR_SALV_ADAPTER               =
      CHANGING
        IT_OUTTAB                     = <FS_1>
        IT_FIELDCATALOG               = LT_FIELDCATALOG2
       IT_SORT                       =
       IT_FILTER                     =
      EXCEPTIONS
        INVALID_PARAMETER_COMBINATION = 1
        PROGRAM_ERROR                 = 2
        TOO_MANY_LINES                = 3
        others                        = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Here, <FS_1> is the field symbol of table type and it holds all my data. and LT_FIELDCATALOG2  is the structure of my fieldcatalog
    Thanks and Regards,
    Avinash

    Hi Avinash,
    Either use parameter
    I_STRUCTURE_NAME = W_TABNAME
    or
    IT_FIELDCATALOG = LT_FIELDCATALOG2
    Both are not required.
    At the end of ur program simply use a write statement like below. Your program will work.
    IF SY-SUBRC 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Write /.      <----
    Thanks,
    Edited by: Sap Fan on Oct 6, 2009 7:17 AM

  • Problem with dynamic internal table updation

    Hello Folks,
      I created  a dynamic internal table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog           = i_fieldcat
          IMPORTING
            ep_table                  = i_dyntab
          EXCEPTIONS
            generate_subpool_dir_full = 1
            OTHERS                    = 2.
    ASSIGN i_dyntab->* TO <f_dyntable>.
    and created a work area
    CREATE DATA wg_f_split LIKE LINE OF <f_dyntable>.
        ASSIGN wg_f_split->* TO <f_wg_dyntable>.
    My requirement is that , i have to loop a normal internal table and append those records to the filed symbol internal table.
    READ TABLE i_normal_itab INTO wg_split INDEX wl_rows-index.
          IF sy-subrc EQ 0.
            ASSIGN wg_split to <f_wg_dyntable>.
             APPEND <f_wg_dyntable> to <f_dyntable>.
           endif.
    here i am geeting dump as "MOVE src TO dst" ... i can get the data in the work area FSymbol but cannot append it in Internal table Field Symbol.. Please help..
    <Added code tags>
    Edited by: Suhas Saha on Aug 3, 2011 10:52 AM

    Hello Sandra,
    Thanks for the reply..
    First i tried  appending the normal work area to the fieldsymbol  internal table.
      append wg_split to <f_dyntable>
    This is hiting dump the same dump and so i created a fieldsymbol work area. ( <f_wg_dyntable>.)and tried to append the field symbol internal table with this work area. which is again giving the dump
    APPEND <f_wg_dyntable> to <f_dyntable>. ( Again a Dump)
    Edited by: Charan-SAP on Aug 2, 2011 9:40 PM
    Edited by: Charan-SAP on Aug 2, 2011 9:42 PM

  • Problem in creating dynamic internal table

    Hi Experts,
    I am trying creating a dynamic internal table.
    But I am getting the error 'The field string "LT_GENTAB" contains no fields. 4 LT_GENTAB".
    Can anybody tell me what is the error and how to solve it.
    Thanks,
    Sudheer

    Hi,
    Please find the below code.
    data : wa_fieldcat type slis_fieldcat_alv,
           wa_fieldcat1 type slis_fieldcat_alv,
           wa_fieldcat2 type LVC_S_FCAT,
           it_fieldcat type slis_t_fieldcat_alv,
           it_fieldcat1 type slis_t_fieldcat_alv,
           it_fieldcat2 type LVC_T_FCAT,
           V_LAYOUT TYPE SLIS_LAYOUT_ALV,
           LS_LVC_FIELDCATALOGUE  TYPE LVC_S_FCAT,
           LT_LVC_FIELDCATALOGUE  TYPE LVC_T_FCAT,
           IT_EVENTS TYPE SLIS_T_EVENT,
           WA_EVENTS TYPE SLIS_ALV_EVENT.
    data : L_TABLE    TYPE REF TO DATA.
    FIELD-SYMBOLS :  <IT_TABLE>    TYPE STANDARD TABLE.
    FIELD-SYMBOLS :  <IT_ITEM1>    TYPE STANDARD TABLE.
    v_col = 1.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PRUEFLOS'.
    wa_fieldcat2-seltext   = 'Inspection Lot'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'WERKS'.
    wa_fieldcat2-seltext   = 'Plant'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ART'.
    wa_fieldcat2-seltext   = 'Inspection Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'HERKUNFT'.
    wa_fieldcat2-seltext   = 'Lot Origin'.
    WA_FIELDCAT1-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'STAT35'.
    wa_fieldcat2-seltext   = 'Usage Decision Made'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ENSTEHDAT'.
    wa_fieldcat2-seltext   = 'Lot created on'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'ERSTELLER'.
    wa_fieldcat2-seltext   = 'Created by'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PASTRTERM'.
    wa_fieldcat2-seltext   = 'Insp. Start Date'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PAENDTERM'.
    wa_fieldcat2-seltext   = 'End of Inspection'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'PLNTY'.
    wa_fieldcat2-seltext   = 'Task List Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'AUFNR'.
    wa_fieldcat2-seltext   = 'Order No.'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KTEXTMAT'.
    wa_fieldcat2-seltext   = 'Object short text'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KURZTEXT'.
    wa_fieldcat2-seltext   = 'Short Text for Code'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'KATALGART1'.
    wa_fieldcat2-seltext   = 'Catalog Type'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'GRUPPE1'.
    wa_fieldcat2-seltext   = 'Code Group'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'CODE1'.
    wa_fieldcat2-seltext   = 'Code'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    *WA_FIELDCAT2-COL_POS = v_col.
    *WA_FIELDCAT2-FIELDNAME = 'ORIGINAL_INPUT'.
    *WA_FIELDCAT2-SELTEXT_M   = 'Original Value'.
    **WA_FIELDCAT2-OUTPUTLEN   = 20.
    *v_col = v_col + 1.
    *APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    *CLEAR  WA_FIELDCAT2.
    loop at it_qamv1 into wa_qamv1.
      read table it_qasr into wa_qasr with key wa_qamv1-prueflos.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = wa_qamv-kurztext.
    wa_fieldcat2-seltext   = wa_qasr-original_input.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    endloop.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'EQUNR'.
    wa_fieldcat2-seltext   = 'Equipment'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'TPLNR'.
    wa_fieldcat2-seltext   = 'Functional Location'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'TPLMA'.
    wa_fieldcat2-seltext   = 'Superior Funct Loc.'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'STATUS'.
    wa_fieldcat2-seltext   = 'Status'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    WA_FIELDCAT2-COL_POS = v_col.
    WA_FIELDCAT2-FIELDNAME = 'INACT'.
    wa_fieldcat2-seltext   = 'Status Inactive'.
    WA_FIELDCAT2-OUTPUTLEN   = 20.
    v_col = v_col + 1.
    APPEND WA_FIELDCAT2 TO IT_FIELDCAT2.
    CLEAR  WA_FIELDCAT2.
    Create internal table dynamic
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_FIELDCATALOGUE
        IMPORTING
          EP_TABLE        = L_TABLE.
      ASSIGN L_TABLE->* TO <IT_TABLE>.
    I am getting the error when the method  CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
    is executed.
    Please help me
    Thanks,
    Sudheer

  • Problem disalying alv using dynamic internal table

    Hi All,
        I have 4 radiobutton for each radiobutton there is one internaltable to be displayed in alv.
    My requirement is intead of calling the function module reuse_alv_grid_display everytime for
    each of the internal table I want to create a dynamic internal tble for the function module.
       My question is how to create a dynamic internal table which will hold the fields & data of
    different interna table when diffrent radiobuttons are checked.
       Areciate your time to help.
       Thank you very much.

    Hi follow following logic:
    field-symbols: <i_table> type standard table.
    when rb1 is checked.
    assign itab1 to <i_table>.
    perform alv_disp using <i_table>
    when rb2 is checked.
    assign itab2 to <i_table>.
    perform alv_disp using <i_table>
    when rb3 is checked.
    assign itab3 to <i_table>.
    perform alv_disp using <i_table>
    when rb4 is checked.
    assign itab4 to <i_table>.
    perform alv_disp using <i_table>
    <<<<<<<<<<form alv_disp
    form alv_disp  using p_i_table type standard table.
    perform create fieldcatelog changing i_fc
    call the fm and pass the table p_i_table and i_fc
    <<<<<<<<<< form create fieldcaelog
    here create field catelog ..either by fm reuse_alv_fieldcatelog_merge ...in this just pass the structure name based on the radiobutton
    hope its useful

  • 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

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

  • 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

  • Passing dynamic internal table into ALV

    I have made one ALV report where i had created one button 'GENERATE'.  ON CLICKING THIS BUTTON the data in the ALV report is downloaded to excel file.
    i have used this:-
    CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = l_title
          default_extension    = 'XLS'
          initial_directory    = 'C:\'
        CHANGING
          filename             = filename
          path                 = path
          fullpath             = fullpath
          user_action          = user_action
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    Check which button is pressed
      IF user_action <> cl_gui_frontend_services=>action_ok.
        EXIT.
      ENDIF.
    Download error data collected from the internal table
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          filename                = fullpath
          filetype                = 'ASC'
          write_field_separator   = '#'
         codepage                = '4103'
         write_bom               = c_true
        CHANGING
          data_tab                = gi_final
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          not_supported_by_gui    = 22
          error_no_gui            = 23
          OTHERS                  = 24.
    If selection is successful
      IF sy-subrc EQ 0.
        MESSAGE s004 . " File  created successfully
      ELSE.
        MESSAGE i005 . " File is not created successfully
      ENDIF.
    In the table i have passed the internal table . this is working fine.
    <b>But,
    The problem is if i want to display the data in diferent layout based on selection screen criteria the data downloaded are same as default layout.
    how to pass a dynamic internal table in the
    CALL METHOD cl_gui_frontend_services=>gui_download</b>

    Hi    ,
    here is the Program for  Download  
    REPORT yrs_download_transport_request.
    PARAMETERS:
      p_reqest TYPE trkorr OBLIGATORY,
      p_folder(255) TYPE c LOWER CASE, p_sepr OBLIGATORY.
    DATA:
      folder TYPE string,
      retval LIKE TABLE OF ddshretval WITH HEADER LINE,
      fldvalue LIKE help_info-fldvalue,
      transdir TYPE text255,
      filename(255),
      trfile(20) TYPE c,
      datatab TYPE TABLE OF text8192 WITH HEADER LINE,
      len TYPE i,
      flen TYPE i.
    TYPE-POOLS: sabc, stms, trwbo.
    INITIALIZATION.
      CONCATENATE sy-sysid 'K*' INTO p_reqest.
      IF sy-opsys = 'Windows NT'.
        p_sepr = ''.
      ELSE.
        p_sepr = '/'.
      ENDIF.
    *  CALL FUNCTION 'WSAF_BUILD_SEPARATOR'
    *       IMPORTING
    *            separator                  = p_sepr
    *       EXCEPTIONS
    *            separator_not_maintained   = 1
    *            wrong_call                 = 2
    *            wsaf_config_not_maintained = 3
    *            OTHERS                     = 4.
    *  IF sy-subrc NE 0.
    *    MESSAGE s001(00)
    *      WITH
    *      'Unable to find out the separator symbol for the system.'(011).
    *  ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_reqest.
      DATA:
        tt_system TYPE TABLE OF tmscsys WITH HEADER LINE,
        es_selected_request TYPE trwbo_request_header,
        es_selected_task TYPE trwbo_request_header,
        iv_organizer_type TYPE trwbo_calling_organizer,
        is_selection TYPE trwbo_selection.
      iv_organizer_type = 'W'. is_selection-reqstatus = 'R'.
      CALL FUNCTION 'TR_PRESENT_REQUESTS_SEL_POPUP'
        EXPORTING
          iv_organizer_type   = iv_organizer_type
          is_selection        = is_selection
        IMPORTING
          es_selected_request = es_selected_request
          es_selected_task    = es_selected_task.
      p_reqest = es_selected_request-trkorr.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
      DATA: title TYPE string.
      title = 'Select target folder'(005).
      CALL METHOD cl_gui_frontend_services=>directory_browse
        EXPORTING
          window_title    = title
        CHANGING
          selected_folder = folder
        EXCEPTIONS
          cntl_error      = 1
          error_no_gui    = 2
          OTHERS          = 3.
      CALL FUNCTION 'CONTROL_FLUSH'
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      p_folder = folder.
    AT SELECTION-SCREEN ON p_reqest.
      DATA: request_info TYPE stms_wbo_request,
            request_infos TYPE stms_wbo_requests.
      REFRESH request_infos.
      CALL FUNCTION 'TMS_MGR_READ_TRANSPORT_REQUEST'
        EXPORTING
          iv_request                 = p_reqest
          iv_header_only             = 'X'
        IMPORTING
          et_request_infos           = request_infos
        EXCEPTIONS
          read_config_failed         = 1
          table_of_requests_is_empty = 2
          system_not_available       = 3
          OTHERS                     = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CLEAR request_info.
      READ TABLE request_infos INTO request_info INDEX 1.
      IF sy-subrc NE 0
      OR request_info-e070-trkorr IS INITIAL.
        MESSAGE e398(00) WITH 'Request'(006) p_reqest 'not found'(007).
      ELSEIF request_info-e070-trstatus NE 'R'.
        MESSAGE e398(00)
        WITH 'You must release request'(008)
             request_info-e070-trkorr
             'before downloading'(009).
      ENDIF.
    START-OF-SELECTION.
      folder = p_folder.
      CONCATENATE p_reqest+3(7) '.' p_reqest(3) INTO trfile.
      CALL FUNCTION 'RSPO_R_SAPGPARAM'
        EXPORTING
          name   = 'DIR_TRANS'
        IMPORTING
          value  = transdir
        EXCEPTIONS
          error  = 0
          OTHERS = 0.
      PERFORM copy_file USING 'cofiles' trfile.
      trfile(1) = 'R'.
      PERFORM copy_file USING 'data' trfile.
      trfile(1) = 'D'.
      PERFORM copy_file USING 'data' trfile.
    * FORM copy_file *
    * --> SUBDIR * * --> FNAME *
    FORM copy_file USING subdir fname.
      DATA:
        auth_filename TYPE authb-filename,
        gui_filename TYPE string.
      CONCATENATE transdir subdir fname
        INTO filename
        SEPARATED BY p_sepr.
      REFRESH datatab.
      CLEAR flen.
      auth_filename = filename.
      CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
        EXPORTING
          activity         = sabc_act_read
          filename         = auth_filename
        EXCEPTIONS
          no_authority     = 1
          activity_unknown = 2
          OTHERS           = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_NEGATIVE.
        WRITE: / 'Read access denied. File'(001),
                  filename.
        FORMAT COLOR OFF. EXIT.
      ENDIF.
      OPEN DATASET filename FOR INPUT IN BINARY MODE.
      IF sy-subrc NE 0.
        FORMAT COLOR COL_TOTAL.
        WRITE: / 'File open error'(010), filename.
        FORMAT COLOR OFF. EXIT.
      ENDIF.
      DO.
        CLEAR len.
        READ DATASET filename INTO datatab LENGTH len.
        flen = flen + len.
        IF len > 0. APPEND datatab. ENDIF.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
      ENDDO.
      CLOSE DATASET filename.
      CONCATENATE p_folder '' fname INTO gui_filename.
      CALL METHOD cl_gui_frontend_services=>gui_download
        EXPORTING
          bin_filesize            = flen
          filename                = gui_filename
          filetype                = 'BIN'
        CHANGING
          data_tab                = datatab[]
        EXCEPTIONS
          file_write_error        = 1
          no_batch                = 2
          gui_refuse_filetransfer = 3
          invalid_type            = 4
          no_authority            = 5
          unknown_error           = 6
          header_not_allowed      = 7
          separator_not_allowed   = 8
          filesize_not_allowed    = 9
          header_too_long         = 10
          dp_error_create         = 11
          dp_error_send           = 12
          dp_error_write          = 13
          unknown_dp_error        = 14
          access_denied           = 15
          dp_out_of_memory        = 16
          disk_full               = 17
          dp_timeout              = 18
          file_not_found          = 19
          dataprovider_exception  = 20
          control_flush_error     = 21
          OTHERS                  = 24.
      IF sy-subrc = 0.
        WRITE: / 'File'(002), filename, 'downloaded. Length'(003), flen.
      ELSE.
        FORMAT COLOR COL_NEGATIVE.
        WRITE: / 'File download error. Filename:'(004), filename.
        FORMAT COLOR OFF.
      ENDIF.
    ENDFORM. "copy_file
    Reward  points if it is usefull....
    Girish

  • Dynamic internal table- column to row conversion

    Hello all,
    Inside a program i generate a dynamic internal table and
    This table has one single column. But I need to convert the rows as columns.
    Eg:
    dynamic internal table ITAB has content
    Forbes
    Times
    Reuters
    Warner
    stern
    I would like to have a ITAB2 like this
    Forbes Times Reuters Warner Stern
    Please note this is a Dynamic internal table!!!!
    I need some approach for my problem. Thanks a lot in advance.
    Karthik.

    Hi karthik,
    1.
      For this purpose,
      in my program,
    <b>  there is an INDEPENDENT FORM</b>
       whose inputs are
    <b>  LIST OF FIELDS, (just as u require)</b> 
    and from those, it consructs dynamic table.
    2. Here is the program.
    the dynamic table name will be
    <DYNTABLE>.
    3. U can use this program (FORM in this program)
    to generate any kind of internal table
    by specifying list of fields.
    4.
    REPORT abc.
    COMPULSORY
    FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
    FIELD-SYMBOLS: <dynline> TYPE ANY.
    DATA: lt TYPE lvc_t_fcat.
    DATA: ls TYPE lvc_s_fcat.
    FIELD-SYMBOLS: <fld> TYPE ANY.
    DATA : fldname(50) TYPE c.
    DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    field list
      ddfields-fieldname = 'BUKRS'.
      APPEND DDFIELDS.
      ddfields-fieldname = 'MATNR'.
      APPEND DDFIELDS.
      PERFORM mydyntable .
    see <DYNTABLE> in debug mode.
      BREAK-POINT.
    INDEPENDENT FORM
    FORM mydyntable .
    Create Dyn Table From FC
      FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
      FIELD-SYMBOLS: <fs_1>.
      FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
      DATA: lt_data TYPE REF TO data.
      data : lt TYPE lvc_t_fcat .
    CONSTRUCT FIELD LIST
      LOOP AT ddfields.
        ls-fieldname = ddfields-fieldname.
        APPEND ls TO lt.
      ENDLOOP.
      ASSIGN lt_data TO <fs_data>.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = lt
        IMPORTING
          ep_table                  = <fs_data>
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
      ENDIF.
    Assign Dyn Table To Field Sumbol
      ASSIGN <fs_data>->* TO <fs_1>.
      ASSIGN <fs_1> TO <fs_2>.
      ASSIGN <fs_1> TO <dyntable>.
    ENDFORM. "MYDYNTABLE
    regards,
    amit m.

  • Defining Dynamic Internal Table

    Hi everybody,
    I would like to create a dynamic internal table without knowing its structure. I have stored the DDIC field elements that have to be used in a customizing table. I would like to create the internal table depending on the field elements order. The goal is to be able to pass this internal table to an Adobe Forms.
    For example, in some cases I might have to print fieldu2019s content 1, 2, 3, and 4 but in other cases I might have to print fields 3, 1, 4 and 2. I do not know in which order the fields have to be printed.
    I am struggling with the techniques I should use to create my internal table. I do not know if I should use Field Symbols or else.
    Could you provide any coding examples?
    Thanks in advance for your help.
    Best regards,
    Sylvain

    Hi Sylvain
    I have the same requirement to pass the internal table with varying number of columns in the adobe form and the same should be display in the form.,
    i have passed the dynamic internal table from the abap code to the adobe interface and checked teh same value are passed.
    Tried the below solution:
    1)Defined the field symbol of the type Standard table(beacuse the structure for table is not fixed) in the adobe Interface.
    2)Assign the values of the internal table into the field symbol by:
       READ TABLE im_t_output INTO ls_output INDEX 1.
      ASSIGN ls_output-ZALVTAB->* TO <GT_T_OUTPUT>.
    Already checked , the values are coming into the <GT_T_OUTPUT> field symbols.
    3) Drag the field symbol <GT_T_OUTPUT> from the adobe interface to the data context of the form.
    when i am running the program its giving dump with the following error.
    "You attempted to move one data object to another.
      This is not possible here because the conversion of a data object
      of type "h" to type "g" is not supported."
    I think that is beacuse in the form it ia taking the field symbol as the text value not the internal table .
    As you have already solved the problem to pass the internal table of varying number of columns in the adobe for.
    Request you to provide me the code or some guidelines so that i can achieve the same and also request to share hoe you have read the values of the internal table in the adobe form through the adove form language.
    Thanks in advance.
    Regards,
    Sourabh Makhija

Maybe you are looking for

  • How to fade in and fade out buttons ???

    Hi guys I am building a website and I need help to fade in/ fade out buttons. Here is an example : My main goal is that when I roll over the services button, I want the submenu (corporate and weddings) to fade in. Then when I roll over the portfolio

  • Another question about import/export to excel file?

    Hi, I need to know urgently if it's possible to import/export excel files from/to JSP with unpredicted number of fields each row. For example, row 1 in the excel file can have 5 columns of data, row 2 has 3 columns of data, etc... Does reading from e

  • DDP 2.0 file - Errors found by Technicolor

    I sent off a DDP 2.0 file to Technicolor last week and when they loaded it up into their system tons of errors came back. It is a very simple DVD project. 2 motion menu pages. One hour long show. Thats it. Below is a read-out of their error log. Anyo

  • I want to run program in applet

    I wrote program in applet using Fote for java CE , but can't run it . please, help me!

  • Fireworks CS5 not opening.

    Hey. So here's my problem. I've been using Fireworks (On Windows) for years but have recently jumped over to Mac OSX Snow Leopard and CS5 Master Collection. Now, my whole suite works perfectly, I can open PS, DW, everything, and they work beautifully