Double click in a ALV GRID
Hi all,
I have a problem with an ALV GRID Control: I print in the screen an ALV with the clauses 'starting at...ending at...' ; when I do double click in a line of the ALV I show the details but, the size of the ALV get smaller and smaller for everytime I do double-click...
Any ideas about how to solve this?
Thanks and Regard.
Urtzi.
I have two dynpros:
- In the first, in PBO I do
CALL METHOD grid1->set_table_for_first_display
To display the ALV
- When I do double-clic, I raise the event handle_double_click. In the event I do a
CALL SCREEN 2000 STARTING AT d_left_d d_top_d ENDING AT y1 y2
to get the details. then, in the screen 2000, in the PBO, I do another
CALL METHOD grid2->set_table_for_first_display
to display the second ALV, the details.
Regards.
Similar Messages
-
Single click event in alv grid.
Hi Experts,
i have done will my code..everything is working perfectly, but having an issue..pls help me...
in my output screen i have 2 check-boxes,when i select both of them i shuld get a message saying select only one..this is done when am using double click. Is single click possible in alv-grid...
please help me.
thanks.
anushaHi Anusha,
Did you Try by using get_selected_rows(Method)?
If the selected rows are 2 display a message such that 'Select only One record'.
data t_roid type lvc_t_roid.
CALL METHOD r_grid->get_selected_rows
IMPORTING
et_row_no = t_roid.
READ TABLE t_roid INDEX 1 TRANSPORTING NO FIELDS."to know how many No.Of records selected
if sy-tfill > 1.
Message 'Please Select only one record' type 'I'.
Exit.
endif. -
About double click event in ALV report
Hi all,
I want to program a double-click event in ALV reprot.
I am not suppose to use module pool approach for the same.
If a user double clicks on the any of the row of ALV report, the transaction should get called.
Again, I am using function 'REUSE_ALV_GRID_DISPLAY' for displaying ALV.
Can you please help me to solve this?
Thanks,
-SiddhiHi Sidhi,
You can do it easily by using Reuse_ALV_GRID_DISPALY.
The User Command subroutine which you pass to this function module in that you can check which field is selected and what is the value of that and also you can get the table index.
I am giving you a code example where interactivity of ALV report is done .
*& Report ZRAIL_LOT_REPORT
REPORT zrail_lot_report.
TABLES :qals,aufk.
TYPE-POOLS:slis.
TYPES:BEGIN OF x_lot,
sel(1) TYPE c, "SELECTION
prueflos TYPE qals-prueflos, "INSPECTION LOT NUMBER
werk TYPE qals-werk, "PLANT
losmenge TYPE qals-losmenge, "LOT QUANTITY
mengeneinh TYPE qals-mengeneinh, "BASE UNIT OF MEASURE FOR THE INSPECTION LOT QUANTITY
matnr TYPE qals-matnr, " MATERIAL NO. ATTACHED TO ORDER
zzequnr TYPE qals-zzequnr, "EQUIPMENT NO.
zzassembly TYPE qals-zzassembly, "ASSEMBLY
herkunft TYPE qals-herkunft, "INSPECTION LOT ORIGIN
aufnr TYPE qals-aufnr, "ORDER NO.
sttxt TYPE qals_d02-sttxt, "LOT STATUS
objnr TYPE qals-objnr, "OBJECT NUMBER
enstehdat TYPE qals-enstehdat, "lot creation date
pruefer TYPE qamr-pruefer, "Name of the Inspector
END OF x_lot.
TYPES:BEGIN OF x_ordmat,
aufnr TYPE aufk-aufnr, "Order No.
equnr TYPE afih-equnr, "Equipment No. attached to Order
zmatnr TYPE aufk-zmatnr, "Material No. attached to Order
bautl TYPE afih-bautl, "Assembly attached to Order
END OF x_ordmat.
TYPES:BEGIN OF x_status,
objnr TYPE jest-objnr,
stat TYPE jest-stat,
txt04 TYPE tj02t-txt04,
END OF x_status.
DATA:it_qals TYPE STANDARD TABLE OF x_lot,
wa_qals TYPE x_lot.
DATA:it_ordmat TYPE TABLE OF x_ordmat,
wa_ordmat TYPE x_ordmat.
DATA:it_status TYPE STANDARD TABLE OF x_status,
wa_status TYPE x_status.
DATA:mytabix TYPE sy-tabix.
DATA: wa_layout TYPE slis_layout_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE TABLE OF slis_fieldcat_alv,
it_fcat TYPE TABLE OF slis_fieldcat_alv.
DATA:mytabix1 TYPE sy-tabix.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_werks FOR qals-werk,
s_zmatnr FOR aufk-zmatnr,
s_assbly FOR qals-zzassembly,
s_equnr FOR qals-zzequnr,
s_lotor FOR qals-herkunft,
s_lotdat FOR qals-enstehdat.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION.
s_lotdat-low = sy-datum - 7.
s_lotdat-high = sy-datum.
APPEND s_lotdat.
START-OF-SELECTION.
PERFORM get_data_qals.
PERFORM build_fieldcat.
PERFORM display_data.
EXIT.
END-OF-SELECTION.
*& Form get_data_qals
text
--> p1 text
<-- p2 text
FORM get_data_qals .
IF it_qals[] IS INITIAL.
SELECT a~prueflos
a~werk
a~losmenge
a~mengeneinh
a~zzequnr
a~zzassembly
a~herkunft
a~aufnr
a~objnr
a~matnr
a~enstehdat
b~pruefer
FROM qals AS a INNER JOIN qamr AS b
ON aprueflos = bprueflos
INTO CORRESPONDING FIELDS OF TABLE it_qals
WHERE werk IN s_werks
AND zzassembly IN s_assbly
AND zzequnr IN s_equnr
AND herkunft IN s_lotor
AND enstehdat IN s_lotdat.
ENDIF.
IF it_ordmat[] IS INITIAL.
SELECT a~aufnr
a~zmatnr
b~bautl
b~equnr
FROM aufk AS a INNER JOIN afih AS b
ON aaufnr = baufnr
INTO CORRESPONDING FIELDS OF TABLE it_ordmat FOR ALL ENTRIES IN it_qals
WHERE a~aufnr = it_qals-aufnr
AND zmatnr IN s_zmatnr.
ENDIF.
IF it_status[] IS INITIAL.
SELECT a~objnr
a~stat
b~txt04
FROM tj02t AS b
INNER JOIN jest AS a ON bistat = astat
INTO CORRESPONDING FIELDS OF TABLE it_status FOR ALL ENTRIES IN it_qals
WHERE a~objnr = it_qals-objnr
AND b~spras = sy-langu
AND a~inact = space.
ENDIF.
LOOP AT it_qals INTO wa_qals.
mytabix = sy-tabix.
READ TABLE it_ordmat INTO wa_ordmat WITH KEY aufnr = wa_qals-aufnr.
IF sy-subrc = 0.
IF wa_qals-herkunft = '14'.
wa_qals-matnr = wa_ordmat-zmatnr.
wa_qals-zzequnr = wa_ordmat-equnr.
wa_qals-zzassembly = wa_ordmat-bautl.
MODIFY it_qals FROM wa_qals INDEX mytabix TRANSPORTING matnr zzassembly zzequnr.
ENDIF.
ENDIF.
LOOP AT it_status INTO wa_status WHERE objnr = wa_qals-objnr.
CONCATENATE wa_qals-sttxt wa_status-txt04 INTO wa_qals-sttxt SEPARATED BY space.
CLEAR :wa_status.
ENDLOOP.
MODIFY it_qals FROM wa_qals INDEX mytabix TRANSPORTING sttxt.
CLEAR :wa_qals,wa_ordmat,mytabix.
ENDLOOP.
IF s_zmatnr[] IS NOT INITIAL.
DELETE it_qals WHERE matnr IS INITIAL.
ENDIF.
ENDFORM. " get_data_qals
*& Form build_fieldcat
text
--> p1 text
<-- p2 text
FORM build_fieldcat .
wa_layout-zebra = 'X'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-box_fieldname = 'SEL'.
wa_layout-box_tabname = 'IT_QALS'.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME =
i_internal_tabname = 'IT_QALS'
i_structure_name = 'QALS_D02'
I_CLIENT_NEVER_DISPLAY = 'X'
I_INCLNAME =
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE =
CHANGING
ct_fieldcat = it_fieldcat
IF sy-subrc = 0.
LOOP AT it_fieldcat INTO wa_fieldcat.
CASE wa_fieldcat-fieldname .
WHEN 'PRUEFLOS'.
wa_fieldcat-col_pos = 1.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'WERK'.
wa_fieldcat-col_pos = 3.
APPEND wa_fieldcat TO it_fcat.
WHEN 'LOSMENGE'.
wa_fieldcat-col_pos = 4.
wa_fieldcat-no_out = ''.
APPEND wa_fieldcat TO it_fcat.
WHEN 'MENGENEINH'.
wa_fieldcat-col_pos = 5.
wa_fieldcat-no_out = ''.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ZZEQUNR'.
wa_fieldcat-col_pos = 6.
wa_fieldcat-no_out = ''.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ZZASSEMBLY'.
wa_fieldcat-col_pos = 7.
wa_fieldcat-no_out = ''.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'HERKUNFT'.
wa_fieldcat-col_pos = 8.
APPEND wa_fieldcat TO it_fcat.
WHEN 'AUFNR'.
wa_fieldcat-col_pos = 9.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN 'ENSTEHDAT'."enstehdat
wa_fieldcat-col_pos = 10.
APPEND wa_fieldcat TO it_fcat.
WHEN 'STTXT'.
wa_fieldcat-col_pos = 12.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fcat.
WHEN OTHERS.
ENDCASE.
CLEAR wa_fieldcat.
ENDLOOP.
wa_fieldcat-fieldname = 'MATNR'.
wa_fieldcat-tabname = 'IT_QALS'.
wa_fieldcat-col_pos = 2.
wa_fieldcat-ref_tabname = 'AUFK'.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-seltext_l = 'Material No.'.
APPEND wa_fieldcat TO it_fcat.
wa_fieldcat-fieldname = 'PRUEFER'.
wa_fieldcat-tabname = 'IT_QALS'.
wa_fieldcat-col_pos = 11.
wa_fieldcat-ref_tabname = 'QAMR'.
wa_fieldcat-seltext_l = 'Name of the Inspector'.
APPEND wa_fieldcat TO it_fcat.
ENDIF.
ENDFORM. " build_fieldcat
*& Form display_data
text
--> p1 text
<-- p2 text
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZRAIL_LOT_REPORT'
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fcat
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
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
TABLES
t_outtab = it_qals
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.
ENDFORM. " display_data
*& Form USER_COMMAND
text
-->R_UCOMM text
-->RS_SELFIELD text
FORM user_command USING r_ucomm TYPE sy-ucomm rs_selfield TYPE slis_selfield.
CASE rs_selfield-fieldname .
WHEN 'PRUEFLOS'.
SET PARAMETER ID 'QLS' FIELD rs_selfield-value.
CALL TRANSACTION 'QA03' AND SKIP FIRST SCREEN.
WHEN 'ZZEQUNR'.
SET PARAMETER ID 'EQN' FIELD rs_selfield-value.
CALL TRANSACTION 'IE03' AND SKIP FIRST SCREEN.
WHEN 'ZMATNR'.
SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN 'ZZASSEMBLY'.
SET PARAMETER ID 'MAT' FIELD rs_selfield-value.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
WHEN 'AUFNR'.
SET PARAMETER ID 'ANR' FIELD rs_selfield-value.
CALL TRANSACTION 'IW33' AND SKIP FIRST SCREEN.
WHEN 'STTXT'.
MOVE rs_selfield-tabindex TO mytabix1.
PERFORM show_status.
ENDCASE.
ENDFORM. "USER_COMMAND
*& Form show_status
text
--> p1 text
<-- p2 text
FORM show_status .
DATA:it_systat TYPE TABLE OF bapi2045ss,
wa_sysstat TYPE bapi2045ss,
it_bapi2045us TYPE TABLE OF bapi2045us.
DATA:it_fsys TYPE TABLE OF slis_fieldcat_alv.
DATA:insplot TYPE bapi2045d_il0-insplot.
DATA:language TYPE bapi2045la.
CLEAR wa_qals.
READ TABLE it_qals INTO wa_qals INDEX mytabix1.
insplot = wa_qals-prueflos.
language-langu = sy-langu.
CALL FUNCTION 'BAPI_INSPLOT_GETSTATUS'
EXPORTING
number = insplot
language = language
TABLES
system_status = it_systat
user_status = it_bapi2045us.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZRAIL_LOT_REPORT'
i_internal_tabname = 'IT_SYSTAT'
i_structure_name = 'BAPI2045SS'
CHANGING
ct_fieldcat = it_fsys.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZRAIL_LOT_REPORT'
it_fieldcat = it_fsys
TABLES
t_outtab = it_systat.
ENDFORM. " show_status
IIn the subrouitne the User command the Parameter rs_selfield will give you the selected or clicked field and its value its record no .
I hope this will help you. -
Handling Right & Left Click Events in ALV Grid
Hi Friends,
Please give me the idea how to handle Right & Left mouse Click Events in ALV Grid.
My requirement is that when i click on the grid i need to pop up a message.
Eagerly waiting for your replies
Thanks
Satishyou have to Define a class and implement event handler methods for this purpose.
and the following events can help.
LEFT_CLICK_DESIGN
LEFT_CLICK_RUN
Regards
Raja -
Show long text for Quality Notification when double click field in alv
I have an ALV grid called using a FM and I am using the user command routine to do somthing when a particular cell is clicked. I want to call up the root cause text from the action box of the QN via QM03 . I am building a BDC table to call with a CALL transaction but when I write my BDC up to that point, the program is running the BDC but not going to the point where the long text is displayed is i am in mode 'N'.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
READ TABLE itab INDEX rs_selfield-tabindex.
CASE r_ucomm.
WHEN '&IC1'.
CASE rs_selfield-fieldname.
* When double click on root cause, display root cause long text
WHEN 'ZZ_URCOD'.
PERFORM display_root_cause_text.
CALL TRANSACTION 'QM03' USING gt_bdc MODE 'N'.
ENDCASE.
ENDFORM. "user_command
FORM display_root_cause_text .
FREE gt_bdc.
PERFORM fill_bdc USING 'SAPLIQS0' '0200' 'X'.
PERFORM fill_bdc USING 'RIWO00-QMNUM' itab-qmnum space.
PERFORM fill_bdc USING 'SAPLIQS0' '7200' 'X'.
PERFORM fill_bdc USING 'BDC_OKCODE' '=10\TAB03' space.
PERFORM fill_bdc USING 'SAPLIQS0' '7200' 'X'.
PERFORM fill_bdc USING 'BDC_CURSOR'
'QMICON-LTURSACHE(01)' space.
PERFORM fill_bdc USING 'BDC_OKCODE' '=UX01' space.
ENDFORM. " DISPLAY_ROOT_CAUSE_TEXT
Any one have any suggestions of know of a BAPI that I can achieve the same thing?
Thanks
Larissa MaryniukHello,
also try to use the messages clause (of type BDCMSGCOLL).
This will return the system messages.
call transaction 'XXXX' using BDCTAB
mode 'P'
messages into MSG_TAB.
Try to change the mode from 'N' to 'P' and try to place a breakpoint and check what happens.
Alternatively, you can read the Quality Notification text using FM READ_TEXT, and then show this data to the user in pop-up, rather than calling the tx.
Hope this helps. -
Double click event in alv oops
Hi,
can any one please help me out... i dont know how to call events in alv oops...so can any one provide me with some help..
My requirment is i have to generate a mail grid containing customer details and if i double click on a customer it should go to the transaction XD03 second screen.....u have to declae an event like this.
class event_receiver definition.
public section.
methods handle_double_click
for event double_click of cl_gui_alv_grid
importing e_row.
endclass.
then u have to implement it in the implementation
class lcl_event_receiver implementation.
method lmt_handle_double_click.
perform double_click using e_row
tbl_final_display.
endmethod.
endclass.
form double_click
using fu_e_row type lvc_s_row
fu_tbl_final_display type typ_tbl_display.
read table fu_tbl_final_display into l_h_tbl_final_display
index fu_e_row-index.
if sy-subrc = 0.
set parameter id cns_aun field l_h_tbl_final_display-vbeln.
call transaction cns_trans and skip first screen.
endif.
endform.
hope it will help u -
How can I use hotspot click in an ALV grid?
Hello,
I have a table that is displayed in an ALV grid and I would like to have one of the columns as clickable icons.
For example:
Print | Doc. Type | Name
(icon) | .docx | first
(icon) | .pdf | second ... and so on.
I would like to click in the icon (Print column) and execute an action, but no matter what I do I can't set the action.
I know that is not just setting "fieldcatalog-hotspot='X'", but I don't know how to use a hotspot handler.
Here's some of the code I have:
TYPES: BEGIN OF ty_docs,
print LIKE ICON-ID,
doc_type LIKE table_doc-TYPE,
name LIKE table_doc-NAME,
END OF ty_docs.
DATA: oref_dock TYPE REF TO cl_gui_docking_container,
oref_alv TYPE REF TO cl_gui_alv_grid,
i_fieldcat TYPE lvc_t_fcat,
aux_fieldcat TYPE lvc_s_fcat,
aux_lay TYPE lvc_s_layo,
i_exclude TYPE TABLE OF syucomm,
i_docs TYPE ty_docs,
t_docs LIKE TABLE OF i_docs.
AT SELECTION-SCREEN OUTPUT.
APPEND 'ONLI' TO i_exclude.
APPEND 'SJOB' TO i_exclude.
APPEND 'PRIN' TO i_exclude.
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
p_program = sy-repid
TABLES
p_exclude = i_exclude.
AT SELECTION-SCREEN.
CHECK sy-ucomm = space.
SELECT
icon~ID AS print
doc~TYPE AS doc_type
doc~NAME as name
INTO CORRESPONDING FIELDS OF TABLE t_docs
FROM table_doc AS doc
INNER JOIN ICON AS icon
ON icon~NAME EQ 'ICON_PRINT'
GROUP BY icon~ID doc~TYPE doc~NAME.
IF sy-subrc = 0.
IF oref_dock IS NOT BOUND.
CREATE OBJECT oref_dock
EXPORTING
repid = sy-repid
dynnr = sy-dynnr
side = cl_gui_docking_container=>dock_at_bottom
ratio = 90
EXCEPTIONS
OTHERS = 1.
ENDIF.
IF oref_alv IS NOT BOUND.
CHECK oref_dock IS BOUND.
CREATE OBJECT oref_alv
EXPORTING
i_parent = oref_dock
EXCEPTIONS
OTHERS = 1.
CHECK oref_alv IS BOUND.
aux_fieldcat-fieldname = 'PRINT'.
aux_fieldcat-coltext = 'Print'.
aux_fieldcat-ref_table = 't_docs'.
aux_fieldcat-ref_field = 't_docs-print'.
aux_fieldcat-edit = ''.
aux_fieldcat-just = 'C'.
aux_fieldcat-hotspot = 'X'.
aux_fieldcat-outputlen = 10.
aux_fieldcat-col_pos = 0.
APPEND aux_fieldcat TO i_fieldcat.
CLEAR aux_fieldcat.
aux_fieldcat-fieldname = 'TYPE'.
aux_fieldcat-coltext = 'Doc. Type'.
aux_fieldcat-ref_table = 't_docs'.
aux_fieldcat-ref_field = 't_docs-doc_type'.
aux_fieldcat-edit = ''.
aux_fieldcat-outputlen = 15.
aux_fieldcat-col_pos = 1.
APPEND aux_fieldcat TO i_fieldcat.
CLEAR aux_fieldcat.
aux_fieldcat-fieldname = 'NAME'.
aux_fieldcat-coltext = 'Name'.
aux_fieldcat-ref_table = 't_docs'.
aux_fieldcat-ref_field = 't_docs-name'.
aux_fieldcat-edit = ''.
aux_fieldcat-outputlen = 12.
aux_fieldcat-col_pos = 2.
APPEND aux_fieldcat TO i_fieldcat.
CLEAR aux_fieldcat.
aux_lay-grid_title = 'Docs'.
aux_lay-edit = ''.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'ty_docs'
i_internal_tabname = 't_docs'
CHANGING
ct_fieldcat = i_fieldcat
EXCEPTIONS
OTHERS = 3.
CALL METHOD oref_alv->set_table_for_first_display
EXPORTING
i_structure_name = 'ty_docs'
is_layout = aux_lay
CHANGING
it_fieldcatalog = i_fieldcat
it_outtab = t_docs
EXCEPTIONS
OTHERS = 1.
ELSE.
CALL METHOD oref_alv->refresh_table_display
EXCEPTIONS
OTHERS = 1.
ENDIF.
ENDIF.
Thank you so much in advance!Hi,
After creating grid set the even handler for hot spot.
SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
Try this code:
TABLES: mara,t001l.
DATA: BEGIN OF i_alv OCCURS 0,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
matkl TYPE mara-matkl,
groes TYPE mara-groes,
maktx TYPE makt-maktx,
END OF i_alv.
DATA: wa_alv LIKE LINE OF i_alv.
DATA: alv_container TYPE REF TO cl_gui_docking_container.
DATA: alv_grid TYPE REF TO cl_gui_alv_grid.
DATA: layout TYPE lvc_s_layo.
DATA: fieldcat TYPE lvc_t_fcat.
DATA: gt_t001l TYPE STANDARD TABLE OF t001l.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
*-->Method for User command
CLASS-METHODS :
handle_hotspot_click FOR EVENT hotspot_click OF
cl_gui_alv_grid
IMPORTING E_ROW_ID e_column_id.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_hotspot_click.
READ TABLE i_alv INTO wa_alv
INDEX e_row_id-index
TRANSPORTING matnr.
SET PARAMETER ID 'MAT' FIELD wa_alv-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDMETHOD. "handle_double_click
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
PARAMETERS: p_check TYPE matnr.
INITIALIZATION.
PERFORM get_data.
AT SELECTION-SCREEN OUTPUT.
* START-OF-SELECTION.
DATA: variant TYPE disvariant.
DATA: repid TYPE sy-repid.
repid = sy-repid.
variant-report = sy-repid.
variant-username = sy-uname.
layout-zebra = 'X'.
layout-edit_mode = 'X'.
CHECK alv_container IS INITIAL.
CREATE OBJECT alv_container
EXPORTING repid = repid
dynnr = sy-dynnr
side = alv_container->dock_at_right
extension = 350.
CREATE OBJECT alv_grid
EXPORTING
i_parent = alv_container.
* Set event handler
SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
* ALV Specific. Data selection.
* Populate Field Catalog
PERFORM get_fieldcatalog.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
is_layout = layout
is_variant = variant
i_save = 'U'
i_structure_name = 'I_ALV'
CHANGING
it_outtab = i_alv[]
it_fieldcatalog = fieldcat[].
START-OF-SELECTION.
* FORM GET_DATA
FORM get_data.
SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
FROM mara
INNER JOIN makt
ON mara~matnr = makt~matnr
UP TO 100 ROWS
WHERE makt~spras = sy-langu.
SORT i_alv ASCENDING BY matnr.
ENDFORM. "get_data
* Form Get_Fieldcatalog - Set Up Columns/Headers
FORM get_fieldcatalog.
DATA: ls_fcat TYPE lvc_s_fcat.
REFRESH: fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Number'.
ls_fcat-fieldname = 'MATNR'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '18'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-hotspot = 'X'.
ls_fcat-col_pos = '1'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Type'.
ls_fcat-fieldname = 'MTART'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '10'.
ls_fcat-fix_column = 'X'.
ls_fcat-key = 'X'.
ls_fcat-col_pos = '2'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Group'.
ls_fcat-fieldname = 'MATKL'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '12'.
ls_fcat-col_pos = '3'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Size'.
ls_fcat-fieldname = 'GROES'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '30'.
ls_fcat-col_pos = '4'.
APPEND ls_fcat TO fieldcat.
CLEAR: ls_fcat.
ls_fcat-reptext = 'Material Description'.
ls_fcat-fieldname = 'MAKTX'.
ls_fcat-ref_table = 'I_ALV'.
ls_fcat-outputlen = '40'.
ls_fcat-col_pos = '5'.
APPEND ls_fcat TO fieldcat.
ENDFORM. "get_fieldcatalog
Hope this solves your problem.... -
Short dump while on double click event in ALV
Hi ,
I have created a ALV screen to display the customer number and NAme ,my requirement is that when i click on the Key field i.e. Customer number it should call the transaction xd03 for that I have written the following code
gs_layout-box_fieldname = 'SEL'.
gs_layout-colwidth_optimize = 'X'.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
is_layout = gs_layout
it_fieldcat = fieldcatalog[]
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = t_itab
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 user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'KUNNR'.
READ TABLE t_itab INTO w_itab
WITH KEY kunnr = rs_selfield-value.
IF sy-subrc = 0.
SET PARAMETER ID 'KUN' FIELD rs_selfield-value.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
CLEAR r_ucomm.
ENDCASE.
ENDFORM. "user_command
FORM pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD1'.
ENDFORM. "pf_status
Problem is when i double click on the Customer No field on the ALV ouput i Am getting a Short dump.. "MOVE_TO_LIT_NOTALLOWED_NODATA"..
How should i overcome this runtime error....
Thanks in advance,
Nishant>
Abhii wrote:
> There was a problem in the SET PARAMETER ID statement.
> Nishant, Make the code changes I have suggested, you will get the output.
Either you possess telepathic skills or you are omniscient.
Before asserting your solution on someone be sure what exactly is the problem. If you check the OP's code, CALL TRANSACTION will be called only when the READ TABLE is successful.
So how does your solution add benefit to the existing one.
BR,
Suhas -
Double click event in ALV Display
Hi
I am using Reuse_alv_grid_display for dis[playing ALV. Now I want to handle double click event on a perticular Single column.
Pls provide code.Hi,
Check this example..If you double click on the purchase order field, it will take you to the corresponding PO in ME23N..
TYPE-POOLS: slis.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: BEGIN OF wa_ekko,
ebeln like ekko-ebeln,
ekorg like ekko-ekorg,
ekgrp like ekko-ekgrp,
END OF wa_ekko.
DATA: v_repid TYPE syrepid.
v_repid = sy-repid.
DATA it_ekko LIKE STANDARD TABLE OF wa_ekko WITH HEADER LINE.
SELECT * UP TO 100 ROWS
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = v_repid
i_internal_tabname = 'WA_EKKO'
i_inclname = v_repid
CHANGING
ct_fieldcat = gt_fieldcat.
Pass the program.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = gt_fieldcat
i_callback_user_command = 'USER_COMMAND'
TABLES
t_outtab = it_ekko.
FORM display_detail *
--> UCOMM *
--> SELFIELD *
FORM user_command USING ucomm LIKE sy-ucomm
selfield TYPE slis_selfield.
IF ucomm = '&IC1' AND selfield-fieldname = 'EBELN'.
READ TABLE it_ekko INDEX selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'BES' FIELD it_ekko-ebeln.
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDIF.
ENDFORM.
Thanks,
Naren -
Double Click Event In ALV Tree
Hello guys,
There is a requirement that when I double click on an item in ALV tree it takes me to a standard transaction code.
Can anyone suggest me how to proceed on this.
Thanks in Advance.
Regards,
AbhinavHi,
Refer:
Get cursor field in ALV Tree
Hope this helps you.
Regards,
Tarun -
hi all,
Is there any way to handle the single click/tick on checkbox. Is there user command on that? For now, if we will click on the checkbox, the changes made on it does not reflect. I checked on the debugging mode, checkbox is not populated/ marked even if it was ticked by the user.
thanks in advance.Hi Akira,
For Controling Check Box , you have to use grid display using customised Container screen.
From there you can control check Box .
CREATE OBJECT custom_container
EXPORTING container_name = o_container.
CREATE OBJECT o_grid
EXPORTING i_parent = custom_container.
Form for building the fieldcatalog
PERFORM build_fieldcat CHANGING it_fieldcat.
Form for excluding the unwanted functionalities from the toolbar.
PERFORM exclude_tb_functions CHANGING it_exclude.
Method for displaying the ALV grid.
CALL METHOD o_grid->set_table_for_first_display
EXPORTING
is_layout = it_layout
it_toolbar_excluding = it_exclude
CHANGING
it_fieldcatalog = it_fieldcat
it_outtab = it_final.
CREATE OBJECT o_event_receiver.
Setting the event handlers for events toolbar, usercommand and datachange.
SET HANDLER o_event_receiver->catch_toolbar FOR o_grid.
SET HANDLER o_event_receiver->catch_user_command FOR o_grid.
SET HANDLER o_event_receiver->catch_datachange FOR o_grid.
Set editable cells to ready for input.
CALL METHOD o_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1. -
Problem in Double click event for ALV.
Hi experts ,
My scenario is one ALV is displayed in First screen and after double click on particular column second screen is displayed with the other ALV.
I have created 2 custom containers.
My problem is that for the first double click every thing is fine,then i come back to first screen from second screen when i double click on different item the previous item is displayed which was for the first double click .
I debugg the program , passing of data to the internal table is fine.
Help me in the problem
Thanks
AisuryaHi,
You have to use refresh_table_dispaly method to update the values. else it will display the same.
try this logic
if cus_cont is initial.
o_grid->set_table_for_first_display.
else.
o_grid->refresh_table_display.
endif.,
check BCALV_GRID_03 standard program for reference.
hope this helps u.,
Thanks & Regards,
Kiran -
How to overwrite double click action in siteadmin grid?
I would like to create custom page based on siteadmin widget and now I'm facing a problem with changing a double click action as a defoult it open location with .html sufix if it is not a folder. I would like to open dialog.
Thanks,Thanks Sham, here is my sample function if anyone need it too
var coreOpenPage = CQ.wcm.SiteAdmin.openPage;
CQ.wcm.SiteAdmin.openPage = function(path, type, newWindow, selection) {
if (type == 'commerce/components/product') {
CQ.Ext.Msg.alert(
"Debug",
"Open product dialog"
} else {
coreOpenPage.apply(this, arguments); -
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 ?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 -
Double-click in ALV Grid on BDC recording not recorded
Hi,
I'm recording a BDC session in a CRM system to enter a business partner. One of the steps is to choose a marketing attribute. To do this you have to double click on a (read only) ALV grid to select the attribute.
When I record this in SHDB or LSMW, the double click is never recorded?
Anybody else had problems recording a double click in an ALV grid.
Thanks
NaidooUnfortunely, BDC and gui controls do not get along. The ALV_Grid uses a gui control to intereactive with the user. Doing a recording over these kinds of transaction is not suggested for this very reason. You will have to find another way to achieve your result. Is there any BAPI or function module which does this functionality?
Regards,
Rich Heilman
Maybe you are looking for
-
my macbook pro will not boot. It gets the grey screen with the apple until the bar is half way across and then shuts down. The only screen I can get to is in safe mode and I don't know what to do with that
-
I am new to Adobe and I am planning to start learning it. Where to start ? I am keen in Video tutorial than books. Please help. thanks
-
Hi all, Is there any way to handle the console events? I need something like AWT's WindowListener but for handling console events - "on close" in particular. I've written basic server app for a game, and it does not have gui (it only listens on speci
-
Multiple channels from GigE camera
Hello NI Folks, I am using a GigE camera for my Machine Vision application. I have to save data from all three channels coming out of Camera. I am using Example VI from National Instruments 'Grab and Setup attributes.vi' to get attributes and save Im
-
How to debug DOC_CHANGE_BADI?
Need some help to debug the BBP_DOC_CHANGE_BADI, have made changes to the BADI and put breakpoints in but cannot get the ITS debugger working. Have also tried to invoke the transfer method and it also does not go into debug? How do I debug this? Any