10-21-2008 9:42 AM
Hi,
We are trying to build a ALV able to be launched in background mode. We need to see the result ALV of the job. We have looked up in this forum and we have found this helpful thread:
but even though we follow its instructions, when we go to SM37 and look in the job log we don't find the ALV results.
Thanks in advance for your help.
Regards.
10-21-2008 9:44 AM
Hi,
U wont get the output for ALV grid in background. Try to use ALV list.
10-21-2008 9:55 AM
10-21-2008 10:36 AM
Hi Carla
If yuo want to run the ALV GRID in background mode u need to force to create a spool print request and u doesn't need to set the instance for container.
So u try to set the right value in the parameter IS_PRINT of method SET_TABLE_FOR_FIRST_DISPLAY:
* Check if the process is in background
CALL METHOD CL_GUI_ALV_GRID=>OFFLINE
RECEIVING
E_OFFLINE = E_OFFLINE.
IF E_OFFLINE IS INITIAL.
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.
ELSE.
I_PRINT-PRINT = 'X'.
CREATE OBJECT GRID1
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
IS_PRINT = I_PRINT
CHANGING
IT_OUTTAB = GT_SFLIGHT.
ENDIF.
Max
10-21-2008 12:39 PM
It is possible to run the report in background also. this case we don't need any custom control on the screen. create an empty screen and test it foreground and background.
report ztest_alv_oo.
data: it_carr type table of scarr,
it_flight type table of sflight.
data: grid1 type ref to cl_gui_alv_grid,
con1 type ref to cl_gui_custom_container.
data: layout1 type lvc_s_layo.
start-of-selection.
select * from scarr
into table it_carr.
if grid1 is initial.
create object grid1
exporting
i_parent = con1.
layout1-grid_title = 'Carrid data'.
layout1-smalltitle = 'X'.
layout1-sel_mode = 'A'.
layout1-cwidth_opt = 'X'.
layout1-zebra = 'X'.
grid1->set_table_for_first_display(
exporting
i_structure_name = 'SCARR'
is_layout = layout1
changing
it_outtab = it_carr
exceptions
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
).
if sy-subrc ne 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endif.
if sy-batch ne abap_true.
call screen 100.
endif.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.
set pf-status 'CARR'.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
case sy-ucomm.
when 'BACK' or 'CANCEL' or 'EXIT'.
leave to screen 0.
endcase.
endmodule. " USER_COMMAND_0100 INPUT