Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

....

case 'SY-UCOMM'

WHEN 'BACK'.

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..

Former Member 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.

case sy-ucomm.

when 'BACK'.*

CALL METHOD us_alvgrid->get_frontend_fieldcatalog

IMPORTING

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 .

ENDIF .

ENDLOOP .

CALL METHOD us_alvgrid->set_frontend_fieldcatalog

EXPORTING

it_fieldcatalog = is_fieldcat[].

if us_alvgrid is not initial.

CALL METHOD us_alvgrid->refresh_table_display

EXCEPTIONS

finished = 1

OTHERS = 2.

else.

call method set_table for first display after creating the object of ALV grid.

endif.

endcase

hope this will help.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question