Logic required for a Internal table  issue

Hi All,
I have 2 internal table. I need STLNR value to another internal table. Both having same field. But while reading from one internal table to another internal table using IDNRK key, One idnrk having 2 different stlnr value. But its taking only one. How to take both the values?
The internal table value like below.
it_stpo--> This is first table, Here one Idnrk having different stlnr value. I need the same in to next table. Here i read with idnrk field but its taking one stlnr value only into next table.
How to change the logic ?
Below is it_stpo table and next one is it_mbew_1
it_stpo
STLNR     IDNRK             MENGE
17224     00439RM1     2.3
17225     00439RM1     4.2
172333     00849RM2     5.6
172158     00432TM3     7.2
152164     00583RM4     8.4
176123     00583RM4     2.3
it_mbew_1
STLNR     IDNRK             STPRS
     00439RM1     111.22
     00439RM1     126.45
     00849RM2     3.3364
     00432TM3     15.5888
     00583RM4     0
     00583RM4     0.235
My logic like below,
          SORT it_stpo BY idnrk.
          SORT it_mbew_1 BY matnr.
          LOOP AT it_mbew_1 INTO wa_mbew_1.
            READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr BINARY SEARCH.
            IF sy-subrc = 0.
              wa_mbew_1-stlnr = wa_stpo-stlnr.
              MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
            ENDIF.
          ENDLOOP.
Kindly help us.
Mohana

Try below logic.
add one more field to it_stpo flag type char01.
update the field with value 'X'.
SORT it_stpo BY idnrk.
          SORT it_mbew_1 BY matnr.
          LOOP AT it_mbew_1 INTO wa_mbew_1.
            CLEAR WA_STPO.
            READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_mbew_1-matnr                                                                               
flag = 'X'.
            if sy-subrc eq 0.
                     move ' ' to wa_stpo-flag.
                     modify it_stpo from wa_stpo index sy-tabix.
                      wa_mbew_1-stlnr = wa_stpo-stlnr.
                     MODIFY it_mbew_1 FROM wa_mbew_1 TRANSPORTING stlnr WHERE matnr = wa_mbew_1-matnr.
             endif.
          ENDLOOP.
Regards
Vinod

