ALV grid layouts
Moderators: Snowy, thx4allthefish, YuriT, Gothmog
ALV grid layouts
Hi,
Does anyone know how to get at the layout stored with an ALV gird?
Are client wants to be able to run a report in background and in foreground. In background mode we are just going to write the data out in a list.
At the moment the user is able to choose the list layout on the initial selection screen and have that used with his ALV. He wants to be able to do the same when running the report in background.
I thought maybe if I just instantiated the ALV without displaying it... I would be able to call the method get_frontend_layout but this still causes background abap dumps.
Thanks for any ideas/suggestions/solutions
Does anyone know how to get at the layout stored with an ALV gird?
Are client wants to be able to run a report in background and in foreground. In background mode we are just going to write the data out in a list.
At the moment the user is able to choose the list layout on the initial selection screen and have that used with his ALV. He wants to be able to do the same when running the report in background.
I thought maybe if I just instantiated the ALV without displaying it... I would be able to call the method get_frontend_layout but this still causes background abap dumps.
Thanks for any ideas/suggestions/solutions
-
- Posts: 346
- Joined: Tue Dec 17, 2002 7:52 am
- Location: Amsterdam, The Netherlands
- Contact:
.. and to be able to save a layout when you use REUSE_ALV_GRID_DISPLAY, check out topic viewtopic.php?p=52847&highlight=#52847
Best regards, Tim van Steenbergen
ok,
This all sounds good but I still get the feeling that I am going to get an ABAP dump when I run in background. At the moment SM37 keeps showing the jobs cancelling with the following message
"Control Framework: Fatal error - GUI cannot be reached"
and this is even when I am only instantiating the ALV and then calling the method to get the front end layout.
How with the solutions you are suggesting am I not going to get this error??
Thanks
This all sounds good but I still get the feeling that I am going to get an ABAP dump when I run in background. At the moment SM37 keeps showing the jobs cancelling with the following message
"Control Framework: Fatal error - GUI cannot be reached"
and this is even when I am only instantiating the ALV and then calling the method to get the front end layout.
How with the solutions you are suggesting am I not going to get this error??
Thanks
REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY are function modules that do not look for SAPGui (or presentation server) to perform their task.
You might still get a short dump for some other reason - but you won't get one just because it is running in background.
The OO classes you are currently using require custom controls that are currently instantiated in a SAPGui session. In a background job there is no such thing, so you are getting a short dump.
Using those FMs is extremely easy - if only you had tried them, you would have saved a lot of time by now.
You might still get a short dump for some other reason - but you won't get one just because it is running in background.
The OO classes you are currently using require custom controls that are currently instantiated in a SAPGui session. In a background job there is no such thing, so you are getting a short dump.
Using those FMs is extremely easy - if only you had tried them, you would have saved a lot of time by now.
Sudhi Karkada
Alv control frame error
Hi,
The Container object has to be instansiated only once..ie Create object of container has to be in between IF not initial of container obj ..and end if.
Try this may work.
The Container object has to be instansiated only once..ie Create object of container has to be in between IF not initial of container obj ..and end if.
Try this may work.
If you are using the ABAP Grid Control (OO object), you can still create the ALV list as a spool listing for the background job.
The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
e.g. if sy-batch is initial.
call screen 0100.
else.
perform present_grid.
endif.
In a PBO module of screen 0100, the subroutine present_grid is also performed.
The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job.
Regards,
Marty
The easiest way to do this is to put all the create object statements and method calls for the custom container and ALV grid object inside a subroutine (for example, present_grid).
All that is required is a simple check of the sy-batch variable to determine if the program is being executed in the foreground or background.
e.g. if sy-batch is initial.
call screen 0100.
else.
perform present_grid.
endif.
In a PBO module of screen 0100, the subroutine present_grid is also performed.
The set_table_for_first_display method will be invoked in the routine present_grid, however, due to the job being executed in the background, the ALV list output will be written as spool output for the background job.
Regards,
Marty
OO ALV Grid works okay
You can easily use an ALV grid in back ground, but you need to suppress the "Control Framework: Fatal error - GUI cannot be reached". Have a look at example code: BCALV_GRID_01, where they suppress the error by catching it.
Code: Select all
IF CUSTOM_CONTAINER IS INITIAL.
* create a custom container control for our ALV Control
CREATE OBJECT CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = MYCONTAINER
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC NE 0.
* add your handling, for example
* >>> Capturing this error is what allows the
* >>> program to run in background
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
TITEL = G_REPID
TXT2 = SY-SUBRC
TXT1 = 'The control could not be created'(010).
ENDIF.
* create an instance of alv control
CREATE OBJECT GRID1
EXPORTING I_PARENT = CUSTOM_CONTAINER.
*
* Set a titlebar for the grid control
*
GS_LAYOUT-GRID_TITLE = 'Flights'(100).
* § 5. In case of PRINT_END_OF_PAGE, you must set 'reservelns' to
* the number of reserved lines at the end of a page.
*
* reserve two lines for the PRINT_END_OF_PAGE event
*
GS_PRINT-RESERVELNS = 2.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'
IS_PRINT = GS_PRINT
IS_LAYOUT = GS_LAYOUT
CHANGING IT_OUTTAB = GT_SFLIGHT.
--
"It's not magic, it's work!"
"It's not magic, it's work!"