2006 Sep 15 11:33 AM
Hi all ,
In the code below ,
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
DATA: L_TA TYPE SY-TCODE VALUE 'SLIS_DUMMY'.
*
CASE R_UCOMM.
WHEN 'WAHL'. "menubutton
READ TABLE GT_OUTTAB INDEX RS_SELFIELD-TABINDEX. "cursorposit.
IF SY-SUBRC = 0.
SUBMIT SLIS_DUMMY WITH P_CARRID EQ GT_OUTTAB-CARRID
WITH P_CONNID EQ GT_OUTTAB-CONNID.
ENDIF.
CLEAR R_UCOMM.
WHEN '&IC1'. "doubleclick
READ TABLE GT_OUTTAB INTO GT_OUTTAB INDEX RS_SELFIELD-TABINDEX.
IF SY-SUBRC = 0.
SUBMIT SLIS_DUMMY WITH P_CARRID EQ GT_OUTTAB-CARRID
WITH P_CONNID EQ GT_OUTTAB-CONNID.
ENDIF.
CLEAR R_UCOMM.
ENDCASE.
ENDFORM.
this ( WHEN 'WAHL'.) is for "menubutton click.
& this ('&IC1'.) is for "doubleclick.
Anyone have any idea what should be the return command for single click in grid ?
2006 Sep 15 11:42 AM
You can create a hotspot on the fields required by you.By this way &IC1& will function as a single click.
2006 Sep 15 11:58 AM
Requirement is to invoke the code in single click.Any help plz reagrding this.
Thks
manish
2006 Sep 15 12:12 PM
hi Manish,
as Ravi mentioned, if you get hand key as your cursor on the display and if you select any row,then your UCOMM WILl be &IC1 only.
2 WAYS you can do this single click option.
option 1.
in the field catalog,you can give the HOTSPOT = 'X' to the fields for them you want a HAND cursor instead of a regular cursor.
option 2
in the LAYOUT,
there is a field KEY_HOTSPOT . give 'X' to this field also makes your KEY on the output appears a HAND KEY.
if you select any row either with the HAND KEY(like which appears as hyper link) or double click,
<b>in BOTH the CASES your Function code will be the SAME and It will be &IC1</b>
Message was edited by: Srikanth Kidambi
2006 Sep 15 12:28 PM
Ravi/Diether/Shrikant
Thanks for ur inputs, can i create a hotspot in the grid button(leftmost in ALV) itself ? that 'll resolve my requirement.
2006 Sep 15 12:31 PM
yes,
check my earlier post,i given 2 options how to make them HOTSPOT on. use either of them.
even after doing this, check it in debugging the value of that SY-UCOMM by double clicking on other columns or single clicking on hotspot on COLUMNS.
either case your FCODE will be SAME. i.e., <b>&IC1</b>
Srikanth.
Message was edited by: Srikanth Kidambi
Message was edited by: Srikanth Kidambi
2006 Sep 15 12:11 PM
Hi Manish,
do this in the Fieldcat:
MOVE 'X' TO WA_FIELDCAT-HOTSPOT.
in that field on which you will have the hotspot
Regards, Dieter
2006 Sep 15 12:32 PM
Hi Manish,
i think
MOVE 'X' TO WA_FIELDCAT-HOTSPOT.
defines the field as an hotspot.
When you will have an own field do it and
define it as an icon (for example). i have done it in GRID.
Regards, Dieter
Message was edited by: Dieter Gröhn
2006 Sep 15 12:45 PM
sorry guys might be i couldn't able to convey the requirement properly.What u guys had suggested is to make the field in the ALV as hotspot.I need to click on the ALV grid itself(the leftmost buttons in the ALV grid).or could anyone of u provide me some sample code.
2006 Sep 15 1:09 PM
Hi Manish,
i'm not quiet shue what you mean. Is that the MARK-Button
on the left? I think it's not possible to use it.
Why don't you insert an ICON-Field and handle it
in USER_COMMEND as '&IC1'?
Regards, Dieter
2006 Sep 15 2:05 PM
it's a gr8 help dieter , if u can send me any sample code related to this.
Thanks in advance
manish
2006 Sep 15 3:34 PM
Hi Manish,
here a short examle:
REPORT ZGRO_TEST MESSAGE-ID ZZ NO STANDARD PAGE HEADING.
*
TABLES: VBAK.
*
TYPE-POOLS: SLIS.
*
INCLUDE <ICON>.
*
DATA: PROGNAME LIKE SY-REPID,
FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
EVENT_EXIT TYPE SLIS_T_EVENT_EXIT,
EVENTS TYPE SLIS_T_EVENT.
*
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
KUNNR LIKE VBAK-KUNNR,
ICON LIKE ICONS-L4 VALUE ICON_OKAY,
END OF ITAB.
*
START-OF-SELECTION.
*
*
SELECT * FROM VBAK UP TO 100 ROWS.
ITAB-VBELN = VBAK-VBELN.
ITAB-KUNNR = VBAK-KUNNR.
APPEND ITAB.
ENDSELECT.
*
PERFORM AUSGABE_ALV_GRID.
*
END-OF-SELECTION.
FORM AUSGABE_ALV_GRID.
*
PROGNAME = SY-REPID.
*
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = PROGNAME
I_INTERNAL_TABNAME = 'ITAB'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME = PROGNAME
CHANGING
CT_FIELDCAT = FIELDCAT.
*
PERFORM SPALTENEIGENSCHAFTEN USING FIELDCAT.
*
DATA: WA_EVENT_EXIT TYPE SLIS_EVENT_EXIT.
*
MOVE: '&IC1' TO WA_EVENT_EXIT-UCOMM,
'X' TO WA_EVENT_EXIT-BEFORE.
*
APPEND WA_EVENT_EXIT TO EVENT_EXIT.
*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = PROGNAME
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IT_FIELDCAT = FIELDCAT
IT_EVENT_EXIT = EVENT_EXIT
TABLES
T_OUTTAB = ITAB
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
*
ENDFORM.
FORM SPALTENEIGENSCHAFTEN USING P_FIELDCAT
TYPE SLIS_T_FIELDCAT_ALV.
*
*
DATA: WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
*
LOOP AT P_FIELDCAT INTO WA_FIELDCAT.
*
CASE WA_FIELDCAT-FIELDNAME.
WHEN 'ICON'.
MOVE 'X' TO WA_FIELDCAT-HOTSPOT.
MOVE 'X' TO WA_FIELDCAT-ICON.
ENDCASE.
*
MODIFY P_FIELDCAT INDEX SY-TABIX FROM WA_FIELDCAT .
*
ENDLOOP.
*
ENDFORM.
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
*
READ TABLE ITAB INDEX RS_SELFIELD-TABINDEX.
*
IF R_UCOMM EQ '&IC1'.
SET PARAMETER ID 'AUN' FIELD itab-VBELN.
CALL TRANSACTION 'VA03' AND SKIP FIRST SCREEN.
ENDIF.
*
ENDFORM.
Have a nice weekend,
Regards, Dieter
2006 Sep 20 8:10 AM
2006 Sep 20 9:08 AM
Nope Dieter,
I need to add fucntinality such that if user click on the leftmost button in the grid then i'll need to invoke some code.still struggling to find out some way(client don't want any extra column)
2006 Sep 20 8:30 AM
Apart from all these solutions. You can also solvethe problem by creating a event handling class for ALV grid.
You can define the class as
CLASS lcl_event_handler DEFINITION.
PUBLIC SECTION.
METHODS
Method to handle single click event.
handle_double_click
FOR EVENT single_click OF cl_gui_alv_grid
IMPORTING e_row e_column.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_double_click.
PERFORM f_double_click USING e_row e_column.
ENDMETHOD. "handle_double_click
ENDCLASS.
In the handler section you can define the functio name to handle the single click event.
Then you can set the handler as
DATA : gt_event TYPE REF TO lcl_event_handler.
CREATE OBJECT gt_event.
SET HANDLER gt_event->handle_single_click FOR ALV_GRID_NAME.
Hope this will help.
2006 Sep 20 10:11 AM
Hi Mahish,
if you mean the MARK-BUTTON i think it's not possible,
if not i havn't another solution as i told above.
Regards, Dieter