Spool to PDF Conversion in ECC6 from Report running in Background
Hi Friends,
Iam working in ECC6, I have created one Classical report with line size of 295 which is running in Background and spool is generating.
But my requirement is I have to send this spool to email through PDF Attachment.
Here i have to convert Spool of line size 295 to PDF format. and then using FM give mail to respective email ids.
Here is the code i have written for your refference:
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
endif.
1. FORM GET_JOB_DETAILS .
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM. " G
2. FORM OBTAIN_SPOOL_ID .
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
MESSAGE s004(zdd) WITH gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM. " OBTAIN_SPO
3. CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
dst_device = 'ZLOCL'
PDF_DESTINATION = 'X'
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_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
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
*Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM. " CONVERT_SPOOL_TO_PDF
4. FORM PROCESS_EMAIL .
DESCRIBE TABLE it_mess_att LINES gd_recsize.
*DESCRIBE TABLE it_pdf_output LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
ENDFORM. " P
5. FORM SEND_EMAIL USING P_EMAIL.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachnament'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
Send file by email as PDF format
PERFORM send_file_as_email_attachment
TABLES it_mess_bod
it_mess_att
it_pdf_output
USING p_email1
'PDF Document Attached'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
CHANGING gd_error
gd_reciever.
ENDFORM. " SEND_EMAIL
6. FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES it_message
it_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
send_mail LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
LOOP AT p_email1.
t_receivers-receiver = p_email1-low.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDLOOP.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
But when iam executing the report in Background mail is coming to respective email ids but when i opened that attachment which is in PDF is not opening, giving error as below:
"Could not parsed Attachment.PDF!"
and file size is less oringinallly file size should be 125 KB buit in mail it is coming only 3 KB.
When i executed FM CONVERT_ABAPSPOOLJOB_2_PDF in foreground, its working fine for that Spool id.
Any suggestions from u friends.
regards,
Sekhar.
Hi when ur running tha application in background pass the below parameters .
DATA:
w_form_name TYPE tdsfname VALUE 'Zpramu_TEST',
w_fmodule TYPE rs38l_fnam,
w_cparam TYPE ssfctrlop,
w_outoptions TYPE ssfcompop,
W_bin_filesize TYPE i, " Binary File Size
w_FILE_NAME type string,
w_File_path type string,
w_FULL_PATH type string.
Internal tables declaration
Internal table to hold the OTF data
DATA:
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
Internal table to hold OTF data recd from the SMARTFORM
t_otf_from_fm TYPE ssfcrescl,
Internal table to hold the data from the FM CONVERT_OTF
T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.
This function module call is used to retrieve the name of the Function
module generated when the SMARTFORM is activated
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_form_name
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = w_fmodule
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Calling the SMARTFORM using the function module retrieved above
GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
format of the output
w_cparam-no_dialog = 'X'.
w_cparam-preview = space. " Suppressing the dialog box
" for print preview
w_cparam-getotf = 'X'.
Printer name to be used is provided in the export parameter
OUTPUT_OPTIONS
w_outoptions-tddest = 'LP01'.
CALL FUNCTION w_fmodule
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = w_cparam
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
output_options = w_outoptions
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
job_output_info = t_otf_from_fm
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
t_otf[] = t_otf_from_fm-otfdata[].
Function Module CONVERT_OTF is used to convert the OTF format to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_bin_filesize
BIN_FILE =
TABLES
otf = T_OTF
lines = T_pdf_tab
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 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.
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
tables
data_tab = T_pdf_tab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Smart form: Spool to PDF Conversion more than 100 pages.
Hi folks,
I have an issue with Function Module (FM) CONVERT_ABAPSPOOLJOB_2_PDF when the report to be converted has more than 100 pages.....i have explained this scenario as below
We have been using the FM CONVERT_ABAPSPOOLJOB_2_PDF to convert ABAP report to PDF file and then send this via mail using FM SO_DOCUMENT_SEND_API1.....
PDF conversion using FM CONVERT_ABAPSPOOLJOB_2_PDF works well if the number of report pages is less than 100....i.e the table pdf of the FM will contain the output as expected.....
If the report has more than 100 pages, the the FM CONVERT_ABAPSPOOLJOB_2_PDF will schedule the conversion job as a background job and returns with a SY-subrc eq 0 and the table parameter pdf will ne empty.
Could you suggest me a woorkaround in this situtaion...i.e how do I then get the output of the background job
And any process to convert Spool to PDF if having more than 100 pages.
Thanks in Advance............Pb,
If the report has more than 100 pages, the the FM CONVERT_ABAPSPOOLJOB_2_PDF will schedule the conversion job as a background job and returns with a SY-subrc eq 0 and the table parameter pdf will ne empty
i would suggest you to if pages are more than 100 than you need to send report output to sp01 with spool request number by using fm job_open..job_close..
than from sp01 you can convert pdf by running RSTXPDFT4 in se38.
hope this would solve your problem.
Amit. -
Error in Spool to PDF conversion using 'CONVERT_ABAPSPOOLJOB_2_PDF'.
Hi
I am sending classical report output from the Spool to PDF using 'CONVERT_ABAPSPOOLJOB_2_PDF'.
This is done through a batch job.
Step 1 is RVKRED01 report
Step 2 is a program that picks up the spool number of step1 and converts the spool to PDF.
Now in step 2 I am getting following error.
TEMSE_READ_LISTLINE error, TemssPart 1
What can be the reason?
What can be the solution?HI,
I checked your FM CONVERT_ABAPSPOOLJOB_2_PDF.
in the include LSTXWFPL line 1006, the IF condition is failing (if eop = 'X'. "end of part, read next part? )
so you are getting that message,
you can check that failing job in the debugging mode why it was failing at that point.
Note: for checking the background job you need to do below things.
1) go to sm37, and select you job.
2) and just type "JDBG" in the command line it goes to the debugging mode of your job.
by this way you will find. how and why its that error.
Alternative to your FM ( CONVERT_ABAPSPOOLJOB_2_PDF ) you can also use the
FM FPCOMP_CREATE_PDF_FROM_SPOOL. -
Problem in Spool to PDF conversion
Hi,
Iam using FM 'RSPO_SX_OUTPUT_TEXTDATA' to genarete a spool. then iam using FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to conver to PDF.
Iam able to generate spool as wel pdf file, but when try to open pdf file, its thrwing an error ''There was an error opening this document. the file is damaged and could not be repair'
pls help me to solve this...
SrinivasHi,
After calling the fm'CONVERT_ABAPSPOOLJOB_2_PDF' u need to call the subroutine.Please have a look at the below piece of code.
Declaration of local variables
DATA : lv_bytecount TYPE i,
lv_cancel(1) TYPE c,
lv_filename1 LIKE rlgrap-filename. "File name
Declaration of local constants
CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.
CONCATENATE c_c
sy-repid
lc_pdf
INTO lv_filename1.
Convert Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = v_rqident
no_dialog = c_x
dst_device = v_print_parms-pdest
IMPORTING
pdf_bytecount = lv_bytecount
TABLES
pdf = i_pdf
EXCEPTIONS
err_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
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
IF sy-subrc NE 0.
REFRESH : i_pdf.
ENDIF.
IF p_pdf IS NOT INITIAL.
To Download to PDF format
PERFORM download_w_ext(rstxpdft) TABLES i_pdf
USING lv_filename1
lc_pdf
'BIN'
lv_bytecount
lv_cancel.
ENDIF.
Reward points if u find useful
Regards,
Nagaraj -
Data is missing in Even Page when report running in background (spool)
Hi
I have this weird problem in my report. The report would run in background convert the data in to PDF from spool and then email it to people.
Now when the PDF has more then 1 page the error occurs.
It drops the last row from the even page. The total at the end and every thing shows correctly. If there r more than 2 pages then on page 3 the last row is not dropped and its all fine but again on page 4 it drops one record and on page 5 again its working fine.
One thing is it also puts an extra line(horizontal line which is not in the code) on those pages where its unable to put the record and its always the last one on the even page. I also looked up the spool. Its doing it in the spool too. So i think its not the PDF converter its when the spool is getting created for some reason its droping the rows for the even pages...
Did any one else encountered some thing like this? please help.
Thanks
Message was edited by:
Anwarul Kabiris there any problem with Background spools with SAP? We are running R3 here. And looks like its the spool background job that's creating the error. When i execute the report it shows all the record in print preview or if i print it.
Please Help! -
ALV report run In background gives 2 spool numbers
Hi ,
The ALV report which I am running in Background gives me 2 spool numbers after the Job is created in sm37.
I am just executing my ALV report by running it in backgroung procressing, but I get 2 spool one has all the correct data of the ALV and 1 blank spool is created.
I have Passed the followin parameter to my ALV FM.
lwa_print-no_change_print_params = 'X'.
lwa_print-no_print_listinfos = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
i_default = space
is_layout = t_layout
is_print = lwa_print
it_fieldcat = t_fieldcat
TABLES
t_outtab = t_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
Unable to find the reason why I get 2 spool created for it?
Thanks
RiteshHi venkatesh,
Thanks for the reply.
I tried that also but issue was due to a SKIP statement called in the program and due to which a new spool which was blank was called.
The issue is resolved.
Thanks
Solanki Ritesh -
Return table from report processed in background .
Hi All ,
I have a requirement where from inside a method , I have to process a report in background and this report should return a internal table with SAP data which have to be processed further .
Can anyone suggest me is it possible to get a return internal table from a report processed in background .
All your responses/suggestions would be appreciated ..
Regards,
RanjitaHi,
You can Export the internal table to a memory location and import the entries in the report.
Regards,
Srini. -
Error when OO ALV report run in background
Hello all,
We recently applied stack 12 for a 7.0 system. My custom ALV report using CL_GUI_CUSTOM_CONTAINER coding now returns an error when run in Background. It works fine in dialog.
The error occurred in program CL_GUI_CUSTOM_CONTAINER=======CP. The log message was "Control Framework: Fatal error - GUI cannot be reached".
Is there a solution for OO ALV reports run in the background? I would not like to re-write my ALV reports using the function call. Any advice is appreciated. Thanks!!Yes, you need to code it a little differently, but you can still use CL_GUI_ALV_GRID. Here is an example.
REPORT ZRICH_0006 .
DATA: ITAB TYPE TABLE OF MARA.
DATA: R_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: R_CONTROL TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: G_DOCK TYPE REF TO CL_GUI_DOCKING_CONTAINER.
DATA: OKCODE type sy-ucomm.
START-OF-SELECTION.
SELECT * FROM MARA INTO TABLE ITAB up to 100 rows.
CALL SCREEN 100.
*& Module STATUS_0100 OUTPUT
* text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
IF R_CONTROL IS INITIAL.
* Check whether the program is run in batch or foreground
IF CL_GUI_ALV_GRID=>OFFLINE( ) IS INITIAL.
* Run in foreground
CREATE OBJECT R_CONTROL EXPORTING CONTAINER_NAME = 'CONTAINER_1'.
CREATE OBJECT R_GRID EXPORTING I_PARENT = R_CONTROL.
ELSE.
* Run in background
CREATE OBJECT R_GRID EXPORTING I_PARENT = G_DOCK.
ENDIF.
CALL METHOD R_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
I_STRUCTURE_NAME = 'MARA'
CHANGING
IT_OUTTAB = ITAB.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE USER_COMMAND_0100 INPUT.
CASE OKCODE.
WHEN 'BACK'.
leave program.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Regards,
Rich Heilman -
Printout of report running in background.
Hi
i have a report which i am running in background , If i want to take printout of the output
list generated, which FM am i suppose to use ?
thanks in advance.Sample code would be
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
copies = 1
department = c_dept
destination = c_dest
expiration = 2
layout = c_layout
line_count = 65
line_size = 255
list_name = text-031
list_text = text-032
mode = ' '
new_list_id = 'X'
no_dialog = 'X'
receiver = c_rec
release = 'X'
sap_cover_page = 'X'
user = sy-uname
IMPORTING
out_parameters = l_params
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc = 0 AND NOT l_params IS INITIAL.
NEW-PAGE PRINT ON PARAMETERS l_params NO DIALOG NEW-SECTION.
g_spool = 'X'.
ENDIF. -
Error while report running in background
Hello to all,
I am running a report in backgroud using SM37.This report already programmed to call a report in background.It takes stocks for given period,I am taking the values using "import memory-id" statement.It gives an error log in SM37 as:
Choose at least one scope of list
Message no. M7829
Can we call a submit stmt in a report that is to run in background?? or pls provide any alternative for this problem??
Thnax & Regards
Vipin B.Hi,
If you faced problem in submit statement,then try replacing the same by running the bdc for the particular program that you are using in submit statement.
Make sure that you had given values for all the mandatory parameters and select option in the selection screen of the report program that you are submitting using submit statement.
Kindly reward points by clicking the star on the left of reply,if it helps. -
Hi All
I have created a pdf through spool, and the list is having output in ALV.
The columns in ALV are 11 where as I am getting only 9 columns in pdf attachment.
Can anyone suggest any solution to get all the 11 columns in pdf attachment.
Thanks in advance.
swathiU can write ur own pgm like
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spoolnum
NO_DIALOG = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = NUMBYTES
PDF_SPOOLID = PDFSPOOLID
LIST_PAGECOUNT =
BTC_JOBNAME = JOBNAME
BTC_JOBCOUNT = JOBCOUNT
TABLES
PDF = GT_ABAP_PDF
EXCEPTIONS
ERR_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
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
and then
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = NUMBYTES
FILENAME = FILEPATH
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_EOL = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = PDFDATA
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>
Edited by: Alvaro Tejada Galindo on Sep 1, 2008 4:31 PM -
Spool to PDF conversion CONVERT_OTFSPOOLJOB_2_PDF
Hi All,
I am using the function module CONVERT_OTFSPOOLJOB_2_PDF to convert spool into the PDF file in BSP.
I am getting correct output for the other language but only for greek I am not getting correct output even spool is correct.
Regards
SagarIssue Resolved.
-
Hi experts 1 query regarding alv report running in background
when i run my alv report with 40 columns in background in spool when i get output disturbed 20 lines of first row is moving to second row so when i download to excel the o/p is completely disturbed and no use for me is there any way to solve this problem.please reply
hi ,
this will solve your problem
http://www.****************/Tutorials/ALV/Spool/width.htm
Increasing the width of the spool when using ALV List
By Aafaque Husain, YASH Technologies
Whenever an ALV report (with more number of columns) is scheduled in background, the output will be displayed in a zigzag fashion as shown below:
If we try to download the output from the spool or try to view the output, then we observe that the output is not in an appropriate fashion.
To get the right format of output in the spool we generally increase the u201Cno. of columns fieldu201D in the Format typesu201D. Have a look at the following screenshot:
Sometimes even when we change this field, we get the output truncated at the end, like last few columns are not displayed. There is certain limitation for this field, so that even if increase this value again, we find no change in the output display in spool.
This value is effective only when we check the check box u201CNumber of columns from list display formatu201D in the SPAD transaction.
Ø GO to SPAD Transaction code
Ø In the menu Settings -> Spool System as shown belowu2026
Ø In the others tab check the first check box in the Output Controller block, SAVE and exit.
Now Schedule the ALV report again by providing the output device and format, and then we get the full output in the spool as shown below:
Regards,
Madhavi -
Default Layout for a report running in background
Dear Friends,
I have created a layout for report ME2L and set as default layout (for every user)....
Foreground execution picked the DEFAULT layout but when am trying to execute the same report in background, default layout is not picked but the STANDARD layout is shown in the spool
Could you please suggest me how can i use same report layout for foreground as well as background
Thanks in Advance
AnaAtanu dey,
If you wnat to download excel in back ground
You have to download in application server only.
EX:
DATA : v_filepath(80) VALUE '/data/sapdata/inc/error_log/pme_br/',
c_coma VALUE ',' .
OPEN DATASET v_filepath FOR OUTPUT IN TEXT MODE.
IF sy-subrc EQ 0.
LOOP AT i_errors_bat.
CONCATENATE i_errors_bat-plant c_coma
i_errors_bat-zzvendor c_coma
INTO v_string.
TRANSFER v_string TO v_filepath.
ENDLOOP.
CLOSE DATASET v_filepath.
Note : you can download in presentation server also.
but it requires lot of authorizations and have to use
FTP commands.
Reason is Apllication server in back ground has to
recognize the from which system request came.
Better go for OPEN DATA sets.
Don't forget to reward if useful..... -
Report run in background, attachment needs to be sent to user via email
Hi all,
we have a PDF solution which allows the system to send a PDF document as attachment via email to the recipient, all one needs to do is type in recipient email to a predefined PDF printer.
What i need is a similar solution but instead of PDF it has to be an Excel file attached to email.
The enduser does not have authorization to use SM36.
Searching the Web (and with help from our Basis team) i have found several ideas but not sure as it would mean coding programs and so on.
Is there an easier way?
regards
RMHi all,
we have a PDF solution which allows the system to send a PDF document as attachment via email to the recipient, all one needs to do is type in recipient email to a predefined PDF printer.
What i need is a similar solution but instead of PDF it has to be an Excel file attached to email.
The enduser does not have authorization to use SM36.
Searching the Web (and with help from our Basis team) i have found several ideas but not sure as it would mean coding programs and so on.
Is there an easier way?
regards
RM
Maybe you are looking for
-
How do I get adobe pdf to connect and appear back on Microsoft Oulook next to the help button?
Adobe Acrobat 9 is on most of our computers and is connected to Micrsoft Oulook email because the adobe pdf button is next to the help button in Oulook. For some reason it has disappeared on one of the computers and don't know why and now how do we
-
Prob. in Implement User Exit for wrong calculation of Surcharge during MIRO
Dear All, In our system the calculation of Surcharge is wrong during MIRO. So i write this issue to the SAP, the below solution is provided by them : Use the user exit 'J_1I7_USEREXIT_PROCESS_TKOMV' to redetermine the additional VAT condition type va
-
Appleworks won't open at all! help!
Yesterday I was working on a word document and all of the sudden, I got the little spinning disk. I did a force quit and restarted my computer. Then, I go to open Appleworks and it doesn't do anything. I click the icon in the dock and it bounces up o
-
Possible Bug in 1.6 Report Totals?
I have this Report Region based on a SQL statement: SELECT 'SDR ' || OBOB_SNAME || ' ' || OBOB_CNAME "SDR", sum( decode(to_char(PHPH_DATE,'DY'),'MON',PHPH_PERSON_HOUR,NULL) ) "Mon", sum( decode(to_char(PHPH_DATE,'DY'),'TUE',PHPH_PERSON_HOUR,NULL) ) "
-
Hello everyone. A procedure is a trasanction,right? well if a procedure have exception, will the code in the block between begin and end rollback implicitly? If it does, what's the difference executing rollback explicitly? Thanks very much.