Similar Messages

  • How to get the NameTab Structure(X031L) for Dynamic internal table?

    when we pass standard table to the FM 'DD_GET_NAMETAB' we will get the
    nametab structure(x031l), like this i want to get the same structure for
    dynamic internal  table . how can I achieve this
    please help me...

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

  • To create a deep structure for dynamic internal table.

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

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

  • SMART FORMS- data from  internal table issue

    Hi ,
           I have a smart form in which I have to print three types of materials of Material Types say M1, M2 ,M3.
    In the SMART FORM,Main Window, I have created 3 TABLES for 3 types of Materials ie,
               TableM1,
               TableM2,
               TableM3.
    The internal tables to populate these TABLES are
    ( passing from Print program ).
                t_M1,
                t_M2,
                t_M3
    The Number of FIELDS vary in all the tables ,thats why I have created 3 internal tables for Diff Material Types.
    But only first TABLE is getting printed ie data inside TableM2, TableM3 are not getting printed.
    Can any SMARTFORM Gurus please let me know how I can solve this issue.
    Regards
    Avi

    Hi,
       Check whether you are mentioning any condition on the data. There are different possibilites of not getting printed. Like the way your displaying, data is in table.
    Can you please clearly mention how did you populated the internal table and kept the logic to print the values in the table. So that it problem would be  more clearly nown.
    Br,
    Laxmi

  • How to create New columns for the Internal Table Dynamically?

    HI Guys,
                          In my logic i have to create new columns depending on the logic which i am executing.
    My requirement is .I have to display o/p like this
    Material || Year || Period  ||  Mix ratio || Vendor ||Mix Ratio || Vendor || Mix Ratio Vendor || Mix ratio || Vendor || Mix ratio.............................from table's CKMLMV003 and CKMLMV001.Her i have to display the o/p in the above format and i have to display Vendor and Mix Ratio for 5 columns irrespective of data .If i have more than 5 columns for any record then i have to create a New columns dynamically for Vendor and Mix ratio.If anybody want my code i can Submit But plz tell with example how to do?
                    <b>The O/P must be finally shown in ALV Grid</b>
    Thanks,
    Gopi

    You must create the entire internal table dynamically, you can not add columns to a statically define internal table.  Here is an example of creating a dynamic internal table.
    Creation of internal table dynamically based on the Date Range entered
    Regards,
    Rich Heilman

  • Totals for the internal table field in alv

    Hi Gurus,
    I have an issue in displaying the totals in alv.
    I have an internal table with the three fields like below.
    scrap_code_001 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_002 like afru-xmnga, " Scrap Reason Qty.
    scrap_code_003 like afru-xmnga, " Scrap Reason Qty.
    In the output table which i am passing to the fieldcatlog is having the three above fields with values 10,3,4 respectively.
    I am looping at the internal table
    loop at gt_grund.
    gv_tabix = sy-tabix.
    i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum = gc_x.
    perform assign_alv_qty_format.
    if gt_grund-grund is initial.
    gt_grund = 'NONE'.
    gv_text = gt_grund.
    else.
    gv_text = gt_grund-grdtx.
    endif.
    gv_tabixn = gv_tabix.
    gv_scrap_code+11(03) = gv_tabixn.
    gv_fieldname = gv_scrap_code.
    translate gv_fieldname to upper case.
    perform bild_fieldcat using
    gv_fieldname 'GT_REPORT' 'AFRU' gv_text 'QUAN' '12' ' ' .
    endif.
    endloop.
    But in the output I am getting the totals but it displays totals for all the three columns as 17,17,17 (summing 10,3,4).
    How do I display total as 10,3,4 for each column separately.
    I appreciate you help and award points for the answer

    Hi,
    Please check if value fields i_fieldcat-ref_fieldname and i_fieldcat-ref_tabname regard to numc or curr type.
    EX: i_fieldcat-ref_fieldname = 'WRBTR'
           I_fieldcat-ref_tabname = 'BSEG'.
    Regards,
    Fernando

  • Help on ALV GRID display outputting format for 2 internal tables

    Hi,
        I have requirement in ALV GRID where I need to display the data from 2 internal tables. The first internal table has the content of Delivery due list data and second the internal table has the corresponding stock transfer data of the Delivery Due list. I have a checbox on my selection screen, when unchecked it should output the 1st internal table data, i.e for Delivery due list. When it is checked then it should output 1st Internal table data + 2nd internal table data of stock transfer. For example, 1 document delivery due list data and 2nd line for that document should show the stock transfer data. You can also check the transaction code VL10E for that will show a delivery due list...and for stock tranfer,you need to check with Purchase order in in the USer Role tabstrip. Pls suggest.
    Regards,
    Mira

    Hi,
    U can try out this code
    REPORT zzz_test NO STANDARD PAGE HEADING
                           MESSAGE-ID zz.
    The Data Declarations
    INCLUDE zzm_test_alv_data.
    The Selection Screen Definition
    INCLUDE zzm_test_alv_selscrn.
    The definition and implementation of the event reciever class
    INCLUDE zzm_test_alv_class.
    START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM f1000_load_itabs.
    END-OF-SELECTION
    END-OF-SELECTION.
      IF NOT cb_disp IS INITIAL.
        CALL SCREEN 9001.
      ENDIF.
    Include for getting data
      INCLUDE zzm_test_alv_forms.
    Include for PAI and PBO of screen
      INCLUDE zzm_test_alv_screen.
      INCLUDE ZZM_TEST_ALV_DATA                                          *
    This include has all the data declaration defined
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    Table Declarations:
    TABLES: mara,
            makt.
    Internal Tables:
    The following structure type must be defined in the data dictionary
    DATA:  i_fieldcat  TYPE lvc_t_fcat,
           i_fieldcat1 TYPE lvc_t_fcat,
           i_output1   TYPE STANDARD TABLE OF mara,
           i_output2   TYPE STANDARD TABLE OF makt,
    Work Areas:
           w_output1   TYPE STANDARD TABLE OF mara,
           w_output2   TYPE STANDARD TABLE OF makt.
    Variable:
    DATA: lv_repid    LIKE sy-repid.
    lv_repid = sy-repid.
      INCLUDE ZZM_TEST_ALV_SELSCRN                                       *
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    SELECTION-SCREEN BEGIN OF BLOCK b_main WITH FRAME TITLE text-001.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: cb_disp AS CHECKBOX.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN END OF BLOCK b_main.
      INCLUDE ZZM_TEST_ALV_CLASS                                         *
    This include has all the data declaration defined for ALV
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    INCLUDE <icon>.
    Predefine a local class for event handling to allow the
    declaration of a reference variable before the class is defined.
    DATA : o_alvgrid1 TYPE REF TO cl_gui_alv_grid ,
           o_alvgrid2 TYPE REF TO cl_gui_alv_grid ,
           cont_for_cognos1   TYPE scrfname VALUE 'BCALC_GRID_01_9100',
           cont_for_cognos2   TYPE scrfname VALUE 'BCALC_GRID_01_9200',
           custom_container1 TYPE REF TO cl_gui_custom_container,
           custom_container2 TYPE REF TO cl_gui_custom_container,
          Work Area
           w_layout TYPE lvc_s_layo ,
           w_variant TYPE disvariant.
          Constants
    CONSTANTS : c_lay(1) TYPE c VALUE 'A' .                  " All Layouts
    CONSTANTS: BEGIN OF c_main_tab,
               tab1 LIKE sy-ucomm VALUE 'MAIN_TAB_FC1',   "
               tab2 LIKE sy-ucomm VALUE 'MAIN_TAB_FC2',   "
               END OF c_main_tab.
      INCLUDE ZZM_TEST_ALV_FORMS                                         *
    This Include has the various forms used in the program
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    *&      Form  f9001_build_field_cat
          To Build Field Catalog
         -->P_I_FIELDCAT  text
         -->P_0021   text
    FORM f9001_build_field_cat TABLES   p_fieldcat STRUCTURE lvc_s_fcat
                          USING value(p_structure).
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
           EXPORTING
                i_structure_name       = p_structure
           CHANGING
                ct_fieldcat            = p_fieldcat[]
           EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH 'Error in ALV field catalogue creation'.
                                                                " text-e05.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " f9001_build_field_cat
    *&      Form  f9000_objects_create
          For creating Custom Containers
    -->  p1        text
    <--  p2        text
    FORM f9000_objects_create.
      CREATE OBJECT custom_container1
          EXPORTING
              container_name = cont_for_cognos1
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      CREATE OBJECT custom_container2
          EXPORTING
              container_name = cont_for_cognos2
          EXCEPTIONS
              cntl_error = 1
              cntl_system_error = 2
              create_error = 3
              lifetime_error = 4
              lifetime_dynpro_dynpro_link = 5.
      IF sy-subrc NE 0.
    add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'The control could not be created'(510).
      ENDIF.
      CREATE OBJECT o_alvgrid1
           EXPORTING i_parent = custom_container1.
      CREATE OBJECT o_alvgrid2
           EXPORTING i_parent = custom_container2.
    ENDFORM.                    " f9000_objects_create
    *&      Form  f9003_layout
          To define the layout
         -->P_SY_TITLE  text
         -->P_0030   text
         -->P_0031   text
         -->P_0032   text
    FORM f9003_layout USING  value(ptitle)
                             value(pzebra)
                             value(pmode)
                             value(pwidth).
      w_layout-grid_title  = ptitle.
      w_layout-zebra       = pzebra.
      w_layout-sel_mode    = pmode.
      w_layout-cwidth_opt  = pwidth.
      w_variant-report     = sy-repid.
    ENDFORM.                    " f9003_layout
    *&      Form  f9006_error_handle
         To handle event
         -->P_PTEXT  text
    FORM f9006_error_handle USING value(ptext).
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = text-e03 " Error Note
                  txt2  = sy-subrc
                  txt1  = ptext.
      ENDIF.
    ENDFORM.                    " f9006_error_handle
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
      CALL METHOD custom_container1->free.
      CALL METHOD custom_container2->free.
      CALL METHOD cl_gui_cfw=>flush.
      IF sy-subrc NE 0.
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = lv_repid
                  txt2  = sy-subrc
                  txt1  = 'Error in FLush'(500).
      ENDIF.
    ENDFORM.
    *&      Form  f1000_load_itabs
          Select from Database
    -->  p1        text
    <--  p2        text
    form f1000_load_itabs.
      SELECT * FROM mara
               INTO TABLE i_output1
               UP TO 50 rows.
      SELECT * FROM makt
               INTO TABLE i_output2
               UP TO 50 rows.
    endform.                    " f1000_load_itabs
      INCLUDE ZZM_TEST_ALV_SCREEN                                        *
    2/ Description / Include functions
    This include contains PBO and PAI events for the screen of report
    ZZZJJ_TEST_ALV
    3/ Responsibility
    Author............: Judith Jessie Selvi
    Creation Date.....: 28/03/2005
    DATA FOR TABSTRIP 'MAIN_TAB'
    CONTROLS:  main_tab TYPE TABSTRIP.
    DATA:      BEGIN OF i_main_tab,
                 subscreen   LIKE sy-dynnr,
                 prog        LIKE sy-repid VALUE
                                  'ZZZ_TEST',
                 pressed_tab LIKE sy-ucomm VALUE c_main_tab-tab1,
               END OF i_main_tab.
    *&      Module  STATUS_9001  OUTPUT
          text
    MODULE status_9001 OUTPUT.
    IF custom_container1 IS INITIAL.
      SET PF-STATUS 'ZSTATUS'.
      SET TITLEBAR 'ZTITLE'.
      Creating Object
        PERFORM f9000_objects_create.
      Building the field catalog
        PERFORM f9001_build_field_cat TABLES i_fieldcat
                                USING 'MARA'.
        PERFORM f9001_build_field_cat TABLES i_fieldcat1
                                USING 'MAKT'.
      Modifying the field catalog
       PERFORM f9002_modify_field_cat TABLES i_fieldcat.
      For Layout
        PERFORM f9003_layout USING sy-title 'X' 'B' 'X'.
    ENDIF.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  MAIN_TAB_ACTIVE_TAB_SET  OUTPUT
          Call method to display in the output grid
    MODULE main_tab_active_tab_set OUTPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
      To display report
         i_main_tab-subscreen = '9100'.
          CALL METHOD o_alvgrid1->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output1[]
             it_fieldcatalog               = i_fieldcat[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
        WHEN c_main_tab-tab2.
      To display report
          i_main_tab-subscreen = '9200'.
          CALL METHOD o_alvgrid2->set_table_for_first_display
          EXPORTING
             is_variant                    = w_variant
             i_save                        = c_lay
             is_layout                     = w_layout
          CHANGING
             it_outtab                     = i_output2[]
             it_fieldcatalog               = i_fieldcat1[]
          EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i005 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
    WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET OUTPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_GET INPUT
          Check & Process the selected Tab
    MODULE main_tab_active_tab_get INPUT.
      CASE sy-ucomm.
        WHEN c_main_tab-tab1.
          i_main_tab-pressed_tab = c_main_tab-tab1.
        WHEN c_main_tab-tab2.
          i_main_tab-pressed_tab = c_main_tab-tab2.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_GET INPUT
    *&      Module USER_COMMAND_9001 INPUT
          User Command
    MODULE user_command_9001 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          PERFORM exit_program.
          SET SCREEN '0'.
        WHEN 'EXIT' OR  'CANC'.
          PERFORM exit_program.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 “USER_COMMAND_9000 INPUT
    *&      Module MAIN_TAB_ACTIVE_TAB_SET INPUT
          Set sunscreen
    MODULE main_tab_active_tab_set INPUT.
      main_tab-activetab = i_main_tab-pressed_tab.
      CASE i_main_tab-pressed_tab.
        WHEN c_main_tab-tab1.
            i_main_tab-subscreen = '9100'.
        WHEN c_main_tab-tab2.
            i_main_tab-subscreen = '9200'.
        WHEN OTHERS.
         DO NOTHING
      ENDCASE.
    ENDMODULE.                 “MAIN_TAB_ACTIVE_TAB_SET INPUT
    Thanks & Regards,
    Judith.

  • No extended memory for the internal table

    Hi all,  I created one filed in the selection screen with f4 help, this is the code i writtenAT SELECTION-SCREEN ON VALUE-REQUEST FOR PA_BKTXT.
    SELECT  BKTXT  INTO TABLE T_BKTXT from mkpf.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
      EXPORTING
      DDIC_STRUCTURE         = ' '
        RETFIELD               =  'BKTXT'
      PVALKEY                = ' '
       DYNPPROG               = SY-CPROG
       DYNPNR                 = SY-DYNNR
       DYNPROFIELD            = 'PA_BKTXT'
      STEPL                  = 0
    WINDOW_TITLE           = ' '
      VALUE                  = ' '
       VALUE_ORG              = 'S'
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
      TABLES
        VALUE_TAB              = T_BKTXT
      FIELD_TAB              =
      RETURN_TAB             =
      DYNPFLD_MAPPING        =
    EXCEPTIONS
      PARAMETER_ERROR        = 1
      NO_VALUES_FOUND        = 2
       OTHERS                 = 3.
    IF SY-SUBRC <> 0.
    REFRESH T_BKTXT.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>and the internal table i declared is</b>  DATA: BEGIN OF T_BKTXT OCCURS 0,
      PA_BKTXT type MKPF-BKTXT,
      END OF T_BKTXT. please let me know how to solve this issue.

    Hi  friend  ... please see this 
    Here is the example program for the F4 impelemting to the Selection Parameter ..
    REPORT demo_dynpro_f4_help_module .
    TYPES: BEGIN OF values,
             carrid TYPE spfli-carrid,
             connid TYPE spfli-connid,
           END OF values.
    DATA: carrier(3) TYPE c,
          connection(4) TYPE c.
    DATA: progname TYPE sy-repid,
          dynnum   TYPE sy-dynnr,
          dynpro_values TYPE TABLE OF dynpread,
          field_value LIKE LINE OF dynpro_values,
          values_tab TYPE TABLE OF values.
    CALL SCREEN 100.
    MODULE init OUTPUT.
      progname = sy-repid.
      dynnum   = sy-dynnr.
      CLEAR: field_value, dynpro_values.
      field_value-fieldname = 'CARRIER'.
      APPEND field_value TO dynpro_values.
    ENDMODULE.
    MODULE cancel INPUT.
      LEAVE PROGRAM.
    ENDMODULE.
    MODULE value_carrier INPUT.
      CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
           EXPORTING
                tabname     = 'DEMOF4HELP'
                fieldname   = 'CARRIER1'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CARRIER'.
    ENDMODULE.
    MODULE value_connection INPUT.
      CALL FUNCTION 'DYNP_VALUES_READ'
           EXPORTING
                dyname             = progname
                dynumb             = dynnum
                translate_to_upper = 'X'
           TABLES
                dynpfields         = dynpro_values.
      READ TABLE dynpro_values INDEX 1 INTO field_value.
      SELECT  carrid connid
        FROM  spfli
        INTO  CORRESPONDING FIELDS OF TABLE values_tab
        WHERE carrid = field_value-fieldvalue.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield    = 'CONNID'
                dynpprog    = progname
                dynpnr      = dynnum
                dynprofield = 'CONNECTION'
                value_org   = 'S'
           TABLES
                value_tab   = values_tab.
    ENDMODULE.
    reward points if it is usefull ...
    Girish

  • Excel to Internal Table Issue

    Hi Experts,
      Row
      Column
      Value
      1
      0001
      Prem(First Name )
      1
      0002
      Raj(Middle name )
      1
      0003
      Kaushik(Last name
      2
      0001
      Naresh
    I have the above data in excel file  and my internal table like as follows
    Data : begin of  it_itab occurs 0,
    Row type c,
    Column type string,
    Value type string,
    End of it_itab.
    Now I want to upload the excel file to my internal table
    filed wise  i.e in my intenal table row
    shold have row values from excel same as
    for column and value also
    Can anyone suggest me fix this issue?
    Best Regards,
    Ramjee M

    You may use this function to put data in internal table.
    CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = p_file *xcel file name
           i_begin_col             = p_scol  *start column
           i_begin_row             = p_srow *start row
           i_end_col               = p_ecol *end col
           i_end_row               = p_erow *end row
         TABLES
           intern                  = it_tab
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
      Use this function to put data in internal table.

  • Reading internal table issue?

    SELECT PERNR WERKS ABKRS BUKRS KOSTL ENAME GSBER FROM PA0001
                INTO TABLE GT_0001
                FOR ALL ENTRIES IN GT_0709
               WHERE PERNR = GT_0709-PERNR
                 AND ENDDA >= P_DATE
                 AND BEGDA <= P_DATE.
             READ TABLE GT_0001 INTO LS_0001 WITH TABLE KEY PERNR = LS_0709-PERNE
             IF SY-SUBRC = 0.
            CALL FUNCTION 'PA03_PCR_READ'
          EXPORTING
            F_ABKRS         = LS_0001-ABKRS
          IMPORTING
            F_CURRENT_BEGDA = GV_BEGINDATE
            F_CURRENT_ENDDA = GV_ENDDATE.
            ENDIF.
    IN THIS CODE WHILE READING THE INTERNAL TABLE IT IS SHOWING ERROR?
    PLEASE CORRECT THE CODE.
    REGARDS
    REDDY

    Hi,
    Please remove 'TABLE' keyword from your syntax.
    Check the datatype of field PERNR & PERNE. It shoud be same.
    Check the value which is in PERNE fied shoud be available in PERNR Field or not?
    Hope by this things you will be able to resolve issue.
    Regards,
    Narendra

  • Static internal table issue - Used in BI Extractor

    Hi,
      We are reading data from a table in to a static internal table and using this table for future lookups.
      Once in a while we can't find data while doing a lookup from this static internal table , But most of the time it works.
       Is it possible that data from this static internal table is removed due to memory issues during peak periods.
    Thanks in advance

    Here is the code and it is there in a function module.This function module is called from a different FM in a loop.
    TABLES: OIU_CM_MAT_PRCD.
      STATICS: i_mat_prcd LIKE OIU_CM_MAT_PRCD OCCURS 10 WITH HEADER LINE.
      DATA: ws_lines like sy-toccu.
      DESCRIBE TABLE i_mat_prcd LINES ws_lines.
      IF ws_lines = 0.
        SELECT * INTO TABLE i_mat_prcd
          FROM OIU_CM_MAT_PRCD.
        IF i_matnr > ' '.
          SORT i_mat_prcd BY matnr.
        ELSE.
          SORT i_mat_prcd BY majpd_cd pd_cd.
        ENDIF.
      ENDIF.
      IF i_matnr > ' '.
        READ TABLE i_mat_prcd WITH KEY matnr = i_matnr
           BINARY SEARCH.
        IF SY-SUBRC = 0.
          CHG_MAJOR = i_mat_prcd-MAJPD_CD.
          CHG_MINOR = i_mat_prcd-PD_CD.
          CONCATENATE i_mat_prcd-majpd_cd i_mat_prcd-pd_cd
             INTO chg_prod.
        ENDIF.    " i_matnr > blank

  • Populating Empty Fields for Existing Internal Table Using For All Entries

    I have an internal table called itab_extract that populates without any issues in SELECT A and SELECT B below. Trying to avoid looping, I am using select DB table 'for all entries' in itab_extract. I want the empty fields in itab_extract to populate from the values in the database. However, about 200,000 entries are being appended to the table, and, the values that existed for the already populated fields in itab_extract are gone, and the new fields are populated.
    I've played with the syntax and cannot seem to get it to work. My next option is a time consuming loop.
    How should the for all entries syntax look to accomplish filling the empty fields in the itab?   Thank-You
    *read ekko
        select ebeln lifnr aedat bsart from ekko                                                     *SELECT A*
               into  CORRESPONDING FIELDS OF TABLE me->itab_extract
               where aedat in r_aedat.
        select ebeln lifnr aedat BSART from ekko                                                  *SELECT B*
               appending CORRESPONDING FIELDS OF TABLE me->itab_extract
               where aedat in S_DATE2 AND
                     BSART IN S_BSART.
          select ebelp werks matnr                                                                           *SELECT C*
            into CORRESPONDING FIELDS OF TABLE itab_extract
            from ekpo
            FOR ALL ENTRIES IN itab_extract
            where ebeln = itab_extract-ebeln.

    Hi Tom,
               This SQL statement will be time consuming, Do not use a loop.
    There are two options.
    1. Select EKKO and EKPO details based on standard SAP view. (You can type EKKO in se11 view to find the correct view).
        also use one range table populate r_aedat and s_date2 in the same. So you where condition will have r_newrange and   
        s_bsart. Also do not use into corresponding fields, it is not a good idea. It will increase your performance. Maintain the proper 
        sequence (Based on database structure of EKKO and EKPO)
    2. If you are keen to use for all entries, then first select ekko then after your sy-subrc check get the data from EKPO.
    Should be like this.
    select ebeln bsart aedat lifnr from ekko into table gt_ekko where aedat in r_newrange and bsart in s_bsart.
    if sy-subrc eq 0.
    sort gt_ekko by ebeln ascending.
    select ebeln ebelp werks matnr  into table gt_ekpo for all entries in gt_ekko where ebeln eq gt_ekko-ebeln.
    endif.
    Hope it helps,
    Best Regards,
    Tapodipta Khan.

  • Logic required  for Sort in ALV

    Hi All,
    I am dowloding the ALV report layout in excel sheet thorough mailing functionality.
    I want to implenemnt the dynamic sort. Here I am writing this.but i want the logic for below code.
          CALL FUNCTION 'LT_DBDATA_READ_FROM_LTDX'
            EXPORTING
      I_TOOL             = 'LT'
              IS_VARKEY          = W_VARKEY_EU
            TABLES
              T_DBFIELDCAT       = IT_DBFIELDCAT_EU
            T_DBSORTINFO       =  IT_DBSORTINFO
             T_DBFILTER         = IT_FILTER_LAYOUT
             T_DBLAYOUT         = IT_DB_LAYOUT.
    LIT_DBSORTINFO[] = IT_DBSORTINFO[].
        SORT LIT_DBSORTINFO[] BY KEY1.
        DELETE ADJACENT DUPLICATES FROM LIT_DBSORTINFO[] COMPARING KEY1.
        LOOP AT LIT_DBSORTINFO[].
          CLEAR: LW_SPOS,
                 LW_UP,
                 LW_DOWN,
                 LW_SUBTOT,
                 LW_COMP,
                 LW_EXPA,
                 LW_GROUP.
          CLEAR IT_DBSORTINFO[].
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SPOS'.
          IF SY-SUBRC = 0.
            LW_SPOS = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'UP'.
          IF SY-SUBRC = 0.
            LW_UP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'DOWN'.
          IF SY-SUBRC = 0.
            LW_DOWN = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'SUBTOT'.
          IF SY-SUBRC = 0.
            LW_SUBTOT = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'COMP'.
          IF SY-SUBRC = 0.
            LW_COMP = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'EXPA'.
          IF SY-SUBRC = 0.
            LW_EXPA = IT_DBSORTINFO-VALUE.
          ENDIF.
          CLEAR IT_DBSORTINFO.
          READ TABLE IT_DBSORTINFO WITH KEY
                                    KEY1  = LIT_DBSORTINFO-KEY1
                                    PARAM = 'GROUP'.
          IF SY-SUBRC = 0.
            LW_GROUP = IT_DBSORTINFO-VALUE.
          ENDIF.
          LOOP AT IT_ALV_DATA FROM W_LOOP_FROM_EU TO W_LOOP_TO_EU.
            LW_TABIX = SY-TABIX.
            READ TABLE IT_FIELDCAT INTO LW_FIELDCAT WITH KEY
                               FIELDNAME = LIT_DBSORTINFO-KEY1.
            IF SY-SUBRC = 0.
              ASSIGN COMPONENT SY-TABIX OF
                         STRUCTURE IT_ALV_DATA TO <LFS>.
              IF SY-SUBRC = 0.
                CLEAR LW_CHAR.
                LW_CHAR = <LFS>.
                  IF LW_SPOS= 'SPOS'.
                  LOGIC Required
                    ENDIF.
                  ELSEIF LW_OPTION = 'DOWN'.
                 LOgic required
                    ENDIF.
                        ENDIF.
          ENDLOOP.
        ENDLOOP.
    regards,
    Ajay reddy

    Hai,
    Let
    1)general data
    2)all customers
    3)company code data
    4)sales organization data
    are the check box names,Then
    Just use the piece  of code below:
    <b>IF general data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF all_customers = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF company_code_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.
    IF sales_organization_data = 'X'.
       COUNT = COUNT + 1.
    ENDIF.</b>
    Now check whether more than one Check Boxes are selected or not
    <b>IF COUNT GT 1.
    "* Do the oprations  what ever you want here  
    ENDIF.</b>
    <b>Reward points if it helps you.</b>
    Regds,
    Rama chary.Pammi

  • Really urgent: reagrding alv format for like (internal tables)

    Hi,
    I making a report in which i am using the concept of 2 internal tables and i am usnig the concept of likes in a internal table .
    for instance,
    DATA : BEGIN OF ITAB OCCURS 0,
              ITEMID LIKE CHVW-MATNR,      
              WERKS LIKE CHVW-WERKS,   
              CHARG LIKE CHVW-CHARG,       
              SHKZG LIKE CHVW-SHKZG,       
              MENGE LIKE CHVW-MENGE,     
              MEINS LIKE CHVW-MEINS, 
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0,
               MATNR TYPE BSEG-MATNR,  
               LIFNR TYPE BSEG-LIFNR,       
               AUGDT TYPE BSEG-AUGDT,     
               WRBTR TYPE BSEG-WRBTR,      
             END OF IT_BSEG.
    and i am able to create ALV for 1 itab only as i had declared all fields in a 1 itab ,but now i have to declare 1 more itab and i  dont know how to perform ALV with 2 itabs..
    Plzz help me out as it is really urgent to me.
    Edited by: ric .s on Apr 22, 2008 11:45 AM
    Edited by: ric .s on Apr 23, 2008 7:21 AM
    Edited by: ric .s on Apr 23, 2008 7:55 AM

    Hi Ric,
    Yes, You can .
    Check the sample ALV  program which helps u in displaying output using ALV . Comments have been made everywhere .
    report  zvenkat_alv_2_grid_description.
    types:
          begin of t_mard,
           werks type mard-werks,
           lgort type mard-lgort,
           matnr type mard-matnr,
           insme type mard-insme,
           einme type mard-einme,
           speme type mard-speme,
          end of t_mard.
    data:
          w_mard type t_mard.
    data:
          i_mard type standard table of t_mard.
    " ALV Declarations
    "     ALV internal tables and Structures
    "     To refer ALV tables(slis tables) and structures.SLIS must be
    "     declared under TYPE-POOLS(see below).SLIS is a Type group which is
    "     defined in Dictionary.Internal tables and structures and constants
    "     are defined under type group.(Double click on SLIS).
    * Types Pools
    type-pools:
       slis.
    * Types
    types:
       t_fieldcat         type slis_fieldcat_alv,
       t_events           type slis_alv_event,
       t_layout           type slis_layout_alv.
    * Workareas
    data:
       w_fieldcat         type t_fieldcat,
       w_events           type t_events,
       w_layout           type t_layout.
    * Internal Tables
    data:
       i_fieldcat         type standard table of t_fieldcat,
       i_fieldcat1        type standard table of t_fieldcat,
       i_events           type standard table of t_events.
    *&      START-OF-SELECTION
    start-of-selection.
      perform get_data_from_database .
      "      END-OF-SELECTION
      "     Steps to create simple ALV program
      "      1. Pass an internal table with the set of output information
      "      2. Pass a field catalog as an internal table
      "      3. Pass a structure with general list layout details
    end-of-selection.
      perform build_fieldcatalog.
      perform build_events.
      perform build_layout.
      perform display_data.
      "      Form  build_fieldcatalog
      "     Fieldcatalog Internal table
      "    1. It contains descriptions of the list output fields
      "       (usually a subset of the internal output table fields).
      "    2. A field catalog is required for every ALV list output.
    form build_fieldcatalog .
      clear :
        w_fieldcat,
       i_fieldcat[].
      perform build_fcat using:
            "Field   Int.Table Column headings
            'WERKS' 'I_MARD' 'WERKS',
            'LGORT' 'I_MARD' 'LGORT',
            'MATNR' 'I_MARD' 'MATNR',
            'INSME' 'I_MARD' 'INSME',
            'EINME' 'I_MARD' 'EINME',
            'SPEME' 'I_MARD' 'SPEME'.
    endform.                    " build_fieldcatalog
    *&      Form  display_data
    form display_data .
      data :program like sy-repid value sy-repid.
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_callback_program = program
          is_layout          = w_layout
          it_fieldcat        = i_fieldcat
          it_events          = i_events
        tables
          t_outtab           = i_mard.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      endif.
    endform.                    " display_data
    *&      Form  get_data_from_database
    *       text
    form get_data_from_database .
      clear :i_mard,
             i_mard[].
      select werks lgort matnr insme einme speme
      from mard
      into corresponding fields of table i_mard
        up to 100 rows.
    endform.                    " get_data_from_database
    *&      Form  top_of_page
    *       text
    form top_of_page.
      data :
      i_header type slis_t_listheader,
      w_header like line of i_header.
      data:l_date1 type datum,
           l_date2 type datum.
      w_header-typ = 'S'.
      w_header-info = sy-title.
      append w_header to i_header.
      clear w_header.
      w_header-typ = 'H'.
      w_header-info = sy-repid.
      append w_header to i_header.
      clear w_header.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary = i_header
          i_logo             = 'ENJOYSAP_LOGO'.
    endform.                    "top_of_page
    *&      Form  BUILD_FCAT
    form build_fcat  using  l_field l_tab l_text.
      w_fieldcat-fieldname = l_field.
      w_fieldcat-tabname   = l_tab.
      w_fieldcat-seltext_m = l_text.
      append w_fieldcat to i_fieldcat.
      clear w_fieldcat.
    endform.                    " BUILD_FCAT
    "      Form  build_events
    "     Events
    "    1. When we use ALV,certain events TOP-OF-PAGE ,END-OF-PAGE,
    "       AT LINE-SELECTION,AT USER-COMMANDs are not triggered.
    "    2. To perform those Functions ,we have to build Events table and
    "       pass this table through REUSE_ALV_LIST_DISPALY Function.
    form build_events .
      clear :
             w_events,i_events[].
      w_events-name = 'TOP_OF_PAGE'.
      w_events-form = 'TOP_OF_PAGE'.
      append w_events to i_events.
      clear w_events.
    endform.                    " build_events
    "&      Form  build_layout
    "     Layouts
    "  Use :We change the display of our list using layouts.
    "  ===
    "  Features
    "  ========
    "    The layouts that you can use vary according to the type of list:
    "   1-->In all lists, you can do the following:
    "       (a).Choose one of the std layouts supplied with the std system.
    "       (b).Change the current layout of the list .
    "   2-->In lists that use only the standard layouts in the std system
    "       you cannot save your changes to the current layout.When you
    "       choose the layouts, only the standard layouts will be proposed.
    "   3-->In some lists, you can also save the layouts that you have
    "       defined as our own layouts.
    "      User-defined layouts are generally saved for all users. They can
    "       then be used by all users. All users will be able to choose from
    "       the user-defined layouts as well as the standard layouts.
    "   4-->In some lists, you can also save user-specific layouts that you
    "       have defined . When you choose the current layout,only these
    "       layouts are available to you.
    "   5-->You can delete or transport layouts, or define them as initial
    "       layouts
    "   6-->STRUCTURE :SLIS_LAYOUT_ALV.
    form build_layout .
      clear:
            w_layout.
      w_layout-colwidth_optimize = 'X'.
    endform.                    " build_layout
    Regards,
    Venkat.O

  • Create a deep structure for dynamic internal table

    Hi All,
    I am creating a dynamic table using method cl_alv_table_create=>create_dynamic_table.
    The normal structure gets created. but now I want to creat a Deep structure for having information of colors also for each column. So I want to add a COLTAB type LVC_T_SCOL for colors information .
    How should I create this using above method?
    Rgds,
    Madhuri

    I created a zcelltab structure as below. But while creating dynamic internal table, I received the error  with
    'Type "ZCELLTAB" is unknown 68 ZCELLTAB-CELLTAB
    Here is the code.
    DATA: BEGIN OF ZCELLTAB,
             CELLTAB LIKE LVC_S_STYL,
         END OF ZCELLTAB.
    FIELD-SYMBOLS <T_CELLTAB> TYPE LVC_T_STYL.
    DATA : LT_CELLTAB TYPE LVC_T_STYL.
    DATA:  WA_CELLTAB TYPE LINE OF LVC_T_STYL.
    DATA: GT_FCAT1 TYPE LVC_T_FCAT,
               GW_FCAT1 TYPE LVC_S_FCAT,
                GT_FCAT2 TYPE LVC_T_FCAT,
                GW_FCAT2  TYPE LVC_S_FCAT.
    After filling the FCAT1, I added the field in FCAT2  like below
      GT_FCAT2[ ] = GT_FCAT1[ ].
      G_TABIX = G_TABIX + 1.
      GW_FCAT2-INTTYPE = 'C'.
      MOVE G_TABIX TO GW_FCAT2-COL_POS.
      GW_FCAT2-OUTPUTLEN = '10'.
      GW_FCAT2-FIELDNAME = 'T_CELLTAB'.
      GW_FCAT2-TABNAME = 'ZCELLTAB'.
      GW_FCAT2-REF_FIELD = 'CELLTAB'.
      GW_FCAT2-REF_TABLE = 'ZCELLTAB'.
      APPEND GW_FCAT2 TO GT_FCAT2
      CLEAR GW_FCAT2.
    While calling the below method, the error with
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
         EXPORTING
          IT_FIELDCATALOG = GT_FCAT2
        IMPORTING
          EP_TABLE        = GT_REQ.
      ASSIGN GT_REQ->* TO <F_TAB>.
      CREATE DATA GWA_REQ LIKE LINE OF <F_TAB>.
      ASSIGN GWA_REQ->* TO <F_WA>.
    LOOP AT ITAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <F_WA> TO <F_VAL>
    <F_VAL> = ITAB-MATNR.
    IF ITAB-MATNR IS INITIAL.
    ASSIGN COMPONENT 'T_CELLTAB' OF STRUCTURE <F_WA> TO <T_CELLTAB>
            CLEAR WA_CELLTAB.
            WA_CELLTAB-FIELDNAME = 'MATNR'.
            WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            INSERT WA_CELLTAB INTO TABLE <T_CELLTAB>.
    ENDIF.
    APPEND <F_WA> TO <F_TAB>
    ENDLOOP.
    CALL METHOD GR_GRID->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              I_CONSISTENCY_CHECK  = G_CONSISTENCY_CHECK
              IT_TOOLBAR_EXCLUDING = G_EXCLUDE
              I_SAVE               = G_SAVE
           I_DEFAULT            = 'X'
              IS_LAYOUT            = G_LAYOUT
            CHANGING
              IT_OUTTAB            = <F_TAB>
              IT_FIELDCATALOG      = F_CAT1.
    Please let me know where I was wrong.
    Should I remove the T_CELLTAB as the field name is not mentioned in the structure 'ZCELLTAB'.
    Thanks,
    Kumar.
    Edited by: venn e on May 7, 2010 4:10 PM

