09-12-2014 1:23 PM
Hi Expert,
It's known that when we run a progarm in background,it should use docking containter for ALV display.
But i see in few program it run in background successfully without using docking container and it is using custom container in foreground.
Need your suggesting ....
Best Regards,
Sandip
09-12-2014 1:39 PM
Hi
What do you mean?
BCALV_GRID_01: it uses custom container but it works in background
Max
09-12-2014 1:39 PM
Hi
What do you mean?
BCALV_GRID_01: it uses custom container but it works in background
Max
09-12-2014 3:21 PM
Hi Max,
I wanted to know the major difference between program BCALV_GRID_01 and other progrram that need docking container when executed in background to get rid of control error.
Regards,
Sandip
09-12-2014 3:37 PM
Hi
But which programs need a docking container in order to run in background mode?
09-12-2014 4:08 PM
Max,
Program BCALV_GRID_DEMO when run background gives dump:
Reason:
ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error “Fatal Error – GUI cannot be reached”. This type of problem is common with all the programs that use the ALV grid control to display the output.
Solution:
Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control. The docking container doesn’t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards to enable it to execute it in background.
Thanks,
Sandip
09-12-2014 5:57 PM
The problem is on what you need to do
The container (and docking container too) are element of a dynpro, so they could be useless in a background process if the dynpro doesn't has to be used.
If you want to prevent the dump it needs to catch the exceptions, so try to copy BCALV_GRID_DEMO, and do this modifications:
- Original call of conainer:
MODULE PBO OUTPUT.
SET PF-STATUS 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.
CREATE OBJECT GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING IT_OUTTAB = GT_SFLIGHT.
ENDIF.
ENDMODULE.
New call:
module pbo output.
set pf-status 'MAIN100'.
if g_custom_container is initial.
create object g_custom_container
exporting
container_name = g_container
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
create object grid1
exporting
i_parent = g_custom_container.
call method grid1->set_table_for_first_display
exporting
i_structure_name = 'SFLIGHT'
changing
it_outtab = gt_sflight.
endif.
endmodule.
As you can see I've only added the excptions in order to prevent the dump and now it'll work in background, because the ALV will be print with a ALV list not GRID
Of course it's not very nice so it should be better to check if the program run in background mode, so the code should be:
MODULE PBO OUTPUT.
SET PF-STATUS 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
IF SY-BATCH IS INITIAL.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = G_CONTAINER.
ENDIF.
CREATE OBJECT GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
CHANGING IT_OUTTAB = GT_SFLIGHT.
ENDIF.
ENDMODULE.
So in this situation it desn't need to replace custom container with docking container
Max
09-12-2014 7:05 PM