ALV Grid with rows sticked together

Hi,
Is there any chance to get two <b>rows</b> of an ALV grid sticked together.
This means if the user selects the first row, the second one is automatically selected too. On the other hand, selecting the second row should select the first too.
This also applies if the users deletes one of the two rows.
Using FM REUSE_ALV_GRID_DISPLAY btw. and grouping is not useful in this case.
Thanks,
Michael

Hello,
I am not sure if that could be done dynamically however what can be done is when he selects some row and tries to process an event you can check whether the other row is ticked and then pop up a message asking the user the other row will also be selected does he want to proceed with his event of deletion.
So for eg..
*Function Call for ALV List Display
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
            i_callback_program       = v_repid
            i_callback_pf_status_set = 'F_PF_ALV_100'
            i_callback_user_command  = 'F_USER_COMMAND_2A'
            it_fieldcat              = i_fieldcat[]
            i_save                   = 'A'
       TABLES
            t_outtab                 = i_inci
       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.
and then in the call back user command routine
FORM f_user_command_2a USING wa_ucomm TYPE sy-ucomm
                             wa_selfield TYPE slis_selfield.
  CASE wa_ucomm.
    WHEN 'DELETE'.
pop up a dialog box and notify this line will also be selected and delete do you want to proceed... yes delete both lines no... deselect the earlier line... i hope you are using a checkbox in alv...
Regards,
Shekhar Kulkarni

