ALV get_frontend_fieldcatalog and set_frontend_fieldcatalog not working
Hi all Gurus,
I have devoloped an ALV report (Using cl_gui_alv_grid & cl_gui_custom_container), after the grid is displayed using set_table_for_first_display method when user clicks "Back" button, I call below methods.
DATA : t_filedcat TYPE lvc_t_fcat, wa_filedcat TYPE lvc_s_fcat. CALL METHOD obj_alv_grid->get_frontend_fieldcatalog IMPORTING et_fieldcatalog = t_filedcat. LOOP AT t_filedcat INTO wa_filedcat . IF wa_filedcat-fieldname = 'POSID' . wa_filedcat-edit = 'X' . MODIFY t_filedcat FROM wa_filedcat . ENDIF . ENDLOOP . CALL METHOD obj_alv_grid->set_frontend_fieldcatalog EXPORTING it_fieldcatalog = t_filedcat. CALL SCREEN 9001. " same screen which ALV initially displayed
t_filedcat modifies accordingly. But Edit mode doesn't work. need your advice.
Thank you all in advance..
Sheelesh Kumar replied
Have you wrote the code in PAI of screen 9001?
write the below code in PAI of screen 9001 and no need to call screen 9001 again.
CALL METHOD us_alvgrid->get_frontend_fieldcatalog
et_fieldcatalog = is_fieldcat.
LOOP AT is_fieldcat INTO e_fieldcat .
IF e_fieldcat-fieldname = 'TEST'' .
e_fieldcat-edit = 'X' .
MODIFY is_fieldcat FROM e_fieldcat .
CALL METHOD us_alvgrid->set_frontend_fieldcatalog
it_fieldcatalog = is_fieldcat.
if us_alvgrid is not initial.
CALL METHOD us_alvgrid->refresh_table_display
finished = 1
OTHERS = 2.
call method set_table for first display after creating the object of ALV grid.
hope this will help.