Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV get_frontend_fieldcatalog and set_frontend_fieldcatalog not working

tharaka_fernando
Contributor
0 Kudos

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

1 ACCEPTED SOLUTION

jarryq
Explorer
0 Kudos

Hi,

> t_filedcat modifies accordingly. But Edit mode doesn't work. need your advice.

You mean the field catalog of your report is not updated? You should use REFRESH_TABLE_DISPLAY of CL_GUI_ALV_GRID to refresh the list.

Hope this helps.

3 REPLIES 3

jarryq
Explorer
0 Kudos

Hi,

> t_filedcat modifies accordingly. But Edit mode doesn't work. need your advice.

You mean the field catalog of your report is not updated? You should use REFRESH_TABLE_DISPLAY of CL_GUI_ALV_GRID to refresh the list.

Hope this helps.

0 Kudos

Hi,

Thank you for the response.

Fieldcatalog modifies the change in the loop (as per code).

wa_filedcat-edit = 'X' .

MODIFY t_filedcat FROM wa_filedcat .

METHOD obj_alv_grid->set_frontend_fieldcatalog produses the requirement I want. (ex : when user clicks "Back" button the "POSID" field column should be editable )

But This is not happening in the screen 9001. (as per code)

I have used "refresh_table_display" after the "set_table_for_first_display".

any clue...

Thanks

Edited by: jam123 on May 24, 2011 12:07 PM

Edited by: jam123 on May 24, 2011 12:08 PM

Former Member
0 Kudos

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.