2010 May 11 4:18 PM
xperts,
i have a report , i need the output in foreground ALV and background SPOOL.
For that i have used
set_table_for_first_display
i m getting the alv output correctly.
but not able to generate spool list of the same .
any other methods available other than SUBMIT report?
plz advice
2010 May 11 10:52 PM
Hi,
I was able to send the ALV grid to spool as following:
IF sy-batch = 'X'.
ls_print-print = 'X'.
ls_print-no_print_listinfos = 'X'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
is_print = ls_print
it_sort = lt_sort
TABLES
t_outtab = lt_data.
Thanks,
Arash
2010 May 11 5:30 PM
You can check the param IS_PRINT of the method SET_TABLE_FOR_FIRST_DISPLAY.
2010 May 11 10:52 PM
Hi,
I was able to send the ALV grid to spool as following:
IF sy-batch = 'X'.
ls_print-print = 'X'.
ls_print-no_print_listinfos = 'X'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
is_print = ls_print
it_sort = lt_sort
TABLES
t_outtab = lt_data.
Thanks,
Arash
2010 May 11 11:23 PM
Hi,
If u want to display the alv output using SET_TABLE_FOR_FIRST_DISPLAY in a spool then u have use a docking container.
below code will be useful for you.
DATA: GV_DOC TYPE REF TO CL_GUI_DOCKING_CONTAINER,
GV_CCONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
GV_GRID1 TYPE REF TO CL_GUI_ALV_GRID,
GV_EVENT_RECEIVER TYPE REF TO LCL_EVENT_RECEIVER.
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
CREATE OBJECT GV_CCONTAINER
EXPORTING
CONTAINER_NAME = 'GV_CCONTAINER'.
CREATE OBJECT GV_GRID1
EXPORTING
I_PARENT = GV_CCONTAINER.
ELSE.
CREATE OBJECT GV_GRID1
EXPORTING
I_PARENT = GV_DOC.
ENDIF.
then
CAll method GV_GRID1->SET_TABLE_FOR_FIRST_DISPLAY.
Edited by: subas Bose on May 12, 2010 12:23 AM
2010 May 26 9:19 AM
Hi i know it's an old question but know i have the same but i'm not finding a solution.
can u please tell me how to get spool id after displaying my ALV GRID.
Regards.
imedix
2010 May 26 9:32 AM
Hi,
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,
bhavana
2010 May 26 9:46 AM
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
cover_page = 'X'
list_name = 'X'
no_dialog = 'X'
IMPORTING
out_parameters = wa_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
wa_print-print_ctrl-pri_params = wa_params.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_bypassing_buffer = c_check
is_layout = is_layout
it_fieldcat = t_fc
is_print = wa_print
TABLES
t_outtab = t_output
EXCEPTIONS
program_error = 1
OTHERS = 2.
this works fine..
2010 May 26 9:50 AM
2010 May 26 9:59 AM
It was an old post by me.
and got it solved a couple of days b4.
i jst put the solution
Thanks & Regards,
Anoop Chandran.
2010 May 26 10:09 AM
Ok Anoop,
Iam srry,please closed the thread if it is answered....
Bhavana
2010 May 26 10:12 AM
still have the same problem when when i'm calling screen 101 The spool is generated but i still in screen 100.
that's my code:
PBO of screen 101.
...
CREATE OBJECT grid04
EXPORTING i_parent = g_custom_container04.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
cover_page = 'X'
list_name = 'X'
no_dialog = 'X'
IMPORTING
out_parameters = wa_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
ls_print-print = 'X'.
ls_print-print_ctrl-pri_params = wa_params.
CALL METHOD grid04->set_table_for_first_display
EXPORTING
is_layout = ls_layo
it_toolbar_excluding = t_exclude
is_print = ls_print
CHANGING
it_fieldcatalog = lt_fieldcat4
it_outtab = <fs_output>.
2010 Nov 08 2:27 PM
I think that solution is:
1- Show ALV report as Spool report
2- Store spool report in pdf form
3- Send an email with pdf attached.
But I'm not sure. I'm investigating.
2014 Jul 02 7:50 AM
Hi Anoop,
I am also having the same requirement.
I am able to generate spool. But the next step in the code is not working.
FM 'CONVERT_ABAPSPOOLJOB_2_PDF' is not getting executed.
CALL METHOD g_ref_grid->set_table_for_first_display
EXPORTING
i_save = 'A'
is_layout = gs_layo "Layout
is_print = gs_print "For Creating Spool
CHANGING
it_outtab = gt_output "Final Internal Table Containing Data to Display
it_fieldcatalog = gt_fcat "Fieldcatalog
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* NEW-PAGE PRINT OFF.
*convert spool to pdf and send as attachment to sap inbox.
MOVE sy-spono TO lv_spool_nr.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = lv_spool_nr "Spool Number
no_dialog = space
dst_device = '%L01' "Printer Name
importingpdf_bytecount = lv_size "Output Size
tablespdf = lt_pdf_output "Spool data in PDF Format
exceptionserr_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9.
IF sy-subrc EQ 0.
LOOP AT lt_pdf_output INTO ls_pdf_output.
TRANSLATE ls_pdf_output USING c_col1.
CONCATENATE lv_buffer ls_pdf_output INTO lv_buffer.
CLEAR ls_pdf_output.
ENDLOOP.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |