CL_GUI_ALV_GRID: Line selection and backend table

Dear community,
is there a way to propagate line selection of ALV GRID GUI automagically to the backend data table?
This is my scenario:
1) A table containing several records with one column 'SELECTED' for selection status
2) ALV_GRID to display the table with layout info for line selection
alv_layo-sel_mode   = 'A'.
alv_layo-box_fname  = 'SELECTED'.
3) At PBO methods set_table_for_first_display and refresh_table_display are called with the table containing some records marked as 'SELECTED'.
First problem here: 'SELECTED' entries are not propagated to the ALV grid (the lines in the GUI are not marked). I know I could use set_selected_rows to force the selection, but is this really necessary?
4) Then, at PAI method check_changed_data is called (and yes, event mc_evt_modified is registered).
Second problem: Changes in selection are not propagated automagically to the underlying table. I also know I could use get_selected_rows to force this update manually, but again: is this really necessary?
Can anyone explain the behavior why sorting etc. is propagated automatically to the underlying table, but not the selection of rows? Am I missing something?
Hint: Removing box_fname = 'SELECTED' and setting the fieldcatalog to display the column 'SELECTED' as editable checkbox works also. But our users are familiar with the rowmark, so this is no option.
Any suggestions are welcome.
Thanks,
Torsten.
Here an (almost) complete listing of the code:
PROCESS BEFORE OUTPUT.
  MODULE SET_STATUS_TITLE_0100.
  MODULE INIT_ALV_GRID_0100.
  MODULE DISPLAY_DATA_0100.
  MODULE SET_GRID_SELECTION_0100.
PROCESS AFTER INPUT.
  MODULE EXIT_COMMAND_0100 AT EXIT-COMMAND.
  MODULE UPDATE_TABLE_DATA_0100.
  MODULE USER_COMMAND_0100.
MODULE init_alv_grid_0100 OUTPUT.
  IF NOT gr_container IS BOUND.
*   Container erzeugen
    CREATE OBJECT gr_container ...
*   ALV Grid erstellen
    CREATE OBJECT gr_alv_grid ...
*   ALV für die erste Anzeige vorbereiten
    gs_alv_layo-zebra      = on.         " Gestreifte Anzeige
    gs_alv_layo-no_toolbar = on.         " Keine Toolbar
    gs_alv_layo-no_rowmark = off.        " Keine Zeilenmarkierung
    gs_alv_layo-edit       = off.        " Editieren ermöglichen
    gs_alv_layo-sel_mode   = 'A'.        " Selektionsmodus
    gs_alv_layo-cwidth_opt = off.        " Optimierte Spaltenbreite!
    gs_alv_layo-info_fname = 'LCOLOR'.   " ALV-Control: Feldname mit
                                         " einfacher Farbcodierung für
                                         " Zeile
    gs_alv_layo-ctab_fname = 'CCOLOR'.   " ALV-Control: Feldname mit
                                         " komplexer Farbcodierung
                                         " für Zellen
    gs_alv_layo-box_fname  = 'SELECTED'. " Markierte Zeilen
*   Feldkatalog für die Anzeige vorbereiten
*    CLEAR gs_fcat.                       " Mehrfachsel. ermöglichen
*    gs_fcat-fieldname = 'SELECTED'.      " Dazu muss das Feld für die
*    gs_fcat-edit      = on.              " Selektion editierbar sein.
*    gs_fcat-checkbox  = on.              " Ausserdem muss die
**   gs_fcat-outputlen = '3'.             " Zeilenmark. eingeschaltet
*    APPEND gs_fcat TO gt_fcat.           " und box_fname gesetzt sein.
*   Ereignisbehandlung
    SET HANDLER
      lcl_event_handler=>on_click
      lcl_event_handler=>on_hotspot
      lcl_event_handler=>on_double_click
      lcl_event_handler=>on_user_command
      lcl_event_handler=>on_data_changed
    FOR gr_alv_grid.
    CALL METHOD gr_alv_grid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_modified
      EXCEPTIONS
        error      = 1
        OTHERS     = 2.
  ENDIF.
ENDMODULE.                 " INIT_ALV_GRID_0100  OUTPUT
MODULE display_data_0100 OUTPUT.
* PBO Modul für alle weiteren Anzeigezyklen.
  IF gr_alv_grid IS BOUND.
    CALL METHOD gr_alv_grid->set_table_for_first_display ...
  ENDIF.
ENDMODULE.                 " DISPLAY_DATA_0100  OUTPUT
MODULE set_grid_selection_0100 OUTPUT.
  IF gr_alv_grid IS BOUND.
    CALL METHOD gr_alv_grid->refresh_table_display.
  ENDIF.
* Alterative: Set selected rows manually
*    CALL METHOD gr_alv_grid->set_selected_rows
ENDMODULE.                 " SET_GRID_SELECTION_0100 OUTPUT
MODULE update_table_data_0100 INPUT.
    CALL METHOD gr_alv_grid->check_changed_data.
* Alternative: Get selected rows and update table manually
*    CALL METHOD gr_alv_grid->get_selected_rows ...
ENDMODULE.                 " UPDATE_TABLE_DATA_0100  INPUT

Hello Torsten
I may be wrong but I think the field LVC_S_LAYO-BOX_FNAME is a relict from the stone-age SLIS-based ALV programming.
Using modern OO-based ALV we do not need any kind of "MARK" row but we have the appropriate methods available.
Regards
  Uwe

