07-23-2009 1:37 PM
Hi all,
I've been working on an implementation of an ALV grid in which the user has the ability to edit certain fields. I want to capture those changed values in my program. I've implemented a lcl_event_handler class and I've defined a method within the class to process the data_changed event. I've also defined and instantiated a handle to the class. I've also registered the mc_evt_enter event with the ALV grid. When I run the grid and change a value the data_changed event fires as you would expect. The trouble is an error message is returned which says "Field ty_pan-gsmng is not defined in the ABAP dictionary". I pass a reference to a custom type I defined within the program to the ALV grid...you guessed the name...ty_plan. One of the editable fields within the custome type is gsmng. I'm curious...do I have to pass a reference to a table or type defined within the ABAP dictionary or can I get this code to work with my custom type?
Thanks in advance...Mat.
07-23-2009 1:42 PM
HI,
If your are talking about the reference field and reference table in the fieldcatlog; then it has to be a specific field and table or structure within the data dictionary.
Regards,
Ankur Parab
07-23-2009 1:42 PM
HI,
If your are talking about the reference field and reference table in the fieldcatlog; then it has to be a specific field and table or structure within the data dictionary.
Regards,
Ankur Parab
07-23-2009 1:49 PM
Thanks for the assitance Ankur. I call method set_table_for_first_display and pass i_structure_name with a reference to the custom type ty_plan defined within my program. Seems odd that the type has to be defined within the ABAP dictionary. What if I just want to use a type I define within the program...there is no way to handle that?
Mat
07-23-2009 2:04 PM
07-23-2009 2:17 PM
As follows:
DATA: obj_handler TYPE REF TO lcl_event_handler.
CLASS lcl_event_handler IMPLEMENTATION.
METHOD handle_data_changed.
DATA: ls_good TYPE lvc_s_modi.
LOOP AT er_data_changed->mt_good_cells INTO ls_good.
CASE ls_good-fieldname.
Order Quantity
WHEN 'GSMNG'.
Order Start
WHEN 'PSTTR'.
Order Finish
WHEN 'PEDTR'.
All other fields
WHEN OTHERS.
ENDCASE.
ENDLOOP.
ENDMETHOD.
Call the method to display the data in ALV grid
CALL METHOD obj_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layo
i_structure_name = 'ty_plan'
is_variant = gs_variant
i_save = gv_save_variant
CHANGING
it_outtab = pt_plan
it_fieldcatalog = pt_fieldcat
it_sort = lt_sort
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
OTHERS = 3.
CALL METHOD obj_alv_grid->set_ready_for_input
EXPORTING
i_ready_for_input = 1.
CALL METHOD obj_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_enter.
CALL METHOD obj_alv_grid->register_edit_event
EXPORTING
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
CREATE OBJECT obj_handler.
SET HANDLER obj_handler->handle_data_changed FOR obj_alv_grid.
07-23-2009 2:44 PM
Hi,
Just try passing the structure name in capital 'TY_PLAN'
Regards,
Ankur Parab
07-23-2009 2:51 PM
Try to create the field catalog this way
call function 'LVC_FIELDCATALOG_MERGE'
exporting
i_structure_name = 'TY_PLAN'
i_client_never_display = 'X'
changing
ct_fieldcat = i_fieldcat[].
then
CALL METHOD obj_alv_grid->set_table_for_first_display
EXPORTING
is_layout = wa_layo
is_variant = gs_variant
i_save = gv_save_variant
CHANGING
it_outtab = pt_plan
it_fieldcatalog = pt_fieldcat
it_sort = lt_sort
a®
07-25-2009 11:03 AM
Ankur,
As per your recommendation I capitalized the reference to the type...this did not help. I had to define the type in the ABAP dictionary. Thanks.
12-01-2010 6:04 PM
Hello,
I'm late on this post, but I think I could have a clue.
In fact, if you don't want to have to declare your structure in the DDIC, you have to be sure in your field catalog that the field REF_TABLE is empty. Otherwise, a check is made against the DDIC, and this message appear.
Had the same issue, and I solved it this way.
Best regards.