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 Grid - Resource Issue?

IanStubbings
Active Participant
0 Likes
1,315

Morning All

I have a situation where I have a standard selection screen displaying an ALV grid. The user can then double click a line to see a drill down ALV. My error occurs if the user executes the program multiple times i.e. displaying the grid time and time again. Eventually the session does not display the grid and on a subsequent attempt the session either crashes or locks.

I am currently destroying the 2 containers used every time the user exits the relevant screens using call method gr_alvgrid-> free but to no avail.

Has anyone else had similar problems? I am on a 46B machine running on NT4 (yes I know I'm in the dark ages!)

Cheers

Ian

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,276

Hi,

Seee that whether u have used this restriction

MODULE   status_9001 OUTPUT.

<b>  IF o_dockingcontainer IS INITIAL.</b>
   SET PF-STATUS 'ZSTATUS'.
    SET TITLEBAR 'ZTITLE'.
*   Creating Object
    PERFORM f9000_objects_create.
    SET HANDLER o_eventreceiver->handle_double_click  FOR o_alvgrid.
*   Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat


*   Modifying the field catalog
    PERFORM f9002_modify_field_cat TABLES i_fieldcat.
*   For Layout
    PERFORM f9003_layout USING sy-title 'X' 'B' 'X' .
*   To display output
    PERFORM f9004_display_data TABLES i_output
                                      i_fieldcat.
  <b>ENDIF.</b>

ENDMODULE.                 " STATUS_9001  OUTPUT

Hope this helsp u.

Morning All

I have a situation where I have a standard selection screen displaying an ALV grid. The user can then double click a line to see a drill down ALV. My error occurs if the user executes the program multiple times i.e. displaying the grid time and time again. Eventually the session does not display the grid and on a subsequent attempt the session either crashes or locks.

I am currently destroying the 2 containers used every time the user exits the relevant screens using call method gr_alvgrid-> free but to no avail.

Has anyone else had similar problems? I am on a 46B machine running on NT4 (yes I know I'm in the dark ages!)

Cheers

Ian

11 REPLIES 11
Read only

Former Member
0 Likes
1,276

Hello,

Check the dump using st22. What does the dump analysis says.

Regards,

Shekhar Kulkarni

Read only

Former Member
0 Likes
1,277

Hi,

Seee that whether u have used this restriction

MODULE   status_9001 OUTPUT.

<b>  IF o_dockingcontainer IS INITIAL.</b>
   SET PF-STATUS 'ZSTATUS'.
    SET TITLEBAR 'ZTITLE'.
*   Creating Object
    PERFORM f9000_objects_create.
    SET HANDLER o_eventreceiver->handle_double_click  FOR o_alvgrid.
*   Building the field catalog
    PERFORM f9001_build_field_cat TABLES i_fieldcat


*   Modifying the field catalog
    PERFORM f9002_modify_field_cat TABLES i_fieldcat.
*   For Layout
    PERFORM f9003_layout USING sy-title 'X' 'B' 'X' .
*   To display output
    PERFORM f9004_display_data TABLES i_output
                                      i_fieldcat.
  <b>ENDIF.</b>

ENDMODULE.                 " STATUS_9001  OUTPUT

Hope this helsp u.

Read only

0 Likes
1,276

Hi Judith

Yes, I am using this sort of restriction:

IF gr_alvgrid IS INITIAL.

  • Creates an ALV instance and links it to the container instance

CREATE OBJECT gr_alvgrid

EXPORTING

i_parent = gr_alvcontainer.

  • Deterime the table columns

PERFORM prepare_field_catalog.

  • Determine any layout attibutes

PERFORM prepare_layout.

  • Provide the sort criteria

PERFORM prepare_sorting TABLES gt_sort.

  • Display the ALV grid

CALL METHOD gr_alvgrid->set_table_for_first_display

EXPORTING

is_layout = gs_layout1

CHANGING

it_outtab = gt_outtab1

it_fieldcatalog = gt_fieldcat1

it_sort = gt_sort

EXCEPTIONS

invalid_parameter_combination = 1

program_error = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CREATE OBJECT gr_event_receiver.

SET HANDLER gr_event_receiver->handle_top_of_list

FOR gr_alvgrid.

SET HANDLER gr_event_receiver->handle_double_click

FOR gr_alvgrid.

ENDIF.

Read only

0 Likes
1,276

Hi,

Have you did something like that before creating event receiver?

IF cl_gui_alv_grid=>offline( ) IS INITIAL.
* Create the event reciever
    IF o_eventreceiver IS INITIAL.
      CREATE OBJECT o_eventreceiver.
    ENDIF.
  ENDIF.

In PAI of the screen,just try this.

module USER_COMMAND_9001 input.
  CASE sy-ucomm.
    WHEN 'EXIT' or  'CANC'.

      perform f9600_free_objects:
               using o_Alvgrid 'ALV' text-E02,
               using o_Dockingcontainer 'DOCKING'
                       TEXT-E01.
* leave program.
      LEAVE PROGRAM.

    when 'BACK'.
      perform f9600_free_objects:
               using o_Alvgrid 'ALV' text-E02,
               using o_Dockingcontainer 'DOCKING'
                       TEXT-E01.
      set screen '0'.
      leave screen.
* This leaves the program but you may need to re-call the
* transaction to go back to the original screen

    when others.

  ENDCASE.

endmodule.                 " USER_COMMAND_9001  INPUT

FORM f9600_free_objects USING pobject
                    value(ptype)
                    value(ptext).

  DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.
* Need to type the field symbol or it does not work

  CASE ptype.
    WHEN 'ALV'.

      l_objectalv = pobject.

      IF NOT ( l_objectalv IS INITIAL ).
        CALL METHOD l_objectalv->free
          EXCEPTIONS
            cntl_error        = 1
           cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject, l_objectalv.
        PERFORM f9700_error_handle USING ptext.

      ENDIF.
    WHEN 'DOCKING'.
      DATA: lobjectdock TYPE REF TO cl_gui_docking_container.
      lobjectdock = pobject.

      IF NOT ( lobjectdock IS INITIAL ).
        CALL METHOD lobjectdock->free
          EXCEPTIONS
            cntl_error        = 1
           cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject, lobjectdock.
        PERFORM f9700_error_handle USING ptext.

      ENDIF.
    WHEN 'CONTAINER'.
      DATA: lobjectcontainer TYPE REF TO cl_gui_container.
      lobjectcontainer = pobject.

      IF NOT ( lobjectcontainer IS INITIAL ).
        CALL METHOD lobjectcontainer->free
          EXCEPTIONS
            cntl_error        = 1
           cntl_system_error = 2
            OTHERS            = 3.
        CLEAR: pobject, lobjectcontainer.
        PERFORM f9700_error_handle USING ptext.

      ENDIF.
    WHEN OTHERS.
      sy-subrc = 1.
      PERFORM f9700_error_handle USING
                                text-e04.
  ENDCASE.

ENDFORM.                    " f9600_free_objects


FORM f9700_error_handle USING    value(ptext).

  IF sy-subrc NE 0.
* add your handling, for example
    CALL FUNCTION 'POPUP_TO_INFORM'
         EXPORTING
              titel = text-e03
              txt2  = sy-subrc
              txt1  = ptext.
  ENDIF.


ENDFORM.                    " f9700_error_handle

Message was edited by: Jayanthi Jayaraman

Read only

0 Likes
1,276

Frederic/Jayanthi

Doesn't the fact that the container is destroyed have a cascading effect on the grid and event receivers?

Ian

Message was edited by: Ian Stubbings

Read only

0 Likes
1,276

Hi,

Try this way of destroying

MODULE user_command_0100 INPUT.
  DATA: i_return_code TYPE i .

  CALL METHOD cl_gui_cfw=>dispatch
      IMPORTING return_code = i_return_code.
  save_ok = ok_code.
  CASE save_ok.
    WHEN 'BACK' OR 'END' OR 'CANC'.
      PERFORM exit_program.
  ENDCASE.
  CLEAR save_ok.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

*&--------------------------------------------------------------------*
*&      Form  EXIT_PROGRAM
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM exit_program.

  CALL METHOD o_grid_container->free.
  CALL METHOD cl_gui_cfw=>flush.
  IF sy-subrc NE 0.
*     Error in FLush
  ENDIF.

  LEAVE TO SCREEN 0.
ENDFORM.                  " EXIT_PROGRAM

Check with this code.

Read only

0 Likes
1,276

Did anyone finally solve the problem?

We've got a very similar problem here processing the f4 event of the alv grid control.

Read only

0 Likes
1,276

Hi Markus,

try to provide ref_field, ref_table in the fieldcat to enable the F4 Help.

Regards

vijay

Read only

FredericGirod
Active Contributor
0 Likes
1,276

Hi Ian,

Could you cut/past your source code of the exit (destroy) ?

Read only

0 Likes
1,276

Hi guys

Thanks for the speedy responses.

My destroy code is below:

IF NOT gr_ccontainer IS INITIAL.

CALL METHOD gr_ccontainer->free.

FREE gr_ccontainer.

ENDIF.

IF NOT gr_ccontainer2 IS INITIAL.

CALL METHOD gr_ccontainer2->free.

FREE gr_ccontainer2.

ENDIF.

This is called at the exit of each screen and before initially creating the objects for display.

Ian

Read only

0 Likes
1,276

But, you don't destroy the grid ? the event receiver ?