Skip to Content
author's profile photo Former Member
Former Member

Interactive-list:- highlighting a row on singal click on a row.

hi

in interactive-list report (not ALV list) , i m displaying my output as a column for checkbox and some more fields.

so my problem is on click of the checkbox i want the entier row to get highlighted.

i know how to do it on double click on the row but i m not sure how to do it on single click when the checkbox is selected.

Message was edited by:

ashwinee mali

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Posted on Dec 01, 2007 at 05:44 AM

    Hi,

    Following this report will explains u have to select the record and press the detail button it will show the whole detail about that record.

    REPORT YMS_CHECKBOXTEST .

    TYPE-POOLS: SLIS.

    *- Fieldcatalog

    DATA: IT_FIELDCAT TYPE LVC_T_FCAT,

    IT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV..

    *- For Events

    DATA:IT_EVENTS TYPE SLIS_T_EVENT.

    DATA: X_FIELDCAT TYPE LVC_S_FCAT,

    X_FIELDCAT1 TYPE SLIS_FIELDCAT_ALV.

    DATA:X_LAYOUT TYPE LVC_S_LAYO.

    "{ FOR DISABLE

    DATA: LS_EDIT TYPE LVC_S_STYL,

    LT_EDIT TYPE LVC_T_STYL.

    "} FOR DISABLE

    DATA: BEGIN OF IT_VBAP OCCURS 0,

    VBELN LIKE VBAP-VBELN,

    POSNR LIKE VBAP-POSNR,

    HANDLE_STYLE TYPE LVC_T_STYL, "FOR DISABLE

    BUTTON(10),

    END OF IT_VBAP.

    DATA: LS_OUTTAB LIKE LINE OF IT_VBAP.

    SELECT VBELN

    POSNR

    UP TO 10 ROWS

    INTO CORRESPONDING FIELDS OF TABLE IT_VBAP

    FROM VBAP.

    DATA:L_POS TYPE I VALUE 1.

    CLEAR: L_POS.

    L_POS = L_POS + 1.

    X_FIELDCAT-SELTEXT = 'VBELN'.

    X_FIELDCAT-FIELDNAME = 'VBELN'.

    X_FIELDCAT-TABNAME = 'ITAB'.

    X_FIELDCAT-COL_POS = L_POS.

    *X_FIELDCAT-EDIT = 'X'.

    X_FIELDCAT-OUTPUTLEN = '10'.

    x_fieldcat-ref_field = 'VBELN'.

    x_fieldcat-ref_table = 'VBAK'.

    APPEND X_FIELDCAT TO IT_FIELDCAT.

    CLEAR X_FIELDCAT.

    L_POS = L_POS + 1.

    X_FIELDCAT-SELTEXT = 'POSNR'.

    X_FIELDCAT-FIELDNAME = 'POSNR'.

    X_FIELDCAT-TABNAME = 'ITAB'.

    X_FIELDCAT-COL_POS = L_POS.

    *X_FIELDCAT-EDIT = 'X'.

    X_FIELDCAT-OUTPUTLEN = '5'.

    APPEND X_FIELDCAT TO IT_FIELDCAT.

    CLEAR X_FIELDCAT.

    L_POS = L_POS + 1.

    "{FOR DISABLE HERE 6ROW IS DISABLED

    SY-TABIX = 6.

    LS_EDIT-FIELDNAME = 'VBELN'.

    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

    LS_EDIT-STYLE2 = SPACE.

    LS_EDIT-STYLE3 = SPACE.

    LS_EDIT-STYLE4 = SPACE.

    LS_EDIT-MAXLEN = 10.

    INSERT LS_EDIT INTO TABLE LT_EDIT.

    LS_EDIT-FIELDNAME = 'POSNR'.

    LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.

    LS_EDIT-STYLE2 = SPACE.

    LS_EDIT-STYLE3 = SPACE.

    LS_EDIT-STYLE4 = SPACE.

    LS_EDIT-MAXLEN = 6.

    INSERT LS_EDIT INTO TABLE LT_EDIT.

    INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.

    MODIFY IT_VBAP INDEX SY-TABIX FROM LS_OUTTAB TRANSPORTING

    HANDLE_STYLE .

    X_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.

    "} UP TO HERE

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'

    EXPORTING

    I_CALLBACK_PROGRAM = SY-REPID

    IS_LAYOUT_LVC = X_LAYOUT

    IT_FIELDCAT_LVC = IT_FIELDCAT

    TABLES

    T_OUTTAB = IT_VBAP[]

    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.

    Thanks,

    <b>Sankar M</b>

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      hello Shankar,

      thnx for ur quick reply but i m not using ALV list (question modified to clear any future confusion) and i m nt lookin for how to display a row in detail view.

      wht i m lookin for is how to get a row on the list highlighted when the checkbox is clicked ( also nt after user checks the checkbox and clicks some other button).

      I even know how to do it when the row is clicked (using hotspot) but i m nt getting how do i highlight the row when the user has clicked on the checkbox provided.

  • Posted on Dec 01, 2007 at 05:58 AM

    Hi,

    Go through that following report.

    If user check the checkbox for the particulr record and press the detail button that traffic signal colour will be modified from red to green. Kidnly check that one.

    REPORT YMS_CHECKBOXALV.

    TYPE-POOLS: slis.

    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv.

    DATA: s_fieldcatalog TYPE slis_fieldcat_alv.

    DATA: s_layout TYPE slis_layout_alv.

    DATA: BEGIN OF itab OCCURS 0,

    icon TYPE icon-id,

    vbeln TYPE vbeln,

    kunnr TYPE kunnr,

    erdat TYPE erdat,

    box TYPE c,

    END OF itab.

    DATA: v_repid TYPE syrepid.

    START-OF-SELECTION.

    • Get the data.

    SELECT vbeln kunnr erdat UP TO 100 ROWS

    FROM vbak

    INTO CORRESPONDING FIELDS OF TABLE itab.

    IF sy-subrc <> 0.

    MESSAGE s208(00) WITH 'No data found'.

    LEAVE LIST-PROCESSING.

    ENDIF.

    • Modify the record with red light.

    itab-icon = '@0A@'.

    MODIFY itab TRANSPORTING icon WHERE NOT vbeln IS initial.

    v_repid = sy-repid.

    • Get the field catalog.

    CLEAR: s_fieldcatalog.

    s_fieldcatalog-col_pos = '1'.

    s_fieldcatalog-fieldname = 'ICON'.

    s_fieldcatalog-tabname = 'ITAB'.

    s_fieldcatalog-seltext_l = 'Status'.

    s_fieldcatalog-icon = 'X'.

    APPEND s_fieldcatalog TO t_fieldcatalog.

    CLEAR: s_fieldcatalog.

    s_fieldcatalog-col_pos = '2'.

    s_fieldcatalog-fieldname = 'VBELN'.

    s_fieldcatalog-tabname = 'ITAB'.

    s_fieldcatalog-rollname = 'VBELN'.

    APPEND s_fieldcatalog TO t_fieldcatalog.

    CLEAR: s_fieldcatalog.

    s_fieldcatalog-col_pos = '3'.

    s_fieldcatalog-fieldname = 'KUNNR'.

    s_fieldcatalog-tabname = 'ITAB'.

    s_fieldcatalog-rollname = 'KUNNR'.

    APPEND s_fieldcatalog TO t_fieldcatalog.

    CLEAR: s_fieldcatalog.

    s_fieldcatalog-col_pos = '4'.

    s_fieldcatalog-fieldname = 'ERDAT'.

    s_fieldcatalog-tabname = 'ITAB'.

    s_fieldcatalog-rollname = 'ERDAT'.

    APPEND s_fieldcatalog TO t_fieldcatalog.

    • Set the layout.

    s_layout-box_fieldname = 'BOX'.

    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

    EXPORTING

    i_callback_program = v_repid

    is_layout = s_layout

    i_callback_pf_status_set = 'SET_PF_STATUS'

    i_callback_user_command = 'USER_COMMAND'

    it_fieldcat = t_fieldcatalog[]

    TABLES

    t_outtab = itab.

    ----


    • FORM SET_PF_STATUS *

    ----


    • ........ *

    ----


    • --> EXTAB *

    ----


    FORM set_pf_status USING extab TYPE slis_t_extab.

    SET PF-STATUS 'TEST2'.

    ENDFORM.

    ----


    • FORM user_command *

    ----


    • ........ *

    ----


    • --> UCOMM *

    • --> SELFIELD *

    ----


    FORM user_command USING ucomm LIKE sy-ucomm

    selfield TYPE slis_selfield.

    • Check the ucomm.

    IF ucomm = 'DETAIL'.

    LOOP AT itab WHERE box = 'X'.

    itab-icon = '@08@'.

    MODIFY itab TRANSPORTING icon.

    ENDLOOP.

    ENDIF.

    selfield-refresh = 'X'.

    ENDFORM.

    Thanks,

    <b>Sankar M</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 01, 2007 at 06:30 AM

    Try this...

    specify the checkbox as hotspot and then when user clicks on it make the checkbox value as 'X' and change the write statement with Inverse ON so the row is highlighted.

    Also as this is interactive report and on user's click u'll have to rewrite the screen ( AS U NEED TO HIGHLIGHT THE ROW AS MENTIONED )..don't forget to reduce sy-lsind explicitly else after few clicks u'll end up in Program dump ...

    Anyways try this and reply if any doubts on this logic..

    <b>Do reward points if this works out</b>

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      well the hotspot is not working for checkbox, i had tried it already.

      chk da following code

      data : a(1).

      START-OF-SELECTION.

      WRITE : 2 a as checkbox ,

      5 'Click!' HOTSPOT.

      AT LINE-SELECTION.

      a = 'X'.

      sy-lsind = sy-lsind - 1.

      WRITE : 2 a as checkbox ,

      5 'Click me!' color = 5 inverse off.

      this code does work but when i specify hotspot to the checkbox it doesnt do nything.

      data : a(1).

      START-OF-SELECTION.

      WRITE : 2 a as checkbox hotspot,

      5 'Click!' .

      AT LINE-SELECTION.

      a = 'X'.

      sy-lsind = sy-lsind - 1.

      WRITE : 2 a as checkbox hotspot,

      5 'Click me!' color = 5 inverse off.

  • Posted on Dec 01, 2007 at 07:11 AM

    Hi Aswinee,

    Saw u r code...i understand that hotspot and checkbox don;t go together..

    anyways

    i understand the need of the hour is to dynamically check or uncheck the line and later be able to figure out the checked line...

    the below code uses icon as hotspot and uses tick and cross as for check and uncheck.

    This works ..but see if ur consultant ( Functional Person ) accepts this output..

    INCLUDE : icons.
    DATA : a(4).
    a = '@01@'.
    
    START-OF-SELECTION.
      WRITE : 2 a  HOTSPOT ,
              7 'Click!' .
    
    AT LINE-SELECTION.
      IF a = '@01@'.
        a = '@0W@'.
      ELSE.
        a = '@01@'.
      ENDIF.
    
      sy-lsind = sy-lsind - 1.
      IF a = '@01@'.
      WRITE : 2 a  HOTSPOT,
              7 'Click me!' COLOR = 5 INVERSE OFF.
      else.
      WRITE : 2 a  HOTSPOT,
              7 'Click me!' COLOR = 6 INVERSE OFF.
      endif.

    This is not excat solution but as checkbox doesn't take user command for dynamic screen changes,i could find only this as a solution to serve the functionality.

    <b>Do reward points if usefuls and served any purpose and if u find any better solution for such requriements do post back so we can also use it</b>

    Cheers,

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 01, 2007 at 07:16 AM

    <b>Just to add wat i found out after searching : Check box cannot be associated with the User Command</b>

    Read This :

    ... HOTSPOT [ON] or ... HOTSPOT OFF

    Effect

    Affects the display format of the mouse pointer and the effect of the single mouse-click:

    If you drag the mouse pointer over list areas which are output with the format ...HOTSPOT (lines or fields), the mouse pointer switches from its standard display format (usually an arrow) to the format of a hand with an outstretched index finger. If you then click once, the effect is like double-clicking or pressing the function key F2 (AT LINE-SELECTION).

    Note

    <b>The addition ...HOTSPOT has no effect on input fields.</b>

    <i><b>AND ABT THE CHECKBOX</b></i>

    In technical terms, a checkbox behaves exactly like an input field with a length of 1

    <b>All these from Standard SAP Help...Just to share wat i found </b>

    Thankx .

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.