Select single row in ALV grid

ABAPer's ,
Does anyone can guide me to select single row only in ALV grid , without OO.

Hello,
I did not get u.
But check the below code it may help u.
tables: mara.
TYPE-POOLS: SLIS.
data:repid like sy-repid.
data: itb type mara occurs 0 with header line,
IT_FIELDCAT TYPE STANDARD TABLE OF SLIS_FIELDCAT_ALV WITH HEADER LINE,
IT_LAYOUT TYPE SLIS_LAYOUT_ALV,
ITB1 TYPE MAKT OCCURS 0 WITH HEADER LINE.
selection-screen begin of block b.
parameters: p_matnr type matnr.
selection-screen end of block b.
select * from mara into table itb where matnr = p_matnr.
SELECT * FROM MAKT INTO TABLE ITB1 WHERE MATNR = P_MATNR.
repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
  I_INTERFACE_CHECK              = ' '
  I_BYPASSING_BUFFER             =
  I_BUFFER_ACTIVE                = ' '
   I_CALLBACK_PROGRAM             = repid
  I_CALLBACK_PF_STATUS_SET       = ' '
   I_CALLBACK_USER_COMMAND        = 'HANDLE_USER_COMMAND'
   I_STRUCTURE_NAME               = 'MARA'
   IS_LAYOUT                      = IT_LAYOUT
   IT_FIELDCAT                    = IT_FIELDCAT[]
  IT_EXCLUDING                   =
  IT_SPECIAL_GROUPS              =
  IT_SORT                        =
  IT_FILTER                      =
  IS_SEL_HIDE                    =
  I_DEFAULT                      = 'X'
  I_SAVE                         = ' '
  IS_VARIANT                     =
  IT_EVENTS                      =
  IT_EVENT_EXIT                  =
  IS_PRINT                       =
  IS_REPREP_ID                   =
  I_SCREEN_START_COLUMN          = 0
  I_SCREEN_START_LINE            = 0
  I_SCREEN_END_COLUMN            = 0
  I_SCREEN_END_LINE              = 0
IMPORTING
  E_EXIT_CAUSED_BY_CALLER        =
  ES_EXIT_CAUSED_BY_USER         =
  TABLES
    t_outtab                       = itb
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 HANDLE_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM RS_SELFIELD TYPE
SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
CLEAR IT_FIELDCAT[].
IF RS_SELFIELD-FIELDNAME = 'MATNR'.
READ TABLE ITB1 INDEX RS_SELFIELD-TABINDEX.
WRITE: / ITB1-MAKTX.
ENDIF.
ENDCASE.
ENDFORM. "HANDLE_USER_COMMAND
Regards

