Application Development and Automation 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: 
Read only

ALV {oop} column Hide at runtime

former_member194669
Active Contributor
0 Likes
878

Hi,

I have a ALV report using OOp. In the report application toolbar i have 2 buttons (PF-Status)

If user click on button1 one of the column to be hide from display. But if click button2 then that column to be unhide and display.

I have tried this use NO_OUT or TECH field in the fieldcatalog. but no use.

Any info how to do this.

aRs

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
555

The problem is that you can only set the fieldcat once for the SET_TABLE_FOR_FIRST_DISPLAY. If you want to modify it afterwards, I think you could use the combination of the GET_FRONTEND_FIELDCATALOG and SET_FRONTEND_FIELDCATALOG methods. So get the FC, read the specific line for the field and set the NO_OUT flag, modify the line and then pass this FC internal table to the SET_FRONTEND_FIELDCATALOG method.

REgards,

RIch Heilman

Hi,

I have a ALV report using OOp. In the report application toolbar i have 2 buttons (PF-Status)

If user click on button1 one of the column to be hide from display. But if click button2 then that column to be unhide and display.

I have tried this use NO_OUT or TECH field in the fieldcatalog. but no use.

Any info how to do this.

aRs

3 REPLIES 3
Read only

Former Member
0 Likes
555

Hi,

Try this..

In the PBO if the container is not initial then call the method REFRESH_TABLE_DISPLAY

  • creation of the ALV Grid Control

if g_custom_container is initial.

  • call the method grid->set_table_for_first_display

else.

  • call the method grid->refresh_table_display.

endif.

Thanks,

Naren

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
556

The problem is that you can only set the fieldcat once for the SET_TABLE_FOR_FIRST_DISPLAY. If you want to modify it afterwards, I think you could use the combination of the GET_FRONTEND_FIELDCATALOG and SET_FRONTEND_FIELDCATALOG methods. So get the FC, read the specific line for the field and set the NO_OUT flag, modify the line and then pass this FC internal table to the SET_FRONTEND_FIELDCATALOG method.

REgards,

RIch Heilman

Read only

former_member194669
Active Contributor
0 Likes
555

Thanks Rich,

Your solution worked.



In PAI we have to use 

  call method cl_gui_cfw=>set_new_ok_code
    exporting
      new_code = 'ENTR'.

In the PBO

  if g_custom_container is initial.
    perform f_create_and_init_alv.
  else.
    perform f_rebuild_fieldcat changing gt_fieldcat.
    call method g_grid->set_frontend_fieldcatalog
       exporting
         it_fieldcatalog = gt_fieldcat[].
  call method  g_grid->refresh_table_display.
  endif.

aRs