How to trigger left_click_run event on ALV GRID
Hiiiiiiii........
Can any of u please tell me how to trigger left_click_run event on ALV GRID.
There is an event LEFT_CLICK_RUN and its a public accessed event. But the problem is , the corresponding attribute of this event "EVENT_LEFT_CLICK_RUN" which is needed to registered that event (We need to register our events through a method set_register_events using table of type cntl_simple_events...) is protect accessed. So I am unable to use that attribute...Could u please tell me is there any alternative way to register that event.......ANY POSSIBLE WAY?
Thanks in advance,
Rams
I think you should use event selection_changed. Note that you shouldn't allow multiple selection for the tree at the same time, i.e. use: create object g_tree exporting \[...\] node_selection_mode = cl_gui_column_tree=>node_sel_mode_single.
For more information, see this thread: Urgently required : cl_gui_alv_tree single_click event...
Similar Messages
-
LEFT_CLICK_RUN event of ALV Grid Control
Hello,
What is the use of LEFT_CLICK_RUN event of the CL_GUI_ALV_GRID control. I thought it gets triggered when we click on the ALV Grid. But nothing as such is happening.
I had defined the event and then implemented it. I had even registered the event to the Grid Control. But when I am clicking on the Grid control, this event is not gettin triggered.
My requirement is I need to get a popup when I click on a particular field of a ALV Grid Control.
PriyaHi Priya,
Please check demo program BCALV_GRID_06, it shows how to create a context menu when you right-click on the list.
Hope this may help you.
Regards,
Lanka -
How to capture the event in ALV grid display?
Hi experts,
How to capture the event in an ALV grid display which is editable. I have to capture the TAB key or ENTER key.
regards,
Arul Jothi.Hi Arul,
Take a look at sample program BCALV_EDIT_03. (Find string "register ENTER" in the program to see how to register)
Basically you have to Register edit events using method call REGISTER_EDIT_EVENT and then write a handler method for event DATA_CHANGED..
If you are using a REUSE..GRID fm then first get the grid reference using function module GET_GLOBALS_FROM_SLVC_FULLSCR and then repeat the above procedure..
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni -
How can I call functionality of ALV Grid by event of button outside grid?
Hello,
How can I call functionality of ALV Grid by event of button located outside ALV Grid? For example how to fire printing of this ALV Grid by button click elsewhere on the screen (not in toolbar of ALV Grid).
Best regards,
Josef Motlhi Motl,
these are steps to create a button in ALV and trigger an event from it..
1.Use the parameter i_callback_pf_status_set in the function module REUSE_ALV_GRID_DISPLAY
i_callback_program = gd_repid
i_callback_pf_status_set = 'SET_PF_STATUS'
form set_pf_status using rt_extab type slis_t_extab.
set pf-status 'NEWALVSTATUS'.
endform.
You have to copy the standard ALV pf stauts to 'NEWALVSTATUS' and add your button.
2.You have to do the following to process the new button click.
i_callback_user_command = 'USER_COMMAND'
form user_command using i_ucomm like sy-ucomm
is_selfield type slis_selfield.
case i_ucomm.
3. to copy the standard pf status to a new one.go to the ALV screen and take the menu System -> Status. Then look for the standard pf status. Copy this to Z range and then add your new button.
reward points if helpful
regards
satesh -
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 -
How to enable excel downloading in ALV grid report.
Hi all,
How to enable excal downing in ALV grid report?
Thanks in Advance.
Siva Sankar.hi
check the following code
Example of a Simple ALV Grid Report
REPORT ZTUFI091 .
*& Report ZDEMO_ALVGRID *
*& Example of a simple ALV Grid Report *
*& The basic requirement for this demo is to display a number of *
*& fields from the EKKO table. *
*REPORT zdemo_alvgrid .
TABLES: ekko.
type-pools: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_ekko,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
statu TYPE ekpo-statu,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
menge TYPE ekpo-menge,
meins TYPE ekpo-meins,
netpr TYPE ekpo-netpr,
peinh TYPE ekpo-peinh,
END OF t_ekko.
DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
wa_ekko TYPE t_ekko.
*ALV data declarations
data: fieldcatalog type slis_t_fieldcat_alv with header line,
gd_tab_group type slis_t_sp_group_alv,
gd_layout type slis_layout_alv,
gd_repid like sy-repid,
gt_events type slis_t_event,
gd_prntparams type slis_print_alv.
*Start-of-selection.
START-OF-SELECTION.
perform data_retrieval.
perform build_fieldcatalog.
perform build_layout.
perform build_events.
perform build_print_params.
perform display_alv_report.
*& Form BUILD_FIELDCATALOG
Build Fieldcatalog for ALV Report
form build_fieldcatalog.
There are a number of ways to create a fieldcat.
For the purpose of this example i will build the fieldcatalog manualy
by populating the internal table fields individually and then
appending the rows. This method can be the most time consuming but can
also allow you more control of the final product.
Beware though, you need to ensure that all fields required are
populated. When using some of functionality available via ALV, such as
total. You may need to provide more information than if you were
simply displaying the result
I.e. Field type may be required in-order for
the 'TOTAL' function to work.
fieldcatalog-fieldname = 'EBELN'.
fieldcatalog-seltext_m = 'Purchase Order'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
fieldcatalog-key = 'X'.
fieldcatalog-do_sum = 'X'.
fieldcatalog-no_zero = 'X'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'EBELP'.
fieldcatalog-seltext_m = 'PO Item'.
fieldcatalog-col_pos = 1.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'STATU'.
fieldcatalog-seltext_m = 'Status'.
fieldcatalog-col_pos = 2.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'AEDAT'.
fieldcatalog-seltext_m = 'Item change date'.
fieldcatalog-col_pos = 3.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'Material Number'.
fieldcatalog-col_pos = 4.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MENGE'.
fieldcatalog-seltext_m = 'PO quantity'.
fieldcatalog-col_pos = 5.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'MEINS'.
fieldcatalog-seltext_m = 'Order Unit'.
fieldcatalog-col_pos = 6.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'NETPR'.
fieldcatalog-seltext_m = 'Net Price'.
fieldcatalog-col_pos = 7.
fieldcatalog-outputlen = 15.
fieldcatalog-datatype = 'CURR'.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
fieldcatalog-fieldname = 'PEINH'.
fieldcatalog-seltext_m = 'Price Unit'.
fieldcatalog-col_pos = 8.
append fieldcatalog to fieldcatalog.
clear fieldcatalog.
endform. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
Build layout for ALV grid report
form build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
gd_layout-totals_only = 'X'.
gd_layout-f2code = 'DISP'. "Sets fcode for when double
"click(press f2)
gd_layout-zebra = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text = 'helllllo'.
endform. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
Display report using ALV grid
form display_alv_report.
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
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
it_special_groups = gd_tabgroup
it_events = gt_events
is_print = gd_prntparams
i_save = 'X'
is_variant = z_template
tables
t_outtab = it_ekko
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_ALV_REPORT
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp statu aedat matnr menge meins netpr peinh
up to 10 rows
from ekpo
into table it_ekko.
endform. " DATA_RETRIEVAL
Form TOP-OF-PAGE *
ALV Report Header *
Form top-of-page.
*ALV Header declarations
data: t_header type slis_t_listheader,
wa_header type slis_listheader,
t_line like wa_header-info,
ld_lines type i,
ld_linesc(10) type c.
Title
wa_header-typ = 'H'.
wa_header-info = 'EKKO Table Report'.
append wa_header to t_header.
clear wa_header.
Date
wa_header-typ = 'S'.
wa_header-key = 'Date: '.
CONCATENATE sy-datum+6(2) '.'
sy-datum+4(2) '.'
sy-datum(4) INTO wa_header-info. "todays date
append wa_header to t_header.
clear: wa_header.
Total No. of Records Selected
describe table it_ekko lines ld_lines.
ld_linesc = ld_lines.
concatenate 'Total No. of Records Selected: ' ld_linesc
into t_line separated by space.
wa_header-typ = 'A'.
wa_header-info = t_line.
append wa_header to t_header.
clear: wa_header, t_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = t_header.
i_logo = 'Z_LOGO'.
endform.
FORM USER_COMMAND *
--> R_UCOMM *
--> RS_SELFIELD *
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
Check function code
CASE r_ucomm.
WHEN '&IC1'.
Check field clicked on within ALVgrid report
IF rs_selfield-fieldname = 'EBELN'.
Read data table, using index of row user clicked on
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
Set parameter ID for transaction screen field
SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
Sxecute transaction ME23N, and skip initial data entry screen
CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
*& Form BUILD_EVENTS
Build events table
form build_events.
data: ls_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = gt_events[].
read table gt_events with key name = slis_ev_end_of_page
into ls_event.
if sy-subrc = 0.
move 'END_OF_PAGE' to ls_event-form.
append ls_event to gt_events.
endif.
read table gt_events with key name = slis_ev_end_of_list
into ls_event.
if sy-subrc = 0.
move 'END_OF_LIST' to ls_event-form.
append ls_event to gt_events.
endif.
endform. " BUILD_EVENTS
*& Form BUILD_PRINT_PARAMS
Setup print parameters
form build_print_params.
gd_prntparams-reserve_lines = '3'. "Lines reserved for footer
gd_prntparams-no_coverpage = 'X'.
endform. " BUILD_PRINT_PARAMS
*& Form END_OF_PAGE
form END_OF_PAGE.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
write: sy-uline(50).
skip.
write:/40 'Page:', sy-pagno .
endform.
*& Form END_OF_LIST
form END_OF_LIST.
data: listwidth type i,
ld_pagepos(10) type c,
ld_page(10) type c.
skip.
write:/40 'Page:', sy-pagno .
endform.
hope it will help you
regards
sreelatha gullapalli -
How to get f4 help in alv grid in container-urgent
hi,
how to get f4 help in alv grid in container using abap objects
ganeshHi Ganesh,
Did you have a look at sample report BCALV_TEST_GRID_F4_HELP ?
Here is part of the header documentation:
*& Report BCALV_GRID_F4_HELP *
Purpose:
~~~~~~~~
This report illustrates the use of f4-Help in an alv grid control.
Background:
~~~~~~~~~~~
There a two possibilities to implement an f4-Help in the alv grid
control: one can either use standard f4-help or write one by Hand.
For the former there is nothing to do at all. This report shows how
to implement user-defined f4-help.
I am sure you will find within this report the solution you are looking for.
Reward points if this Helps.
Manish -
How to trigger an event in the program
Hi,
I have a program. The purpose of the program is to retrieve the data matching the selection criteria and downlod the same to a file.
In the selection screen, I have a parameter called 'EVENT'. Here, user enters some event name. Generally, they enter the 'Background job processing events'.
So, my requirement is... once the files are successfully downloaded, the program should trigger the 'EVENT' specified in the selection screen at run time.
Can someone help me in this regard. How to trigger an EVENT in the program. Is there any Function Module or Method available in SAP which triggers the EVENT at runtime.
And is there any table available in SAP which stores all the events available in SAP. Because, whenever the user enters an EVENT in the selection screen, we should check whether the event is valid or not. So, if there is any table available which has all the events then, it will be easy I guess. or is there any other way to validate the EVENT name.
Please help me. Thanks in advance,
Best Regards,
Paddu.Hello Paddu,
have a look at tables
- btcsev, btcsed (system events)
- btcuev, btcued (user events)
and use function BP_EVENT_RAISE.
kind regards
Walter Habich -
How to trigger a event when WBS gets changed in Cj02
Hello,
I have a requirement where I need to send create an idoc and send the idoc to external system when WBS is created or changed. Currently, I have the following setup:
- I have created a YBUS2054 as a subtype of BUS2054 using SWO1
- YBUS2054 has been delegated to BUS2054
- created an CHANGED event in the YBUS2054. This event is implemented and then released
- created a type linkage (object type=YBUS2054, event=CHANGED, receiver type null, and receiver function module = zz_create_wbs_idoc) using SWETYPV. This function is supposed to create an idoc when CHANGED event occurs. I just don't know how to trigger the event to occur.
- all the port, define idoc type, logical system, and etc are setup
- when I try to create an entry in "Event for Chagne Document" using SWEC with change doc object=PROJ, business object type = YBUS2054, with on change, I get "Key for change doc object PROJ and business object type YBUS2054 are incompatible".
I tried various configurations, and I was not successfully in creating an event on CHANGED
can you please advise what I am missing in getting the changed event to trigger?
Thank you in advance,
ShawnHi,
If the change doc doesnt exist, check if you can create an event using BSVW.
Also use the event log to see if there are other sap standard events happening.
I checked the package belonging to CJ02 to see if there is something useable, but didn't find anything: CN_PSP_OPR
If there are no sap standard ways to get an event, you'll have to find a badi/enhancement spot and include some coding to start the event using fm SAP_WAPI_CREATE_EVENT.
Kind regards, Rob Dielemans -
How to trigger ENTER event in oo ALV grid
Hi,
Can anybody help me out in catching the ENTER event in the oo ALV Grid. My requirement is as follows,
I have oo ALV Grid displaying hell lot of columns, in that vendor number column is an editable field so when the user enters the vendor number the immediate next cell showing the vendor name should be populated with the corresponding name as soon as he press enter button, I have search help also for vendor field.
Please give me some sample program which i can just do the copy+paste sort of as today is the deadline for the object.
Regards,
SumanHi,
This example is working. Please try this one.
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_ucomm.
ENDCLASS. "lcl_event_receiver DEFINITION
* CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_data_changed.
DATA : modi TYPE TABLE OF lvc_s_modi ,
modis TYPE lvc_s_modi,
wa LIKE LINE OF git_alv_items,
lv_matnr TYPE matnr.
modi = er_data_changed->mt_mod_cells .
LOOP AT modi INTO modis WHERE fieldname = 'MATNR'.
MOVE modis-value TO lv_matnr.
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = lv_matnr
IMPORTING
output = lv_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
READ TABLE git_alv_items INTO wa INDEX modis-row_id .
IF sy-subrc = 0.
SELECT SINGLE maktx FROM makt
INTO wa-maktx
WHERE matnr = lv_matnr
AND spras = sy-langu.
MODIFY git_alv_items FROM wa INDEX modis-row_id.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
CALL METHOD alv_grid->refresh_table_display
EXPORTING
is_stable = gs_stbl.
ENDIF.
ENDMETHOD. "handle_data_changed
ENDCLASS. "lcl_event_receiver IMPLEMENTATION
DATA : eventreceiver TYPE REF TO lcl_event_receiver.
SET HANDLER eventreceiver->handle_data_changed FOR alv_grid.
CALL METHOD alv_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = layo_alv
i_bypassing_buffer = 'X'
i_buffer_active = ''
CHANGING
it_outtab = git_alv_items
it_fieldcatalog = fcat_alv
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
CALL METHOD alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter. -
How can I trigger a USER_COMMAND for alv grid "toolbar" ???
Hi,
i have the standard ALV Grid "toolbar" and if i click to the Button "&LOCAL©_ROW" than i want try to make a Refresh to my ALV Table in the Event "afteruser_command"_!!!!
Here is the implementation of my Event *"afteruser_command":*_
METHOD on_after_user_command.
........DATA: ls_stable TYPE lvc_s_stbl.
.....CASE e_ucomm.
.....WHEN '&LOCAL©_ROW'.
........MESSAGE 'LOCAL_COPY_ROW' TYPE 'S' DISPLAY LIKE 'E'.
........ls_stable-row = 'X'.
........ls_stable-col = 'X'.
........CALL METHOD gr_grid_d0100->refresh_table_display
..............EXPORTING
.......................is_stable = ls_stable
..............EXCEPTIONS
.......................finished = 1
.......................OTHERS = 2.
......ENDCASE.
ENDMETHOD.
But it doesnt work.
Is there another function code for the Copy Button????
Thanks
ErsinHello Ersin,
the events "after_user_command", "before_user_command" and "user_command" will not be fired when selecting this command!
In my opinion, there is no solution, to fire these events, using this alv-function!
But there is a trick:
1. Register on the event "toolbar" with an own method:
toolbar_own for event toolbar of cl_gui_alv_grid
importing e_object
e_interactive,
In this method change the function code of "&LOCAL©_ROW", but don´t change the row of the entry, because the button should appear on the same place in the toolbar:
field-symbols: <ls_toolbar> type stb_button.
read table e_object->mt_toolbar with key function = '&LOCAL©_ROW'
assigning <ls_toolbar>.
if sy-subrc = 0.
<ls_toolbar>-function = 'COPYROW_OWN'.
endif.
2. Register on the event "user_command" ( I think, that´s clear ):
user_cmd_own for event user_command
of cl_gui_alv_grid
importing e_ucomm,
( don´t forget the set handler-commands for both events:
set handler po_alv_own->user_cmd_own for po_alv_own.
set handler po_alv_own->toolbar_own for po_alv_own. )
3. Now you can react in the method "user_command" on your own function code:
case e_ucomm.
when 'COPYROW_OWN'.
perform copy_row using me
changing gt_bis_cf_out.
Sample code for copying the current line:
FORM COPY_ROW using po_alv_own type ref to gcl_alv_own
changing pt_table_alv type gt_table_alv_t.
data: l_index type i,
ls_table_alv type gs_table_alvt_t.
call method po_alv_own->get_current_cell
importing
e_row = l_index.
* e_value =
* e_col =
* es_row_id =
* es_col_id =
* es_row_no =
"read the current line:
read table pt_table_alv index l_index
into ls_table_alv_out.
"some changes for the new row:
clear: ls_table_alv-style,
ls_table_alv-tabix.
"insert the new line:
add 1 to l_index.
insert ls_table_alv into pt_table_alv index l_index.
po_alv_own->refresh( ).
ENDFORM. " COPY_ROW
In this manner the events "after_user_command", "before_user_command" are fired, too!
For information: My problem was, that the ALV-function copied the style-information too, so in the new line, some fields are not editable. At least his field must be cleared!
Best regard
Thomas Scheuermann -
How can I register an EVENT for ALV-GRID?????
Hi,
i have create Events for my ALV-Grid Table (cl_gui_alv_grid).
But there is one Problem!!!!
Which Event must i create, if users write something in the ALV row and press to key "enter" ???
With kind regards
ErsinDid you set the handler for one of forementioned events? If no, please suplement your code with the following
"create handler class
CLASS lcl_gui_alv_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
" Controlling data changes when ALV Grid is editable
handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed e_onf4 e_onf4_before e_onf4_after,
" To be triggered after data changing is finished
handle_data_changed_finished FOR EVENT data_changed_finished OF cl_gui_alv_grid
IMPORTING e_modified ,
ENDCLASS.
"implement you handler methods
CLASS lcl_gui_alv_event_receiver IMPLEMENTATION.
METHOD handle_data_changed .
MESSAGE 'Data changed' TYPE 'I'.
ENDMETHOD.
METHOD handle_data_changed_finished .
MESSAGE 'Data changed finished' TYPE 'I'.
ENDMETHOD .
ENDCLASS.
data: g_alv_event_ref TYPE REF TO lcl_gui_alv_event_receiver.
CREATE OBJECT g_alv_event_ref.
"set handlers for these events
SET HANDLER:
g_alv_event_ref->handle_data_changed FOR g_alv_grid_ref,
g_alv_event_ref->handle_data_changed_finished FOR g_alv_grid_ref,
"register the events after pressing enter
CALL METHOD g_alv_grid_ref->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
Regards
Marcin -
Reg: Top_Of_List Events in ALV GRID Display
Hi ,
How can i use the the the Top_of_list Event Alv grid Disply.
I have passed Events table with event name and form name to GRID FM it_events.
Form details:-
T_LISTHEADER header deatils table with data. .
FORM TOP_OF_LIST.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
But still its not calling the form and also end_of list is working with same coding but top_of_list is not working can u give solution for this.
Regards,
rajHi Rajviji,
Please change the coding to below :-
*& Report ZR2K9_ALV008
REPORT alv_top_of_list
TABLES : t001.
TYPE-POOLS: slis.
DATA : w_repid LIKE sy-repid.
TYPES : BEGIN OF ty_comp.
INCLUDE STRUCTURE t001.
TYPES : END OF ty_comp.
DATA: T_EVENTS TYPE slis_t_event.
DATA: WA_EVENTS TYPE slis_alv_event .
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA : it_comp TYPE TABLE OF ty_comp.
INITIALIZATION.
w_repid = sy-repid.
*Need to change here
wa_events-name = 'TOP_OF_PAGE'. "Instead of TOP_OF_LIST
wa_events-form = 'TOP_OF_PAGE'.
APPEND wa_events TO t_events.
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE it_comp up to 20 rows.
END-OF-SELECTION.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = w_repid
i_internal_tabname = 'IT_COMP'
I_STRUCTURE_NAME = 't001'
i_inclname = w_repid
CHANGING
ct_fieldcat = it_fieldcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
it_fieldcat = it_fieldcat[]
IT_EVENTS = T_EVENTS
TABLES
t_outtab = it_comp
EXCEPTIONS
program_error = 1
OTHERS = 2.
FORM TOP_OF_PAGE. "Form Name Changed
DATA: T_LISTHEADER TYPE SLIS_T_LISTHEADER.
DATA: LS_LISTHEADER TYPE SLIS_LISTHEADER.
CLEAR LS_LISTHEADER.
LS_LISTHEADER-TYP = 'S'.
LS_LISTHEADER-KEY = 'Po Heder Details :-'.
APPEND LS_LISTHEADER TO T_LISTHEADER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LISTHEADER.
ENDFORM.
Regards
Sandipan -
How can i show details in ALV GRID with double click in a row?
Hello, ich try to show the details of a row with double click in the line,
but it doesn't work!?
I have a eventhandler for doubleclick and the program run this code, but what i have to do, to show the details!?
I try it with some methods like cl_gui_cfw=>set_new_ok_code, ...
i think about the methods cl_gui_alv_grid->show_detail, but this method is private,
i can create a class with inheritance of the cl_gui_alv_grid class and try this method!?
Have anybody any ideas!?Hello Lars
The following sample reports shows an ALV list with company codes. Double-clicking on any company code will open a second ALV list displaying all customers.
*& Report ZUS_SDN_ALVGRID_EVENTS_1
REPORT zus_sdn_alvgrid_events_1.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_docking2 TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_t001 TYPE STANDARD TABLE OF t001,
gt_knb1 TYPE STANDARD TABLE OF knb1.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
IMPORTING
e_row
e_column
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_double_click.
* define local data
DATA:
ls_t001 TYPE t001,
ls_col_id TYPE lvc_s_col.
CHECK ( sender = go_grid1 ).
READ TABLE gt_t001 INTO ls_t001 INDEX e_row-index.
CHECK ( ls_t001-bukrs IS NOT INITIAL ).
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = ls_t001-bukrs.
IF ( syst-subrc NE 0 ).
MESSAGE 'No customers found' TYPE 'S'.
ELSE.
* Trigger PAI of dynpro '0100' and set new ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'CALL_SCREEN_0200' ).
ENDIF.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM t001 INTO TABLE gt_t001.
REFRESH: gt_knb1.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_docking2
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_docking2
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_double_click FOR go_grid1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'T001'
CHANGING
it_outtab = gt_t001
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL METHOD go_docking2->link
EXPORTING
repid = syst-repid
dynnr = '0200'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'CALL_SCREEN_0200'.
go_grid2->refresh_table_display( ). " necessary
CALL SCREEN '0200'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards
Uwe -
How to use Style in LVC_S_LAYO (ALV Grid Layout)
Hi Experts,
I am trying to set field 'STYLEFNAME' of LVC_S_LAYO while setting up layout for ALV GRID using 'SET_TABLE_FOR_FIRST_DISPLAY' . I'm passing the field name contain the styles for each row. I am setting it in the same way we set 'INFO_FNAME' by passing color field name for coloring the rows. Styles are available in include <CL_ALV_CONTROL> .
Please note styles are working properly when I am setting it at field cat level by setting fieldcat field LVC_S_FCAT-STYLE. But set sets style for entire column. I want to set style for few rows. I want to use style 'ALV_STYLE_BUTTON' .
Please advice how to do this.
Regards,
Sushant.I'll try to understand your question.
You have a 'new-style' alv and want to show some fields as pushbutton.
To make a cell to be displayed as a pushbutton, we have two steps.
Firstly, insert a new inner table of type u201CLVC_T_STYLu201D into your list data table.
*--- Internal table holding list data
DATA BEGIN OF gt_list OCCURS 0 .
INCLUDE STRUCTURE SFLIGHT .
DATA rowcolor(4) TYPE c .
DATA cellcolors TYPE lvc_t_scol .
DATA carrid_handle TYPE int4 .
DATA connid_handle TYPE int4 .
DATA cellstyles TYPE lvc_t_styl .
DATA END OF gt_list .
Fill this inner table for each field to be displayed as pushbutton.
DATA ls_style TYPE lvc_s_styl .
READ TABLE gt_list INDEX 7 .
ls_style-fieldname = 'SEATSMAX' .
ls_style-style = cl_gui_alv_grid=>mc_style_button .
APPEND ls_style TO gt_list-cellstyles .
MODIFY gt_list INDEX 7 .
As usual, we state our list data table field related with styles in the layout structure at field u2018STYLEFNAMEu2019.
e.g. ps_layout-stylefname = 'CELLSTYLES' .
Button click event is handled like hotspot click via the event u201Cbutton_clicku201D through its parameters u201Ces_col_idu201D and u201Ces_row_nou201D which contain the address of the clicked pushbutton cell.
Maybe you are looking for
-
Display and return value in select list.
hi, i want to display the value in select list coming from this quary . select student_id from class_record where class_id =:p1_class_id and SECTION =:p1_section minus select student_id from STUDENT_TYPE_DETAILS where class_id =:p1_class_id and SECTI
-
I am writing control software for a process that is usually dull and requires only 10 Hz acquisition rate. At particular times during the sequence, however, we are interested in looking at a couple of channels at 1000 Hz. My approach so far is to c
-
Suddenly I cannot access one website
All of a sudden I cannot access one website at www.countrywalkers.com from any of the three Macs on my network. Two of them are wireless and one is ethernet-cabled I work for them so it would be helpful if I could do so. I e-mailed them and they have
-
Issue with BlackMagic HDTV codec in SHAKE 4.1
Hi! Have a issue with using the Blackmagic HDTV 1920x1080 8bit codec. When adding it to a FileIn node i only get loads of grain in front of the video. I`l only get this problem when opening in shake, in quicktime its fine. anyone with same experience
-
We have recently started using ID CC 2014 and recently have been having Crashing issues stating the network connection was lost. Anyone else having this issue?