Similar Messages

  • How to use AT LINE-SELECTION and AT USER-COMMAND in one report????

    Dear all,
    I have a problem in reports I want to use AT USER-COMMAND.and AT LINE-SELECTION.both in the one report.
    But as soon as I use SET PF-STATUS my AT LINE-SELECTION event stop workingand only AT USER-COMMAND is working.
    How can I use both of them in one report for your reference I am giving my test program below.
    REPORT ZTEST111 .
    SET PF-STATUS '100'.
    DO 10 TIMES.
    WRITE:/ SY-INDEX.
    HIDE SY-INDEX.
    ENDDO.
    START-OF-SELECTION.
    AT LINE-SELECTION.
    MESSAGE I002(SY) WITH SY-INDEX.
    AT USER-COMMAND.
    MESSAGE I002(SY) WITH 'USER COMMAND'.
    END-OF-SELECTION.
    Thanks in advance
    Sachin Gautam

    hi
    Syntax
    AT USER-COMMAND.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
    Note
    Self-defined function codes are all those that include character combinations, except for the following:
    The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
    All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
    The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
    Table 1
    Function code Function
    %CTX Call a context menu
    %EX Exit
    %PC Save to file
    %PRI Print
    %SC Search for ...
    %SC+ Find next
    %SL Search in office
    %ST Save to report tree
    Table 2
    Function code Function
    BACK Back
    P- Scroll to previous page
    P-- Scroll to first page
    P+ Scroll to next page
    P++ Scroll to last page
    PFILE name Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name.
    PL- Scroll to first line of the page
    PL-n Scroll n lines back
    PL+ Scroll to last line of the page
    PL+n Scroll n lines up
    PNOP No effect
    PP- Scroll back one page
    PP-n Scroll n pages back
    PP+ Scroll one page forward
    PP+n Scroll n pages forwad
    PPn Scroll to beginning of page n
    PRI, PRINT Print
    PS-- Scroll to first column
    PS++ Scroll to last column
    PS- Scroll one column to the left
    PS-n Scroll n columns to the left
    PS+ Scroll one column to the right
    PS+n Scroll n columns to the right
    PSn Scroll to column n
    PZn Scroll to line n
    RW Cancel

  • Diff between at line selection and HIDE technique

    hi all,
           wht is the diff between at-line-selection and HIDE technique.
            wht r code instructor
            wht is extended testing
            how can we find selected error records in session                          method ex:-if there r errors in 4th 9th 13th record.
    tthnx in advance

    HIDE
    Syntax
    HIDE dobj.
    Effect
    This statement stores - in the current list level - the content of the variable dobj together with the current list line whose line number is contained in sy-linno. The data type of the variables dobj must be flat and no field symbols can be specified that point to rows of internal tables, and no class attributes can be specified. The stored values can be read as follows:
    For each user action in a displayed screen list that leads to a list result, all the row values stored using HIDE - that is, the row on which the screen cursor is positioned at the time of the event - are assigned to the respective variables.
    If a list row of an arbitrary list level is read or modified using the statements READ LINE or MODIFY LINE, all the values of this row stored using HIDE are assigned to the respective variables.
    Notes
    The HIDE statement works independently of whether the list cursor was set. In particular, variables for empty list rows can be stored - that is, rows in which the list cursor was positioned using statements like SKIP.
    The HIDE statement should be executed immediately at the statement that has set the list cursor in the row.
    Outside of classes, constants and literals that cannot be read in list results and in the statement READ LINE can be specified for dobj outside of classes.
    Example
    Storing square numbers and cubic numbers for a list of numbers. The example shows that arbitrary variables can be stored independently of row content. In the real situation, one would more likely store only the number and execute the calculation, when required, in the the event block for AT LINE-SELECTION.
    REPORT ...
    DATA: square TYPE i,
          cube   TYPE i.
    START-OF-SELECTION.
      FORMAT HOTSPOT.
      DO 10 TIMES.
        square = sy-index ** 2.
        cube   = sy-index ** 3.
        WRITE / sy-index.
        HIDE: square, cube.
      ENDDO.
    AT LINE-SELECTION.
      WRITE: square, cube.
    AT LINE-SELECTION
    Syntax
    AT LINE-SELECTION.
    Effect
    This statement defines an event block whose event is triggered by the ABAP runtime environment during the display of a screen list - provided the scren cursor is on a list line and you select a function using the function code PICK. Through the definition of this event block, the standard list status is automatically enhanced in such a way that the function code F2 and, with it, the double-click mouse function is linked up to the function code PICK.
    Note
    If the function key F2 is linked with a function code different than PICK, each double click will trigger its even, usually AT USER-COMMAND, and not AT LINE-SELECTION.
    Example
    This program works with the standard list status. A line selection with the left mouse key causes the event AT LINE-SELECTION and creates details lists.
    REPORT demo_at_line_selection.
    START-OF-SELECTION.
      WRITE 'Click me!' COLOR = 5 HOTSPOT.
    AT LINE-SELECTION.
      WRITE: / 'You clicked list', sy-listi,
             / 'You are on list',  sy-lsind.
      IF sy-lsind < 20.
        SKIP.
        WRITE: 'More ...' COLOR = 5 HOTSPOT.
      ENDIF.
    Thanks,

  • Difference between line type and internal table?

    Hi..
    I wanted to know, what is the difference between Line type and Internal Table?

    Hi,
        Before the 4.7 release in SAP if we want to define an internal table we have to write the defination using the occurs statement and we need to define all the fields using INCLUDE STRUCTURE or indidually all the fields ine by one.
    From 4.7 release of R/3 SAP introduced the Line type concept and it's part of the ABAP OOPS concept. for internal table defination we don't need to use the occur statements. Instead INCLUDE structure  we need to create a Line type for that structure in Se11 and then we can define the internal table like :
    DATA : ITAB TYPE TABLE OF <LINE_TYPE>.
    Only thing is this table will be  a table without header. So for internal table processing we need to define a work area structure of type line of line type  . EX:
    DATA: WA_ITAB TYPE LINE OF <LINE_TYPE>.
    Hope this helps.
    Thanks,
    Greetson

  • Refresh Report and At Line-Selection and At User-Command

    Hi All
    I have 2 querries
    1) I want to use At Line-selection and At user-command in the same report. But At line-selection is not getting triggered why? When I remove Set pf-status 'xxx' and at user command , then at line selection works . I want to user both at a time.
    2) I am giving user ability to edit the report shown and when he comes back by exiting the editing I want to refresh the report which is shown already to him to give effect of his editing.
    Thanks in anticipation
    pM.

    i just tried, and no problem at all.
    In the <b>Recommended Function Key Settings</b>  for  F2 key add command "PICK"
    Regards
    Raja
    since you are new to the forum, have a look at this weblog.
    /people/mark.finnern/blog/2004/08/10/spread-the-love

  • Using both at line-selection and at user-command

    hellow friends ,
    to use both  at line-selection and at user-command in the same report.

    Hello,
    U can do it like this.
    AT LINE-SELECTION.
      PERFORM at_line_selection.
    AT USER-COMMAND.
      PERFORM at_user_command.
    FORM AT_LINE_SELECTION.
      DATA: LV_CURSOR_FIELD(30).
      DATA: LV_MATNR TYPE MATNR.
      CLEAR H_UCOMM.
      GET CURSOR FIELD LV_CURSOR_FIELD.
      CASE LV_CURSOR_FIELD.
        WHEN 'PSPNR'.
          PERFORM LAGER_AN_PSP USING WA_MATNR-M1-RSNUM
                                     WA_MATNR-M1-RSPOS.
        WHEN 'PSPNR2'.
          H_UCOMM = 'PSPNR2'.
          IF NOT PSPNR2 IS INITIAL AND IT_VKBEL-VBELN CN '0123456789'.
            PERFORM LAGER_AN_PSP_VKBEL USING IT_VKBEL
                                             0
                                             PSPNR2
                                             H_MAKTX
                                             ' '.     "keine Blindbuchung
          ENDIF.
    ENDCASE.
    CASE SY-UCOMM.
        WHEN 'BACK_NEW'.
          PERFORM NEU_START USING 'X'.
        WHEN 'EXIT'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CANC'.
          PERFORM NEU_START USING 'X'.
        WHEN 'CHECK'.
          PERFORM NEU_START USING SPACE.
    ENDCASE.
    Vasanth

  • Multiple line selection and then capturing the selected values

    Dear all
      in my alv program ,i need to capture multiple line selections  using checkboxes.
    I have appended check boxes by adding it in the internal table  & filling in field catalog.
    but problem is i'm not able to capture multiple selected check boxes dynamically,
    i could capture only the last selected check box,
    option i found was to use class method get-selected-rows,but i'm unable to use it properly, could anyone explain in detail
    i have already gone through the various examples in sdn but i am not able to work out.
    like using parameters etc....
    CAN ANY ONE HELP ME WITH THE CODE
    help reqired  immediately,
    Thanks in advance.

    Hi Ankur,
    In the PAI, just after the selection of your user event, button or menu,
    add this code before getting the selected records.
    <b>CALL METHOD grid1->check_changed_data
                 IMPORTING
                   e_valid = ws_x.</b>
    where    grid1  TYPE REF TO cl_gui_alv_grid,
    Now fetch the selected records.
    Check this code for reference
                C O M P A N Y   C O N F I D E N T I A L                **
           Care should be taken to prevent its unauthorized use.       **
    REPORT zfipost MESSAGE-ID f4 NO STANDARD PAGE HEADING .
    AUTHOR   : Susmitha Susan Thomas
    DATE     : August 18, 2005
    *Abridged Version : This report generates a list in Abap List Viewer of
                      all the selected records in VBKPF/VBSEG. * *
                      (TRANSACTION ZPPD:Modified from transaction FBV0)
    -- Class definition--
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    --Tables--
    TABLES:  vbkpf. " Belegkopf
    TABLES: tsp1d, pri_params, spopli.
    TYPE-POOLS slis.
    ---- Global Variables -
    DATA:    anzkr(6)     TYPE n,
             lsind        LIKE sy-lsind,
             no_output(1) TYPE c,
             records(1) TYPE c,
             xpick(1)     TYPE c,
             xpickc(1)    TYPE c,
             xbinp(1)     TYPE c,
             rc           LIKE syst-subrc,
             ok_code LIKE sy-ucomm,
             index TYPE i,
             char_x(1)    TYPE c VALUE 'X',
             post         TYPE c,
             ans          TYPE n,
             user(40) TYPE c.
    DATA :BEGIN OF i_doctype OCCURS 0,
             blart LIKE vbkpf-blart,
          END OF i_doctype.
    --AlV Initialization--
    DATA:  gs_layout TYPE lvc_s_layo,
           gt_fieldcat TYPE lvc_t_fcat,
           gs_fieldcat TYPE lvc_s_fcat,
           gs_index_rows TYPE lvc_t_row,
           l_layout TYPE disvariant,
           g_repid LIKE sy-repid,
           g_max TYPE i VALUE 100,
           ws_row_idx TYPE lvc_t_row ,
           ws_row_no TYPE lvc_t_roid,
           i_excl_func TYPE ui_functions,
           ls_prnt TYPE lvc_s_prnt,
           refresh TYPE c,
           i_fieldcat  TYPE lvc_t_fcat,
          post(1) TYPE c,
           accr_def(1) TYPE c,
           rev_cd(3) TYPE c,
           ch(1) TYPE c.
    DATA: list_index LIKE sy-lsind,
          flag TYPE n VALUE 0,
          fl TYPE n VALUE 0,
          g_container TYPE scrfname VALUE 'GRID_CONTAINER',
          grid_container TYPE REF TO cl_gui_docking_container,
          grid1  TYPE REF TO cl_gui_alv_grid,
          custom_container1 TYPE REF TO cl_gui_custom_container,
          event_receiver TYPE REF TO lcl_event_receiver,
          gt_vbkpf1 TYPE STANDARD TABLE OF vbkpf WITH HEADER LINE,
          i_vbkpf TYPE  TABLE OF vbkpf WITH HEADER LINE,
          i_ws_row_idx LIKE ws_row_idx WITH HEADER LINE.
    ---Internal table containing details of selected documents--
    DATA : BEGIN OF gt_vbkpf OCCURS 0,
             xpick(1) TYPE c,
             belnr LIKE vbkpf-belnr,
             gjahr LIKE vbkpf-gjahr,
             bukrs LIKE vbkpf-bukrs,
             blart LIKE vbkpf-blart,
             budat LIKE vbkpf-budat,
             bldat LIKE vbkpf-bldat,
             bktxt LIKE vbkpf-bktxt,
             waers LIKE vbkpf-waers,
             usnam LIKE vbkpf-usnam,
             xblnr LIKE vbkpf-xblnr,
             rev_code(3) TYPE c,
             rev_rsn(15) TYPE c,
             rev_date(10) TYPE c,
             linecolor(4) TYPE c,
           END OF gt_vbkpf.
    --Table to store long text--
    DATA : BEGIN OF inline OCCURS 0,
    tdformat TYPE tdformat,
    tdline TYPE tdline,
    END OF inline.
    DATA: thead LIKE thead OCCURS 0 WITH HEADER LINE.
    -- Records to be posted--
    DATA:   BEGIN OF tbkpf OCCURS 5.
            INCLUDE STRUCTURE vbkpf.
    DATA:   END   OF tbkpf.
    ---- Constants -
    CONSTANTS: awtyp_bkpf TYPE awtyp VALUE 'BKPF '.
    CONSTANTS: awtyp_space TYPE awtyp VALUE '     '.
    Selection Screen
    PARAMETER: funcl   LIKE t020-funcl NO-DISPLAY.   "P(ost),D(isplay),U(pd)
    SELECTION-SCREEN SKIP 2.
    SELECT-OPTIONS:
             p_bukrs     FOR  vbkpf-bukrs,
             p_belnr     FOR  vbkpf-belnr,
             p_gjahr     FOR  vbkpf-gjahr,
             p_budat     FOR  vbkpf-budat,
             p_bldat     FOR  vbkpf-bldat,
             p_blart     FOR  vbkpf-blart,
             p_xblnr     FOR  vbkpf-xblnr,
             p_bktxt     FOR  vbkpf-bktxt,
             p_usnam     FOR  vbkpf-usnam.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF BLOCK blk
                WITH FRAME TITLE text-010 NO INTERVALS.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(35) text-002.
    PARAMETER norm_doc    TYPE c
              RADIOBUTTON GROUP doc DEFAULT 'X' .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(35) text-001.
    PARAMETER ad_doc       TYPE c
               RADIOBUTTON GROUP doc .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(35) text-003.
    PARAMETER all_doc       TYPE c
                RADIOBUTTON GROUP doc .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK blk.
          CLASS lcl_event_receiver DEFINITION
          For capturing events on the ALV                               *
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
    to capture all recently changed data.
          handle_data_changed      FOR EVENT data_changed OF
                                           cl_gui_alv_grid
                                           IMPORTING er_data_changed,
    for hot spot
          handle_hotspot           FOR EVENT hotspot_click OF
                                           cl_gui_alv_grid
                                           IMPORTING e_column_id e_row_id.
    ENDCLASS.   " lcl_event_receiver (Definition)
          CLASS lcl_event_receiver (Implementation)
          For capturing events on the ALV                               *
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM f2200_handle_data_changed USING er_data_changed.
      ENDMETHOD.
      METHOD handle_hotspot.
        PERFORM f2201_handle_hotspot USING e_column_id e_row_id .
      ENDMETHOD.
    ENDCLASS.  " lcl_event_receiver (Implementation)
    AT SELECTION-SCREEN
    AT SELECTION-SCREEN.
    START-OF-SELECTION
    START-OF-SELECTION.
    ---- Colors -
      FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
    -------------------- Status und Title Bar----------------------------*
      SET PF-STATUS funcl.
      SET TITLEBAR  funcl.
    -- Read Records--
      SELECT * FROM vbkpf INTO TABLE gt_vbkpf1
          WHERE bukrs IN p_bukrs
            AND ausbk IN p_bukrs
            AND belnr IN p_belnr
            AND gjahr IN p_gjahr
            AND budat IN p_budat
            AND bldat IN p_bldat
            AND blart IN p_blart
            AND bktxt IN p_bktxt
            AND xblnr IN p_xblnr
            AND usnam IN p_usnam
            AND bstat EQ 'V'
          AND ( awtyp IN (awtyp_bkpf, awtyp_space) OR
                awtyp IS null )
          ORDER BY PRIMARY KEY.
    ----Call the ALV Screen -
      PERFORM alv_display.
    END-OF-SELECTION.
                         FORM BELEG_PICKUP                              *
          Indicate changing of the selected external record             *
    FORM beleg_pickup.
      SET PARAMETER ID 'BUK' FIELD vbkpf-bukrs.
      SET PARAMETER ID 'GJR' FIELD vbkpf-gjahr.
      SET PARAMETER ID 'BLP' FIELD vbkpf-belnr.
      CASE funcl.
         WHEN 'P'.
          IF anzkr IS INITIAL.
            CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_D'
                 EXPORTING
                      bukrs = vbkpf-bukrs
                      belnr = vbkpf-belnr
                      gjahr = vbkpf-gjahr.
          ELSE.
            IF sy-ucomm EQ 'BUCH'.
              CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_ALL'
                   EXPORTING
                        synch   = char_x
                        bupbi   = xbinp
                   TABLES
                        t_vbkpf = tbkpf.
            ELSE.
              CALL FUNCTION 'ZPRELIMINARY_POSTING_POST_ALL'
                   EXPORTING
                        bupbi   = xbinp
                   TABLES
                        t_vbkpf = tbkpf.
             wait up to 3 seconds.
             commit work.
            ENDIF.
          ENDIF.
        WHEN OTHERS.
          IF sy-tcode = 'ZPPD'.
            funcl = 'P'.
          ENDIF.
          CALL FUNCTION 'ZPRELIMINARY_POSTING_DISPLAY'
               EXPORTING
                    bukrs = vbkpf-bukrs
                    belnr = vbkpf-belnr
                    gjahr = vbkpf-gjahr.
      ENDCASE.
    ENDFORM.
                        FORM TBKPF_FUELLEN                              *
                Include  records for posting in TBKPF                   *
    FORM tbkpf_fuellen.
      records = 'X'.
      LOOP AT gt_vbkpf.
        IF gt_vbkpf-xpick = 'X'.
          CLEAR anzkr.
          CLEAR records.
          IF sy-subrc = 0.
            anzkr = anzkr + 1.
            MOVE-CORRESPONDING gt_vbkpf TO tbkpf.
            APPEND tbkpf.
          ELSE.
            EXIT.
          ENDIF.
        ENDIF.
      ENDLOOP.
    ENDFORM.
                              FORM MALL                                 *
                         Select All documents                           *
    FORM mall.
      LOOP AT gt_vbkpf.
        gt_vbkpf-xpick = 'X'.
        MODIFY gt_vbkpf.
      ENDLOOP.
      refresh = 'X'.
      CALL METHOD grid1->refresh_table_display.
    ENDFORM.
                             FORM EMAL                                  *
                       Unselect all documents                           *
    FORM emal.
      LOOP AT gt_vbkpf.
        gt_vbkpf-xpick = ' '.
        MODIFY gt_vbkpf.
      ENDLOOP.
      refresh = 'X'.
      CALL METHOD grid1->refresh_table_display.
    ENDFORM.
                         Form  alv_display                               *
                  To display the details on an ALV.                      *
    FORM alv_display.
      CALL SCREEN 100.
    ENDFORM.                    " alv_display
    *&      Module  PB0_100  OUTPUT
    MODULE pb0_100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'POSTDOC'.
    --To verify that posting is complete.--
    ---- Setting the layout -
      IF grid1 IS INITIAL.
        PERFORM fill_table.
    -- Initializing the field catalog--
        PERFORM fieldcat_init CHANGING i_fieldcat.
    -- Initializing the ALV GRID and CONTAINER--
        CLEAR gs_layout.
        gs_layout-info_fname = 'linecolor'.
        gs_layout-grid_title = 'Parked Documents'(100).
        gs_layout-zebra               = 'X'.
        gs_layout-cwidth_opt   = 'X'.
        gs_layout-sel_mode = 'A'.
        gs_layout-edit                = 'X'.
        l_layout-report = sy-repid.
    ------ Create a custom container control for ALV Control----
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
          CREATE OBJECT grid_container
             EXPORTING
               dynnr                     = '100'
               ratio                     = '100'
            EXCEPTIONS
             cntl_error                  = 1
             cntl_system_error           = 2
             create_error                = 3
             lifetime_error              = 4
             lifetime_dynpro_dynpro_link = 5
             others                      = 6.
          IF sy-subrc NE 0.
         MESSAGE i000 WITH text-007.  " Error in object creation
            LEAVE LIST-PROCESSING.
          ENDIF.
    -- Create an instance of alv control--
          CREATE OBJECT grid1
                 EXPORTING
                    i_lifetime = 1
                    i_parent = grid_container.
    ---- Disable all unwanted button in the ALV grid -
          PERFORM disable_functions TABLES i_excl_func.
    ---- Call the display function of ALV grid -
          CALL METHOD grid1->set_table_for_first_display
               EXPORTING
                         is_variant       = l_layout
                         i_save           = 'A'
                         is_layout        = gs_layout
                         is_print         = ls_prnt
                         it_toolbar_excluding          = i_excl_func
               CHANGING  it_outtab        = gt_vbkpf[]
                         it_fieldcatalog  = i_fieldcat.
        ENDIF.                  "  IF cl_gui_alv_grid=>offline IS INITIAL
        CALL METHOD grid1->register_edit_event
            EXPORTING
             i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid1->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ---- Create a reciever object to handle events -
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_data_changed FOR grid1.
        SET HANDLER event_receiver->handle_hotspot FOR grid1.
        CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid1.
      ENDIF.                   " IF grid1 IS INITIAL.
    ENDMODULE.                 " PB0_100  OUTPUT
    *&      Form  fill_table
         Fills the data table to be passed to the ALV grid.
    FORM fill_table.
      LOOP AT gt_vbkpf1.
        MOVE-CORRESPONDING gt_vbkpf1 TO gt_vbkpf.
        IF ad_doc = 'X' OR all_doc = 'X'.
          thead-tdobject = 'BELEG'.
          CONCATENATE gt_vbkpf1-bukrs
                      gt_vbkpf1-belnr
                      gt_vbkpf1-gjahr INTO thead-tdname.
          thead-tdspras = sy-langu.
          thead-tdid = '0004'.
          PERFORM read_text.
          READ TABLE inline INDEX 1.
          gt_vbkpf-rev_code =  inline-tdline.
          REFRESH inline.
          CLEAR inline.
          thead-tdid = '0005'.
          PERFORM read_text.
          READ TABLE inline INDEX 1.
          gt_vbkpf-rev_rsn =  inline-tdline.
          REFRESH inline.
          CLEAR inline.
          thead-tdid = '0006'.
          PERFORM read_text.
          READ TABLE inline INDEX 1.
          gt_vbkpf-rev_date =  inline-tdline.
          REFRESH inline.
          CLEAR inline.
          REFRESH inline.
          CLEAR inline.
        ENDIF.
        APPEND gt_vbkpf.
        CLEAR gt_vbkpf.
    ENDLOOP.
      ENDLOOP.
    ENDFORM.
    *&      Form  fieldcat_init
         Initialize the field catalog
    FORM fieldcat_init CHANGING i_fieldcat TYPE lvc_t_fcat.
      DATA: i_fldcat TYPE lvc_t_fcat WITH HEADER LINE.
    CHECKBOX
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'XPICK'.
      i_fldcat-checkbox  = 'X'.
    i_fldcat-key       = 'X'.
      i_fldcat-tabname   = 'GT_VBKPF'.
      i_fldcat-outputlen   =  '4'.
      i_fldcat-scrtext_l =  'ChkB'.
       APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BELNR'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-hotspot   = 'X'.
      i_fldcat-outputlen   =  '15'.
      i_fldcat-scrtext_l =  'Document Number'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'GJAHR'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-scrtext_l = 'FYear'.
      i_fldcat-outputlen   = '5'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BUKRS'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-scrtext_l = 'CCode'.
      i_fldcat-outputlen   =  '5'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BLART'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-scrtext_l = 'Type'.
      i_fldcat-outputlen   =  '6'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BLDAT'.
      i_fldcat-tabname  = 'GT_VBKPF'.
    i_fldcat-key      = 'X'.
      i_fldcat-scrtext_l = 'Doc Date'.
      i_fldcat-outputlen   =  '12'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BUDAT'.
      i_fldcat-tabname  = 'GT_VBKPF'.
    i_fldcat-key      = 'X'.
      i_fldcat-scrtext_l = 'Park Date'.
      i_fldcat-outputlen   =  '12'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'BKTXT'.
      i_fldcat-tabname  = 'GT_VBKPF'.
    i_fldcat-key      = 'X'.
      i_fldcat-scrtext_l = 'Document Header Text'.
      i_fldcat-outputlen   =  '25'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'WAERS'.
      i_fldcat-tabname  = 'GT_VBKPF'.
    i_fldcat-key      = 'X'.
      i_fldcat-scrtext_l = 'Curr'.
      i_fldcat-outputlen   =  '7'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'USNAM'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-scrtext_l = 'Parked By'.
      i_fldcat-outputlen   =  '13'.
      APPEND i_fldcat TO i_fieldcat.
      CLEAR i_fldcat.
      i_fldcat-fieldname = 'XBLNR'.
      i_fldcat-tabname   = 'GT_VBKPF'.
    i_fldcat-key       = 'X'.
      i_fldcat-scrtext_l = 'Reference Text'.
      i_fldcat-outputlen   =  '19'.
      APPEND i_fldcat TO i_fieldcat.
      IF ad_doc = 'X' OR all_doc = 'X'.
        CLEAR i_fldcat.
        i_fldcat-fieldname = 'REV_CODE'.
        i_fldcat-tabname   = 'GT_VBKPF'.
       i_fldcat-key       = 'X'.
        i_fldcat-scrtext_l = 'RC'.
        i_fldcat-outputlen   =  '2'.
        APPEND i_fldcat TO i_fieldcat.
        CLEAR i_fldcat.
        i_fldcat-fieldname = 'REV_RSN'.
        i_fldcat-tabname   = 'GT_VBKPF'.
       i_fldcat-key       = 'X'.
        i_fldcat-scrtext_l = 'Rev Reason'.
        i_fldcat-outputlen   =  '15'.
        APPEND i_fldcat TO i_fieldcat.
        CLEAR i_fldcat.
        i_fldcat-fieldname = 'REV_DATE'.
        i_fldcat-tabname   = 'GT_VBKPF'.
       i_fldcat-key       = 'X'.
        i_fldcat-scrtext_l = 'Rev Date'.
        i_fldcat-outputlen   =  '10'.
        APPEND i_fldcat TO i_fieldcat.
      ENDIF.
    ENDFORM.                    " fieldcat_init
    *&      Module  PAI_100  INPUT
    MODULE pai_100 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          IF sy-dynnr = '1000'.
            PERFORM exit_program.
          ELSEIF sy-dynnr = '0100'.
            LEAVE TO TRANSACTION 'ZPPD'.
          ENDIF.
        WHEN 'EXIT'.
          IF sy-dynnr = '1000'.
            PERFORM exit_program.
          ELSEIF sy-dynnr = '0100'.
            LEAVE TO TRANSACTION 'ZPPD'.
          ENDIF.
        WHEN '%EX'.
          IF sy-dynnr = '1000'.
            PERFORM exit_program.
          ELSEIF sy-dynnr = '0100'.
            LEAVE TO TRANSACTION 'ZPPD'.
          ENDIF.
        WHEN 'BINP'.
          DATA : ws_x TYPE c VALUE 'X'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
              EXPORTING
                   titlebar      = 'Posting Documents Via Batch Input'
                   text_question =
               'Are you sure you want to post all the selected documents?'
                   text_button_1 = 'Yes'
                   text_button_2 = 'No'
                   start_column  = 25
                   start_row     = 6
              IMPORTING
                   answer        = ans.
          IF ans = '1'.
            CALL METHOD grid1->check_changed_data
                 IMPORTING
                   e_valid = ws_x.
            xbinp = 'X'.
            PERFORM tbkpf_fuellen.
            IF records = 'X'.
              MESSAGE s999(zv) WITH text-007.
            ELSE.
              PERFORM beleg_pickup.
            ENDIF.
          ENDIF.
        WHEN 'MALL'.
          PERFORM mall.
        WHEN 'EMAL'.
          PERFORM emal.
        WHEN 'RW'.
          IF sy-dynnr = '1000'.
            PERFORM exit_program.
          ELSEIF sy-dynnr = '0100'.
            LEAVE TO TRANSACTION 'ZPPD'.
          ENDIF.
        WHEN 'BUCH'.
          CALL FUNCTION 'POPUP_TO_CONFIRM'
               EXPORTING
                    titlebar      = 'Posting Document'
                    text_question =
                'Are you sure you want to post all documents selected?'
                    text_button_1 = 'Yes'
                    text_button_2 = 'No'
                    start_column  = 25
                    start_row     = 6
               IMPORTING
                    answer        = ans.
          IF ans = '1'.
            CALL METHOD grid1->check_changed_data
              IMPORTING
                e_valid = ws_x.
                perform tbkpf_fuellen.
            IF records = 'X'.
              MESSAGE s999(zv) WITH text-007.
            ELSE.
              PERFORM beleg_pickup.
            ENDIF.
          ENDIF.
        WHEN 'PICK'.
          DATA : check TYPE n,
                 no_rec TYPE c.
          check = 0.
          no_rec = 'X'.
          CALL METHOD grid1->check_changed_data
            IMPORTING
              e_valid = ws_x.
          index = 0.
          LOOP AT gt_vbkpf.
            funcl = 'D'.
            index = index + 1.
            IF gt_vbkpf-xpick = 'X'.
              check = 1.
              CLEAR no_rec.
              READ TABLE gt_vbkpf1 INDEX index INTO vbkpf.
              PERFORM beleg_pickup.
            ENDIF.
          ENDLOOP.
          IF check = 0.
            CALL METHOD grid1->get_selected_rows
              IMPORTING
                et_index_rows = ws_row_idx.
            IF NOT ws_row_idx IS INITIAL.
              CLEAR no_rec.
            ENDIF.
            LOOP AT ws_row_idx INTO i_ws_row_idx.
              READ TABLE gt_vbkpf1 INDEX i_ws_row_idx-index INTO vbkpf.
              PERFORM beleg_pickup.
            ENDLOOP.
            IF no_rec = 'X'.
              MESSAGE s999(zv) WITH text-007.
            ENDIF.
          ENDIF.
        WHEN '&RNT_PREV'.
          CALL METHOD grid1->set_function_code
          CHANGING c_ucomm = ok_code.
        WHEN '&RNT'.
          CALL METHOD grid1->set_function_code
          CHANGING c_ucomm = ok_code.
        WHEN '%SC'.
          CALL METHOD grid1->set_function_code
          CHANGING c_ucomm = ok_code.
        WHEN '&OL0'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN '&OAD'.
          CALL METHOD grid1->set_function_code
          CHANGING c_ucomm = ok_code.
        WHEN '&AVE'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN '&AQW'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN '&XXL'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN '%PC'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN '&CRTEMPL'.
          CALL METHOD grid1->set_function_code
         CHANGING c_ucomm = ok_code.
        WHEN OTHERS.
         do nothing.
      ENDCASE.
      CLEAR ok_code.
    ENDMODULE.                 " PAI_100  INPUT
    *&      Form  exit_program
         Exits from the program after freeing the grid and container     *
    FORM exit_program.
      IF NOT grid_container IS INITIAL.
        CALL METHOD grid_container->free.
      ENDIF.
      IF NOT grid1 IS INITIAL.
        CALL METHOD grid1->free
           EXCEPTIONS
             cntl_error        = 1
             cntl_system_error = 2
             OTHERS            = 3.
      ENDIF.
      LEAVE PROGRAM.
    ENDFORM.                    " exit_program
    *&      Form  f2200_handle_data_changed
          To handle event of change in data in ALV.
         -->P_ER_DATA_CHANGED  text
    FORM f2200_handle_data_changed USING    ir_data_changed
                                             TYPE REF TO
                                             cl_alv_changed_data_protocol.
      DATA : ls_mod_cell TYPE lvc_s_modi ,
             lv_value TYPE lvc_value,
             lflg_check TYPE i.
      DATA : wa_vbkpf LIKE LINE OF gt_vbkpf.
      SORT ir_data_changed->mt_mod_cells BY row_id .
      LOOP AT ir_data_changed->mt_mod_cells
                         INTO ls_mod_cell
                         WHERE fieldname = 'I_PICK'.
        IF NOT ls_mod_cell-value IS INITIAL .
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = ls_mod_cell-fieldname
              i_value     = ls_mod_cell-value.
          READ TABLE gt_vbkpf INTO wa_vbkpf
                     INDEX ls_mod_cell-row_id.
          IF ls_mod_cell-fieldname = 'I_PICK'.
            wa_vbkpf-xpick = ls_mod_cell-value.
          ENDIF.
          MODIFY gt_vbkpf  FROM wa_vbkpf
                              INDEX ls_mod_cell-row_id.
        ENDIF .
      ENDLOOP .
    ENDFORM.                    " f2200_handle_data_changed
    *&      Form  f2201_handle_hotspot
                To handle event of clicking on hyperlink
         -->P_E_COLUMN_ID  text
    FORM f2201_handle_hotspot USING    p_e_column_id  p_e_row_id.
      READ TABLE gt_vbkpf1 INDEX p_e_row_id INTO vbkpf.
      funcl = 'D'.
      PERFORM beleg_pickup.
      PERFORM exit_program.
    ENDFORM.                    " f2201_handle_hotspot
    Regards,
    Susmitha
    Dont forget to reward points for useful answers

  • How to implement line selectability for a table control using table Wizard?

    Hello SDN Community,
    I have created a table control using the Table Wizard.  I found my exact question in this forum, but unfortunately it had not been andsered.  While I cannot paste a screen-print into this plane-text area, here are the steps I followed...
    1) SE51
    2) Create new screen 0100
    3) Click Layout button
    4) Clidk Table Control (with Wizard) and draw box on canvas.
    5) Step is "Start" - click Continue
    6) Step is "Name of Table Control" - provided name
    7) Step is "Table Name" - provided name of dictionary table (AUFK)
    8) Step is "Definition of Columns" - selected order numver and order text
    9) Step is "Table Control Attributes" - Line Selectability is in display mode - cannot set it.
    I would like to have a selectability column for my table.  Would appreciate any insight into how to do this.
    Thank you,
    Dean Atteberry.

    This is a puzzling...
    For the table control wizard, in the Table Control Attributes step, I was able to get line selectability to open up by declaring a char01 data element at the beginning of my type.
    The puzzling is in regards to the "Selection col. fld" entry field.
    If I leave it blank and try to go to the next step, I get message "Enter the name of the selection column if you are using a program table"
    So it looked like it wanted to know the name of my selection column.  So I type in "CHAR1".  and got the message "The field "CHAR1" for the selection column is already contained in the table."
    Hmmmmm.... don't understand............
    Dean Atteberry.

  • How to process Line Selection on ALV Table in ABAP WebDynpro

    Hi there,
    I have a view with an ALV table whose context node retrieves its data from a Service Call for a method.
    The method provides certain data of a database table which the ALV displays.
    Now I would like to be able to select one row of that ALV table and after pressing a button or doubleclicking on the row or whatever a different view (as for me it is also ok on the same view) should appear to display the details of that selection.
    I only need to know how to retrieve the selected data.
    Or its index within the internal table.
    I am already looking for hours for a useful thread and actually there is one which obviously is about a similar issue apart from the multiple selection part: 
    How to process multiple row selection in ALV table in Wendynpro ABAP? Help!
    but i am afraid that i don't understand it. Or at least I misunderstand it since it does not work with me.
    The system example mentioned in the thread does not help me either because it somehow does not correspond to my needs, does it?
    It would be GREAT if somebody could help me with that. Please keep it simple for I am not an expert in webdynpro yet (obviously ^^) and also please explain in detail what I have to do with the context nodes since I am not sure whether the selection is stored in my already existing node or whether I need a special one for that.
    Thanks!!
    christina

    Hi Christina,
    If you just want to get one column data of the line that user clicked, use the Web Dynpro Code Wizard to Read Context of attibute you needed, then you will get code as follow:
    * Define data for read attribute
        node_alv TYPE REF TO if_wd_context_node,
        elem_alv TYPE REF TO if_wd_context_element,
        stru_alv TYPE if_view_display=>element_alv ,
        item_column_name  LIKE stru_alv-column_name.
    * navigate from <CONTEXT> to <ALV> via lead selection
      node_alv = wd_context->get_child_node( name = if_view_display=>wdctx_alv ).
    * get element via lead selection
      elem_alv = node_alv->get_element(  ).
    * get single attribute
      elem_alv->get_attribute(
        EXPORTING
          name =  `COLUMN_NAME'
        IMPORTING
          value = item_column_name ).
    The value of column_name is stored in item_column_name.
    If you need the index that the user clicked, try this:
    * Definition of field symbol for index
      FIELD-SYMBOLS : <fs_index> TYPE data.
    * Get the selected index
      ASSIGN r_param->index->* TO <fs_index>.
    The index of clicked line is stored in field symbol <fs_index>.
    Hope it will help.
    Best Regards,
    Stephanie

  • ITS URGENT QUES ON AT LINE-SELECTION AND AT USER-COMMAND

    ITS URGENT...WHEN I SELECT MULTIPUL VALUES IN BASIC LIST ,I HAVE TO GET THOSE SELECTED MULTIPUL VALUES IN SECONDARY LIST THAT CAN BE AFTER(AT LINE-SELECTION OR AT USER-COMMAND)............?

    hey
    this code modify's simlarly u can read n  display secondary window
        DO .
    Reading the internal table whose data is displayed into wrk area.....
          READ LINE SY-INDEX FIELD VALUE INT_DISPLAY-SHIPMENT_ID INTO WF_SHIPMENT_ID.
    Reading the check box value
          READ LINE SY-INDEX FIELD VALUE WG_CHK.
    If all the records are read and there is no code left to read
          IF SY-SUBRC <> 0 .
            EXIT.
          ENDIF.
    To highlight the line which is selected by the user
          IF WG_CHK = WL_X.
            MODIFY CURRENT LINE
            LINE FORMAT COLOR COL_NEGATIVE INVERSE
            FIELD VALUE WG_CHK FROM WL_SPACE.
            MODIFY CURRENT LINE
            LINE FORMAT INPUT OFF.
    Also append the record read into new internal table which u will display in secondary window.......
          ENDIF.
        ENDDO.
    AT USER-COMMAND. or AT LINE SELECTION . u can write this code.........
    DISPLAYING A POP-UP WINDOW .
          WINDOW STARTING AT 10 50
                 ENDING AT 120 70.
    and then write the table into which u have stored the read entry which user had selected
    reward points if useful

  • At line-selection and user command

    hi,
    is it possible to use both at line selecion and at user command at a time.

    Hi Kiran,
      Yes, it is possible to use both at line selecion and at
      user command at a time.
    AT LINE-SELECTION.
    Event in interactive reporting
    This event is processed whenever the user chooses a valid line in the list (i.e. a line generated by statements such as WRITE,ULINE, or SKIP) with the cursor and presses the function key which has the function PICK in the interface definition. This should normally be the function key F2, because it has the same effect as double-clicking the mouse, or clicking once in the case of a hotspot.
    The processing for the event AT LINE-SELECTION usually generates further list output (the details list) which completely covers the current list display. If you want the current list display to remain visible (to aid user orientation), you can do this with the key word WINDOW.
    AT USER-COMMAND.
    Event in interactive reporting
    This event is executed whenever the user presses a function key in the list or makes an entry in the command field.
    DATA: NUMBER1 TYPE I VALUE 20,
          NUMBER2 TYPE I VALUE  5,
          RESULT  TYPE I.
    START-OF-SELECTION.
      WRITE: / NUMBER1, '?', NUMBER2.
    AT USER-COMMAND.
      CASE SY-UCOMM.
        WHEN 'ADD'.
          RESULT = NUMBER1 + NUMBER2.
        WHEN 'SUBT'.
          RESULT = NUMBER1 - NUMBER2.
        WHEN 'MULT'.
          RESULT = NUMBER1 * NUMBER2.
        WHEN 'DIVI'.
          RESULT = NUMBER1 / NUMBER2.
        WHEN OTHERS.
          WRITE 'Unknown function code'.
          EXIT.
      ENDCASE.
      WRITE: / 'Result:', RESULT.
    After entry of a function code, the appropriate processing is performed under the event AT USER-COMMAND and the result is displayed in the details list.
    Reward points if helpful,
    Rgds,
    Sumana

  • At line-selection and At-user command

    Hi friends,
    Can we use both those events at a time in report?
    If so can any body provide me sample code?
    Regards

    <b>Example for AT LINE-SELECTION</b>
    REPORT demo_list_at_line_selection.
    START-OF-SELECTION.
      WRITE  'Basic List'.
    AT LINE-SELECTION.
      WRITE: 'Secondary List by Line-Selection',
           / 'SY-UCOMM =', sy-ucomm.
    When you run the program, the basic list appears with the standard list status. The detail list shows that SY-UCOMM has the value PICK.
    <b>Example for AT USER-COMMAND</b>
    REPORT demo_list_at_user_command NO STANDARD PAGE HEADING.
    START-OF-SELECTION.
      WRITE: 'Basic List',
           / 'SY-LSIND:', sy-lsind.
    TOP-OF-PAGE.
      WRITE 'Top-of-Page'.
      ULINE.
    TOP-OF-PAGE DURING LINE-SELECTION.
      CASE sy-pfkey.
        WHEN 'TEST'.
          WRITE 'Self-defined GUI for Function Codes'.
          ULINE.
      ENDCASE.
    AT LINE-SELECTION.
      SET PF-STATUS 'TEST' EXCLUDING 'PICK'.
      PERFORM out.
      sy-lsind = sy-lsind - 1.
    AT USER-COMMAND.
      CASE sy-ucomm.
        WHEN 'FC1'.
          PERFORM out.
          WRITE / 'Button FUN 1 was pressed'.
        WHEN 'FC2'.
          PERFORM out.
          WRITE / 'Button FUN 2 was pressed'.
        WHEN 'FC3'.
          PERFORM out.
          WRITE / 'Button FUN 3 was pressed'.
        WHEN 'FC4'.
          PERFORM out.
          WRITE / 'Button FUN 4 was pressed'.
        WHEN 'FC5'.
          PERFORM out.
          WRITE / 'Button FUN 5 was pressed'.
      ENDCASE.
      sy-lsind = sy-lsind - 1.
    FORM out.
      WRITE: 'Secondary List',
           / 'SY-LSIND:', sy-lsind,
           / 'SY-PFKEY:', sy-pfkey.
    ENDFORM.
    When you run the program, the system displays the following basic list with a the page header defined in the program:
    You can trigger the AT LINE-SELECTION event by double-clicking a line. The system sets the status TEST and deactivates the function code PICK. The status TEST contains function codes FC1 to FC5. These are assigned to pushbuttons in the application toolbar. The page header of the detail list depends on the status.
    Here, double-clicking a line no longer triggers an event. However, there is now an application toolbar containing five user-defined pushbuttons. You can use these to trigger the AT USER-COMMAND event. The CASE statement contains a different reaction for each pushbutton.
    For each interactive event, the system decreases the SY-LSIND system field by one, thus canceling out the automatic increase. All detail lists now have the same level as the basic list and thus overwrite it. While the detail list is being created, SY-LSIND still has the value 1.
    I hope it helps.
    For more details have a look at below link.
    http://help.sap.com/saphelp_di471/helpdata/EN/9f/dba3ae35c111d1829f0000e829fbfe/content.htm
    Best Regards,
    Vibha
    *Please mark all the helpful answers

  • Insert, select and create table as give different results

    Hi all
    I have a strange situation with this three cases:
    1) select statement: SELECT (...)
    2) insert statement with that same select as above: INSERT INTO SELECT (...)
    3) create table statement again with that same select: CREATE TABLE AS SELECT (...)
    Each of these cases produce different number of rows (first one 24, second 108 and third 58). What's more the data for second and third case doesn't have any sense with what they should return. The first case returns good results.
    One interesting thing is that select uses "UNION ALL" between 2 queries. When simple UNION is used, everything works fine and all three cases return 24 rows. Also if each query is run seaprately, they work fine.
    Anyone encountered something like this? (before i create an SR :)
    Database is 10.2.0.2 on AIX 5.3. It's a data warehouse.
    Edited by: dsmoljanovic on Dec 10, 2008 3:57 PM

    I understand UNION vs UNION ALL. But that doesn't change the fact that same SELECT should return same set of rows wether in INSERT, CREATE TABLE AS or a simple SELECT.
    DB version is 10.2.0.2.
    Here is the SQL:
    INSERT INTO TMP_TRADING_PROM_BM_OSTALO
    select
    5 AS VRSTA_PLANIRANJA_KLJUC, u1.UNOS_KLJUC, t1.TRADING_TIP_KLJUC, i1.IZVOR_KLJUC, m1.ITEMNAME AS MJESEC,
    l1.PLAN AS IZNOS, l1.TEKUA AS TEKUCA, l1.PROLA AS PROSLA, l1.PLANTEKUA_ AS IZNOS_TEKUCA, l1.PLANPROLA_ AS IZNOS_PROSLA, l1.TEKUAPROLA_ AS TEKUCA_PROSLA, l1.DATUM_UCITAVANJA
    from
    HR_SP_PLAN.L_12_ET_PROMETI_I_BRUTO_MARZA l1,
    select
    m1.ITEMIID, m1.ITEMNAME
    from
    HR_SP_PLAN.L_12_IT_4_MJESECI m1
    where
    UPPER (m1.ITEMNAME) NOT LIKE '%KVARTAL%' AND UPPER (m1.ITEMNAME) NOT LIKE '%GODINA%' AND UPPER (m1.ITEMNAME) NOT LIKE '%PROC%' and
    m1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy')
    union all
    select -99, null from dual
    ) m1,
    HR_SP_PLAN.L_12_IT_5_SEKTORI l2,
    HR_SP_PLAN.L_12_IT_2_TIPOVI_OSTALO l3, HR_SP_PLAN.D_UNOS u1, HR_SP_PLAN.D_TRADING_TIP t1, HR_SP_PLAN.L_12_IT_1_PROMET_I_BM_OSTALO p1, HR_SP_PLAN.D_IZVOR i1
    where
    l1.ELIST = l2.ITEMIID and
    l2.ITEMNAME = u1.UNOS_NAZIV and u1.USER_KLJUC = 12 and l2.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    l1.DIMENSION_1_PROMET = p1.ITEMIID and
    p1.ITEMNAME = i1.IZVOR_NAZIV and i1.USER_KLJUC = 12 and p1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    nvl(l1.DIMENSION_4_MJESEC , -99) = m1.ITEMIID and
    l1.DIMENSION_2_TIPOVI = l3.ITEMIID and
    l3.ITEMNAME = t1.TRADING_TIP_NAZIV and l3.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    l1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    'PROC' = 'PLAN'
    union all
    select
    4 AS VRSTA_PLANIRANJA_KLJUC, u1.UNOS_KLJUC, t1.TRADING_TIP_KLJUC, i1.IZVOR_KLJUC, m1.ITEMNAME AS MJESEC,
    l1.PROCJENA AS IZNOS, l1.TEKUA AS TEKUCA, l1.PROLA AS PROSLA, l1.PROCJENATEKUA_ AS IZNOS_TEKUCA, l1.PROCJENAPROLA_ AS IZNOS_PROSLA, l1.TEKUAPROLA_ AS TEKUCA_PROSLA, l1.DATUM_UCITAVANJA
    from
    HR_SP_PLAN.L_13_ET_PROMETI_I_BRUTO_MARZA l1,
    select
    m1.ITEMIID, m1.ITEMNAME
    from
    HR_SP_PLAN.L_13_IT_4_MJESECI m1
    where
    UPPER (m1.ITEMNAME) NOT LIKE '%KVARTAL%' AND UPPER (m1.ITEMNAME) NOT LIKE '%GODINA%' AND UPPER (m1.ITEMNAME) NOT LIKE '%PROC%' and
    nvl(ceil(to_number(m1.ITEMNAME)/3), mod(4, 5)) = mod(4, 5) and m1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy')
    union all
    select -99, null from dual
    ) m1,
    HR_SP_PLAN.L_13_IT_5_SEKTORI l2, HR_SP_PLAN.L_13_IT_2_TIPOVI_OSTALO l3,
    HR_SP_PLAN.D_UNOS u1, HR_SP_PLAN.D_TRADING_TIP t1,
    HR_SP_PLAN.L_13_IT_1_PROMET_I_BM_OSTALO p1, HR_SP_PLAN.D_IZVOR i1
    where
    l1.ELIST = l2.ITEMIID and
    l2.ITEMNAME = u1.UNOS_NAZIV and u1.USER_KLJUC = 13 and l2.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    l1.DIMENSION_1_PROMET = p1.ITEMIID and
    p1.ITEMNAME = i1.IZVOR_NAZIV and i1.USER_KLJUC = 13 and p1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    nvl(l1.DIMENSION_4_MJESEC , -99) = m1.ITEMIID and
    l1.DIMENSION_2_TIPOVI = l3.ITEMIID and
    l3.ITEMNAME = t1.TRADING_TIP_NAZIV and l3.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    l1.DATUM_UCITAVANJA = to_date('24.11.2008','dd.mm.yyyy') and
    'PROC' = 'PROC';

  • React to a line-selection on a table-view

    Hello,
    I show some data on a table-view and i want to show detail-information in another table-view when a user selects a row of my table-view. How can i get that done?
    Is there an event to catch? How can i realize that?
    Thanks for your help!

    The tableView control has an event "onRowSelection"
    event:
    "Defines the event handling method that will be processed when the user clicks on the radiobutton button in the first column. The radiobutton is visible when the 'selectionMode' is set to "SINGLESELECT". The method com.sap.htmlb.event.TableSelectionEvent.getRowIndex() can be used to retrieve the index of the row that initiated the event"
    import com.sap.htmlb.enum.TableSelectionMode;.
    /* Get the tableView component */
    TableView table = (TableView) this.getComponentByName("myTableView");
    /* Set the onHeaderClick event
    table.setSelectionMode(TableSelectionMode.SINGLESELECT);
    table.setOnRowSelection("onRowSelClick");
    /*  the method onRowSelClick has to be declared in the DynPage. Otherwise an
        exception is thrown ("method not found") when the user clicks on the
        radio button of the tableView.
        Declaring onHeaderClick:
           public void onRowSelClick(Event event)  {          
    System.out.println("Row selection click");     
    Edit: Sorry, I did not see at first that your question aimed at the Visual Composer. I don't know the VC - so no idea if this works.
    Message was edited by: Francisco Villar

  • Not able to select and copy from adf table in IE and chrome if we enable row selection

    Hi All,
    We have an adf table and user wants to select and copy table cell values.
    We enabled row selection on adf table. Ifrow selection is in place, IE and Chrome are not allowing user to select and copy data. But Firefox is allowing.
    Do we have any solution to this? For our customer IE is the standard browser and they do test app on IE.
    Regards
    PavanKumar

    Hi Timo,
    Sorry forgot to mention versions.
    We are using 11.1.1.7 and IE 9.
    I tried in Google but could not get the solution.
    Kindly let me know solution for this.
    PavanKumar

Maybe you are looking for

  • ANN: XML Class Generator for Java Available

    The Oracle XMCL Class Generator for Java is now available as an initial beta release on the Oracle Technology Network at http://technet.oracle.com. Select 'xml' from the Technology menu. The XML Class Generator will generate a set of Java source file

  • IPhone 4 iOS7: Playing music over bluetooth, short dropout during mp3-id-transfer

    After upgrading my iPhone 4 to iOS7, i have a little problem with the music-player. I use it, playing music in my car over Bluetooth. Everytime a new song starts, I have a short dropout while my iPhone transfers the MP3 tag to my car's soundsystem. I

  • Lock screen display issues - Macbook Pro Yosemite

    When waking my Macbook up after it has slept, the lock screen sometimes appears as below, with the left hand side appearing as fragmented lines and the right normally, save for the fact that the blurred image is not my current desktop background. At

  • WDS 2012 Black Screen when trying to capture image

    I'm currently having an issue trying to capture windows 8.1 Enterprise image using Server 2012 R2 + WDS for deployment. All the usual steps have been followed, images added from the install media used to set up the initial machine, DHCP configured an

  • Flash menu reloads and therefore collapses

    I have a site prototype at http://www.olsonzaltman.com/prototype. The menu is one I've customized using the coding brainwork of Ian Kelleigh of www.freehandsource.com. Many thanks to him. My problem is that shy of using frames, I can't get the menu t