ALV: data_changed event
Hi everyone!
I have the following problem:
I created a DYNPRO with one ALV grid and several "ordinary" fields. The ALV is editable.
Now I try to sum up some fields of the ALV grid and put the sum into one of the ordinary DYNPRO fields. When the <i>data_changed</i> event is fired the sum is calculated correctly and put into the global field associated with the DYNPRO field. However, the value change is not shown on the DYNPRO.
When I press <i>ENTER</i> while the cursor is in the "ordinary" DYNPRO area and not in the ALV Grid, the data change is shown correctly. Debugging shows that no PBO/PAI for the DYNPRO is executed when the data in the ALV is changed, so I assume there is no value transport between the global field and the DYNPRO.
What am I doing wrong?
Regards, Joerg
Hi Joerg,
Here is the other way how to achieve the processing of PAI/PBO of the main DYNPRO, which contains ALV. It works fine for me, so you could consider this possibility as well. Inside the event handling method you could do this call:
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = 'ENTE'
IMPORTING
rc = l_rc.
You should deal rather carefully with it - put it better in a method like
HANDLE_DATA_CHANGED_FINISHED
Instead of 'ENTE' you should use the command code defined in your dynpro and better suited for such a "refresh" functionality, but I'm afraid it can not be empty code string.
Hope this helps, regards, Sergei
Similar Messages
-
DATA_CHANGED event handler is not triggered after input.(OO ALV)
Dear Experts,
What I did:
I register Enter as the trigger event for data_changed event, and I put my checking logic in data_changed_handler which is a method of a local class. When the checking fails, I put messages using er_data_changed->add_protocal_entry to show messages.
My checking is simple, if the cell is empty, error messages pops up tells that this cell can not be blank for this row.
My problem:
When there is no entry in the alv list(Only this situation), I insert a new entry, the cell which is required is empty, I press Enter, data_changed event is triggered, the message pops up saying that the cell is required. Then close the pop up message window, I input something in the cell, and press enter. The data_changed event is not triggered.
Is there any1 has any ideas on this problem?
Vicnent
Edited by: Changjiu Tan on Sep 7, 2009 1:33 PMMETHOD HANDLE_DATA_CHANGED. "#EC NEEDED
*<<< BEGIN MODIFY EXAMPLE CODE
* u4FDDu5B58u30C7u30FCu30BFu3092u7DE8u96C6u3059u308Bu3000START
DATA: LW_INS TYPE LVC_S_MOCE,
LV_FNAME TYPE LVC_FNAME,
LW_MOD TYPE LVC_S_MODI,
LV_MAX TYPE I,
LV_RES(12) TYPE C,
LW_LIST TYPE ZTSRE012,
LV_ROWID TYPE LVC_S_ROID,
LT_MOD TYPE LVC_T_MODI,
LV_COLID TYPE LVC_S_COL,
LV_ROW_ID TYPE LVC_S_ROW,
LV_COL_ID TYPE LVC_S_COL.
* u73FEu5728u306Eu30D5u30A9u30FCu30ABu30B9u4F4Du7F6Eu3092u53D6u5F97
CALL METHOD GO_ALV_GRID7->GET_CURRENT_CELL
IMPORTING
ES_ROW_ID = LV_ROW_ID
ES_COL_ID = LV_COL_ID.
LOOP AT GT_LIST INTO LW_LIST.
IF LW_LIST-ID > LV_MAX.
LV_MAX = LW_LIST-ID.
ENDIF.
ENDLOOP.
* u30B0u30EBu30FCu30D7ID
LV_FNAME = CNS_ID.
LOOP AT ER_DATA_CHANGED->MT_INSERTED_ROWS INTO LW_INS.
LV_MAX = LV_MAX + 1.
CALL METHOD ER_DATA_CHANGED->MODIFY_CELL
EXPORTING
I_ROW_ID = LW_INS-ROW_ID
I_FIELDNAME = LV_FNAME
I_VALUE = LV_MAX.
ENDLOOP.
CLEAR: LV_FNAME.
LT_MOD[] = ER_DATA_CHANGED->MT_GOOD_CELLS[].
* u30C7u30FCu30BFu30C1u30A7u30C3u30AF
LOOP AT LT_MOD INTO LW_MOD.
IF LW_MOD-FIELDNAME = CNS_ZZTTSN.
LV_COLID-FIELDNAME = LW_MOD-FIELDNAME.
LV_ROWID-ROW_ID = LW_MOD-ROW_ID.
CALL METHOD GO_ALV_GRID7->SET_CURRENT_CELL_VIA_ID
EXPORTING
IS_COLUMN_ID = LV_COLID
IS_ROW_NO = LV_ROWID.
CALL METHOD GO_ALV_GRID7->GET_CURRENT_CELL
IMPORTING
E_VALUE = LV_RES.
IF LV_RES IS INITIAL.
CALL METHOD ER_DATA_CHANGED->ADD_PROTOCOL_ENTRY
EXPORTING
I_MSGID = CNS_MSGID
I_MSGTY = CNS_MSGTY
I_MSGNO = CNS_MSGNO
I_FIELDNAME = LW_MOD-FIELDNAME
I_ROW_ID = LW_MOD-ROW_ID.
ENDIF.
CALL METHOD ER_DATA_CHANGED->MODIFY_CELL
EXPORTING
I_ROW_ID = LW_MOD-ROW_ID
I_FIELDNAME = LW_MOD-FIELDNAME
I_VALUE = LV_RES.
ENDIF.
CLEAR: LV_RES,
LV_COLID,
LV_ROWID.
ENDLOOP.
CALL METHOD GO_ALV_GRID7->SET_CURRENT_CELL_VIA_ID
EXPORTING
IS_ROW_ID = LV_ROW_ID
IS_COLUMN_ID = LV_COL_ID.
ENDMETHOD. "handle_data_changed
Edited by: Changjiu Tan on Sep 7, 2009 1:31 PM
Edited by: Changjiu Tan on Sep 7, 2009 1:32 PM -
Problem handling data_changed event in OO ALV
I'm displaying my internal table with an OO ALV and I'm trying to handle the data_changed event in order to do some checking before actually modify my internal table.
this is the code of how I was planing to do that:
handle_data_changed
FOR EVENT data_changed OF cl_gui_alv_grid
IMPORTING er_data_changed
e_onf4
e_onf4_before
e_onf4_after
e_ucomm.
METHOD handle_data_changed.
* IF er_data_changed->mt_mod_cells-fieldname = 'COD_M'.
* do something
* else if er_data_changed->mt_mod_cells-fieldname = 'QUANTIDADE'.
* do something else
* endif.
* alv->refresh_table_display.
ENDMETHOD. "handle_data_changed
but it gives me this error:
"MT_MOD_CELLS" is a table without a header line and therefore has no component called "FIELDNAME".
My question is, how can access the cell that is being modified, and the new data?Dont know if this is the most clever way to do it but i solved it like this
DATA: wa_data_changed TYPE lvc_s_modi,
wa_tabi TYPE zsl_mat_c.
READ TABLE er_data_changed->mt_mod_cells INDEX 1
INTO wa_data_changed.
IF wa_data_changed-fieldname = 'COD_M'.
* do something
ELSEIF wa_data_changed-fieldname = 'QUANTIDADE'.
* do something else
ENDIF.
thanks for your help -
ALV Grid editable - How to raise the data_changed event from outside object
Hi,
i'd like to like to raise the data_changed event from outside the ALV-Grid object in order to display errors to the user.
For example a new row was inserted within the program. The user has only to complete the missing informations. Before saving the transactions the program has to execute some semantic checks. The errors of this check process should be shown to the user by creating an instance of the cl_alv_changed_data_portocol object.
Thanks.
RegardsYou don't need to raise the data_changed event to perform the edits or to issue messages using cl_alv_changed_data_protocol.
The following assumes you have an ALV grid object g_alv based on the CL_GUI_ALV_GRID class.
You can mark the inserted records upon insertion as selected using the set_selected_rows method, and then retrieve these rows later using get_selected_rows and perform necessary edits.
Save the row number of each inserted row into a table of the appropriate type (see the method definition for this):
DATA: t_index_rows TYPE lvc_t_row.
DATA: s_row_no TYPE lvc_s_roid.
DATA: t_row_no TYPE lvc_t_roid.
Load entries into t_row_no after each insert. Capture the row number and save in the table t_row_no.
e.g.
PERFORM insert_row USING s_row_no-row_id.
APPEND s_row_no TO t_row_no.
FORM insert_row would have whatever code you are using to insert the row. Save the row id into s_row_no-row_id (which is an INT4).
When done with all inserts do the following
IF t_row_no[] IS NOT INITIAL.
CALL METHOD g_alv->set_selected_rows
EXPORTING
it_index_rows = t_index_rows
it_row_no = t_row_no
is_keep_other_selections = 'X'.
ENDIF.
Then, if SAVE is pressed without the data_changed event having been raised (such as if the user just pressed SAVE without changing anything), use method get_selected_rows to retrieve the rows that were inserted and perform the necessary edits.
DATA: l_t_rows TYPE lvc_t_row. " ALV control: Table rows
CALL METHOD g_alv->get_selected_rows
IMPORTING
et_index_rows = l_t_rows.
Loop through l_t_rows and use the row as an index into the grid, perform the necessary edits, just as you would if the data_changed event had been raised.
If any edits fail, then send messages to the user, abort the save, and re-display the grid.
Remember to refresh the t_row_no and t_index_rows tables if you load a new data set.
You can also use a similar technique with the data_changed event to mark each changed row as selected by saving the row ids, and then you only have to update the changed rows on SAVE, which can minimize database I/O.
Good luck.
Brian -
ALV Grid: event for user return in ALV Grid Control
Hi developers,
i'm wanna do something after a user has pressed the return button in a alv grid control. For that i need probably a event. But i can not find a proper event in the documentation. Could one of you guys help me?
Best regards christianHi Christian
ALV grid is an encapsulated object, so it seems there is no way, you ought to implement the data_changed event. So if you want to make bulk data input and after trigger the event by pressing the return key, you should make the ALV Grid get your changes after pressing the key but not after a cell change of a modified cell.
To set this attribute:
CALL METHOD gr_alvgrid->register_edit_event
EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter .
This way "data_changed" event will be triggered whenever you press the return key while editing.
For some more information you can also refer to the tutorial <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an%20easy%20reference%20for%20alv%20grid%20control.pdf">"An Easy Reference for ALV Grid Control"</a>.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Hi everyone! I need to use event DATA_CHANGED on FM REUSE_ALV_HIERSEQ_LIST_DISPLAY. I used to do so on REUSE_ALV_GRID_DISPLAY passing parameter I_GRID_SETTINGS-EDT_CLL_CB = 'X', but this FM doesn't have it, so does anybody knows something like this but for hierarchical ALV??
I already added DATA_CHANGED event to the events table, but still wont activate.
thanx.
JesusHi,
The DATA_CHANGED_FINISH event is triggerd after a change is committed.This is in contrast to the event DATA_CHANGED where the method is triggered after the change at an editable field is perceived.
Your code should look like this:
data: hnd_grid type ref to lcl_event_receiver.
*:--- Initialization of the objects and events
set handler hnd_event_grid->mth_data_changed_end
for hnd_grid.
*:--- Class definition and Implementation
methods: mth_data_changed_end
for event data_changed of cl_gui_alv_grid
inporting e_modified.
method: mth_data_changed_end.
if e_modified = 'X'.
*:--- do something ...
call method <hnd_grid->refresh_table_display
endif.
endmethod.
one more ex:
CLASS LCL_EVENT_RECEIVER DEFINITION.
PUBLIC SECTION.
METHODS HANDLE_DATA_CHANGED
FOR EVENT DATA_CHANGED OF CL_GUI_ALV_GRID
IMPORTING ER_DATA_CHANGED E_ONF4 E_UCOMM.
ENDCLASS. "cl_event_receiver DEFINITION
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
METHOD HANDLE_DATA_CHANGED.
PERFORM DATA_CHANGED USING ER_DATA_CHANGED E_ONF4 E_UCOMM.
end method.
endclass.
Mark all helpful answers -
In ALV End_of_list Event Scrolling Option
Hi Experts,
In ALV END_OF_LIST Event if I want to display more records approx:50 .
iam able to display using Reuse_Alv_Commentary_Write But .Due to high volume of Records Its Overlaping Main List I need to drag Manually.
My Question : is There any option where Scrolling is Available for Reuse_Alv_Commentary.
Thank You.Please Reply.Hi,
Use do_sum = 'X', in the fieldcatalog for the fields for which you need to do the summation.
Best Regards,
Durga Naresh Bayireddy -
Hi All,
I have used the ALV onF4 event for F4 help for a field in an ALV display....But the problem is that this is not getting triggered on pressing F4.....
What might be the problem..
I have referred the program : BCALV_EDIT_08.
-SatyaPriyaHi ,
Please check whether you have created the class to handle events and also set the handlers for it.
Regards
Arun -
ALV Print event in Custom Button
Hi,
I have requirement to call ALV print event in Custom Button after some condition. Can anyone give me the solution or link to achieve this requirement.
Thank in advance.Hi Mani,
On that ALV button event, write the following code.
DATA lo_component TYPE REF TO if_wd_component.
DATA lo_appl TYPE REF TO if_wd_application.
lo_component = wd_comp_controller->wd_get_api( ).
lo_appl = lo_component->get_application( ).
lo_appl->print_page( ).
DATA lo_app_info TYPE REF TO if_wd_rr_application .
lo_app_info = lo_appl->get_application_info( ).
DATA lv_app_name TYPE string .
lv_app_name = lo_app_info->get_name( ).
It helps you to print the table contents. Hope this helps you.
Thanks
KH -
Wrong messagetype while processing in an alv grid event
Hello,
a brief discription of my problem:
I am processing a standard SAP form "PERIODE_PRUEFEN" which calls the function "READ_CUSTOMIZED_MESSAGE". The routine is called inside an event-handler of the ALV Grid event 'user_command'. The messagetype is selected from a customising table 'T100C'. Despite the messagetype 'W' the program is always aborted with an 'E' message.
What I have tried so far:
1. I debugged the SAP standard transaction 'fb08' which runs exactly the same functions with the same values and it works.
2. I changed the messagetype in the debugger - no success
3. I searched the SAP notes, but theres nothing about my problem
I guess the problem is somewhere in the ALV Grid event, because this is the only difference between the SAP standard an my program. Maybe the message is processed wrong while beeing called within an event.
It would be great to get some useful hints to solve this problemHi,
The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent.
The behaviour of message type 'W' in a dialog is different from a report program.
Run demo program DEMO_MESSAGES, select Main Program, Type 'W' and execute. You will get an error message instead of warning message.
This behaviour is well documeneted in the on-line help for MESSAGE statement.
Regards,
Rao A -
ALV cell attributes CHANGE during DATA_CHANGED event
Hi,
I am working with CL_GUI_ALV_GRID in a splitter control. I am trying to make separate cells (non)editable depending on user input in the ALV. In event DATA_CHANGED (refefined) I change the cellstyle-table and then use method REFRESH_TABLE_DISPLAY.
My problem is: I can change contents of fields perfectly, but when I change a cell's editability, the cell is being showns as editable, but when I press F4 f.i. and look in debug, the cellstyles-table hasn't been updated and still reflects the old values.
Could anybody help me out?
Kind regards,
Roy
P.S. Obviously I will reward points to useful answers.Hi Nithya,
I am not making the field edit or no-edit using fieldcatalog-edit. This makes an emtire column editable. I only want to make individual cells editable.
I do this using a table that I have attached to the ALV's structure and linked using layout-stylefname. You gave me an idea though: I might have to use SET_SELECTED_CELLS or an equivalent.
Any other ideas that might be helpful?
Kind regards,
Roy -
Trigger DATA_CHANGED event from triggered DATA_CHANGED event in second ALV
Hello,
I do have 2 ALVs (class CL_GUI_ALV_GRID) in a Splitter-Control.
Both ALVs do have registered the event DATA_CHANGED in seperate handler methods.
If there is a change in first ALV(line insertion with values), there will be inserted a new line with values in the second ALV. After handling the event at first ALV, I call CHECK_CHANGED_DATA of the second ALV and REFRESH_TABLE_DISPLAY of the second ALV. I would expect that the call of CHECK_CHANGED_DATA would trigger the event DATA_CHANGED, but it does not trigger the event DATA_CHANGED of the second ALV.
The problem is maybe that the input at the data is not made by the user(UI).
What could I do to trigger this event and check the new data at second ALV?
Yours JoergHello ,
yeah thats correct , but in your case what you can do is
g_grid1(first alv) >CHECK_CHANGED_DATA( Importing E_VALID = l_Valid )>in the implementation method of this ..update global variable g_second = 'X' in order to refresh ALV2.
g_grid1(first alv) -->Refresh_table_display( ).
if g_second = 'X'.
g_grid2-->SET_TABLE_FOR_FIRST_DISPLAY. so it will refresh the second alv contents.
endif.
regards
Prabhu -
Hello Friends;
I have a problem with event handlers. I have defined events for double_click, data_change and hotspot_click. At first run of the program everything runs fine but when I make a change at the screen (like pressing Enter or entering a value at a screen field) the handlers seem to be called a couple of times. For example at a hotspot click I call an accounting document display and when I want to return with back button the program seems to be stuck at document display. Actually it calls event handler over and over again. How can I solve this problem? Can refreshing grid be a solution?
Thx in advance
AliHello Ali
The problem is that after handling the hotspot event the current cell is still on the field with the hotspot. Thus, when you push ENTER the ALV grid checks the current cell which has a hotspot defined which, in turn, raises event HOTSPOT_CLICK.
Therefore, you have to move the current cell to another cell that has no hotspot defined. Have a look at the implementation of the event handler method. The hotspot is on field KUNNR. After calling transaction XD03 I shift the current cell to field BUKRS.
If you comment these lines you will see the same behaviour of the report as you described.
*& Report ZUS_SDN_TWO_ALV_GRIDS
REPORT ZUS_SDN_ALVGRID_EVENTS.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '1000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id type lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID = e_row_id
IS_COLUMN_ID = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* 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 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.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
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.
* 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 OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE gt_fcat INTO ls_fcat
WITH KEY fieldname = 'KUNNR'.
IF ( syst-subrc = 0 ).
ls_fcat-hotspot = abap_true.
MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
ENDIF.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
Drop Down List in ALV with Event handler
Hi All ,
I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
Is this possible?
As an example, I have a table of records with one column as a dropdown called " Replace Function Module " and in 2nd column i have call function of that Replace Function Module , If a change in " Replace Function Module " should change the call function of in the 2nd column .
I am using these objects lvc_t_drop , lvc_s_drop and the method " set_drop_down_table ",
Please Can any 1 tel me how to do this with any event handler ar any other way !Hi,
You need to use event handler for this. Check if the below link gives some direction.
[http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
I have not tried it out, but its worth a try.
Hope this helps!
Regards,
Saumya -
ALV Tree event registration doesn't work
Hello Experts,
the following is the registration-form which shall register a item-double-click event to my alv-tree-object. when doing the double-click it doesn't open my own methods in the event-handler class but the standard ones and nothing happens further.
Any ideas?
Many thanks in advance!
Tobias
FORM register_events.
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
CALL METHOD g_alv_tree->get_registered_events
IMPORTING
events = lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
APPEND l_event TO lt_events.
CALL METHOD g_alv_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
CREATE OBJECT event_handler.
SET HANDLER event_handler->handle_item_double_click FOR g_alv_tree.
ENDFORM.It doesn't matter where I place my double-click. The standard event handling "handle_event" is called.
Instead of this I would like to have my coding.....
Changing the cl_gui_alv_tree to cl_gui_column_tree doesn't work since my tree isn't a reference of column_tree but of alv_tree. So I would have to rebuild nearly the entire tree. This cannot be a solution since I guess the double-click item should work anyway.
What I am wondering furthermore is my button declaration not being displayed. The following is my fieldcatalog declaration:
FORM create_tree_fc.
DATA: ls_fc TYPE lvc_s_fcat.
DATA: lo_descrref TYPE REF TO cl_abap_typedescr.
DATA: lo_tableref TYPE REF TO cl_abap_tabledescr.
DATA: lo_structref TYPE REF TO cl_abap_structdescr.
FIELD-SYMBOLS: <fs_str> TYPE abap_compdescr.
lo_tableref ?= cl_abap_tabledescr=>describe_by_data( lt_report_tree ).
lo_descrref ?= lo_tableref->get_table_line_type( ).
lo_structref ?= lo_descrref.
CLEAR gt_fc[].
LOOP AT lo_structref->components ASSIGNING <fs_str>.
CLEAR ls_fc.
ls_fc-fieldname = <fs_str>-name.
ls_fc-intlen = <fs_str>-length.
ls_fc-inttype = <fs_str>-type_kind.
ls_fc-decimals = <fs_str>-decimals.
CASE <fs_str>-name.
WHEN 'PROCESS_TYPE'.
ls_fc-tooltip = 'Process Type'.
ls_fc-coltext = 'Process Type'.
ls_fc-emphasize = 'C110'.
ls_fc-no_sum = 'X'.
ls_fc-style = cl_gui_column_tree=>item_class_button.
ls_fc-outputlen = 20.
WHEN 'SMI_PROJECT'.
ls_fc-tooltip = 'Project Relation'.
ls_fc-coltext = 'Project'.
ls_fc-hotspot = 'X'.
ls_fc-no_sum = 'X'.
ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
ls_fc-outputlen = <fs_str>-length.
WHEN 'TRORDER_NUMBER'.
ls_fc-tooltip = 'ID of Transport Request'.
ls_fc-coltext = 'Transport Request'.
ls_fc-no_sum = 'X'.
ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.
ls_fc-outputlen = 30.
ENDCASE.
APPEND ls_fc TO gt_fc.
ENDLOOP.
ENDFORM.
Edited by: Tobias Fickinger on Jun 10, 2009 9:59 AM
Edited by: Tobias Fickinger on Jun 10, 2009 10:00 AM
Edited by: Tobias Fickinger on Jun 10, 2009 10:03 AM
Maybe you are looking for
-
I have a small program for storing my genealogy names and jpg images of the census pages where each name is found. The images have a thumbnail link that opens in a new tab to view the actual oversized census page. In the new tab the census page is sm
-
:system.trigger_node_selected
How do I programmatically set the :SYSTEM.TRIGGER NODE SELECTED to true after a right mouse click on the node? I've tried the following: Ftree.Set_Tree_Selection(htree, :SYSTEM.RIGHT_MOUSE_TRIGGER_NODE, Ftree.SELECT_ON); This will highlight the node
-
Hi all, I'm trying to find out if there is still a limitation around using ERMS with Service Requests in CRM 7.0. I have read that ERMS was not possible to use with Service Requests originally in 7.0, but I'm wondering if this has been fixed with an
-
Cannot recover objet in session between project in jdev
i have two project in a different workspace, each project have many jsp pages. i would like to recover the user name ( introduced and saved in a session object by the first project (in a jsp file)) in a jsp file located in the second project. i resum
-
Installing Community server on JSK_Installer11.1.1.6.1
Hi, I have installed JSK 11.1.1.6.1 on my system. Now, I need to install my community server on the same.This JSK installs only management server and community server needs both management and production. So do I need to install production on this JS