Maybe you are looking for

  • How to trace an iPad if the Find my iPhone is off?

    My mother's iPad got stolen when we were asleep, so we tried to trace it but apparently my mother hasn't set up a "find my iphone". nor did turn in on. My neighbor said that if possible the police or the support from here can trace the device by its

  • Click wheel no longer works

    Hey guys, The other day, my click wheel just completely stopped working. I got it for Christmas '04 (Suffice to say, I'm disappointed that it hasn't even lasted two years yet). It is a 4th-gen 40GB black/white display. Prior to it completely not work

  • Adobe Bridge not showing updated folders or files

    I created a couple of new folders on a network drive yesterday afternoon (via Windows 7 explorer) and popped in some photographs. Adobe Bridge doesn't show the new folders. I've searched everywhere under lots of different keywords but, while a few pe

  • Open a file in UNC path from jsp page

    Hi, it might be simple but I don't know how i can achieve this, I have a UNC path to a remote computer something like this, \\ComputerName\SharedFolder\ResourceFileName i can open this file from windows by typing the above in Windowes explorer or som

  • Acrobat 9 bug with printing problems

    Hello, Acrobat 9 seems to have a bug when printing pdf files. Only the first page is printed. I tried on my Kyocera 2525E and my HP 2600N. Does anyone know a solution ?