Table Maintenance via ALV GRID

Hi Experts,
I have a requirement to do table maintenance for multiple tables using ALV GRID, with options to change, delete, add records and upload multiple records via copy/paste functionality.
Thanks.

Your welcome.
Rob

Similar Messages

  • Manipulating data in Excel inplace via ALV grids

    Hi everybody,
    I want to create a report which displays data in an Excel file (Excel inplace).
    To solve the problem I have created a custom layout and uplodaded it via the report BCALV_BDS_MAINTENANCE to the BDS. The written report loads the data into an ALV grid, opens Excel inplace and displays the data in the custom layout. This works fine but for one exception: You can only upload an internal table to the ALV grid, consequently no additional information about the selected data itself (e.g. given by a custom selection screen) can be presented in the grid. What I need is a way which adds strings to the excel file not in an internal table.
    Is there a way to to this? Is this possible with ALV grids or do I have to use OLE?
    Thanks in advance.
    Greetings, Daniel

    Daniel,
    Its the TOP_OF_PAGE. See below.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
             EXPORTING
                  i_callback_program     = sy-repid       <<<
                  i_callback_top_of_page = 'TOP-OF-PAGE'  <<<
             TABLES
             EXCEPTIONS
                  program_error          = 1
                  OTHERS                 = 2.
    And then for the call back form.
    FORM top-of-page.                                          
    ALV Header declarations
      DATA: t_header      TYPE slis_t_listheader,
            wa_header     TYPE slis_listheader.
      wa_header-typ  = 'S'.
      wa_header-info = 'Text goes in here'.   <<<<<
      APPEND wa_header TO t_header.
      CLEAR wa_header.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = t_header.
    ENDFORM.
    This will add header to your ALV.
    Execute the program again and open the same in excel. you will now see the strings/text in the layout.
    Hope this helps.
    Ravi.
    Message was edited by: Ravi Gopan

  • How to set a selected checkbox in output internal table of oops ALV grid

    Hi All,
    i have a checkbox as first column in my ALV grid output using oops alv, when i select some checkbox, that rows have to be selected and i need to process only selected rows in user command.
    i have given the below code also in fieldcatolg.
    f_fldcat-fieldname = 'checkbox'.
    f_fldcat-tabname ='gi_output'
    f_fldcat-checkbox = 'X'.
    f_fldcat-edit = 'X'.
    but the checkbox is not getting set in internal table when i select some checkboxes.
    can anybody explain y the checkbox in internal table not getting set?
    Thanks,
    Srilakshmi.

    Hi,
    i tried already whatever u said, but still not resolved.Pasted my code below..can u please look into it.
    MODULE pbo OUTPUT.
      PERFORM init_container.
      PERFORM prepare_field_catalog.
      PERFORM prepare_layout.
      PERFORM display_output.
    ENDMODULE.                 " PBO  OUTPUT
    *&      Module  PAI  INPUT
          text
    MODULE pai INPUT.
       DATA: lt_rows TYPE lvc_t_row.
      CASE gv_okcode.
        WHEN gc_exit OR gc_back OR gc_canc. " Finish program
          LEAVE PROGRAM.
          when 'PRINT'.
           CALL METHOD gv_grid->get_selected_rows
                     IMPORTING et_index_rows = lt_rows.
            CALL METHOD cl_gui_cfw=>flush.
      ENDCASE.
    ENDMODULE.                 " PAI  INPUT
    *&      Form  INIT_CONTAINER
          text
    FORM init_container .
      CREATE OBJECT gv_custom_container
        EXPORTING
          container_name = gc_container.
      CREATE OBJECT gv_grid
        EXPORTING
          i_parent = gv_custom_container.
      CREATE OBJECT gv_document
        EXPORTING
          style = 'ALV_GRID'.
    *&      Form  PREPARE_FIELD_CATALOG
          text
    FORM prepare_field_catalog .
      PERFORM fill_catalog USING:
    'Table Name'   'Field Name' 'NoZero'   'sel-text'
      'GI_OUTPUT'  'CHECKBOX'   ' '           text-013  'X',
      'GI_OUTPUT'  'KUNNR'      'X'           text-003  ' ',
      'GI_OUTPUT'  'NAME1'      ' '           text-004  ' ',
      'GI_OUTPUT'  'BELNR'      'X'           text-005  ' ',
      'GI_OUTPUT'  'BLART'      ' '           text-006  ' ',
      'GI_OUTPUT'  'BUDAT'      ' '           text-007  ' ',
      'GI_OUTPUT'  'BLDAT'      ' '           text-008  ' ',
      'GI_OUTPUT'  'DMBTR'      ' '           text-009  ' ',
      'GI_OUTPUT'  'WAERS'      ' '           text-010  ' '.
    ENDFORM.                    " PREPARE_FIELD_CATALOG
    *&      Form  FILL_CATALOG
          text
    FORM fill_catalog  USING    fv_tabname
                                fv_fldname
                                fv_nozero
                                fv_seltxt
                                fv_checkbox.
      DATA f_fldcat TYPE lvc_s_fcat.
      f_fldcat-fieldname     = fv_fldname.
      f_fldcat-tabname       = fv_tabname.
      f_fldcat-no_zero       = fv_nozero.
      f_fldcat-coltext       = fv_seltxt.
      f_fldcat-checkbox      = fv_checkbox.
      IF fv_checkbox = gc_x.
        f_fldcat-edit = gc_x.
      ENDIF.
      APPEND f_fldcat TO gi_fieldcat.
    ENDFORM.                    " FILL_CATALOG
    *&      Form  PREPARE_LAYOUT
          text
    FORM prepare_layout .
      gs_layout-info_fname = 'COL'.
      gs_layout-cwidth_opt = gc_x.
      gs_layout-zebra      = gc_x.
      gs_layout-no_toolbar = gc_x.
      gs_layout-no_rowmark = '1'.
      gs_layout-sel_mode = 'A'.
    ENDFORM.                    " PREPARE_LAYOUT
    *&      Form  DISPLAY_OUTPUT
          text
    FORM display_output .
      CALL METHOD gv_grid->set_table_for_first_display
        EXPORTING
          is_layout       = gs_layout
        CHANGING
          it_outtab       = gi_output
          it_fieldcatalog = gi_fieldcat.
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_user_command FOR gv_grid.
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = gv_grid.
    ENDFORM.                    " DISPLAY_OUTPUT

  • Printing a Table Control AND ALV grid from same report

    Hello,
    I am trying to figure out how to print the output of my report, which consist of a table control and a OO-driven ALV grid under it. i tried several possibilities but I only get the ALV in my spool....?
    Answers will be rewarded !

    Keep a break point in that method. Press print in the ALV, check it stops in the break point. If yes then you can use write statement, the values what ever u r writing it come in the print-out. If the control doesn't stop in the break point then there is some problem in the method declartion.
    Check my code - I written every thing in the global declaration.
                          ALV Class Definition
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
            handle_top_of_list
                FOR EVENT print_top_of_list OF cl_gui_alv_grid,
            handle_end_of_list
                FOR EVENT print_end_of_list OF cl_gui_alv_grid.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    DATA: o_event_receiver   TYPE REF TO lcl_event_receiver.
                          ALV Class Implementation
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_top_of_list.
        DATA: lws_top1(20) TYPE c,
              lws_top2(150) TYPE c,
              lws_top3(150) TYPE c,
              lws_len_file TYPE i,
              lws_file(80) TYPE c,
              lws_file1(100) TYPE c,
              lws_file2(100) TYPE c,
              lws_file3(100) TYPE c.
        WRITE: / text-001.
    *Date
        CONCATENATE text-008 ws_date INTO lws_top1 SEPARATED BY space.
        WRITE : /1 lws_top1.
    Source File Name
        WRITE: / text-009.
        lws_len_file = STRLEN( p_upload ).
        IF lws_len_file < 80.
          MOVE p_upload TO lws_top2.
          WRITE : /1 lws_top2.
        ELSE.
          MOVE p_upload TO lws_file.
          MOVE p_upload+80(48) TO lws_file1.
          DO.
            IF lws_file+79(1) EQ '\'.
              EXIT.
            ELSE.
              CONCATENATE lws_file+79(1) lws_file2 INTO lws_file2.
              SHIFT lws_file RIGHT.
            ENDIF.
          ENDDO.
          IF lws_file2 IS INITIAL.
            MOVE lws_file TO lws_top2.
            WRITE : /1 lws_top2.
            WRITE : /1 lws_file1.
          ELSE.
            CONDENSE lws_file.
            MOVE lws_file TO lws_top2.
            WRITE : /1  lws_top2.
            CONCATENATE lws_file2 lws_file1 INTO lws_file3.
            WRITE : /1  lws_file3.
          ENDIF.
        ENDIF.
      ENDMETHOD.                           "handle_top_of_list
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    Regards,
    Prakash.

  • Two Internal Tables for ALV Grid

    Hi Gurus,
    I have a little problem here. I have a report to display cost of production. The rows is about 50 displaying amount in dollars (currency fields). I have this in ALV Grid. But my problem is that the last 4 lines of the report are not currency fields like the others, they are quantity fields.
    How can i go about to display this last 4 lines in this ALV Grid. They are from different internal tables off course because of the data type.
    In short. I just want to display these 2 internal tables in an ALV Grid.
    Thanks in Advance.

    Hi,
    u can use ALV Block list to display 2 ALV.
    Reffer to the below code.
    DATA: v_layout TYPE slis_layout_alv.
      DATA: ls_print TYPE slis_print_alv.
      PERFORM build_fieldcatalog.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program             = sy-repid
    *     I_CALLBACK_PF_STATUS_SET       = ' '
    *     I_CALLBACK_USER_COMMAND        = ' '
    *     IT_EXCLUDING                   =
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = v_layout
          it_fieldcat                      = it_fcat_nlei
          i_tabname                        = 'IT_NLEI_ALV'
          it_events                        = it_event_nlei
    *     IT_SORT                          =
    *     I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_nlei_alv
        EXCEPTIONS
          program_error                    = 1
          maximum_of_appends_reached       = 2
          OTHERS                           = 3.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = v_layout
          it_fieldcat                      = it_fcat_vbrp
          i_tabname                        = 'IT_VBRP_ALV'
          it_events                        = it_event_vbrp
    *     IT_SORT                          =
    *     I_TEXT                           = ' '
        TABLES
          t_outtab                         = it_vbrp_alv
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 2
         OTHERS                           = 3.
      ls_print-no_print_selinfos  = 'X'.   " Display no selection infos
      ls_print-no_print_listinfos = 'X'.   " Display no listinfos
      ls_print-reserve_lines      = 2.     " Lines reserved for end of page
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        EXPORTING
    *     I_INTERFACE_CHECK             = ' '
          is_print                      = ls_print
    *     I_SCREEN_START_COLUMN         = 0
    *     I_SCREEN_START_LINE           = 0
    *     I_SCREEN_END_COLUMN           = 0
    *     I_SCREEN_END_LINE             = 0
    *   IMPORTING
    *     E_EXIT_CAUSED_BY_CALLER       =
    *     ES_EXIT_CAUSED_BY_USER        =
       EXCEPTIONS
         program_error                 = 1
         OTHERS                        = 2

  • Updating database table using ALV Grid class CL_ALV_CHANGED_DATA_PROTOCOL

    Hi,
    I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
    I have used program BCALV_EDIT_04 as an example.
    I am able to successfully processed inserted or deleted lines using the attributes
    MT_DELETED_ROWS
    MT_INSERTED_ROWS
    but I also want to process modified lines.
    I was just wondering whether anyone out there has some example code for this.
    I can see that there are the following attributes available
    MT_MOD_CELLS
    MP_MOD_ROWS.
    I would ideally like to use MP_MOD_ROWS rather than  MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
    If anyone has any example code for this sort of thing, please let me know.
    Thanks,
    Ruby

    hi Ruby,
    Yes we can use that *data reference variable *.
    It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
    which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
    assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
    Check the below code for example -> method refresh_changed_data
    screen flow logic.
    PROCESS BEFORE OUTPUT.
      MODULE pbo.
    PROCESS AFTER INPUT.
      MODULE pai.
    main program.
    *       CLASS lcl_event_responder DEFINITION                           *
    CLASS lcl_event_responder DEFINITION.
      PUBLIC SECTION.
        DATA  : ls_changed_cell TYPE  lvc_s_modi,
                lv_language     TYPE  spras..
        METHODS refresh_changed_data  FOR EVENT data_changed
                                      OF cl_gui_alv_grid
                                      IMPORTING er_data_changed
                                                e_ucomm.
    ENDCLASS.                    "event_responder DEFINITION
    TYPES tt_makt TYPE STANDARD TABLE OF makt.
    DATA: go_handler         TYPE REF TO lcl_event_responder,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE tt_makt,
          gs_tableline       TYPE LINE OF tt_makt.
    FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
    CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_grid IS NOT BOUND.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = cl_gui_container=>default_screen.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
    * raises the 'data_changed' event when we select another cell/any action after changing the data
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
      CREATE OBJECT go_handler.
      SET HANDLER go_handler->refresh_changed_data FOR go_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'MAKT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        ls_fcat-edit       = abap_true.
        MODIFY pt_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    *       CLASS event_responder IMPLEMENTATION                          *
    CLASS lcl_event_responder IMPLEMENTATION.
      METHOD refresh_changed_data.
        ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
        LOOP AT <changed_rows> INTO gs_tableline.
          BREAK-POINT.
        ENDLOOP.
      ENDMETHOD.                    "click
    ENDCLASS.                    "event_responder IMPLEMENTATION
    Cheers,
    Jose.

  • Alv grid using dynamic internal table

    hi i have an internal table
    begin of itab
    equipno like equi-equnr,
    reading like imrg-readg
    uom like imrg-uom
    date like imrg-date
    end of itab.
    and many more fields  in this table the reading, date, uom are dynamic its not fixed there can be five readings and 6 reading etc
    if i get all the data populated into final table  itab. how to display it throgh the alv grid
    i can use fieldsymbols i have seen some documents i want to know how to populate the fieldname s of the dynamic internal table to the field catalog and the values of the dynamic internal table .its a alv grid display pls guide

    Hi,
    Before displaying the records in ALV, you integrate all the fields (Fixed fields as well as variable fields) into one table. To do so you need create one dynamic table. If you already created this dynamic table then in the same way (same sequence) you need to populate the field catalog and use normal FM REUSE_ALV_GRID_DISPLAY to display it.
    If you not aware of how to create this dynamic internal table, please check the below way.
    1. Populate the fixed field into one field catalog(NB. this to create dyn table not ALV).
    *--- Cons Unit
      wa_lvc_cat-fieldname = c_cons.       
      wa_lvc_cat-ref_field = c_rbunit.      
      wa_lvc_cat-ref_table = c_ecmca.   
      append wa_lvc_cat to it_lvc_cat.    
    *--- account description
      wa_lvc_cat-fieldname = c_acctd.
      wa_lvc_cat-ref_field = c_txtmi.
      wa_lvc_cat-ref_table = c_tf101.
      append wa_lvc_cat to it_lvc_cat.
    2. For variable fields you have your own logic based on which you need to display the output. (like loop at one table and make each field as one column). Here one thing need to make sure every time field name should be different. You know in one structure there are 2 fields with same name is not allowed.
    3. next use the below method to create the internal table
    Create a new Table
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = it_lvc_cat
        importing
          ep_table        = it_new_table.
    Create a new Line with the same structure of the table.
      assign it_new_table->* to <l_table>. " internal table
      create data wa_new_line like line of <l_table>.
      assign wa_new_line->* to <l_line>.  " Work area
    4. To populate the field catalog for ALV use the same sequence. Better while you populated it_lvc_cat for dynamic table also create one lookup table with three fields. (fieldname, Text, col_pos). Here loop into this look up table and populate the ALV field catalog.
    5. Display it using REUSE_ALV_GRID_DISPLAY
    call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program      = c_rep_name
          i_callback_user_command = 'F_USER_DOUBLE_CLICK'       "SD0K963313
          is_layout               = l_wa_layout
          it_fieldcat             = it_fieldcat
          it_sort                 = it_sort
          i_save                  = l_save
          is_variant              = wa_variant1
          it_events               = it_events
        tables
          t_outtab                = <l_table>
        exceptions
          program_error           = 1
          others                  = 2.
    Thanks
    Subhankar

  • Alv Grid and Table Control

    What is the difference between Alv Grid and Table Control?Explain in detail..

    Table control is a screen table to display table data in a screen. You can add table control to a screen in the Screen Painter. The typical flow-logic to process table control is:
    LOOP AT <internal table> CURSOR <scroll-var>
    [WITH CONTROL <table-control> ]
    [FROM <line1> ] [TO <line2> ].
    ...<actions>...
    ENDLOOP.
    ALV Grid is a SAP Technology to display a set of data on the output screen. For example if you have selected some SAP tables and processed these data in a way you want to display, then you can pass the internal table to the ALV Grid and it will be displayed on the result screen as ALV Grid. See example in SE16 result.

  • Table Display in for OO ALV Grid

    Hello All,
    I have an internal table with the following setup:
    DATA:  BEGIN OF mat_locs OCCURS 0,
              matid      LIKE /sapapo/matloc-matid,
              locid      LIKE /sapapo/matloc-locid,
              pegids     TYPE /sapapo/om_pegid_tab,
           END OF mat_locs.
    The PEGIDS is a Table of GUIDs.  It is possible that the PEGIDS table can have more than one entry for each MATID and LOCID.  Currently, I am only able to have one line item appear in the ALV grid when there are two in PEGIDS.  Is there a setting that I am missing to display this correctly? Thanks for your help in advance.
    John

    Hi,
    I am not sure how to display second level internal table in an ALV grid..
    But I can suggest you one thing..
    Create an internal table with the following fields..
    DATA: BEGIN OF ITAB OCCURS 0,
            matid LIKE /sapapo/matloc-matid,
            locid LIKE /sapapo/matloc-locid.
            INCLUDE STRUCTURE /sapapo/om_pegid. "GIVE THE STRUCTURE and not the table type..
    DATA: END OF ITAB.
    Populate the data..
    Create a sort order for the fields matid & locid..And then display the records..
    Thanks,
    Naren

  • ALV grid - using f4 search help - want separate value from hit list

    I have the following scenario that I am trying to resolve.
    I have created my own search help with a search help exit for a bespoke maintenance table which lists categories against HR positions which are to receive workflow for these categories.  I am designing a front-end for this table using an ALV grid whereby the person holding that position (i.e. name) is shown instead of position number.  The search help allows you to select by First name and last name and brings up a hit list which includes employee number, first name last name, formatted name field, position number, position description and org unit it belongs in.
    The issue occurs where the list brings back more than one hit.
    e.g.:
    1 Fred     Bloggs Fred Bloggs 50000001  pos1  org 1
    2 Frederic Bloggs Fred Bloggs 50000002  pos2  org 3
    If you select an entry, the formatted name field goes in the ALV grid field. I call the search help via F4IF_FIELDVALUE_REQUEST using the onf4 event .
    What I want to do is retrieve the position number of the entry selected and put this into another table without having to add this to my ALV grid and make available for input. I want to use name only for the input in my ALV grid (i.e. if I select the second example, the return table in F4IF_FIELDVALUE_REQUEST shows the name Fred Bloggs but does not show the position number which I need to add to another table to update my maintenance table).
    Can anyone suggest any way around this?
    Many thanks
    Larissa

    You are right, you can add this fields as an import parameter to the list.
    In Custom search help you must have marked fields as Export or Import parameters.
    If field is marked as Export parameters, it will be displayed in the selection pop up.
    If Import paramter check box is selected then this will be imported to the screen.
    Check this SAP documentation for both these options -
    Flag for IMPORT parameter of the search help                      
         Flag if the parameter is an import parameter.                                                                               
    Context information from the processed input template (screen) can be
         copied to the help process with an import parameter. Where an import 
         parameter gets its values from is defined when the search help is    
         attached to the corresponding field of the input template.           
    Flag for EXPORT parameter of the search help                                                                               
    Flag if the parameter is an export parameter.                                                                               
    Values can be returned from the hit list to the input template (screen)
         with an export parameter. The fields of the input template in which the
         contents of the export parameter are returned are defined by the search
         help attachment.
    Message was edited by: Ashish Gundawar

  • Value in ALV Grid ?

    Hello,
    is there a method which sets the cell value of a certain cell in a alv grid.
    I've to set a vallue of a cell after the user has entered a value in a special cell.

    Hi,
    Refer this program:-
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = v_rep_id       " report id
         i_callback_pf_status_set          = 'PF'           " for PF-STATUS
         i_callback_user_command           = 'USER_COMMAND' " for User-Command
         it_fieldcat                       = it_field       " field catalog
        TABLES
          t_outtab                          = it_final      " internal table
    *&      Form  pf
    *       SUB-ROUTINE PF IS USED TO SET THE PF-STATUS OF THE SCREEN
    *       ON WHICH THE ALV GRID IS DISPLAYED
    FORM pf USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'ZTG_STAT'.
    ENDFORM.                    "pf
    *&      Form  USER_COMMAND
    *       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
    *       AND EXECUTE THE APPROPIATE CODE
    FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
    * assign the function code to variable v_okcode
      lv_okcode = sy-ucomm.
    * handle the code execution based on the function code encountered
      CASE lv_okcode.
    * when the function code is SAVE then save records into internal table
        WHEN 'SAVE'.
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          IF ref_grid IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = ref_grid.
          ENDIF.
          IF NOT ref_grid IS INITIAL.
            CALL METHOD ref_grid->check_changed_data.
          ENDIF.
    "now at this time you have modified internal table
    * refresh the ALV Grid output from internal table
          l_selfield-refresh = 'X'.
    "alv output is refreshed as per changes in internal table
    "now you can include code to modify your ztable from internal table
      ENDCASE.
    ENDFORM.                    "USER_COMMAND
    Regards,
    Tarun

  • ALV Grid: refresh in sub screens

    Hello All,
    I have some issues with internal table display in ALV grid.
    The following is the scenario.
    I am in a wizard which has 2 sub screens (SScreen 1 and sscreen 2).
    1)On sscreen 1, i have a input field,where i provide a value and on clicking the next button i get a list of values which i display on sub screen 2 using ALV grid.
    2)Now i go back to sscreen1 and change the value in the input field,since i use on-request module, i know the value in the field has changed and now i need to display new set of values on sscreen 2.
    In this case i clear the internal table, get new values for internal table and then call set_values_for_first_display().However i still get the old values displayed on SScreen 2!!!!.
    Any suggestions on what i might be doing wrong?
    Cheers
    Dev

    Hi Vijay,
    Thanks for the info.
    I will try refresh_table_display option after getting to work in a couple of hours.
    I am initializing the grid and control everytime i change a value on Subscreen 1 in the PBO of Subscreen 2(the screen where the ALV list is displayed).
    That is the reason why i call set_table_first_display, whenever there are new values in the internal table and avoid refresh_table_display.
    Cheers
    Dev

  • Alv grid question

    Hi all,
    I m trying to print the content of an internal table as a alv grid , but i miss the F1 documentation of the field component:
    I have the following code :
    Types :
      BEGIN OF ty_s_temp,
          application        TYPE char20,
          component        LIKE t512e-lgart,
        END OF ty_s_inrichting,
    DATA :
        it_temp  like table of ty_s_temp.
    After defining the fieldcatalog .. i use the function
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = gd_repid
          is_layout          = gd_layout
          it_fieldcat        = fieldcatalog[]
          it_sort            = gt_sort
          i_save             = 'X'
        TABLES
          t_outtab           = it_temp.
    Can someone tell me what i m doing wrong ?
    regards,

    Hi Adel,
    give the reference fieldname in the  fieldcatalog for that field and also roll name and checkout if it works
    wa_fieldcat-rollname = 'LGART'.
    wa_fieldcat-ref_fieldname = 'LGART'.

  • Problems with alv-grid

    hello all,
    i've got a little problem with the output of an internal table with the ALV Grid.
    i have made the declaration of my internal table (itab) with DATA: Begin of itab... and i have build my own fieldcatalog.
    the output of the fieldcatalog is correct but i don't get the results of my itab shown.
    it only shows me the numbers of lines in my itab but not the content.
    for this im using 'REUSE_ALV_FIELDCATALOG_MERGE' and 'REUSE_ALV_GRID_DISPLAY'
    *ALV-Grid
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
            i_program_name        = sy-repid
           i_internal_tabname    = 'itab'
          i_structure_name = 'itab'
         i_client_never_display
         i_inclname            = sy-repid
         CHANGING
            ct_fieldcat            = feldkatalog_itab
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 2
            OTHERS                 = 3.
    *ALV  call
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
           i_callback_program = sy-repid
                it_fieldcat   = feldkatalog_itab
                i_structure_name = 'itab'
               it_events     = event_itab
           TABLES
                t_outtab      = itab[]
           EXCEPTIONS
                program_error = 1
                OTHERS        = 2.
    when i debug my programm the lines of the itab are filled.
    thanks and regards
    Ayse
    REPORT z_test_auswertung.
    G L O B A L   I N T E R N  A L   T A B L E S
    DATA: BEGIN OF itab OCCURS 100,
          status TYPE dimaiobpar-zstatus,
          rtyp TYPE  dimaiobpar-zrtyp,
          zahlweg TYPE dimaiobpar-ezawe_x,
          a_status TYPE i,
          a_rtyp TYPE i,
          a_partner TYPE i,
          a_vertraege TYPE i,
          END OF itab .
    G L O B A L   D A T A
    DATA: ok_code LIKE sy-ucomm,
          wa_test_tab LIKE dimaiobpar,
          my_title TYPE lvc_title.
    TYPE-POOLS: slis.
    DATA:     feldkatalog_itab   TYPE   slis_t_fieldcat_alv,
         wa_feldkatalog     TYPE   slis_fieldcat_alv,
           event_itab         TYPE   slis_t_event,
           header_itab        TYPE   slis_t_listheader,
           wa_header          TYPE   slis_listheader.
    DATA:
      mycontainer TYPE scrfname VALUE 'BCALV_VARIANTS_0100_C1',
      my_grid             TYPE REF TO cl_gui_alv_grid,
      my_custom_container TYPE REF TO cl_gui_custom_container.
    DATA: t_tab LIKE dimaiobpar.
    *selection-screen
    SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test WITH FRAME TITLE text-010.
    SELECT-OPTIONS: partner FOR  t_tab-partner,
                    astatus FOR  t_tab-zstatus.
    SELECTION-SCREEN END OF BLOCK test.
    *Radiobutton
    SELECTION-SCREEN: SKIP, BEGIN OF BLOCK test2 WITH FRAME TITLE text-020.
    PARAMETERS: radio1 RADIOBUTTON GROUP test DEFAULT 'X',
                radio2 RADIOBUTTON GROUP test,
                radio3 RADIOBUTTON GROUP test,
                radio4 RADIOBUTTON GROUP test,
                rafio5 RADIOBUTTON GROUP test.
    SELECTION-SCREEN END OF BLOCK test2.
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
      PERFORM select_data.
    CALL SCREEN 100.
      DATA ttab LIKE itab.
      MOVE itab TO ttab.
    Feldkatalog fuellen.
      PERFORM feldkatalog_fuellen .
    Feldkatalog übergeben
      PERFORM alv_feldkatalog.
    ALV mit daten füllen
      PERFORM alv_füllen.
    END-OF-SELECTION.
      SORT itab.
      my_title = 'Auswertung Dimaiobpar'.
      PERFORM exit_program.
          FORM alv_feldkatalog                                          *
    FORM alv_feldkatalog.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
          EXPORTING
                  i_program_name        = sy-repid
            i_internal_tabname    = 'ITAB[]'
        i_structure_name = 'TTAB'
        i_client_never_display
         i_inclname            = 'ITAB[]'
         i_bypassing_buffer = 'X'
         CHANGING
            ct_fieldcat            = FELDKATALOG_ITAB
            EXCEPTIONS
            program_error          = 1
            OTHERS                 = 2.
    ENDFORM.
          FORM alv_füllen                                               *
    FORM alv_füllen .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
           i_callback_program = sy-repid
           i_grid_title = my_title
                it_fieldcat   = FELDKATALOG_ITAB
               i_structure_name = 'ITAB'
               it_events     = event_itab
           TABLES
                t_outtab      = itab
           EXCEPTIONS
                program_error = 1
                OTHERS        = 2.
    ENDFORM.
          FORM EXIT_PROGRAM                                             *
    FORM exit_program.
    CALL METHOD G_CUSTOM_CONTAINER->FREE.
    CALL METHOD CL_GUI_CFW=>FLUSH.
      LEAVE PROGRAM.
    ENDFORM.
          FORM feldkatalog_fuellen                                      *
    FORM feldkatalog_fuellen.
      IF radio1 = 'X'.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'status'.
             wa_feldkatalog-seltext_m     = 'Status'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'rtyp'.
             wa_feldkatalog-seltext_m     = 'RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'a_rtyp'.
             wa_feldkatalog-seltext_m     = 'Anzahl RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
      ELSEIF radio2 = 'X'.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'rtyp'.
             wa_feldkatalog-seltext_m     = 'RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'a_status'.
             wa_feldkatalog-seltext_m     = 'Anzahl Status'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
      ELSEIF radio3 = 'X'.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'status'.
             wa_feldkatalog-seltext_m     = 'Status'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'rtyp'.
             wa_feldkatalog-seltext_m     = 'RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'a_vertraege'.
             wa_feldkatalog-seltext_m     = 'Anzahl Vertraege'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
      ELSEIF radio4 = 'X'.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'status'.
             wa_feldkatalog-seltext_m     = 'Status'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'rtyp'.
             wa_feldkatalog-seltext_m     = 'RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'a_gpartner'.
             wa_feldkatalog-seltext_m     = 'Anzahl GPartner'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
      ELSE.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'status'.
             wa_feldkatalog-seltext_m     = 'Status'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'rtyp'.
             wa_feldkatalog-seltext_m     = 'RTyp'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'zahlweg'.
             wa_feldkatalog-seltext_m     = 'Zahlweg'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
        CLEAR wa_feldkatalog.
             wa_feldkatalog-fieldname     = 'a_gpartner'.
             wa_feldkatalog-seltext_m     = 'Anzahl GPartner'.
        APPEND wa_feldkatalog TO feldkatalog_itab.
      ENDIF.
    ENDFORM.
          FORM select_data                                              *
    FORM select_data.
      IF radio1 = 'X' .
       WRITE / 'Radiobutton1: Rechungstypen je Satus'.
      WRITE / 'Status, Rtyp, Anzahl-Rtyp'.
       ULINE.
        SELECT
           zstatus AS status
           zrtyp AS rtyp
           COUNT( DISTINCT zrtyp ) AS a_rtyp
           INTO CORRESPONDING FIELDS OF itab
           FROM dimaiobpar
           WHERE
           insobject LIKE 'V%' AND
           partner IN partner AND
           zstatus IN astatus
           GROUP BY ZSTATUS zrtyp
           ORDER BY zstatus.
          APPEND itab.
         WRITE:  / itab.
        ENDSELECT.
      ELSEIF radio2 = 'X'.
       WRITE / 'Radiobutton2: Status je Rechungstyp'.
       WRITE /.
        SELECT
               zrtyp AS rtyp
               COUNT( DISTINCT zstatus ) AS a_status
               INTO CORRESPONDING FIELDS OF itab
               FROM dimaiobpar
               WHERE
               insobject LIKE 'V%' AND
               partner IN partner AND
               zstatus IN astatus
               GROUP BY  ZRTYP
               ORDER BY zrtyp.
          APPEND itab.
         WRITE:    / itab-rtyp, itab-a_status.
        ENDSELECT.
      ELSEIF radio3 = 'X'.
       WRITE / 'Radiobutton3: Anzahl Verträge je Status und Rtyp'.
       WRITE /.
        SELECT
             zstatus AS status
             zrtyp AS rtyp
             COUNT( DISTINCT insobject ) AS a_vertraege
             INTO CORRESPONDING FIELDS OF itab
             FROM dimaiobpar
             WHERE
             insobject LIKE 'V%' AND
             partner IN partner AND
             zstatus IN astatus
             GROUP BY ZSTATUS zrtyp
             ORDER BY zstatus.
          APPEND itab.
         WRITE: / itab-status, itab-rtyp, itab-a_vertraege.
        ENDSELECT.
      ELSEIF radio4 ='X'.
       WRITE: / 'Radiobutton4: Anzahl GPartner je Status und RTyp'.
       WRITE: /.
        SELECT
               zstatus AS status
               zrtyp AS rtyp
               COUNT( DISTINCT partner ) AS a_partner
               INTO CORRESPONDING FIELDS OF itab
               FROM dimaiobpar
               WHERE
               insobject LIKE 'V%' AND
               partner IN partner AND
               zstatus IN astatus
               GROUP BY ZSTATUS zrtyp
               ORDER BY zstatus zrtyp.
          APPEND itab.
        WRITE: / itab-status, itab-rtyp, itab-a_partner.
        ENDSELECT.
      ELSE.
       WRITE / 'Radiobutton5: Anzahl Kunden nach Zahlweg'.
       WRITE /.
        SELECT
             zstatus AS status
             zrtyp AS rtyp
             ezawe_x AS zahlweg
             COUNT( DISTINCT partner ) AS a_partner
             INTO CORRESPONDING FIELDS OF itab
             FROM dimaiobpar
             WHERE
             insobject LIKE 'V%' AND
             partner IN partner AND
             zstatus IN astatus AND
             ezawe_x IN ('E', 'F', space)
             GROUP BY ZSTATUS zrtyp EZAWE_X
             ORDER BY zstatus zrtyp.
          APPEND itab.
         WRITE: / itab-status, itab-rtyp, itab-zahlweg, itab-a_partner
        ENDSELECT.
      ENDIF.
    APPEND itab.
    ENDFORM=

    Hi,
    Make itab into capital letters as below
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program = sy-repid
    it_fieldcat = feldkatalog_itab
    i_structure_name = 'ITAB'
    * it_events = event_itab
    TABLES
    t_outtab = itab[]
    EXCEPTIONS
    program_error = 1
    OTHERS = 2.
    <b>Reward for helpful answers</b>

  • Table Maintenance Generator Issue

    Hello Experts,
    I have created and activated a Z-table ZRATE with 4 fields.
    Field Name   |        Field Type
    MANDT          |      MANDT
    ZRATE           |      ZRATE (DEC 5, 4)
    FROM_DATE  |     DATAB
    TO_DATE       |     DATBI
    And then I generated the table maintenance via SE54. When I go to SM30 to maintain the records for that table, I am not seeing any fields there. When I click on NEW ENTRIES tab, I am getting a message: No Entries are available. I don't see any field there.
    Can anybody please advise what went wrong?
    Thanks much.

    Hello Sam,
    I guess the amount fields and date fields will not be visible in the first screen of the table maintenance generator when it is defined with two screens. Try giving that as a single screen, and then you would be able to see the fields.
    However, in change mode when you select new entries tab, it should display the fields for maintenance. Please re-check the table maintenance generation.
    Regards,
    Pavan

Maybe you are looking for

  • Records added into the DB when deleting row in List

    I have a list with an add button at the bottom. Every entry has a delete button on the left. Whenever I create new entries and then delete some rows, the newly created entries are automatically saved. How can I solve this? Deleting calls getOADBTrans

  • Memory details

    Could any one explain about the Memory usage details attached here What is Inactive Memory? What is wired Memory? what is Used Memory How to increase the Memory I'm using MacBook Pro, Mac OS X 10.8.4

  • My sister's macbook cant connect to wifi. It said that "no airport card installed". What should we do?

      My sister's macbook cant connect to wifi. It said that "no airport card installed". What should we do? Help us to solve this problem.

  • Tax condition in quotation

    hi all, can u please explain me i have to maintaion tax condition in quotation maintenance in $ sign only discount related condition are avl where should i maintain tax related conditions regards, sujit

  • Query Oracle database using JCheckBox getLabel()

    Hey guys. I'm not sure if this is the right place, so if it's not I greatly apologise! I just figured if it include Java code then it's appropriate. Anyway, just a query... I've got a Java application hooked up to an Oracle database. I was just wonde