Multiple Selection in ALV grid

HI All,
I am displaying output using ALV grid method. On screen i am selecting multiple rows & based on selection i want process further. How can i determine whcih rows user has selected ?
Regards,
Rahul

Hi,
In IT_FIELDCAT you can pass one field with attributes of check box.
for example.
Declare:
DATA: GT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
FIELDCAT_LN LIKE LINE OF GT_FIELDCAT.
Pass the below values.
FIELDCAT_LN-FIELDNAME = 'CHECK'.
FIELDCAT_LN-TABNAME = 'ITAB1'.
FIELDCAT_LN-KEY = ' '. "SUBTOTAL KEY
FIELDCAT_LN-NO_OUT = ' '.
FIELDCAT_LN-SELTEXT_L = 'Check Box'.
FIELDCAT_LN-CHECK-BOX = 'X'.
APPEND FIELDCAT_LN TO GT_FIELDCAT.
<b>rEWARD IF USEFULL</b>

Similar Messages

  • Multiple Heading in ALV Grid

    Hello ,
    I have a requirement to display Multiple heading in ALV Grid, I am using the Class 'cl_gui_alv_grid'. please let me know if you have Any suggestions.
    Ex:
    |                 Divison                     |     
    Sub D:1
    Sub D: 2
    Sub D: 3
        Like wise i have few more divisions to display and Under we need to display the Sub Division also .
    Thanks in Advance..  Waiting for your suggestions.
    With Best Regards
    Nags

    Hi,
    I had attempted to do it in the object oriented way, but found no ready solution, so I settled for the below solution.
    Please use the function REUSE_ALV_COMMENTARY_WRITE.
    This allows you to print multiple lines in the header.
    I had a requirement of showing 5 lines in the header.
    So i went on like:
    DATA: it_list_commentary TYPE slis_t_listheader,
               wa_list_commentary TYPE slis_listheader.
    wa_list_commentary-typ = 'H'.
    wa_list_commentary-info = <text>.
    APPEND wa_list_commentary TO it_list_commentary.
    wa_list_commentary-typ = 'S'.
    wa_list_commentary-info = <text>.
    APPEND wa_list_commentary TO it_list_commentary.
    I fed he internal table with all 5 lines like above.
    Finally I called the function.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_list_commentary.
    Regards,
    Prosenjit.
    Edited by: prosenjit chaudhuri on Jan 28, 2009 6:14 AM

  • How to avoid multiple selection in ALV tree control?

    Hi,
    Experts,
    I want to avoid multiple selections on Alv tree control after pressing control keyboard button(Ctrl). Even by pressing Ctrl keyword button i want to select only one row of a Alv tree control.i have used cl_salv_tree class for it is there any method to achieve this please pass some code/idea on it.
    Thanks in advance,
    Shabeer ahmed.

    I haven't tried it before but it should help.
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]

  • How to capture multiple rows of ALV grid when user selected?

    Actually,It is easy to get one single line.However, my user wants select several lines of ALV grid  by condition  .  i need to process the selected lines ,so i need to put these lines into an internal table. But now, i have no idea to capture the lines.
    What method for an ALV Grid will return the lines the user has selected?
    Appreciate for your help!
    Edited by: Heyman52 on Aug 25, 2010 4:28 AM
    Edited by: Heyman52 on Aug 25, 2010 4:30 AM

    Hi,
    Once user selects multiple rows and press another button for further execution, you can modify your internal table with marked rows using selection column.
    You need to add user command code in your ALV grid call. Please refer below code.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM       = SY-REPID
            I_CALLBACK_PF_STATUS_SET = 'F_GUI_STATUS'
            I_CALLBACK_USER_COMMAND  = 'F_USERCOMMAND'
            I_GRID_TITLE             = TEXT-026
            IS_LAYOUT                = WA_LAYOUT
            IT_FIELDCAT              = I_FIELDCAT
          TABLES
            T_OUTTAB                 = I_OUTTAB
          EXCEPTIONS
            PROGRAM_ERROR            = 1
            OTHERS                   = 2.
        IF SY-SUBRC NE 0.
          MESSAGE S475 DISPLAY LIKE 'E'.
          LEAVE LIST-PROCESSING.
        ENDIF.
    *- User command for details display.
        PERFORM F_USERCOMMAND USING I_UCOMM
                                    I_SELFIELD.
    FORM F_USERCOMMAND USING FP_R_UCOMM LIKE SY-UCOMM
                             FP_SELFIELD TYPE SLIS_SELFIELD.
    IF L_V_REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = L_V_REF_GRID.
      ENDIF.
      IF NOT L_V_REF_GRID IS INITIAL.
        CALL METHOD L_V_REF_GRID->CHECK_CHANGED_DATA.
      ENDIF.
    ENDFORM.
    You can then read your final internal table as below and take the selected records in another internal table.
    LOOP AT I_OUTTAB ASSIGNING <FS_OUTTAB> WHERE SEL EQ 'X'.
            APPEND <FS_OUTTAB> TO I_CHECK.
          ENDLOOP.
    Edited by: Archana Pawar on Aug 25, 2010 11:16 AM

  • Selecting Multiple Rows from ALV GRID Display

    Hi,
    I am having a ALV GRID Display. I want to select multiple rows from the Output and move them to an internal table.
    Please let me know how do I acheive this.
    Thanks in advance,
    Ishaq.

    Hi,
    Have a look on the following code. It displays the selected rows which hv been selected in basic list.
    TABLES:
      spfli.
    TYPE-POOLS:
      slis.
    DATA:
      BEGIN OF t_spfli OCCURS 0,
        checkbox.
            INCLUDE STRUCTURE spfli.
    DATA:  END OF t_spfli.
    DATA:
      t_sspfli LIKE STANDARD TABLE OF t_spfli .
    DATA:
      fs_spfli LIKE LINE OF t_sspfli.
    DATA:
      fs_layout TYPE  slis_layout_alv,
      w_program TYPE sy-repid.
    SELECT *
      FROM spfli
      INTO CORRESPONDING FIELDS OF TABLE t_spfli.
    *fs_layout-info_fieldname = 'COLOR'.
    fs_layout-box_fieldname = 'CHECKBOX'.
    w_program = sy-repid.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program       = w_program
        i_callback_pf_status_set = 'FLIGHT'
        i_callback_user_command  = 'SPFLI_INFO'
        i_structure_name         = 'SPFLI'
        is_layout                = fs_layout
      TABLES
        t_outtab                 = t_spfli
      EXCEPTIONS
        program_error            = 1
        OTHERS                   = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *&      Form  FLIGHT
          text
         -->RT_EXTAB   text
    FORM flight    USING rt_extab TYPE slis_t_extab..
      SET PF-STATUS 'FLIGHT' EXCLUDING rt_extab.
    ENDFORM.                    "FLIGHT
    *&      Form  SPFLI_INFO
          text
         -->UCOMM      text
         -->SELFIELD   text
    FORM spfli_info USING ucomm LIKE sy-ucomm
                           selfield TYPE slis_selfield.
      selfield-refresh = 'X'.
      CASE ucomm.
        WHEN 'FLIGHT'.
          LOOP AT t_spfli.
            IF t_spfli-checkbox = 'X'.
              t_spfli-checkbox = ' '.
             t_spfli-color = 'C51'.
              MODIFY t_spfli TRANSPORTING checkbox.
              fs_spfli = t_spfli.
              APPEND fs_spfli TO t_sspfli.
            ENDIF.
          ENDLOOP.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
      CLEAR fs_spfli.
      fs_layout-info_fieldname = 'COLOR'.
    fs_layout-confirmation_prompt = 'X'.
      fs_layout-key_hotspot = 'X'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = w_program
          i_structure_name   = 'SFLIGHT'
          is_layout          = fs_layout
        TABLES
          t_outtab           = t_sspfli
        EXCEPTIONS
          program_error      = 1
          OTHERS             = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      REFRESH t_sspfli.
    ENDFORM.                    "SPFLI_INFO
    Regards,
    Chandu

  • Selecting multiple rows in ALV grid display

    Hi,
    I have an ALV grid display in my report.
    My grid contains multiple rows.
    I have to select multiple rows at a time, to perform some operations on the selected rows.
    How can it be achieved?
    Thanks,
    Sandeep.

    Hi ,
    you have to use a box fieldname in the report to be able to select multiple lines at a time :
    - in your internal table declaration put the first field as 'box_fieldname' of type c1
    - then in your work area for layout add, lwa_layout-box_fieldname =     'box_fieldname'
    - in the perform for handling user commands, all selected lines will have an "X" in the field name  'box_fieldname'
    Thanks and Regards,
    Dev.

  • Selecting multiple rows in alv grid

    my requirement is i want to send the data from alv grid to smartforms using check boxes from report output but without using either oo framework or layout-box_fieldname.can anybody give me the solution?

    in fieldcatalog you have to use CHECKBOX = 'X'  INPUT = 'X' and EDIT = 'X' for the columns which ever you want to be check box .
    You need use the Function moduel in the user command to get the updated data with checked value.
    GET_GLOBALS_FROM_SLVC_FULLSCR
    follow the sample code.
    REPORT ZTEST_ALV_CHECK MESSAGE-ID ZZ .
    TYPE-POOLS: SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV,
    X_EVENTS TYPE SLIS_ALV_EVENT,
    IT_EVENTS TYPE SLIS_T_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    CHK(1),
    color(4),
    END OF ITAB.
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
    X_FIELDCAT-FIELDNAME = 'CHK'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    X_FIELDCAT-INPUT = 'X'.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-CHECKBOX = 'X'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-HOTSPOT = 'X'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_LAYOUT-info_fieldname = 'COLOR'.
    *L_LAYOUT-ZEBRA = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IT_FIELDCAT = IT_FIELDCAT
    TABLES
    T_OUTTAB = ITAB
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2.
    IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
    "Copy the standard program SAPLKKBL , STANDARD status to your program
    SET PF-STATUS 'STATUS'.
    ENDFORM. " STATUS
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    DATA: GD_REPID LIKE SY-REPID, "Exists
    REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
    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.
    loop at itab where chk = 'X'.
    "collect all the records to an internal table here..
    endloop.
    "Now call your smartform here using SSFFunction module and the get the dynamic function . From there call the Function with the selected values, to show the smartform
    RS_SELFIELD-refresh = 'X'.
    break-point.
    ENDFORM. "USER_COMMAND
    Regards
    Vijay Babu Dudla

  • Select From ALV Grid

    I'm hoping that someone can help.
    I have a program that displays an ALV grid. I want the user to be able to select one or more lines from this grid and then to pop up a box to allow them to input a new date and then update this date via BAPI.
    Could any one please point me in the right direction of how to get the info of the lines selected by the user into another internal table so that I can merge this with my new date info to run the BAPI.
    Thanks

    Which version of ALV technology do you use (REUSE_ALV, OO ALV, SALV ? ) <br />
    <br />
    e.g. for CL_GUI_ALV_GRID<br />
    - Use the <a class="jive-link-external" href="http://help.sap.com/saphelp_erp2004/helpdata/en/ef/a2e9eff88311d2b48d006094192fe3/frameset.htm" target="_newWindow">SEL_MODE</a> field of the layout to enable multiple row selection (also add a check box in internal table)<br />
    - you have method <a class="jive-link-external" href="http://help.sap.com/saphelp_erp2004/helpdata/EN/0a/b55312d30911d2b467006094192fe3/frameset.htm" target="_newWindow">GET_SELECTED_ROWS</a> and CHECK_CHANGED_DATA <br />
    <br />
    <i>Also, don't hesitate to use the search tool.there are sample in wiki like [Capture single and multiple row selction in ALV |http://wiki.sdn.sap.com/wiki/display/Snippets/Capturesingleandmultiplerowselctionin+ALV]</i><br />
    <br />
    Regards,<br />
    Raymond

  • Folder for multiple details in ALV GRID DISPLAY

    Hi All,
    I am developing one ALV GRID DISPLAY report. Here I am displaying the material and production order details in the report. If we have the multiple production order details for one material , then in that case , we have to place one folder at the first material level, in that folder I need to show all the multiple production order details.
    I am using FUNCTION MODULE to develope the report, not using any Objects to develope this. 
    Thanks in advance.
    Ramesh.

    Here is a simple example of such an ALV.
    report zrich_0001.
    type-pools: slis.
    data: begin of head occurs 0,
           matnr type afpo-matnr,
           maktx type makt-maktx,
           EXPAND type c,
          end of head.
    data: begin of detail occurs 0,
           aufnr type afpo-aufnr,
           matnr type afpo-matnr,
           werks type aufk-werks,
           pwerk type afpo-pwerk,
           psmng type afpo-psmng,
          end of detail.
    start-of-selection.
      select * into corresponding fields of table detail
                   from afpo
                      inner join aufk
                        on afpo~aufnr = aufk~aufnr
                      inner join afko
                        on afpo~aufnr = afko~aufnr
                                  up to 500 rows
                                        where aufk~auart = 'PP01'.
      if not detail[] is initial.
        sort detail ascending by matnr.
        select distinct * into corresponding fields of table head
                  from makt
                     for all entries in detail
                        where matnr = detail-matnr
                          and spras = sy-langu.
      endif.
      perform call_alv.
    *       FORM call_alv                                                 *
    form call_alv.
      data: gt_fieldcat type slis_t_fieldcat_alv,
            gs_keyinfo  type slis_keyinfo_alv,
            gs_layout   type slis_layout_alv.
      data: ls_fieldcat type slis_fieldcat_alv.
      clear gs_keyinfo.
      gs_keyinfo-header01 = 'MATNR'.
      gs_keyinfo-item01   = 'MATNR'.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'MATNR'.
      ls_fieldcat-reptext_ddic = 'Material'.
      ls_fieldcat-tabname      = 'HEAD'.
      ls_fieldcat-outputlen    = 18.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'MAKTX'.
      ls_fieldcat-reptext_ddic = 'Description'.
      ls_fieldcat-tabname      = 'HEAD'.
      ls_fieldcat-outputlen    = 40.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'AUFNR'.
      ls_fieldcat-reptext_ddic = 'Production Order'.
      ls_fieldcat-tabname      = 'DETAIL'.
      ls_fieldcat-outputlen    = 12.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'WERKS'.
      ls_fieldcat-reptext_ddic = 'Production Plant'.
      ls_fieldcat-tabname      = 'DETAIL'.
      ls_fieldcat-outputlen    = 4.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'PWERK'.
      ls_fieldcat-reptext_ddic = 'Planning Plant'.
      ls_fieldcat-tabname      = 'DETAIL'.
      ls_fieldcat-outputlen    = 4.
      append ls_fieldcat to gt_fieldcat.
      clear ls_fieldcat.
      ls_fieldcat-fieldname    = 'PSMNG'.
      ls_fieldcat-reptext_ddic = 'Quantity'.
      ls_fieldcat-tabname      = 'DETAIL'.
      ls_fieldcat-outputlen    = 20.
      append ls_fieldcat to gt_fieldcat.
      gs_layout-expand_fieldname = 'EXPAND'.
      call function 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           exporting
                it_fieldcat      = gt_fieldcat[]
                is_layout        = gs_layout
                i_tabname_header = 'HEAD'
                i_tabname_item   = 'DETAIL'
                is_keyinfo       = gs_keyinfo
           tables
                t_outtab_header  = head
                t_outtab_item    = detail.
    endform.
    Regard,s
    RIch Heilman

  • Multiple selections in alv

    how to do multiple rows selection in alv's....

    do you use the function or the alv grid control (i.e. the classes)?
    bye
    enzo

  • Multi Line Selection with ALV Grid

    Dear all
    what do I have to do to make multiple line selection available in an ALV Grid (Version 4.7)?
    Herbert

    Hi Herbert again,
    Once you displayed your alv output display, then select rows in the alv display.
    then when you click for interactive buttion (ie. like Refresh functionality), In debug mode you can see internal table with Sell field active (i.e. marked "X") which you have selected.
    e.g.
    FORM user_command USING lv_ucomm TYPE sy-ucomm ls_selfield TYPE slis_selfield.
      DATA:
            lv_ref_grid   TYPE REF TO cl_gui_alv_grid.
      CLEAR : gv_tcode.
    *-- to ensure that only new processed data is displayed
      IF lv_ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = lv_ref_grid.
      ENDIF.
      IF NOT lv_ref_grid IS INITIAL.
        CALL METHOD lv_ref_grid->check_changed_data.
      ENDIF.
      CASE lv_ucomm.
        WHEN '&IC1'.
          IF ls_selfield-fieldname = 'MATNR'.
            READ TABLE gt_gi INTO gs_gi INDEX ls_selfield-tabindex.
            IF sy-subrc = 0.
              gv_tcode = 'MMBE'.
              SET PARAMETER ID 'MAT' FIELD gs_gi-matnr.
              CALL TRANSACTION gv_tcode AND SKIP FIRST SCREEN. "#EC CI_CALLTA "MMBE
            ENDIF.
          ENDIF.
        WHEN 'COPY'.
          LOOP AT gt_gi INTO gs_gi WHERE sel = 'X'.
            gs_gi-sel = ' '.
            APPEND gs_gi TO gt_gi.
            CLEAR gs_gi.
          ENDLOOP.
        WHEN 'POST'.
          REFRESH : gt_error[].
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    " USER_COMMAND
    I hope you clear now.
    Feel free to ask any doubts.
    Thanks and regards,
    Vijay

  • Single row select in ALV Grid

    HI,
    I want to make my ALV Grid only single row select enabled, can some one guide me which variable should be set for the same.
    Thanks and Regards,
    Harsh

    If you are using OO for alv then
      call method grid1->get_selected_rows
        importing
          et_index_rows = i_sel_alvrows[].
      call method cl_gui_cfw=>flush.
      describe table i_sel_alvrows lines v_dbcnt.
      if i_sel_alvrows[] is initial.
    * Info message : Please select a row
        message i176.                        " Please select a row'.
      endif.
      if v_dbcnt gt 1.
    * Info message : Multiple Row Selection not  possible
        message i177.                        " Multiple Row Selection not
        " possible'
      endif.
    or if your using REUSE then
    form user_command using p_ucomm type sy-ucomm
                         rs_selfield type  slis_selfield.
    " Check the rs_selfield-tabindex value here
    " you may get some clue here
    endform.

  • Single selection in ALV Grid Control

    hi,
    I want to enable single row selection only in the alv grid displayed.
    attribute sel_mode of layout doesnt help.
    Can anybody provide me a solution.
    Regards,
    Auro

    Hello,
    Try this:
    DATA:gs_layout type lvc_s_layo.
    gs_layout-NO_ROWMARK = 'X'.
    call method g_grid->set_table_for_first_display
           exporting is_layout             = gs_layout
    Regards,
    Beejal
    **reward if this helps

  • How do I find an event which is triggered on line selection for ALV grid?

    Hi,
    I'm trying to find an event which is triggered when a user selects a row in the ALV grid. I want to add my own code in to add up the total values of selected lines, but can't find any event which will trigger my method.
    I found CLICK_ROW_COL but it's protected so when I try and add a method for it:
      PROTECTED SECTION.
        METHODS:
        select_row
            FOR EVENT click_row_col OF cl_gui_alv_grid.
    I get the syntax error:
    Access to protected event "CLICK_ROW_COL" is not allowed.
    Am I using the right event? Am I implementing it correctly?
    Any help appreciated. Thanks in advance.
    Gill

    I chose to solve this by removing the line select buttons from the ALV and replacing them with a checkbox defined as a hotspot.  I then used EVENT hotspot_click FROM cl_gui_alv_grid to highlight the line and change my totals on a single click.

  • Layout selection in ALV grid.

    Hi All,
    I have one requirement to change the existing program. Currently it is displaying all the fields in the ALV grid. Now i need to make the selection screen with two options for Header data selection and Item data selection. So now if I select the Header data only to be displayed (in the coding I made the changes in the field catalog and hidded some fields using
                                 WHEN 'FKART'
                                  if p_header = 'X'.
                                   <fc>-no_out = 'X'.
                                  endif.
    so now it should not display the FKART field in the output. My question is, If I select some different layout in the ALV GRID  even this hidden header fields are also getting displayed. Please help me and give me the solution for this.
    Regards,
    AL.

    Hi Anbu,
    You can try like this,  Modify your Col Position like this...
    IF P_HEARDER = 'X'.
      COL_POS = COL_POS + 1.
      FIELDCATALOG-COL_POS     = COL_POS.
      FIELDCATALOG-FIELDNAME   = 'FKART'.
      FIELDCATALOG-OUTPUTLEN   = 10.
      FIELDCATALOG-NO_OUT     = 'X'.
      APPEND FIELDCATALOG TO FIELDCATALOG.
    ELSE.
      COL_POS = COL_POS + 1.
      FIELDCATALOG-COL_POS     = COL_POS.
      FIELDCATALOG-FIELDNAME   = 'FKART'.
      FIELDCATALOG-OUTPUTLEN   = 10.
      APPEND FIELDCATALOG TO FIELDCATALOG.
    ENDIF.
    Thanks & regards,
    Dileep .C

Maybe you are looking for