Message handling in ALV events
I have a screen with ALV Grid control. This grid has columns (attributes of more than one material). Now when I select more than one column and click on a button added on the ALV grid toolbar
it triggers a button click event and in the implementation I have written a code to check whether the selected columns (ie attributes) are from same material or not
.if not from same material it throws an error message (Message type E). Once the error message is displayed doing any operation exits from the program
.as the Message type E exits from the program.
The requirement is to remain on the same screen and not exit. Error will disappear only on selecting columns from the same material and press the button.
Note : There are no input fields here. So the concept of Chain-EndChain doesnt hold good.
METHOD handle_user_command_mmv.
DATA: lt_cols TYPE lvc_t_col, "Stores the selected columns
wa_lt_cols LIKE LINE OF lt_cols, "Work Area for the above
skey TYPE char2, "To store the key of the selected material
flag TYPE int1, "For getting the first entry in current field catalog
errFlag TYPE int1, "Set if error occurs
dupflag TYPE int1, "To check for invalid selection
l_fld_name TYPE string, "String to hold dynamic column name
it_curr_fcat TYPE lvc_t_fcat, "Current field catalog
wa_curr_fcat LIKE LINE OF it_curr_fcat, "Work Area for current field catalog
it_new_fcat TYPE lvc_t_fcat, "New field catalog
wa_new_fcat LIKE LINE OF it_new_fcat, "Work Area for new field catalog
it_sel_mat_fcat TYPE lvc_t_fcat, "Selected materials field catalog
wa_sel_mat_fcat LIKE LINE OF it_sel_mat_fcat, "Work Area for selected materials field catalog
l_count_seq type int4. "Col position for the new table
DATA: lt_fcat TYPE lvc_t_fcat. "New field catalog in which final data will be stored
Structure to maintain the order of materials
TYPES: BEGIN OF struct_mattab,
matrkey TYPE char3,
END OF struct_mattab.
DATA: itab_mat_fcat TYPE TABLE OF struct_mattab,
wa_mat_fcat LIKE LINE OF itab_mat_fcat,
WA_G_MMV_F4_TAB LIKE LINE OF G_MMV_F4_TAB.
CASE e_ucomm.
WHEN 'MMV_CASCADE'.
Get all selected columns in a temporary table
CALL METHOD alv_grid_mmv->get_selected_columns
IMPORTING
et_index_columns = lt_cols[].
flag = 1.
dupflag = 1.
l_count_seq = 1.
errFlag = 0.
CLEAR skey.
LOOP AT lt_cols INTO wa_lt_cols.
IF wa_lt_cols-fieldname <> 'LOCID' AND
wa_lt_cols-fieldname <> 'TSYST' AND
wa_lt_cols-fieldname <> 'MATNR' AND
wa_lt_cols-fieldname <> 'CHARG' AND
wa_lt_cols-fieldname <> 'DATUM' AND
wa_lt_cols-fieldname <> 'DATE_MMV' AND
wa_lt_cols-fieldname <> 'DOW' AND
wa_lt_cols-fieldname <> 'INTNO' AND
wa_lt_cols-fieldname <> 'MULTFLAG' AND
wa_lt_cols-fieldname <> 'CELLIO_TAB' AND
wa_lt_cols-fieldname <> 'CELLCOLOR_TAB' AND
wa_lt_cols-fieldname <> 'LINECOLOR'.
Get the key of the first column in the current field catalog other than the fixed columns
IF flag = 1.
skey = wa_lt_cols-fieldname+7(2).
flag = flag + 1.
ENDIF.
Check if selected columns are from different materials or aggregate columns
IF skey <> wa_lt_cols-fieldname+7(2).
dupflag = 2.
ELSEIF wa_lt_cols-fieldname+7(2) = '00'.
dupflag = 3.
ENDIF.
ENDIF.
ENDLOOP.
<b>IF dupflag = 2.
errFlag = 1.
MESSAGE E067(OIJ_SP).
ELSEIF dupflag = 3.
errFlag = 1.
MESSAGE E068(OIJ_SP).</b>
ELSE.
CLEAR it_curr_fcat.
CLEAR it_sel_mat_fcat.
CLEAR it_new_fcat.
Get the current field catalog
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = it_curr_fcat.
If columns are not selected and the button is clicked
IF SKEY EQ SPACE.
IT_NEW_FCAT[] = IT_CURR_FCAT[].
ELSE.
Maintain the field catalog for the selected material in a temporary table
LOOP AT it_curr_fcat INTO wa_curr_fcat.
IF wa_curr_fcat-fieldname+7(2) = skey.
INSERT wa_curr_fcat INTO TABLE it_sel_mat_fcat.
ENDIF.
Inserting the aggregate and fixed columns into the new field catalog
IF WA_CURR_FCAT-FIELDNAME EQ 'LOCID' OR
WA_CURR_FCAT-FIELDNAME EQ 'TSYST' OR
WA_CURR_FCAT-FIELDNAME EQ 'MATNR' OR
WA_CURR_FCAT-FIELDNAME EQ 'CHARG' OR
WA_CURR_FCAT-FIELDNAME EQ 'DATUM' OR
WA_CURR_FCAT-FIELDNAME EQ 'DATE_MMV' OR
WA_CURR_FCAT-FIELDNAME EQ 'DOW' OR
WA_CURR_FCAT-FIELDNAME EQ 'INTNO' OR
WA_CURR_FCAT-FIELDNAME EQ 'MULTFLAG' OR
WA_CURR_FCAT-FIELDNAME EQ 'CELLIO_TAB' OR
WA_CURR_FCAT-FIELDNAME EQ 'CELLCOLOR_TAB' OR
WA_CURR_FCAT-FIELDNAME EQ 'LINECOLOR' OR
WA_CURR_FCAT-FIELDNAME+7(2) EQ '00'.
WA_CURR_FCAT-COL_POS = l_count_seq.
APPEND WA_CURR_FCAT TO IT_NEW_FCAT.
l_count_seq = l_count_seq + 1.
ENDIF.
ENDLOOP.
Sort the internal table to reflect ordering
SORT IT_SEL_MAT_FCAT ASCENDING BY COL_POS.
ENDIF.
ENDIF.
IF SKEY NE SPACE AND errFlag NE 1.
Inserting the material columns into the new field catalog after cascading
LOOP AT G_MMV_F4_TAB INTO WA_G_MMV_F4_TAB
WHERE LOCID = G_LOCID.
LOOP AT IT_SEL_MAT_FCAT INTO WA_SEL_MAT_FCAT.
CONCATENATE WA_SEL_MAT_FCAT-FIELDNAME(7) WA_G_MMV_F4_TAB-KEY INTO L_FLD_NAME.
LOOP AT IT_CURR_FCAT INTO WA_CURR_FCAT
WHERE FIELDNAME = L_FLD_NAME.
MOVE WA_SEL_MAT_FCAT-NO_OUT TO WA_CURR_FCAT-NO_OUT.
MOVE WA_SEL_MAT_FCAT-OUTPUTLEN TO WA_CURR_FCAT-OUTPUTLEN.
WA_CURR_FCAT-COL_POS = l_count_seq.
APPEND WA_CURR_FCAT TO IT_NEW_FCAT.
l_count_seq = l_count_seq + 1.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDIF.
IF errFlag EQ 1.
Get the current field catalog
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = it_curr_fcat.
IT_NEW_FCAT[] = IT_CURR_FCAT[].
ENDIF.
CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = it_new_fcat.
CALL METHOD alv_grid_mmv->refresh_table_display.
Saving the current fieldcatalog
CLEAR g_itab_old_order.
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = g_itab_old_order.
WHEN 'MMV_COL_HDR_PREFIX'.
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fcat.
gv_mmv_col_hdr_setting = 1.
PERFORM set_mmv_col_hdr_txt
CHANGING lt_fcat
gv_mmv_col_hdr_setting.
CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = lt_fcat.
CALL METHOD alv_grid_mmv->refresh_table_display.
WHEN 'MMV_COL_HDR_SUFFIX'.
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fcat.
gv_mmv_col_hdr_setting = 2.
PERFORM set_mmv_col_hdr_txt
CHANGING lt_fcat
gv_mmv_col_hdr_setting.
CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = lt_fcat.
CALL METHOD alv_grid_mmv->refresh_table_display.
WHEN 'MMV_COL_HDR_1ST_PREFIX'.
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fcat.
gv_mmv_col_hdr_setting = 3.
PERFORM set_mmv_col_hdr_txt
CHANGING lt_fcat
gv_mmv_col_hdr_setting.
CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = lt_fcat.
CALL METHOD alv_grid_mmv->refresh_table_display.
WHEN 'MMV_COL_HDR_1ST_SUFFIX'.
CALL METHOD alv_grid_mmv->get_frontend_fieldcatalog
IMPORTING
et_fieldcatalog = lt_fcat.
gv_mmv_col_hdr_setting = 4.
PERFORM set_mmv_col_hdr_txt
CHANGING lt_fcat
gv_mmv_col_hdr_setting.
CALL METHOD alv_grid_mmv->set_frontend_fieldcatalog
EXPORTING
it_fieldcatalog = lt_fcat.
CALL METHOD alv_grid_mmv->refresh_table_display.
ENDCASE.
ENDMETHOD. "handle_user_command_mmv
Similar Messages
-
Handling double click event in oops alv
I need to write a interactive alv where,can any one help me in handling double click event using oops.
Hello,
Demo program on interactive ALV using OOPS
REPORT ZALV_OOINTERACTIVE.*Class definition for handling double click
CLASS event_class DEFINITION DEFERRED.*Internal table and work area declarations for dd02l and dd03l
DATA : it_dd02l TYPE TABLE OF dd02l,
wa_dd02l TYPE dd02l,
it_dd03l TYPE TABLE OF dd03l,
wa_dd03l TYPE dd03l.*data declarations for ALV Main list
DATA : ty_lay1 TYPE lvc_s_layo,
it_fieldcat TYPE lvc_t_fcat ,
ty_fieldcat TYPE lvc_s_fcat ,
c_alv1 TYPE REF TO cl_gui_alv_grid,
c_cont1 TYPE REF TO cl_gui_custom_container,
event_receiver TYPE REF TO event_class.*data declarations for ALV Interactive listDATA : ty_lay2 TYPE lvc_s_layo,
it_fcat TYPE lvc_t_fcat ,
ty_fcat TYPE lvc_s_fcat ,
c_alv2 TYPE REF TO cl_gui_alv_grid,
c_cont2 TYPE REF TO cl_gui_custom_container.
**Select options for multiple values and NOT ranges
SELECT-OPTIONS : s_table FOR wa_dd02l-tabname NO INTERVALS.
Initialization event
INITIALIZATION.*Start of selection event
START-OF-SELECTION.*fetch data into table and field characteristics
PERFORM fetch_data.*ALV display for output
PERFORM alv_output.&----
*& Form FETCH_DATA
text
--> p1 text
<-- p2 text
FORM fetch_data .*Select the table details
SELECT * FROM dd02l INTO CORRESPONDING FIELDS OF TABLE it_dd02l
WHERE tabname IN s_table
AND tabclass = 'TRANSP'.
ENDFORM. " FETCH_DATA----* CLASS lcl_event_receiver DEFINITION----CLASS event_class DEFINITION.*Handling double click
PUBLIC SECTION. METHODS:
handle_double_click
FOR EVENT double_click OF cl_gui_alv_grid IMPORTING e_row .ENDCLASS. "lcl_event_receiver DEFINITION
----* CLASS lcl_event_receiver IMPLEMENTATION
----CLASS event_class IMPLEMENTATION. METHOD handle_double_click. DATA : ls_dd02l LIKE LINE OF it_dd02l.*Reading the selected data into a variable
READ TABLE it_dd02l INDEX e_row-index INTO ls_dd02l.* *Select the field details of the selected table
SELECT * FROM dd03l INTO CORRESPONDING FIELDS OF TABLE it_dd03l
WHERE tabname EQ ls_dd02l-tabname.
*calling the ALV containing the field values
CALL SCREEN 101. ENDMETHOD. "handle_double_clickENDCLASS. "lcl_event_receiver IMPLEMENTATION&----& Module pbo_100 OUTPUT&----
*MODULE pbo_100 OUTPUT.
*set pf-status 'XXX'.
*set titlebar 'XXX'.
ENDMODULE. " PBO_100 OUTPUT
*& Module alv_100 OUTPUT
&----MODULE alv_100 OUTPUT.*Check if there is no custom container in screen 100
IF c_cont1 IS INITIAL.*Creating object of container
CREATE OBJECT c_cont1
EXPORTING
container_name = 'CCONT'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*Creating object of alv
CREATE OBJECT c_alv1
EXPORTING
i_parent = c_cont1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*alv layout
PERFORM alv_100_layout.*alv field catalogue
PERFORM alv_100_fieldcat.*Displaying the ALV grid
CALL METHOD c_alv1->set_table_for_first_display
EXPORTING
is_layout = ty_lay1
CHANGING
it_outtab = it_dd02l[]
it_fieldcatalog = it_fieldcat. 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 of the event class and setting handler for double click
CREATE OBJECT event_receiver.
SET HANDLER event_receiver->handle_double_click FOR c_alv1. ENDIF.ENDMODULE. " ALV_100 OUTPUT&----& Module pai_100 INPUT&----
*MODULE pai_100 INPUT.
ENDMODULE. " pai_100 INPUT----* MODULE PBO_101 OUTPUT----MODULE pbo_101 OUTPUT.
SET PF-STATUS 'XXX'.
SET TITLEBAR 'XXX'.
ENDMODULE. " PBO_101 INPUT----* MODULE ALV_101 OUTPUT----
MODULE alv_101 OUTPUT.
*Check if the Custom container exists.
IF c_cont2 IS INITIAL.*Creating container object
CREATE OBJECT c_cont2
EXPORTING
container_name = 'CDCONT'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*creating ALV grid for interactive list
CREATE OBJECT c_alv2
EXPORTING
i_parent = c_cont2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.*ALV layout
PERFORM alv_101_layout.*ALV fieldcatalogue
PERFORM alv_101_fieldcat.*Sorting the output by field position
SORT it_dd03l BY position.*ALV for display field details
CALL METHOD c_alv2->set_table_for_first_display
EXPORTING
is_layout = ty_lay2
CHANGING
it_outtab = it_dd03l[]
it_fieldcatalog = it_fcat.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. ENDIF.ENDMODULE. " ALV_101 OUTPUT
&----& Module PAI_101 INPUT&----
*MODULE pai_101 INPUT.ENDMODULE. " PAI_101 INPUT
*& Form ALV_OUTPUT
text
--> p1 text
<-- p2 text
FORM alv_output .
CALL SCREEN 100.ENDFORM. " ALV_OUTPUT
*& Form ALV_100_LAYOUT
text
--> p1 text
<-- p2 text
FORM alv_100_layout . ty_lay1-grid_title = 'TABLES'.
ty_lay1-zebra = 'X'.
ty_lay1-no_toolbar = 'X'.ENDFORM. " ALV_100_LAYOUT
*& Form ALV_100_FIELDCAT
text
--> p1 text
<-- p2 text
FORM alv_100_fieldcat .
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 1.
ty_fieldcat-fieldname = 'TABNAME'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'TableName'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat. ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 2.
ty_fieldcat-fieldname = 'TABCLASS'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'CATEGORY'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat. ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 3.
ty_fieldcat-fieldname = 'AS4USER'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'CREATED'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat. ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 4.
ty_fieldcat-fieldname = 'AS4DATE'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'DATE'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.
ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 5.
ty_fieldcat-fieldname = 'AS4TIME'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'TIME'.
ty_fieldcat-outputlen = 10.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat. ty_fieldcat-row_pos = 1.
ty_fieldcat-col_pos = 6.
ty_fieldcat-fieldname = 'CONTFLAG'.
ty_fieldcat-tabname = 'GT_DD02L'.
ty_fieldcat-coltext = 'Delivery Class'.
ty_fieldcat-outputlen = 15.
APPEND ty_fieldcat TO it_fieldcat.
CLEAR ty_fieldcat.ENDFORM. " ALV_100_FIELDCAT
*& Form ALV_101_LAYOUT
text
--> p1 text
<-- p2 text
FORM alv_101_layout . ty_lay2-grid_title = 'FIELDS'.
ty_lay2-zebra = 'X'.
ty_lay2-no_toolbar = 'X'.ENDFORM. " ALV_101_LAYOUT
*& Form ALV_101_FIELDCAT
text
--> p1 text
<-- p2 text
FORM alv_101_fieldcat . REFRESH it_fieldcat.
REFRESH it_fcat.
CLEAR ty_fcat. ty_fcat-row_pos = 1.
ty_fcat-col_pos = 1.
ty_fcat-fieldname = 'FIELDNAME'.
ty_fcat-tabname = 'GT_DD03L'.
ty_fcat-coltext = 'Fieldname'.
ty_fcat-outputlen = 10.
APPEND ty_fcat TO it_fcat.
ty_fcat-row_pos = 1.
ty_fcat-col_pos = 2.
ty_fcat-fieldname = 'CHECKTABLE'.
ty_fcat-tabname = 'GT_DD03L'.
ty_fcat-coltext = 'CHECKTABLE'.
ty_fcat-outputlen = 10.
APPEND ty_fcat TO it_fcat. ty_fcat-row_pos = 1.
ty_fcat-col_pos = 3.
ty_fcat-fieldname = 'KEYFLAG'.
ty_fcat-tabname = 'GT_DD03L'.
ty_fcat-coltext = 'Key Flag'.
ty_fcat-outputlen = 10.
APPEND ty_fcat TO it_fcat.ENDFORM. " ALV_101_FIELDCAT -
How to handle check box events in alv tree.
hi,
i am working in CL_GUI_COLUMN_TREE class.Also using Check box. Now i want to handle events for check box . I am new to ABAP Objects.
Pls expaline in detail or send code
thanks in advance,
senthil kumar.rHello Senthil
Have a look at the sample report
SAPCOLUMN_TREE_CONTROL_DEMO
. The crucial points are:
<b>(1) Register the required events at the control</b>
* define the events which will be passed to the backend
" checkbox change
event-eventid = CL_GUI_COLUMN_TREE=>EVENTID_checkbox_change.
event-appl_event = 'X'.
append event to events.
CALL METHOD G_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
<b>(2) Set the event handler</b>
assign event handlers in the application class to each desired event
SET HANDLER G_APPLICATION->HANDLE_CHECKBOX_CHANGE FOR g_tree.
<b>(3) Define and implement event handler method</b>
METHOD HANDLE_CHECKBOX_CHANGE.
" this method handles the checkbox_change event of the tree
" control instance
" show the key of the node and the name of the item
" of the clicked checkbox in a dynpro field
G_EVENT = 'CHECKBOX_CHANGE'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
CLEAR G_HEADER_NAME.
ENDMETHOD.
Regards
Uwe -
Handle single click event in ALV OOPS
Hi,
I have to display 2 ALV grid...one above the other.
Top ALV will contain Header info and bottom ALV witll display line item.
I am use ALV OOPS.
Now when user will click on the top ALV ...bottom ALV should show corresponding data.
I don't have to use HOTSPOT or Double click event.
How can I handle single click event.
Please guide me..thanks in advance
Regards,
Prasoonhi,
for this in ALV OOPS take <b>2 custom containers( cl_gui_custom_container)</b>in the same screen and on the 1st container display the header data<b>(use set_tale_for_first_display method of class cl_gui_alv_grid)</b>.
On the 2nd screen item data for this use<b> EVENT</b> handling(you want <b>single click</b>). use<b> hotspot_click</b> or <b>button_click </b>events.
for this you have to register the events. the code for that.
<b>CLASS lcl_event_handler DEFINITION .</b>
PUBLIC SECTION .
METHODS:
*--Hotspot click control
handle_hotspot_click
FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING e_row_id e_column_id es_row_no ,
*--To control button clicks
handle_button_click
FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING e_oject e_ucomm .
PRIVATE SECTION.
ENDCLASS.
<b>CLASS lcl_event_handlerIMPLEMENTATION .</b>
*--Handle Hotspot Click
METHOD handle_hotspot_click .
PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
ENDMETHOD .
METHOD handle_button_click .
PERFORM handle_button_click USING e_object e_ucomm .
ENDMETHOD .
ENDCLASS .
DATA gr_event_handler TYPE REF TO lcl_event_handler .
<b>*--Creating an instance for the event handler</b>
CREATE OBJECT gr_event_handler.
<b>*--Registering handler methods to handle ALV Grid events</b>
SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .
SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .
do n't forget to use<b> refresh_table_display
</b> other wise only the record which you first you clicked will display in the 2nd container.
<b>Reward points for useful Answers</b> -
ABAP WebDynpro: Handling the ON_ENTER Event in editable ALVs
Sub: ABAP WebDynpro : Handling the ON_ENTER Event in editable ALVs
Hi,
I would like to know if there exists an event to handle TABout (i.e, when user navigates out of the cell with a TAB key-press) for a cell of an editable ALV.
Alternatively, any help on how to handle ON_ENTER event and how it is triggered when data is entered by user into a cell of an editable ALV, would be really appreciated.
Thanks,
AdithyaHi
I had one similar problem where user enter something into the editable cell and press enter. to handle this scenario i used WDDOBEFOREACTION method of my view to call alv interface method check_data.
if there is any change in the any table cell, it will fire an event on_data_check..which has paramater column name, row index and new and old value of the cell.
you can handle this event and write your business logic in event handler method.
hope it will help
Regards
Saurabh Garg -
No handler for system event CustomHourlyEvent has been registered
I have written a scheduled event to trigger on daily basis using CustomDaily event mentioned in the ScheduledEvent component. I have referred HowToComponents in order to write this filter. But I am getting following error in my logs and my scheduled event is not getting executed.
<!-- IDCLOG: Error: (8/23/12 12:01 PM) !csScheduledEventUnhandled,CustomHourlyEvent!$stack trace -->
<tr><td>Error</td><td>8/23/12 12:01 PM</td><td>No handler for system event CustomHourlyEvent has been registered. stack trace [ <a href="javascript:if(typeof show!='undefined')show('0.31115227955456604')">Details</a> ]
<div id="0.31115227955456604" style="display:none;" class="details"><pre><code>An error has occurred. The stack trace below shows more information.
!csScheduledEventUnhandled,CustomHourlyEvent!$stack trace
!$stack trace
at intradoc.common.IdcLogWriter.doMessageAppend(IdcLogWriter.java:85)
at intradoc.common.Log.addMessage(Log.java:279)
at intradoc.common.DefaultReportHandler.message(DefaultReportHandler.java:508)
at intradoc.common.DefaultReportDelegator.message(DefaultReportDelegator.java:140)
at intradoc.common.Report.messageInternal(Report.java:172)
at intradoc.common.Report.message(Report.java:145)
at intradoc.common.Report.error(Report.java:408)
at intradoc.server.ScheduledSystemEvents.processWork(ScheduledSystemEvents.java:600)
at intradoc.server.ScheduledSystemEvents.run(ScheduledSystemEvents.java:489)
at java.lang.Thread.run(Thread.java:619)
</code></pre></div></td></tr>
Please let me know if anybody has countered the same problem while writing ScheduledEvent filter.I was able to solve this issue by updating the state of the event. HowToComponents - ScheduledEvent has the following method:
* Update the state of the event. Must be done at least once to tell the content server
* when the scehduled event is finished.
protected void update(String action, String msg, Workspace workspace) throws ServiceException, DataException
long curTime = System.currentTimeMillis();
ScheduledSystemEvents sse = IdcSystemLoader.getOrCreateScheduledSystemEvents(workspace);
sse.updateEventState(action, msg, curTime);
Making a call to update() when my scheduled event ran solved the issue for me. -
How to handle double click event in a text control
Hi,
Will u please send me information on handling double click events inside text control and also about locking and unlocking of DB tables for updation.
Regards,
Praba.Hi Prabhavathi,
Here is how you handle double click events in Textedit control.
1)Create a custom control in screen (say TEXT_CONTROL)
2)In main program,
a) Declarations:
data: obj type ref to cl_gui_custiom_control.
text type ref to cl_gui_textedit.
b) Create the instance of custom container
c) Create the instance of textedit control.
3)Now to handle double click events , create a local class as follows.
class shail_event definition.
public section.
methods:
handle_doubleclick for event dblclick of cl_gui_textedit .
endclass.
class shail_event implementation.
method handle_doubleclick .
here do the coding for handling the double click.
endmethod.
endclass.
4) Create an instance of the handler class(ie.ZSHAIL_EVENT).Let it be named hand.
5) Define varibles for event.
DATA: i_events TYPE cntl_simple_events,
wa_events TYPE cntl_simple_event.
SET HANDLER hand->handle_doubleclick for text.
wa_events-eventid = cl_gui_textedit=>event_double_click.
wa_events-appl_event = 'X'. "This is an application event
APPEND wa_events TO i_events.
6)
CALL METHOD texte->set_registered_events
EXPORTING
events = i_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3
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.
These are the basic steps needed for handling events in Textedit control.You can go to SE24 and type CL_GUI_TEXTEDIT to find the associated events of the class.
If you want the program, kindly send your mail-id so that I can mail it to you.
Regards,
Sylendra. -
Hello gurus,
I created a workbench with an edittable ALV for its data. This ALV has several tabs, lets say 5 tabs with individual event handler declaration. Tabs 1, 2 & 3 shares the same event/class and method declaration. 4&5 shares also the same but different to 1,2, & 3.
I have events handle data change and button click (for a column of buttons that pops up a screen when pressed), which are both standard toolbar. Then I also have event toolbar for my custom icon and event user command to handle these icons.
I run my ALV, tabs 1,2 & 3 have their data first. Then I just copy these data going to tab4.
On tab 4, whenever I click on the standard toolbar 'add row' (+ icon), it adds new row and triggers event handle data change.
Now my problem is, whenever I click on any other icon that triggers alv event, instead of going to their respective event, it always go to the handle data change event. (i.e. when I click on my custom toolbar icon, instead of going to event user command, it triggers the handle data change. Same with when I click on any buttons under the button columns, it triggers handle data change.)
Tab 1,2 & 3 works fine. But 4 & 5 are not. They have the same process and coded with the same logic. The only difference I see is that 4 & 5 has handle data change event while 1,2 & 3 have not.
Please help me analysing what's really causing the issue and what solution to apply to handle this.
Thanks,
Sheerayou need to set the subtotal option only to the dummy field. see the below code related.
"no need of subtot option here..
ls_sort-spos = 1.
ls_sort-fieldname = 'EBELN'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
APPEND ls_sort TO it_sort.
CLEAR ls_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'D'.
ls_sort-tabname = 'ITAB'.
ls_sort-up = 'X'.
ls_sort-group = 'UL'.
ls_sort-subtot = 'X'. "Only specify here
APPEND ls_sort TO it_sort. -
HOWTO: Handle a click event on a DAC TreeControl
HOWTO: Handle a click event on a DAC TreeControl
Goal: Handle the event that occurs when a user clicks on a new node of a DAC TreeControl. In this example the handler is simple - it just prints out the current node. You can try this example on the DACTree.jpr project in the 3.2 tutorial, described in the online help under
Tutorials and Sample Applications
-> Tutorials
-> Building Enterprise Applications with Business Components for Java
-> Enhancing the Online Orders Application
-> Creating a DAC Client
The problem: The usual procedure for adding an event to a DAC component does not work: if you select your TreeControl in the designer, then select the Events tab of the property inspector, none of the events listed does what we want.
Solution: Get the underlying JTree and add your listener to it. Although the TreeControl is not a subclass of javax.swing.JTree, it does have an underlying JTree which you can get by calling TreeControl.getTree().
Add the following code to your frame's .java file (Hint: Add any event, from the Events tab of the property inspector, then use the generated code as your template, changing it to match this example):
1. Declare a JTree:
JTree tree = new JTree();2. In jbInit(), add the event listener after the code that sets up your TreeControl:
tree = treeControl1.getTree();
tree.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
tree_valueChanged(e);
});3. Add the event handler method:
void tree_valueChanged(javax.swing.event.TreeSelectionEvent e) {
System.out.println("Current node: " + tree.getLastSelectedPathComponent());
}could you add a mouselistener to the pane or whatever container the pie chart is drawn on? Then override the mouseClicked method to do whatever you want?
Message was edited by:
petes1234 -
I need tips about queued message handler
Hello, I have to use, for the first time a queued message handler. I'd like to know what is the best way to share data between cases in a loop and from a loop to another, I think with local variables isn't the best way...
However all the tips on the queued message handler are welcome!!!
Thankssmilegv wrote:
I'd like to know what is the best way to share data between cases in a loop
Shift registers. Doesn't matter if QMH, State Machine, Producer-Consumer, etc.
smilegv wrote:
I'd like to know what is the best way to share data ...from a loop to another
Well, now that completely depends on what you are passing around. Streaming data? Use a Queue or User Event. Last known value (ie Tag)? Global Variables, Action Engine.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
How best to decouple the UI in the LV 2012 Queued Message Handler Template?
If you create a new "Queued Message Handler" from the new LV 2012 Template, you'll see a blue box in the "Update Display" case which says the following:
Code Recommended - If you wish to decouple the Message Handling Loop from your user interface, consider creating User Events (like the "Stop" event in this VI) to message the Event Handling Loop whenever the user interface needs updating.
I'd like to give this suggestion a shot but I'm struggling to find the best way to do this and still keep the code modular. The template creates a "User Event - Stop.lvlib" with Create/Destroy/Fire SubVI's. I would like to create a similar "User Event - Update UI.lvlib" library with similar Create/Destroy/Fire SubVI's to keep this new user event separate and modular. The problem I'm hitting is that there can only be one Dynamic Event Terminal in the Event Structure so how do I modularlize creating user events into separate SubVIs and still maintain this one Dynamic Event Terminal?
As a follow on question, would it be best to have one user event library per indicator that needs updating or just one single UI update user event and then pass a cluster as the message which contains the name of the control to update (to be used with a case structure) and then the data to go along with it?
Thanks!
Solved!
Go to Solution.
Attachments:
CLD.png 10 KBInstead of having the Register Events in the "Create Methods" you could do that part outside your "create" SubVIs and then simply bundle them. Then you create your individual User Event handling. See snippet where i created a "Create User Event - Update" vi in front of the Stop.
“A child of five could understand this. Send someone to fetch a child of five.”
― Groucho Marx -
Hi.
I'd like to handle tab leave event before user selected tab shown.
because I'm making Settings dialog.
So I want to validate tab contents when user leaving the tab.
And stay the tab if invalid user input.
Thanks.With apologies for the slow reply, I'm currently travelling.
Two things to note:
1) The af:document uncommittedDataWarning flag was designed to stop users navigating away from half entered records. More about this flag can be found here:
http://docs.oracle.com/cd/E23943_01/web.1111/b31973/af_orgpage.htm#CACDDDFH (see point 4)
http://www.oracle.com/technetwork/developer-tools/adf/unsaveddatawarning-096556.html
....please note our documentation from time to time spells this flag wrong with only one "t" in the word committed, so if you're attempting a bulk search check for this (and I'll raise document bugs to get this fixed in the future).
2) On addressing the ADF UI Shell, if you're switching between "pages" in the UI Shell, as separate to switching between dynamic tabs within a single page using the UI Shell, the UI Shell will actually restart the currently running task flow in the page you're returning too. You can verify this by implementing an initializer on your task flow with a log message, and watching when the initializer is called.
In addressing your last question, at this stage I think you need to assess my first answer then come back if you think you sill need to execute the code on the tab click. I also need to know are you talking about the primary level of tabs that represent each page in the UI Shell, or are you referring to the dynamic tabs within a single UI Shell page that hold your task flows?
CM. -
How to handle form close event or escape key press event for user defined f
Experts,
Please let me know how to handle form close event or escape key press event for user defined form...
Thanks & Regards,
Pravin.Hi
You can catch the form close event like this
If ((pVal.FormType = 139 And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE)) And (pVal.Before_Action = True)) Then
Try
SBO_Application.SetStatusBarMessage(pVal.EventType.ToString())
Catch ex As Exception
SBO_Application.SetStatusBarMessage(ex.Message)
End Try
End If
Hope this helps
Regards
Arun -
Active chat Message Handler is received twice, anybody know why?
Hi Guys,
Please can anyone help me with the below issue:
Active Chat Message Handler in Applescript for Messages app runs twice, looks like it receives the message twice, has anyone else seen this issue?
below is my code:
global myBuddysName
global textmsg
on readFile(unixPath)
set foo to (open for access (POSIX file unixPath))
set txt to paragraphs of (read foo for (get eof foo))
close access foo
return txt
end readFile
on msgImage(unixPath)
tell application "Finder"
set randomFile to (some file of folder unixPath)
set the clipboard to (randomFile as «class furl»)
end tell
tell application "System Events"
keystroke "v" using command down
key code 36 -- This is a 'return' which sends the message automatically.
end tell
end msgImage
using terms from application "Messages"
on message received theMessage from theBuddy for theChat
set myBuddysName to 1st item of readFile("Users/username/Desktop/AutomatedTextReply/BuddyName.txt")
set textmsg to some item of readFile("Users/username/Desktop/AutomatedTextReply/Texts.txt")
if name of theBuddy is myBuddysName then
if theMessage contains "text" then
send textmsg to theBuddy
end if
if theMessage contains "image" or theMessage contains "img" then
msgImage("Macintosh HD:Users:username:Desktop:AutomatedTextReply:Images")
delay (5)
end if
if theMessage contains "video" then
msgImage("Macintosh HD:Users:usernameDesktop:AutomatedTextReply:Videos")
end if
end if
end message received
on message sent theMessage with eventDescription
end message sent
on chat room message received with eventDescription
end chat room message received
on active chat message received theMessage from theBuddy
set myBuddysName to 1st item of readFile("Users/username/Desktop/AutomatedTextReply/BuddyName.txt")
set textmsg to some item of readFile("Users/username/Desktop/AutomatedTextReply/Texts.txt")
if name of theBuddy is myBuddysName then
if theMessage contains "text" then
send textmsg to theBuddy
end if
if theMessage contains "image" or theMessage contains "img" then
msgImage("Macintosh HD:Users:username:Desktop:AutomatedTextReply:Images")
delay (5)
end if
if theMessage contains "video" then
msgImage("Macintosh HD:Users:username:Desktop:AutomatedTextReply:Videos")
end if
end if
end active chat message received
on addressed message received theMessage from theBuddy for theChat with eventDescription
end addressed message received
on received text invitation with eventDescription
end received text invitation
on received audio invitation theText from theBuddy for theChat with eventDescription
end received audio invitation
on received video invitation theText from theBuddy for theChat with eventDescription
end received video invitation
on received local screen sharing invitation from theBuddy for theChat with eventDescription
end received local screen sharing invitation
on buddy authorization requested with eventDescription
end buddy authorization requested
on addressed chat room message received with eventDescription
end addressed chat room message received
on received remote screen sharing invitation with eventDescription
end received remote screen sharing invitation
on login finished with eventDescription
end login finished
on logout finished with eventDescription
end logout finished
on buddy became available with eventDescription
end buddy became available
on buddy became unavailable with eventDescription
end buddy became unavailable
on received file transfer invitation theFileTransfer with eventDescription
end received file transfer invitation
on av chat started with eventDescription
end av chat started
on av chat ended with eventDescription
end av chat ended
on completed file transfer with eventDescription
end completed file transfer
end using terms fromSunil, I tried and no luck. I restarted weblogic server and here is the console output showing the parameter :
C:\Oracle11\MIDDLE~1\JDK160~1\bin\java -client -Xms256m -Xmx512m -XX:CompileThreshold=8000 -XX:PermSize=48m -XX:MaxPe
rmSize=128m -Dweblogic.Name=AdminServer -Djava.security.policy=C:\Oracle11\MIDDLE~1\WLSERV~1.3\server\lib\weblogic.polic
y -Xverify:none -da -Dplatform.home=C:\Oracle11\MIDDLE~1\WLSERV~1.3 -Dwls.home=C:\Oracle11\MIDDLE~1\WLSERV~1.3\server
-Dweblogic.home=C:\Oracle11\MIDDLE~1\WLSERV~1.3\server -Dweblogic.wsee.workarea.skipWorkAreaHeader=true -Dweblogic.mana
gement.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=C:\Oracle11\M
But as usual, the message is not caught by the handler.
thanks
Jyothi -
hi , all
How can i get the handle for "Enter" event?
Thank you!Well, do you mean to trigger some checking values in an Editable ALV? If so, you need to tell the ALV specifically that ENTER is an event which triggers the checking of changed data.
You can do this code after the SET_TABLE_FOR_FIRST_DISPLAY.
* Register "ENTER" as an edit event
call method alv_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
* handler for ALV grid
set handler lcl_event_receiver=>on_data_changed for all instances.
Regards,
RIch Heilman
Maybe you are looking for
-
I want to clean my mac. what is best mac keeper or mac booster or is there any recommended by Apple?
-
How do I crop when I want to straighten lines of buildings so to overcome the appearance of converging point? I am trying to figure a way to grab a cropping handle and drag the image to make an unequal crop to overcome the lack of parallel from the
-
I have NW2004S trial version installed without any problems. But when dragging a webservice into an iView I have the message ´failed to fetch metadata´. and Portal request failed due to: .... I have created DynamicWSProxies in visual admin according
-
How to view Goods Receipts that have been paid
Hi Experts, We use SAP Business ONE 2007A PL08. I am wondering what is the procedure to view the goods receipts for which payments have been made. When I go Puchasing AP-->Goods Receipt PO, I put an asterix in the number and I am not sure what to sel
-
How to allow only specific letters, numbers and symbols in input string
Hi all i'm new to java and trying to program a polynom calculator. so, you can enter a polynom string like for example "2.1x^3 + 3x^2 - 1". this all works fine. but i only need numbers, some special symbols and only the letter x which will be the var