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: 

Control Framework: Fatal error - GUI cannot be reached-ALV Grid in Bckgrnd

former_member125661
Contributor
0 Kudos

I have an ALV grid which dumps in the background. But works fine in the foreground.

I thought I am not using Control framework anywhere. But I get 'COntrol framework :Fatal error - GU cannot be reached' error.

I am using a docking container that I have split using a splitter.

I have no custom container in my screen. What else could be causing the Control framework error ? Any suggestions is appreciated. But please do not tell me to use 'REUSE_ALV*' or Classical reporting

Here are the PBO modules of my screen and here are my data declarations.


ALV Data declarations :

data :gt_sort type lvc_t_sort,
        gr_event_handler TYPE REF TO lcl_event_handler ,
     o_docking type ref to cl_gui_docking_container,"Docking Container
     o_grid type ref to cl_gui_alv_grid,"Grid
     o_split type ref to cl_gui_easy_splitter_container,"Splitter
     o_top_container type ref to cl_gui_container,   "Top Container
     o_bottom_container type ref to cl_gui_container,"Bottom Container
     o_document type ref to cl_dd_document.          "Document

module status_0100 output.

if o_docking is initial.

set pf-status 'ZSTATUS_0100'.

set titlebar 'ZTITLE_0100'.

  • Creating Objects

perform create_objects.

  • Filling top of page

perform fill_top_of_page.

  • Filling the fieldcatalog table

  • perform build_fieldcat. "we already got'em

  • Displaying the output

perform display_output.

endif.

Here is the Form Create_objects called in the PBO.

form create_objects .

  • Creating Docking Container

CREATE OBJECT o_docking

EXPORTING

RATIO = '95'.

IF sy-subrc eq 0.

  • Splitting the Docking container

CREATE OBJECT o_split

EXPORTING

PARENT = o_docking

sash_position = 25 "Position of Splitter Bar (in Percent)

with_border = 0. "With Border = 1 Without Border = 0

  • Placing the containers in the splitter

o_top_container = o_split->top_left_container .

o_bottom_container = o_split->bottom_right_container .

  • Creating Grid

CREATE OBJECT o_grid

EXPORTING

i_parent = o_bottom_container.

  • Creating the document

CREATE OBJECT o_document

EXPORTING

style = 'ALV_GRID'.

CREATE OBJECT gr_event_handler .

ENDIF.

endform. " create_objects

form fill_top_of_page .

data : lv_char(255) type c.

  • Calling the methods for dynamic text

CALL METHOD o_document->add_gap

EXPORTING

width = 140.

CALL METHOD o_document->add_text

EXPORTING

text = 'Plant Attainment Report '

sap_fontsize = 'Large'

sap_color = cl_dd_area=>list_key_int

sap_emphasis = cl_dd_area=>strong. " For bold

  • Display the data

CALL METHOD o_document->display_document

EXPORTING

parent = o_top_container.

  • Calling the method of ALV to process top of page

CALL METHOD o_grid->list_processing_events

EXPORTING

i_event_name = 'TOP_OF_PAGE'

i_dyndoc_id = o_document.

endform. " fill_top_of_page

form display_output .

gx_variant-report = sy-repid.

gs_layout-zebra = 'X'.

gs_layout-sel_mode ='X'.

gs_layout-cwidth_opt = 'X'.

call method o_grid->set_table_for_first_display

exporting

is_variant = gx_variant

i_save = 'A'

is_layout = gs_layout

changing

it_fieldcatalog = it_fldcat

it_outtab = <gt_tabletotal>.

IF sy-subrc <> 0.

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

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

ENDIF.

SET HANDLER gr_event_handler->handle_print_top_of_page FOR o_grid .

endform. " display_output



Edited by: Shareen Hegde on Jul 23, 2009 5:03 PM (I have no clue why  

.. doesn't work anymore. My code looks messed up..Sorry folks!

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Your post very difficult to read

If you running in background you need to use IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. Then create the container

Please check my reply in the following thread

5 REPLIES 5

former_member194669
Active Contributor
0 Kudos

Your post very difficult to read

If you running in background you need to use IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. Then create the container

Please check my reply in the following thread

0 Kudos

Hi a@s, my post is difficult to read. i agree. It is strange that

 ..

doesn't work for me anymore. I am not creating any custom container as I said.

0 Kudos

Check below code for executing ALV in background

IF V_CUSTOM_CONTAINER IS INITIAL.

IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.

CREATE OBJECT V_CUSTOM_CONTAINER

EXPORTING

CONTAINER_NAME = V_CONTAINER.

CREATE OBJECT O_DYNDOC_ID

EXPORTING

STYLE = 'ALV_GRID'.

CREATE OBJECT O_SPLITTER

EXPORTING

PARENT = V_CUSTOM_CONTAINER

ROWS = 2

COLUMNS = 1.

CALL METHOD O_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 1

COLUMN = 1

RECEIVING

CONTAINER = O_PARENT_TOP.

CALL METHOD O_SPLITTER->GET_CONTAINER

EXPORTING

ROW = 2

COLUMN = 1

RECEIVING

CONTAINER = O_PARENT_GRID.

CALL METHOD O_SPLITTER->SET_ROW_HEIGHT

EXPORTING

ID = 1

HEIGHT = 15.

CREATE OBJECT V_GRID

EXPORTING

I_PARENT = O_PARENT_GRID.

ELSE.

CREATE OBJECT V_GRID

EXPORTING

I_PARENT = V_DOC_CONTAINER.

ENDIF.

Edited by: Nilesh Shete on Jul 23, 2009 9:08 PM

0 Kudos

Nilesh,

If i put all these create objects inside the IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL. ENDIF , will I be still able to use ,

call method o_grid->set_table_for_first_display
    exporting
      is_variant      = gx_variant
      i_save          = 'A'
      is_layout       = gs_layout
    changing
      it_fieldcatalog = it_fldcat
      it_outtab       = <gt_tabletotal>.

in background ? WIll I not get - OBJECTS_OBJREF_NOT_ASSIGNED erorr ?

How can I call the set_table_for_first_display without creating the object reference ?

Here is my creat object routine.

form create_objects .

* Creating Docking Container
IF CL_GUI_ALV_GRID=>OFFLINE( ) .
  CREATE OBJECT o_docking
         EXPORTING
           RATIO                       = '95'.
  IF sy-subrc eq 0.
* Splitting the Docking container
    CREATE OBJECT o_split
      EXPORTING
       PARENT            = o_docking
       sash_position     = 25 "Position of Splitter Bar (in Percent)
       with_border       = 0. "With Border = 1 Without Border = 0
*   Placing the containers in the splitter
    o_top_container = o_split->top_left_container .
    o_bottom_container = o_split->bottom_right_container .
*   Creating Grid

    CREATE OBJECT o_grid
      EXPORTING
        i_parent          =  o_bottom_container.

*   Creating the document
    CREATE OBJECT o_document
    EXPORTING
        style  = 'ALV_GRID'.

     ENDIF.
     CREATE OBJECT gr_event_handler .
endif.
endform.                    " create_objects

former_member555112
Active Contributor
0 Kudos

Hi,

Incase you have made use of CL_GUI_ALV_GRID and a container the the program will not run in background.

In background it will give a dump.

Regards,

Ankur Parab