Similar Messages

  • ALV Grid with Popup Window

    Hey @all,
    I want to make a ALV Grid with a Popup Window. The idea is that there is a field for notes and when you click on this field a popup window should be opened where you can insert more text or if text already exists only the first column of the text is shown in field until you click on the field.
    Is there any possibility to do it this way? Do I have to make a second Grid for this Popup Window? Do anybody have an example how to solve this problem?
    Thank you in advance for your answers!
    Greetings,
    Alexander

    *& Report  Z_VISHVAS_ALV1
    report  z_vishvas_alv1.
    type-pools: slis.
    data: begin of i_outtab occurs 0.
            include structure sflight.
    data:   w_chk type c.                  "For multiple selection
    data: end of i_outtab.
          I_OUTTAB TYPE SFLIGHT OCCURS 0,
    data: i_private type slis_data_caller_exit,
          i_selfield type slis_selfield,
          w_exit(1) type c.
    parameters: p_title type sy-title.
    start-of-selection.
      select * from sflight into table i_outtab.
      call function 'REUSE_ALV_POPUP_TO_SELECT'
           exporting
                i_title                 = p_title
                i_selection             = 'X'
                i_zebra                 = 'X'
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
                i_checkbox_fieldname    = 'W_CHK'
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                i_tabname               = 'I_OUTTAB'
                i_structure_name        = 'SFLIGHT'
              IT_FIELDCAT             =
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
               IS_PRIVATE             = I_PRIVATE
         importing
                es_selfield             = i_selfield
                e_exit                  = w_exit
           tables
                t_outtab                = i_outtab
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
       MESSAGE i000(0k) WITH sy-subrc.
      endif.
    *****the internal table is modified with a cross sign for marking the
    ***rows selected
      loop at i_outtab where w_chk = 'X'.
        write: /  i_outtab-carrid, i_outtab-price.
      endloop.

  • ALV grid with 2 labels on the output

    Hi,
    I am trying ALV  Grid with two labels using Function modules.
    in the output, it should appear like...
    Header1 | Header2 | Header3 | Header4 |
    T21
    T22
    T31
    T32
    First line is for Header lable and second line is for item lable under corresponding Header labels.
    Pls. can any suggest me a solution for this..
    Thanks
    PRa

    Using the Gird Functions it is not possible, you can get the with the help of ALV list function.
    If you use this aproach you will loose some Functionalities, Your Report Output will Distorted.
    cehck this image..
    http://img100.imageshack.us/img100/3846/output6ef.th.gif
    REPORT ZTEST_ALV 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,
    MALE type i,
    female type i,
    END OF ITAB.
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    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 = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'MALE'.
    X_FIELDCAT-SELTEXT_L = 'MALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'FEMALE'.
    X_FIELDCAT-SELTEXT_L = 'FEMALE'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    x_events-NAME = SLIS_EV_TOP_OF_PAGE.
    x_events-FORM = 'TOP_OF_PAGE'.
    APPEND x_events TO iT_EVENTS.
    CLEAR x_events .
    L_LAYOUT-NO_COLHEAD = 'X'.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    IT_FIELDCAT = IT_FIELDCAT
    it_events = it_events
    TABLES
    T_OUTTAB = ITAB
    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 TOP_OF_PAGE.
    *-To display the headers for main list
    FORMAT COLOR COL_HEADING.
    WRITE: / SY-ULINE(103).
    WRITE: / SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (8) ' ' ,
    SY-VLINE,
    (19) '***'(015) centered,
    sy-vline.
    WRITE: / SY-VLINE,
    (8) 'VBELN'(013) ,
    SY-VLINE,
    (8) 'POSNR'(014) ,
    SY-VLINE,
    (8) 'MALE'(016) ,
    sy-vline,
    (8) 'FMALE'(017) ,
    sy-vline.
    FORMAT COLOR OFF.
    ENDFORM.

  • OO ALV grid with a header line is this possible?

    Howdy!
    I have a requirement where I need to produce an ALV grid with the following format:
    <b>Text 1     Text 2  Text 3                  Text 4
                              Text 6
    Col_1 Col_2 Col_3 Col_4 Col_5 Col_6 Col_7 Col_8 Col_9 
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    Cell conents -
    </b>
    Anyone got any idea on how to get the 'TEXT' fields into the ALV grid? These are dynamic texts that would basically display details of data entered in the selection screen.
    The ALV title line is limited to 70 characters and I can't think of another way of doing this.
    The texts need to appear on the ALV grid becasue the user would like to download them to Excel in addition to the ALV cell contents using the standard ALV functionality.
    Any ideas would be appreciated!
    Message was edited by: Robert

    I'm thinking that this may not work because it is not a full screen grid and the grid container does not care about the container on top of it so, it most likely would not print it.   Implement this example program, you can see how this would work for you if you were using the FM.
    report zrich_0001
           no standard page heading.
    * Global ALV Data Declarations
    type-pools slis.
    data: begin of i_alv occurs 0,
          matnr type mara-matnr,
          end of i_alv.
    * Miscellanous Data Declarations
    data: fieldcat type slis_t_fieldcat_alv,
          events   type slis_t_event,
          list_top_of_page type slis_t_listheader,
          top_of_page  type slis_formname value 'TOP_OF_PAGE'.
    start-of-selection.
      perform initialization.
      perform get_data.
      perform call_alv.
    end-of-selection.
    *  Form  Initialization
    form initialization.
      clear i_alv.       refresh i_alv.
      perform eventtab_build using events[].
    endform.
    *  Form  Get_Data
    form  get_data.
      select matnr into table i_alv
                  from mara up to 100 rows.
    endform.
    *  CALL_ALV
    form call_alv.
      data: variant type  disvariant.
      data: repid type sy-repid.
      repid = sy-repid.
      variant-report = sy-repid.
      variant-username = sy-uname.
      perform build_field_catalog.
      perform comment_build using list_top_of_page[].
    * Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat        = fieldcat
                i_callback_program = repid
                is_variant         = variant
                it_events          = events[]
                i_save             = 'U'
           tables
                t_outtab           = i_alv.
    endform.
    * EVENTTAB_BUILD
    form eventtab_build using events type slis_t_event.
    * Registration of events to happen during list display
      data: tmp_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = events.
      read table events with key name = slis_ev_top_of_page
                               into tmp_event.
      if sy-subrc = 0.
        move top_of_page to tmp_event-form.
        append tmp_event to events.
      endif.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      clear: fieldcat. refresh: fieldcat.
      data: tmp_fc type slis_fieldcat_alv.
      tmp_fc-reptext_ddic = 'Material'.
      tmp_fc-fieldname    = 'MATNR'.
      tmp_fc-tabname      = 'I_ALV'.
      tmp_fc-outputlen    = 18.
      append tmp_fc to fieldcat.
    endform.
    * COMMENT_BUILD
    form comment_build using list_top_of_page type
                                            slis_t_listheader.
      data: tmp_line type slis_listheader.
      clear tmp_line.
      tmp_line-typ  = 'H'.
      tmp_line-info = 'Here is a line of text'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key1'.
      tmp_line-info = 'Here is a value'.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'Key2'.
      tmp_line-info = 'Here is another value'.
      append tmp_line to list_top_of_page.
    endform.
    * TOP_OF_PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = list_top_of_page.
    endform.
    Regards,
    Rich Heilman

  • ALV Grid multiple row selection, disabling some

    Does anyone know if it is possible to have an ALV grid with multiple row selection allowed but for some rows the row selection is disabled?
    Kind regards,
    John.

    Hi John,
    You can add a check box and select multiple rows. I am using the same technique. I have used OO.
    a) Use Even handler "Double Click"
    b)Using "SELECT_ALL_ENTRIES  CHANGING PT_OUTTAB TYPE STANDARD TABLE" and I am sorting based Check box selection.
    Need more help please let me know. I will send you the code.
    Lanka
    Message was edited by: Lanka Murthy

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • ALV grid with editable fields

    Dear Colleagues,
    I develop an ALV grid with OO standard methods. Before the first display of the table I define the editable fields. It works fine.
    I have a problem : if the table is empty and I press the standard icons "Append a line" or "Insert a line", the new line don't have the defined editable characteristics.for fields. Is there a standard method which I have forgotten ?
    Thanks a lot and kind regards
    Peter

    vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_delete_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_append_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_insert_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_copy.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_cut.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_undo.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
        vs_toolbar_excluding = cl_gui_alv_grid=>mc_fc_loc_paste_new_row.
        APPEND vs_toolbar_excluding TO i_toolbar_excluding.
    * Displaying the output in ALV Grid
        vs_layout_grid-no_rowmark = 'X'.
        vs_layout_grid-zebra      = 'X'.
        vs_layout_grid-cwidth_opt = 'X'.
        vs_layout_grid-edit       = 'X'.
        vs_layout_grid-ctab_fname = 'CT'.
        vs_layout_grid-stylefname = 'CELLTAB'.
        CALL METHOD v_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'X'
            is_layout                     = vs_layout_grid
            it_toolbar_excluding          = i_toolbar_excluding[]
          CHANGING
            it_outtab                     = itab[]
            it_fieldcatalog               = it_fieldcat[]
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc NE 0.
          MESSAGE 'ALV Grid display unsuccessful' TYPE 'I'.
          STOP.
        ENDIF.                             " IF sy-subrc NE 0
      ELSE.                                " IF w_custom_container...
    * Refresh the container if it already exists
        CALL METHOD v_grid->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS   = 2.
        IF sy-subrc NE 0.
          MESSAGE 'Refreshing the container is not successful' TYPE 'I'.
          STOP.
        ENDIF.                            

  • ALV GRID with own EXCEL-Template

    Hallo,
    I have Problem with using ALV-Grid with a own created
    template.
    At First I copy the SAP_OM.XLS template to CUS_OM.XLS.
    Then I update it by deleting all sheets, but not RAWDATA.
    When I use this template in ALV-GRID, it would be the right one, but it his no Data.
    The security settings in Excel are correct.
    Can anyone help me to show the data like the normal
    ALV-GRID??
    thanks Dieter

    Hi
    Check this link...
    How to send data  to different tabs of an excel sheet?

  • ALV GRID with icon fields. When exports to Excel, icon fields are emtpy.

    Hi all,
    In our SAP system (6.0 ECC) we've noticed the following behaviour:
    In ALV GRID with icons (color lights for example...) when we export the list to Excel format with the standard button bat, the icon column is always empty.
    We think that in previous SAP version (4.7), the code corresponding to the icon appeared (For example @08@ for green light).
    It's possible to have tha same functionality in this new version like in 4.7?
    Regards.
    Edited by: Ole ES on Nov 17, 2010 6:05 PM

    Hi,
    Check the format in which you export to Excel (MHTML, XML, ...) and try antoher one.
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/66/79ad48157f11d2953700a0c930328a/content.htm
    I think the integrated Excel mode shows '@08@'.
    Best regards,
    Guillaume

  • Manipulate Layout on ALV Grid with dynamic table

    Dear all
    i'm generating a dynamic table depending of a date selection. That means that I show columns for weeks and the quantity of weeky migh change.
    Now the users wants to have a specific layout of the ALV grid with totals. When he saves the layout, only the weeks at this selection will show the next time he runs the programm with a larger selection.
    a) Is it possible to modify the layout during runtime by programming?
    b) Do you have any other ideas how to solve this problem?
    Thank you

    You don't know the names of your columns? hmm you do, because before you created dynamic table you had to create field catalog, so the structure and column names of newly (dynamically) created table will be the same like defined in the field catalog.
    The last loop also does not look good, in my opinion should be something like:
    LOOP AT lt_datatable +(my first table)+ ASSIGNING <ls_data4>.
        AT NEW pernr.
          APPEND initial line to <fs_1> assigning <fs_2>.
          <fs_2>-pernr = <ls_data4>-pernr.
        ENDAT.
        ASSIGN COMPONENT <ls_data4>-wage_type OF STRUCTURE <fs_2> TO <fs_5>.
        <fs_5> = <ls_data4>-amount.
    ENDLOOP.
    also keep in mind that number of calls of method cl_alv_table_create=>create_dynamic_table is limited to 36 (?) calls within one program session because it uses dynamic subroutine pool behind so you will have short dump if you will execute that 37 times.

  • Default collapsed view in ALV grid with subtotoal lines

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.

    Hallo experts,
    I am displaying a ALV grid with subtotals. Now my requirement to display the Grid with only subtotal lines. Means the grid should be displayed in collapsed mode by default.
    Can any you help me finding this option.
    Thanks.
    Matt.
    Hi Matt,
    Whe you call the FM REUSE_ALV_GRID_DISPLAY, you have to fill the table it_sort.
    In this table, you have to fill the field FIELDNAME with the field that you can show with susbstotals and fill the field EXPA with 'X'.
    W_SORT-SPOS = 1.
    W_SORT-FIELDNAME = 'CODIGO'.
    W_SORT-SUBTOT = 'X'.
    W_SORT-EXPA = 'X'.
    APPEND W_SORT TO IT_SORT.
    In the fieldcatalog there must be any with the field DO_SUM = 'X'
    You can maka this directly in the list by creating a variant with susbtotals, colapse them and save as a default variant for all users.
    Regards,
    Pepe
    Regards,
    Pepe

  • Binding ALV GRID with Deep Internal Table

    Hello all,
    I am looking for a way to display ALV Grid with the Deep ITAB.
    My ITAB is not too complex.
    It has One Structure which gets whole DB table + One extra field.
    Therefore my Itab looks as follows.
    TYPES: BEGIN OF TY_TRIP,
            ZPM_UPLOAD LIKE ZDBTABLE, "ZDBTABLE is custom database table.
            TDTIME TYPE STRING,
           END OF TY_TRIP.
    DATA: ITAB TYPE TABLE OF TY_TRIP,
          WA_ITAB LIKE LINE OF ITAB.
    Now i am able to populate data into Deep ITAB.
    If i call ALV Grid with ITAB then i get error. So how to call 'REUSE_ALV_GRID_DISPLAY' with this ITAB?
    Thanks in advance.

    Hello,
    My senior asked me to use the below definition.
    TYPES: BEGIN OF TY_TRIP.
            INCLUDE STRUCTURE ZDBTABLE.
    TYPES:  TDTIME TYPE STRING,
           END OF TY_TRIP.
    DATA: ITAB TYPE TABLE OF TY_TRIP,
          WA_ITAB LIKE LINE OF ITAB.
    If anyone else is looking to print in ALV, they can use this type of ITAB definition though it gives you the flexiblity to create ITAB and also making it FLAT and not DEEP.
    But i am still looking for an answer for my first post.
    Thanks.

  • How can i show details in ALV GRID with double click in a row?

    Hello, ich try to show the details of a row with double click in the line,
    but it doesn't work!?
    I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
    I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
    i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
    i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
    Have anybody any ideas!?

    Hello Lars
    The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
    *& Report  ZUS_SDN_ALVGRID_EVENTS_1
    REPORT  zus_sdn_alvgrid_events_1.
    DATA:
      gd_okcode        TYPE ui_func,
      gt_fcat          TYPE lvc_t_fcat,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_docking2      TYPE REF TO cl_gui_docking_container,
      go_grid1         TYPE REF TO cl_gui_alv_grid,
      go_grid2         TYPE REF TO cl_gui_alv_grid.
    DATA:
      gt_t001          TYPE STANDARD TABLE OF t001,
      gt_knb1          TYPE STANDARD TABLE OF knb1.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_double_click.
    *   define local data
        DATA:
          ls_t001     TYPE t001,
          ls_col_id   TYPE lvc_s_col.
        CHECK ( sender = go_grid1 ).
        READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
        CHECK ( ls_t001-bukrs IS NOT INITIAL ).
        SELECT * FROM knb1 INTO TABLE gt_knb1
          WHERE bukrs = ls_t001-bukrs.
        IF ( syst-subrc NE 0 ).
          MESSAGE 'No customers found' TYPE 'S'.
        ELSE.
    *     Trigger PAI of dynpro '0100' and set new ok-code
          CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
        ENDIF.
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT * FROM t001 INTO TABLE gt_t001.
      REFRESH: gt_knb1.
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_docking2
        EXPORTING
          parent                      = cl_gui_container=>screen0
          ratio                       = 90
        EXCEPTIONS
          OTHERS                      = 6.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid1
        EXPORTING
          i_parent          = go_docking
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT go_grid2
        EXPORTING
          i_parent          = go_docking2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Set event handler
      SET HANDLER:
        lcl_eventhandler=>handle_double_click FOR go_grid1.
    * Display data
      CALL METHOD go_grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'T001'
        CHANGING
          it_outtab        = gt_t001
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNB1'
        CHANGING
          it_outtab        = gt_knb1
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Link the docking container to the target dynpro
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking2->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0200'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'END'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'CALL_SCREEN_0200'.
          go_grid2->refresh_table_display( ).  " necessary
          CALL SCREEN '0200'.
        WHEN OTHERS.
      ENDCASE.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards
      Uwe

  • ALV grid with 2 headers - using OOPS

    Hi,
    I have a requirement wherein I need to display 2 headers using ALV Grid. I am using cl_gui_alv_grid->set_table_for_first display.
                    Header1                    Header2
    Col1     Col2     Col3     Col4     Col5
    1     2     3     4     5
    Please suggest if this is possible, if yes, how to acheive it.
    Thanks,
    Smita

    HI RAM,
    I have did same like what you said. but iam not getting. Below is the pgm what i have dev. please correct it and let me knwo.
    TYPE-POOLS: SLIS.
    DATA: I_CATLOG TYPE slis_t_fieldcat_alv,
          W_CATLOG TYPE SLIS_FIELDCAT_ALV,
          I_CATLOG2 TYPE slis_t_fieldcat_alv,
          W_CATLOG2 TYPE SLIS_FIELDCAT_ALV,
          V_PGM TYPE SY-REPID.
    data: begin of itab1 occurs 0,
            HEADER1(10) TYPE C,
            HEADER2(10) TYPE C,
          end of itab1.
    data: begin of itab occurs 0,
            vbeln like vbak-vbeln,
            posnr like vbap-posnr,
            MATNR LIKE VBAP-MATNR,
            MATWA LIKE VBAP-MATWA,
          end of itab.
    select vbeln
           posnr
           MATNR
           MATWA
      from vbap
      up to 20 rows
      into table itab.
    w_catlog-seltext_l = 'HEADER1'.
    w_catlog-datatype  = 'CHAR'.
    w_catlog-outputlen = 10.
    W_CATLOG-tabname = 'ITAB1'.
    append w_catlog2 to i_catlog2.
    clear  w_catlog2.
    w_catlog-seltext_l = 'HEADER2'.
    w_catlog-datatype  = 'CHAR'.
    w_catlog-outputlen = 10.
    W_CATLOG-tabname = 'ITAB1'.
    append w_catlog2 to i_catlog2.
    clear  w_catlog2.
    w_catlog-seltext_l = 'Sales Document'.
    w_catlog-datatype  = 'CHAR'.
    w_catlog-outputlen = 10.
    w_catlog-fieldname = 'VBELN'.
    W_CATLOG-tabname = 'ITAB'.
    append w_catlog to i_catlog.
    clear  w_catlog.
    w_catlog-seltext_l = 'ITEM'.
    w_catlog-datatype  = 'NUMC'.
    w_catlog-outputlen = 6.
    w_catlog-fieldname = 'POSNR'.
    W_CATLOG-tabname = 'ITAB'.
    append w_catlog to i_catlog.
    clear  w_catlog.
    w_catlog-seltext_l = 'MATERIAL'.
    w_catlog-datatype  = 'CHAR'.
    w_catlog-outputlen = 18.
    w_catlog-fieldname = 'MATNR'.
    W_CATLOG-tabname = 'ITAB'.
    append w_catlog to i_catlog.
    clear  w_catlog.
    w_catlog-seltext_l = 'Material entered'.
    w_catlog-datatype  = 'CHAR'.
    w_catlog-outputlen = 18.
    w_catlog-fieldname = 'MATWA'.
    W_CATLOG-tabname = 'ITAB'.
    append w_catlog to i_catlog.
    clear  w_catlog.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = V_PGM
       IT_FIELDCAT                       = I_CATLOG2
      TABLES
        T_OUTTAB                          = ITAB1
    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.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = V_PGM
       IT_FIELDCAT                       = I_CATLOG
      TABLES
        T_OUTTAB                          = ITAB
    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.

  • Group feature at ALV grid with editable columns

    Am I right ?
    Group function by using a sorted layout is disabled while having one (or more) editable columns, isn't it ?
    ... or is there a possibility to use gouped rows ?
    Greetings
    Markus

    Also...
    *& Report ZDEMO_ALVGRID_EDIT *
    *& Example of a simple ALV Grid Report *
    *& The basic ALV grid, Enhanced to display specific fields as *
    *& editable depending on field value *
    REPORT ZDEMO_ALVGRID_EDIT .
    TABLES: ekko.
    TYPE-POOLS: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    field_style TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat, "slis_t_fieldcat_alv WITH HEADER LINE,
    wa_fieldcat TYPE lvc_s_fcat,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE lvc_s_layo, "slis_layout_alv,
    gd_repid LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    PERFORM data_retrieval.
    PERFORM set_specific_field_attributes.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM display_alv_report.
    *& Form BUILD_FIELDCATALOG
    Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
    wa_fieldcat-fieldname = 'EBELN'.
    wa_fieldcat-scrtext_m = 'Purchase Order'.
    wa_fieldcat-col_pos = 0.
    wa_fieldcat-outputlen = 10.
    wa_fieldcat-emphasize = 'X'.
    wa_fieldcat-key = 'X'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'EBELP'.
    wa_fieldcat-scrtext_m = 'PO Item'.
    wa_fieldcat-col_pos = 1.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'STATU'.
    wa_fieldcat-scrtext_m = 'Status'.
    wa_fieldcat-col_pos = 2.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'AEDAT'.
    wa_fieldcat-scrtext_m = 'Item change date'.
    wa_fieldcat-col_pos = 3.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MATNR'.
    wa_fieldcat-scrtext_m = 'Material Number'.
    wa_fieldcat-col_pos = 4.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MENGE'.
    wa_fieldcat-scrtext_m = 'PO quantity'.
    wa_fieldcat-col_pos = 5.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'MEINS'.
    wa_fieldcat-scrtext_m = 'Order Unit'.
    wa_fieldcat-col_pos = 6.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'NETPR'.
    wa_fieldcat-scrtext_m = 'Net Price'.
    wa_fieldcat-edit = 'X'. "sets whole column to be editable
    wa_fieldcat-col_pos = 7.
    wa_fieldcat-outputlen = 15.
    wa_fieldcat-datatype = 'CURR'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    wa_fieldcat-fieldname = 'PEINH'.
    wa_fieldcat-scrtext_m = 'Price Unit'.
    wa_fieldcat-col_pos = 8.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.
    ENDFORM. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
    gd_layout-stylefname = 'FIELD_STYLE'.
    gd_layout-zebra = 'X'.
    ENDFORM. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    Display report using ALV grid
    FORM display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
    i_callback_program = gd_repid
    i_callback_user_command = 'USER_COMMAND'
    is_layout_lvc = gd_layout
    it_fieldcat_lvc = it_fieldcat
    i_save = 'X'
    TABLES
    t_outtab = it_ekko
    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.
    ENDFORM. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
    UP TO 10 ROWS
    FROM ekpo
    INTO CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM. " DATA_RETRIEVAL
    *& Form set_specific_field_attributes
    populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
    DATA ls_stylerow TYPE lvc_s_styl .
    DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
    LOOP AT it_ekko INTO wa_ekko.
    IF wa_ekko-netpr GT 10.
    ls_stylerow-fieldname = 'NETPR' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
    "set field to disabled
    APPEND ls_stylerow TO wa_ekko-field_style.
    MODIFY it_ekko FROM wa_ekko.
    ENDIF.
    ENDLOOP.
    endform. " set_specific_field_attributes
    REWARD POINTS IF usefful !!

Maybe you are looking for

  • Why is ADF Bindings node not displayed in Expression Builder window?

    Hello, I'm using Oracle JDeveloper Studio Edition Version 11.1.1.1.0, and I've created a Fusion Web Application and I've configured ADF Authentication and Security for my web project, using the provided wizard. On a certain page, I've placed a Go Lin

  • Crystal Reports Consultant

    I am looking for someone who can help write reports to integrate with SAPB1 8.8 PL 17.  Must have extensive knowledge with Crystal Reports 2008 and SAP B1 tables.  Will compensate for time. Thanks Anthony

  • Parse xml for newline chars using xpath

    Hi guys, need your help. I was curious to how can we use subString-before and subString after function to extracts records based on newline. Ex. for an strin xml field with data 1st line 2nd line and want to extract each line as separate record. Hope

  • Image text boxes

    I want to be able to place my cursor over an image in my Dreamweaver website and have a text box appear. Is this possible?

  • SAPMV45A 4312 screen exit

    Hi everyone, The purpose is to add a screen in that user exit which is in fact to add some fields in the Additional Data B in VA01. I am not able to do this. Can someone please explain it for me ? Thanks in advance.