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

How to respond to double-click on the record of table-control?

If I double-click on the record of the table-control,no matter which fields of this record,

I want to show detail information of this record.

What should I do?

Thank you!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2005 at 03:48 AM

    Wow, there is something new that I learnt as well. For

    your screen , say 9000, go to <b>Element List</b> tab.

    Click on the <b>Display Attributes</b> tab, the last checkbox is (hold your breath) - <b>Respond to DoubleClick</b>. It acts as a <i>hotspot</i> event. The function code is <b>PICK</b>. I guess, you can call another screen in this event, and display the required information.

    Regards,

    Subramanian V.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 28, 2005 at 11:52 AM

    Hello Minghan,

    There's another solution to your question. This can be used if you do not want to display the HOTSPOT. If you want to display the information no matter where the user clicks on the table-control, then you would have to make the entire content of the table control as a HOTSPOT. This might be undesirable from a good-UI design perspective. Also the user will no longer be able to place the cursor in the table control. The Detail information always keeps popping up.

    So here's what I propose...

    When you set the GUI status for the screen (on which you have the table control), you can assign a Function Code to the F2 Key. The action of Double Click is always linked to the F2 Key. So this way you are indirectly assigning a Function code to the Double Click event. You can show the detail information when the Function Code is set.

    Trust this is a more elegant solution to your requirement.

    Let us know what you think...

    Regards,

    Anand Mandalika.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Minghan,

      The problem, I think, could be in either of the two areas:

      1. Handling the Double-Click for the table-control and identifying the correct entry.

      2. Starting the Batch Input Program wth the captured entry.

      I shall assume that you have a problem with the first part and shall give you a code snippet which has worked for me.

      REPORT  ZTEST.
      
      controls tc type tableview using screen '0100'.
      
      data : begin of itab occurs 0,
               f1  type vbeln,
               f2  type posnr,
             end of itab.
      
      data clicked_line type i.
      
      initialization.
      
        select vbeln
               posnr
           up to 40 rows
           from vbap
           into table itab.
      
      start-of-selection.
      
        call screen 100.
      
      *&---------------------------------------------------------------------*
      *&      Module  PBO  OUTPUT
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      MODULE PBO OUTPUT.
      * this PF-Status has only one Function Code. The funcion code 'CLICK' has been 
      *assigned to the Function Key F2.
        set pf-status 'TEST'.
      ENDMODULE.                 
      *&---------------------------------------------------------------------*
      *&      Module  PAI  INPUT
      *&---------------------------------------------------------------------*
      *       text
      *----------------------------------------------------------------------*
      MODULE PAI INPUT.
      
        if sy-ucomm eq 'CLICK'.
          clear sy-ucomm.
      * Get the position on the screen where the user has double-clicked.
          get cursor line clicked_line.            
      * The table control has the name TC. A structure called TC will contain the 
      * information about the table control. TOP_LINE is the row of the 
      * internal table which is displayed topmost in the table control in the current 
      * view (after a possible scrolling)
          clicked_line = tc-top_line + clicked_line.
          clicked_line = clicked_line - 1.
      * Clicked_line now has the index of the internal table row which has been 
      * clicked on the screen.
          read table itab index clicked_line.
      * Here you write your code which calls the BDC etc.,
          message i555(bc_bor) with itab-f1 itab-f2.
        elseif sy-ucomm ne space.
          leave to screen 0.
        endif.
      
      ENDMODULE.                 
      *&---------------------------------------------------------------------*
      SCREEN FLOW LOGIC.
      *&---------------------------------------------------------------------*
      PROCESS BEFORE OUTPUT.
      
       loop at itab with control tc.
       endloop.
      MODULE PBO.
      
      
      PROCESS AFTER INPUT.
      
       loop.
       endloop.
      
       MODULE PAI.
      
      *&---------------------------------------------------------------------*

      I believe that the above code will help you understand what's wrong with your table control and rectify it. If you have any doubts on this, please get back.

      Hope to see your problem get solved soon.

      Regards,

      Anand Mandalika.

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.