Skip to Content
0
Former Member
Dec 08, 2010 at 09:21 PM

OO ALV buffer problem

1735 Views

Hello all,

When a workflow work item is executed, a function module is called that displays a screen. The workitem calls a function module that displays an ALV on a screen. The same ALV is displayed for 3 different workitems.

I am changing the field catalog based on certain criteria to set an individual field to be editable/non-editable. I can see that the edit field in the field catalog contains the appropriate value, but the grid does not reflect what is in the field catalog.

The first workitem displays the ALV correctly.

The second and third workitems display the ALV using fieldcat values from the first workitem. The fieldcat contains the correct values when the grid is displayed using method "set_table_for_first_display".

If I log off of SAP and log back on, the second workitem ALV displays with the correct value. But the third workitem now display with the fieldcat values from the second workitem.

If I log off of SAP and log back on, the third workitem ALV displays with the correct value.

Any thought on what I need to do to correct this problem?

This is the logic that creates and displays the ALV in the PBO of the screen of the function module.

clear: il_fieldcat, l_layout.
  refresh: il_fieldcat.
  free: il_fieldcat.
*
  submit balvbufdel and return.                         " clear ALV buffer
  submit bcalv_buffer_del_shared and return. " clear ALV buffer
*

*            Create an instance for the event handler
  create object gr_event_handler .
*
*          Create an instance of the container displayed on screen 1400
  create object w_custom_container_1400
         exporting container_name = w_container_1400.
*
*            Create an instance of the grid displayed in the container
  create object w_grid_1400
         exporting i_parent = w_custom_container_1400.

* Build fieldcat - edit enabled.
  perform build_fieldcat_1400 changing il_fieldcat.
*         >>  call method w_alv->set_frontend_fieldcatalog  after modifying the field ctalog <<
*
  call method w_grid_1400->set_frontend_fieldcatalog
   exporting
      it_fieldcatalog  =   il_fieldcat.
*
* Disable generic ALV toolbar functions
  perform exclude_tb_functions_1400 changing lt_exclude.
*
*  Set layout options:
  l_layout-grid_title = 'ZFXXU003'.
  l_layout-zebra      = 'X'.
  l_layout-edit_mode  = 'X'.   
*
  set handler gr_event_handler->handle_user_command for w_grid_1400 .
  set handler gr_event_handler->handle_toolbar      for w_grid_1400 .
  set handler gr_event_handler->handle_menu_button  for w_grid_1400 .
  set handler gr_event_handler->handle_data_changed for w_grid_1400 .
*
  data: w_is_variant type disvariant.
*
  w_is_variant-report = sy-cprog.
  w_is_variant-variant = '/DEFAULT'.
*
  call method w_grid_1400->set_table_for_first_display
    exporting
      i_buffer_active      = 'X'
      i_bypassing_buffer   = 'X'
      is_layout            = l_layout
      it_toolbar_excluding = lt_exclude
      i_save               = 'A'       " enable save option
      is_variant           = w_is_variant
    changing
      it_fieldcatalog      = il_fieldcat
      it_outtab            = il_outtab.
*
* set editable cells to ready for input
  call method w_grid_1400->set_ready_for_input
    exporting
      i_ready_for_input = 1.
*
* Register ENTER to raise event DATA_CHANGED.
*
  call method w_grid_1400->register_edit_event
    exporting
      i_event_id = cl_gui_alv_grid=>mc_evt_enter.

  create object w_event_receiver_1400.
  set handler w_event_receiver_1400->handle_data_changed
              for w_grid_1400.

Edited by: Bruce Tjosvold on Dec 8, 2010 4:21 PM

Edited by: Bruce Tjosvold on Dec 8, 2010 4:24 PM

Edited by: Bruce Tjosvold on Dec 8, 2010 5:04 PM