Similar Messages

  • Selecting Multiple Rows from ALV GRID Display

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

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

  • Selecting multiple rows in ALV grid display

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

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

  • Selecting multiple rows in alv grid

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

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

  • Selection of rows in ALV grid (class CL_GRID_CATSXT)

    Hi all,
    The CATS transaction CATS_APPR_LITE is using the class CL_GRID_CATSXT, method GET_SELECTED_ROWS, to retrieve selected rows in the ALV report.
    The user/manager selects these rows to approve the work hours registered by his subordinates. He can only select and approve those rows that have been fully expanded, meaning he cannot select and approve total lines. (If he tries to do so, nothing happens).
    I have created a layout that shows only total lines per employee. Using this layout the manager should be able to select the total line for a particular employee and press the "Approve" button. In this way, I need to get a hold of the rows contained in the total line, meaning I need the row numbers of the actual rows which have been added up in the total line.
    Does anyone know how to do this...? As mentioned earlier, the CATS_APPR_LITE transaction is using class CL_GRID_CATSXT, method GET_SELECTED_ROWS.
    All helpful answers will be rewarded!
    Best regards,
    MV

    I guess method GET_SELECTED_ROWS returns the total lines when they are selected ?
    if so, you just have to do a LOOP on your internal table having same key fields as selected total line

  • How to display multiple lines of texts in a single rows in ALV

    Hi,
    I have a unique requirement in which i have to display multiple lines if texts for a single rows in ALV Grid. Right now in my output it is coming in single line which is not visible fully because that text is more than 255 character. So i want to display the test by splitting into multiple lines and show it on output. Please suggest some solution for this if this is possible in ALV.
    Thanks,
    Raghav

    Hi Raghavendra,
    Its not possible to display multiple line in one row of an alv, but i think you can acheive it by splitting the whole text into multiple sub-text.
    For example, if your requirement is as below:
    Field #1          Field #2
    1                    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx(200 characters)
    2                    yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy(220 character)
    then you can break Field#2 value into say 50 character and then populate the internal table with repetative entries of Field#1 and the finally sort it by Field#1 value... as a result of which you output will be somewhat as below:
    Field#1          Field#2
    1                   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                         xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    2                   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
                         yyyyyyyyyyyyyyyyyyyy           
    Hope it will help you in meeting your requirement.
    Regards,
    Shradha

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

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

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

  • Problem in selecting rows in ALV Grid

    Hi All,
    I am doing a ALV Grid program using Classes. when i select 2 rows from that grid and executes,
    it going next screen. Again when  i am using back button and selecting same rows or different rows from teh same Grid and executing it is not retrieving any rows. In dedugger it is showing that the there is no selection of rows.
    Please suggest me the solution.
    Thanks in advance,
    Regards,
    Balaji.

    Hi chaitanya,
    I am not clearing any code.
    please find the code...
    CALL METHOD g_grid1->get_selected_rows
            IMPORTING
              et_index_rows = w_lvc_t_row_1.
          IF w_lvc_t_row_1 IS INITIAL.
            MESSAGE e004(zmsg).
          ELSE.
            CLEAR it_memis1-signal.
            REFRESH po_memis1.
            LOOP AT w_lvc_t_row_1 INTO w_lvc_s_row_1.
              READ TABLE it_memis1 INTO po_memis1 INDEX w_lvc_s_row_1-index.
              SELECT SINGLE name INTO v_nam FROM icon WHERE id = po_memis1-signal.
              IF v_nam = 'ICON_LED_GREEN' OR v_nam = 'ICON_LED_YELLOW'.
                APPEND po_memis1.
                CLEAR po_memis1-signal.
              ELSE.
                MESSAGE 'This item Cannot be processed due to errors' TYPE 'E'.
              ENDIF.
            ENDLOOP.
          ENDIF.
    regards,
    Balaji.

  • HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID?

    HI.
    HOW CAN I HAVE THE NUMBER OF SELECTED ROWS IN ALV GRID????
    GABRY =)

    You need to use
    data : grid1  type ref to cl_gui_alv_grid.
      call method grid1->get_selected_rows
        importing
          et_index_rows = i_sel_alvrows[].

  • Single click in alv grid

    Hi friends,
    below statement is for double clicking,
    WHEN '&IC1'. " SAP standard code for double-clicking, but i need single click because when i select field(not doubble click only single click) in alv grid it has to trigger and perform some action  ,can any one know please tell me.

    gwa_fldcat-col_pos       = 2.
      gwa_fldcat-fieldname     = 'CHK'.
      gwa_fldcat-tabname       = 'GT_FINAL'.
    gwa_fldcat-EMPHASIZE = 'C310'.
    gwa_fldcat-input        = 'X'.
      gwa_fldcat-edit          = 'X'.
      gwa_fldcat-checkbox      = 'X'.
      gwa_fldcat-just          = 'C'.
      gwa_fldcat-key           = 'X'.
      gwa_fldcat-outputlen     = 16.
      gwa_fldcat-seltext_l     = 'Selection'.
      gwa_fldcat-hotspot        = 'X'.
      APPEND gwa_fldcat TO git_fldcat.
      CLEAR gwa_fldcat.
      gs_events-name = 'USER_COMMAND'.
      gs_events-form = 'USER'.
      append gs_events to gi_events.
    call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
         i_callback_program                = sy-repid
         i_callback_pf_status_set          = 'PFSTATUS'
         i_callback_user_command           = 'USER'
         I_CALLBACK_TOP_OF_PAGE            = ' '
         I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
         I_CALLBACK_HTML_END_OF_LIST       = ' '
         I_STRUCTURE_NAME                  =
         I_BACKGROUND_ID                   = ' '
         I_GRID_TITLE                      =
          I_GRID_SETTINGS                   = wa_grid
         is_layout                         = gs_layout
         it_fieldcat                       = git_fldcat
         IT_EXCLUDING                      =
         IT_SPECIAL_GROUPS                 =
         IT_SORT                           =
         IT_FILTER                         =
         IS_SEL_HIDE                       =
         I_DEFAULT                         = 'X'
         I_SAVE                            = ' '
         IS_VARIANT                        =
         it_events                         = gi_events
         IT_EVENT_EXIT                     =
         IS_PRINT                          =
         IS_REPREP_ID                      =
         I_SCREEN_START_COLUMN             = 0
         I_SCREEN_START_LINE               = 0
         I_SCREEN_END_COLUMN               = 0
         I_SCREEN_END_LINE                 = 0
         IT_ALV_GRAPHICS                   =
         IT_HYPERLINK                      =
         IT_ADD_FIELDCAT                   =
         IT_EXCEPT_QINFO                   =
         I_HTML_HEIGHT_TOP                 =
         I_HTML_HEIGHT_END                 =
    IMPORTING
         E_EXIT_CAUSED_BY_CALLER           =
         ES_EXIT_CAUSED_BY_USER            =
    tables
         t_outtab                          = gt_final.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'X'.
      gs_layout-info_fieldname    = 'COLOR'.
    gs_layout-KEY_HOTSPOT       = 'X'.
    form user using lv_okcode   like sy-ucomm
                           rs_selfield type slis_selfield.
      lv_okcode = sy-ucomm.
    case lv_okcode.
    when '&IC1'.
    loop at gt_final into gwa_final .
    where chk = 'X'.
      if gwa_final-chk is not initial.
    gwa_final-color = 'C111' .
    modify gt_final from gwa_final
       index sy-tabix transporting color.
    clear gwa_final.
    endif.
    endloop.
    encase.
    form Grid_settings .
    wa_grid-EDT_CLL_CB = 'X'.
    endform.

  • How to select multiple row in ALV report

    Hi friends,
    1. How to select multiple row in ALV report
                   ( How to set tab in ALV report and want to select multiple line.)
    Thanking you.
    Subash

    Hi Sahoo,
    If you are using the class CL_GUI_ALV_GRID. In methods SET_TABLE_FOR_FIRST_DISPLAY.
    in layout structure you will find field SEL_MODE
    pass :
    LS_LAYOUT-SEL_MODE = 'A'.
    In PAI.
      CALL METHOD GRID->GET_SELECTED_ROWS
        IMPORTING
          ET_INDEX_ROWS = T_ROWS
          ET_ROW_NO     = T_ROWID.
    Hope these will solve your problem.
    Regards,
    Kumar M.

  • Color a row with ALV GRID

    Hi my friends,
    I have written a small ALV Grid where some rows should be colored, dependend on their status in a table. But it's not working and I can't find out, why it is not working. I've already studied all the topics in this forum, which are related to 'row color alv grid', but I can't find the mistake in my code. Is anyone able to find out what is wrong here?
    Thanks a lot for your help!
    *& Report  /BMC_TST_SHOWLOG
    REPORT  /BMC_TST_SHOWLOG.
    TYPES: BEGIN OF log_table.
      TYPES:  log_level TYPE /bmc_log_message,
              cr_date TYPE /bmc_cr_date,
              message TYPE /bmc_log_message,
              linecolor(4) TYPE c.
    TYPES: END OF log_table.
    DATA: lt_log TYPE TABLE OF log_table with HEADER LINE,
          lt_log2 TYPE TABLE OF log_table with HEADER LINE,
          lt_log_list TYPE TABLE OF log_table,
          lt_line LIKE LINE OF lt_log_list,
          container_r TYPE REF TO cl_gui_custom_container,
          grid_r TYPE REF TO cl_gui_alv_grid,
          gc_custom_control_name TYPE scrfname VALUE 'CONTAINER_LOG',
          fieldcat_r TYPE lvc_t_fcat,
          layout_r TYPE lvc_s_layo,
          logA TYPE /bmc_log_level,
          logB TYPE /bmc_log_level,
          logC TYPE /bmc_log_level,
          logD TYPE /bmc_log_level,
          logE TYPE /bmc_log_level,
          ls_ct TYPE lvc_s_scol,
          ok_code LIKE sy-ucomm.
    *DATA BEGIN OF ls_log_list OCCURS 0.
    *DATA: log_level TYPE /bmc_log_message,
    *      cr_date TYPE /bmc_cr_date,
    *      message TYPE /bmc_log_message,
    *      rowcolor(4) TYPE c.
    *DATA END OF ls_log_list.
    *DATA: lt_log_list TYPE TABLE OF log_table.
    PARAMETERS: loglevlA  TYPE c AS CHECKBOX,
                loglevlB  TYPE c as CHECKBOX,
                loglevlC  TYPE c As CHECKBOX,
                loglevlD  TYPE c aS CHECKBOX,
                loglevlE  TYPE c AS CHECKBOX,
                dateA     TYPE /bmc_cr_date OBLIGATORY,
                dateB     TYPE /bmc_cr_date.
    CALL SCREEN 0200.
    MODULE user_command_0200 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          SET SCREEN 0.
          MESSAGE ID 'BC400' TYPE 'S' NUMBER '057'.
        WHEN OTHERS.
      ENDCASE.
    ENDMODULE.
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'DYNPRO200'.
      SET TITLEBAR 'D0200'.
    ENDMODULE.
    MODULE display_alv OUTPUT.
      PERFORM display_alv.
    ENDMODULE.
    FORM display_alv.
      IF grid_r IS INITIAL.
    *----Creating custom container instance
      CREATE OBJECT container_r
      EXPORTING
        container_name = gc_custom_control_name
      EXCEPTIONS
        cntl_error = 1
        cntl_system_error = 2
        create_error = 3
        lifetime_error = 4
        lifetime_dynpro_dynpro_link = 5
        others = 6.
        IF sy-subrc <> 0.
    *--Exception handling
        ENDIF.
    *----Creating ALV Grid instance
        CREATE OBJECT grid_r
        EXPORTING
          i_parent = container_r
        EXCEPTIONS
          error_cntl_create = 1
          error_cntl_init = 2
          error_cntl_link = 3
          error_dp_create = 4
          others = 5.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          PERFORM get_log_data.
    *----Preparing field catalog.
          PERFORM prepare_field_catalog CHANGING fieldcat_r.
    *----Preparing layout structure
          PERFORM prepare_layout CHANGING layout_r.
    *----Here will be additional preparations
    *--e.g. initial sorting criteria, initial filtering criteria, excluding
    *--functions
          CALL METHOD grid_r->set_table_for_first_display
          EXPORTING
            is_layout = layout_r
          CHANGING
            it_outtab = lt_log2[]
            it_fieldcatalog = fieldcat_r
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error = 2
            too_many_lines = 3
            OTHERS = 4.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
          ELSE.
            CALL METHOD grid_r->refresh_table_display
          EXCEPTIONS
            finished = 1
            OTHERS = 2.
          IF sy-subrc <> 0.
    *--Exception handling
          ENDIF.
        ENDIF.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_enter.
        CALL METHOD grid_r->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    ENDFORM.
    FORM prepare_field_catalog CHANGING pt_fieldcat TYPE lvc_t_fcat.
        DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name = '/BMC_LOG'
      CHANGING
        ct_fieldcat = pt_fieldcat[]
      EXCEPTIONS
        inconsistent_interface = 1
        program_error = 2
        OTHERS = 3.
      IF sy-subrc ne 0.
    *--Exception handling
      ENDIF.
      LOOP AT pt_fieldcat INTO ls_fcat.
        CASE ls_fcat-fieldname.
          WHEN 'UUID'.
            ls_fcat-no_out = 'X'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'LOG_LEVEL'.
            ls_fcat-coltext = 'Meldungsart'.
            ls_fcat-outputlen = '25'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CR_DATE'.
            ls_fcat-coltext = 'Erstellungsdatum'.
            ls_fcat-outputlen = '20'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'CR_TIME'.
            ls_fcat-no_out = 'X'.
            MODIFY pt_fieldcat FROM ls_fcat.
          WHEN 'MESSAGE'.
            ls_fcat-coltext = 'Nachricht'.
            ls_fcat-outputlen = '50'.
            MODIFY pt_fieldcat FROM ls_fcat.
        ENDCASE.
    *    CASE ls_fcat-value.
    *      WHEN '1'.
    *        ls_fcat-line_color = 'c100'.
    *    ENDCASE.
      ENDLOOP.
    ENDFORM.
    FORM prepare_layout CHANGING ps_layout TYPE lvc_s_layo.
      ps_layout-zebra = 'X'.
      ps_layout-grid_title = 'Log'.
      ps_layout-smalltitle = 'X'.
      ps_layout-info_fname = 'linecolor'.
    ENDFORM.
    FORM get_log_data.
      if loglevlA = 'X'.
        logA = '1'.
      ENDIF.
      if loglevlB = 'X'.
        logB = '2'.
      ENDIF.
      if loglevlC = 'X'.
        logC = '3'.
      ENDIF.
      if loglevlD = 'X'.
        logD = '4'.
      ENDIF.
      if loglevlE = 'X'.
        logE = '5'.
      ENDIF.
      IF dateB ne 0.
        SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
          OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA and cr_date <= dateB.
      ELSE.
        SELECT log_level cr_date message FROM /bmc_log INTO CORRESPONDING FIELDS OF TABLE lt_log_list WHERE log_level = logA
          OR log_level = logB OR log_level = logC OR log_level = logD OR log_level = logE and cr_date >= dateA.
      ENDIF.
    *    and cr_date >= dateA.
        SORT lt_log_list ASCENDING.
        LOOP AT lt_log_list INTO lt_line.
        IF lt_line-log_level = '1'.
          lt_line-log_level = 'Info'.
          lt_line-linecolor = 'C100'.
        ENDIF.
        IF lt_line-log_level = '2'.
          lt_line-log_level = 'Warning'.
          lt_line-linecolor = 'C200'.
        ENDIF.
        IF lt_line-log_level = '3'.
          lt_line-log_level = 'Error'.
          lt_line-linecolor = 'C300'.
        ENDIF.
        IF lt_line-log_level = '4'.
          lt_line-log_level = 'Debug'.
          lt_line-linecolor = 'C400'.
        ENDIF.
        IF lt_line-log_level = '5'.
          lt_line-log_level = 'Trace'.
          lt_line-linecolor = 'C500'.
        ENDIF.
        APPEND lt_line TO lt_log2.
        ENDLOOP.
    ENDFORM.
    SELECTION-SCREEN BEGIN OF SCREEN 0100 TITLE text-001 AS WINDOW.
    SELECTION-SCREEN END OF SCREEN 0100.

    > change to this
    >
    > <b>ps_layout-stylefname = 'LINECOLOR'.</b>
    >
    > sorry ignore the above line
    >
    > just debug and check what is happening
    >
    > Message was edited by:
    >         Chandrasekhar Jagarlamudi
    Hi,
    I've changed the line to <b>ps_layout-stylefname = 'LINECOLOR'.</b>, but then I'm getting a runtime error 'ASSIGN_TYPE_CONFLICT' in program 'SAPLSLVC in line 2975'...
    I don't have any idea what is causing that.

  • Select multiple rows in a grid

    Hi All,
    I want to select multiple rows in a grid on click of a button, there is no checkbox there are multiple rows which need to be selected like we do on pressing shift key on the keyboard. Please suggest how can this be done.
    thanks in advance.
    Regards,
    Anju

    Hi Anju,
    You can check this link to solve your problem:
    https://wiki.sdn.sap.com/wiki/display/Snippets/ALV%2bGrid%2bDisplay%2bwith%2bcheckbox%2bto%2bprocess%2bselected%2brecords%2bat%2bruntime
    Hope it helps you.
    Thanks & Regards,
    Sarita Singh Rathour

  • Not able to select a row in ALV?

    Hi Experts,
    I am enhancing a standard e-recruiting WD ABAP component.
    It produces a search result as ALV.
    I am not able to select any row in ALV by clicking it like we normally do in ALV.
    I wrote below code to allow selection:
    lo_value->if_wd_salv_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-single).
    Even after this I am not able to select any row by clicking it.
    Need help to solve this.
    Regards,
    Sumit Oberoi

    Hi,
    To have the inputfields for the ALV.
    Get the column references of the ALV table and for each column rference create a inputfield object
    type CL_SALV_WD_UIE_INPUT_FIELD.
    lo_value is model object.
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = wd_this->lit_columns.
    LOOP AT wd_this->lit_columns INTO wd_this->lis_columns.
          lv_id = wd_this->lis_columns-id.
          wd_this->gref_column = wd_this->lis_columns-r_column.
    case lv_id.
    when ' colname'.
                CREATE OBJECT lr_input
                  EXPORTING
                    value_fieldname = lv_id.
                CALL METHOD wd_this->gref_column->set_cell_editor
                  EXPORTING
                    value = lr_input.
    when ' colname'.
                CREATE OBJECT lr_input
                  EXPORTING
                    value_fieldname = lv_id.
                CALL METHOD wd_this->gref_column->set_cell_editor
                  EXPORTING
                    value = lr_input.
    endcase.
    endloop.
    Or you can take a attribute READ_ONLY for the node to which ALV table is bound.
    Set the readonly property to abap_false (for input field) by looping through the table.
    Get the column references and get the textview reference for each column and use the set_read_only
    method by passing the attribute name.
    This way the textview will now become the inputfield when the read_only property is set to abap_false.
    Regards,
    Lekha.

  • Reset lead selection after refresh in alv grid

    Hi experts,
    I've a problem with holding the lead selection in an alv grid table view in web dynpro.
    After changing an attribute the lead selection in the view gets lost, but is hold in the referenced context node.
    Is there a way to change the lead selection in alv by code?
    I've found the method "set_index()" in class CL_SALV_WD_TABLE_LEAD_SELECT, can I use that?
    Thanks a lot,
    Kai

    Hi Kai,
    I faced a similar problem earlier.
    Request you to elaborate about the  "attribute" you are changing.
    I was also facing a similar issue.
    It will be gr8 if I can help you.
    Please see the below thread for some reference.
    [Not able to select a row in ALV|Not able to select a row in ALV?;
    I hope it helps.
    Regards,
    Sumit Oberoi

Maybe you are looking for

  • Report generation in remote panel

    I am using webpublishing tool, i have report button in my front panel,when the clients clicks the Report button the popup for saving the report is coming in the Server.I want the popup should come in the respective client machine so that the user can

  • Pin connector for front headphone ja

    The front headphone jack cable connection on my Dell 4600 is incompatible with my new Xtreme Gamer soundcard's male pin connection. Can anyone tell me where to find the correct female pin connector, and how do I know which leads go to which pin slots

  • Aluminum iMacs RAM question

    Hello all! I currently have a Core Duo iMac, one the first Intel ones. My RAM is 667 MHz, I have 2 GB installed. I am using my iMac for working with large sound and image files, so memory and CPU speed are important to me. I would like to get a 20" i

  • Is JSF 1.0 redistributable for commercial apps

    We need to write a JSF app and plan to use JSF 1.0 but it says they are sun licensed binaries. So do we need some licensing or can we just use them and redistribute them? Please suggest. Thanks

  • Portlets, how to...

    Has anyone ever done portlets in java? We have to implement a portlet (client, not server) which should be able to display dynamically updated business graphics (charts, statistics, alarm messages, meters...). What toolkits do people use to do this?