Pdf to spool
Hi Experts,
i have created a custom program by copying FP_TEST_00 and gave nodialog mode for out parameters which will supress the prompt for printer and that i can run it in background. i just want the data to written to spool.
call function 'FP_JOB_OPEN'
changing
ie_outputparams = iwa_outputparams
exceptions
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
others = 5.
call function module with import params
call function function_name
parameter-table
para_tab.
close job
call function 'FP_JOB_CLOSE'
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
Any pointers in this regard will be help ful.
Please provide some inputs if we can send the PDF to a spool.
Thanks in Advance,
Deepa
step 1.
Use RSTS_GET_ATTRIBUTES function module to get Spool No and related attributes.(Ex.Client , Authority..ect)
Step 2.
select the FM CONVERT_OTFSPOOLJOB_2_PDF if OTF data available to convert or CONVERT_ABAPSPOOLJOB_2_PDF if list data available to convert to PDF in the spool created in the step 1.
Step 3.
Export TABLES - pdf will contain the PDF Data .
Note : you can refer program - RSTXPDFT4
Cheers ,
Dilum
Similar Messages
-
Determine size of pdf from spool
All,
does anyone know how to determine size of pdf from spool.
i'm using RSPO_RETURN_ABAP_SPOOLJOB to get pdf file, but i want to know its size.
any idea?Assume the PDF data is in internal table gt_messg_att.
MOVE p_spoolno TO lv_spoolno.
* CONVERT THE SPOOL TO PDF
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = lv_spoolno
no_dialog = lc_no_dialog
* DST_DEVICE =
* PDF_DESTINATION =
IMPORTING
pdf_bytecount = lv_bytecount
* PDF_SPOOLID =
* OTF_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
pdf = gt_pdf_output
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
* Transfer the 132-long strings to 255-long strings
LOOP AT gt_pdf_output INTO wa_pdf_output.
TRANSLATE wa_pdf_output USING ' ~'.
CONCATENATE v_buffer wa_pdf_output INTO v_buffer.
MODIFY gt_pdf_output FROM wa_pdf_output.
CLEAR wa_pdf_output.
ENDLOOP.
* TO CONVERT THE DATA INTO PDF FORMAT ELSE THE PDF FILE
* WON'T OPEN & REPORT WOULD GIVE A MESSAGE THAT
* THE FILE IS DAMAGED & COULD NOT BE OPENED
TRANSLATE v_buffer USING '~ '.
CLEAR : wa_messg_att,
gt_messg_att.
DO.
wa_messg_att = v_buffer.
APPEND wa_messg_att TO gt_messg_att.
SHIFT v_buffer LEFT BY 255 PLACES.
IF v_buffer IS INITIAL.
EXIT.
ENDIF.
CLEAR wa_messg_att.
ENDDO.
ENDIF.
* Get size of attachment
DESCRIBE TABLE gt_messg_att LINES lv_cnt.
READ TABLE gt_messg_att INTO wa_messg_att INDEX lv_cnt.
lwa_doc_data-doc_size = ( lv_cnt - 1 ) * 255 + STRLEN( wa_messg_att ). -
Convert ABAP list output to PDF without spool
Hi All,
We have used the FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the list output to PDF. It creates the spool number in SP01 and PDF is getting generated.
But, in our SAP ECC 6.0 server all spools are redirected to printer by default and get printed because it configured like that. We requested BASIS people to reconfigure but they said no for a single report.
So we need to find the alternate solution to generate the PDF without spool. We have searched in sdn, but didnot get any alternate solution.
Please help us in this regard.
Thanks in advance.data: begin of i_list occurs 0,
line(255),
end of i_list.
data:i_mara like mara occurs 0 with header line.
parameters: p_matnr like mara-matnr.
start-of-selection.
set pf-status 'PDFFILE'.
select *
from mara
into table i_mara
where matnr = p_matnr.
loop at i_mara.
write:i_mara-matnr,i_mara-ernam,i_mara-pstat.
endloop.
at user-command.
if sy-ucomm = 'PDF'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
I_LIST = SY-LISEL.
APPEND I_LIST.
ENDIF.
ENDDO.
NEW-PAGE PRINT ON DESTINATION 'LP03' IMMEDIATELY ' ' COVER TEXT ' ' KEEP IN SPOOL 'X' NEW LIST IDENTIFICATION 'X' LINE-SIZE 132 LINE-COUNT 65 NO DIALOG.
LOOP AT I_LIST.
IF I_LIST-LINE IS INITIAL.
SKIP.
ELSE.
at first.
write: TEXT-001.
endat.
WRITE: I_LIST-LINE+0(132).
ENDIF.
ENDLOOP.
NEW-PAGE PRINT OFF.
data:filename like RLGRAP-filename value 'C:\PDFFILE.PDF'.
DATA: SPOOL TYPE TSP01-RQIDENT.
SPOOL = SY-SPONO.
SUBMIT rstxpdft4
WITH spoolno = spool
WITH download = 'X'
WITH p_file = filename
AND RETURN.
if sy-subrc = 0.
write: 'pdf file generated'.
else.
write:'pdf file not generated'.
EXIT.
endif.
endif.
please paste this code and check once ,if it works modify the code according to ur requirement.
regards,
padmaja -
What happens to attachment in a PO when it is converted to PDF using SPOOL.
Hi Experts,
While converting a PO to PDF using a spool number, it works fine but i have a question as If the PO has an attachment, does the spool take care of that also?
If not how to download the attachment as well.
Thanks & Regards,
KHi Shan,
No in ME21N there is a tab called Attachment, by which we can attach a note or something(I am thou not sure why this is done), yes a script is generated into a PDF but this attachment which is part of PO does it get attached or we need to do somthing to attach it to PDF was my question?
Cheers,
K
Edited by: Ken Thompson on Sep 29, 2008 5:58 AM -
Read PDF Formatted Spool and write PDF File to Application Server
Hi Experts,
After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
PARAMETERS : p_spono LIKE tsp01-rqident.
DATA: pdf_data type FPCONTENT.
types: lt_pdf_table(1000) type x.
data: l_pdf_data type standard table of lt_pdf_table,
l_pdf_line type lt_pdf_table,
l_offset type i,
l_len type i,
p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
*Read the spool content
CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
EXPORTING
i_spoolid = p_spono
i_partnum = '1'
IMPORTING
e_pdf = pdf_data
* e_pdf_file = file
EXCEPTIONS
ads_error = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
* Modify the spool contents to prepare internal table
l_len = xstrlen( pdf_data ).
while l_len >= 1000.
l_pdf_line = pdf_data+l_offset(1000).
append l_pdf_line to l_pdf_data.
add 1000 to l_offset.
subtract 1000 from l_len.
endwhile.
if l_len > 0.
l_pdf_line = pdf_data+l_offset(l_len).
append l_pdf_line to l_pdf_data.
endif.
* GUI DOWNLOAD Works Fine
* Now pdf contents is ready , lets store in local PC
*CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* filename = 'C:\Documents and Settings\Desktop\shital.pdf'
* filetype = 'BIN'
* TABLES
* data_tab = l_pdf_data.
OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error opening file:'(Z03) p_file.
ENDIF.
LOOP AT l_pdf_data INTO l_pdf_line.
TRANSFER l_pdf_line TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error closing file:'(Z04) p_file.
ENDIF.
Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
Let me know if you require further details about the issue.
Regards
Shital
Edited by: shital phadake on Apr 8, 2009 9:39 PMThanks Selçuk for your reply and taking time for understanding the Issue,
I went thru Functionality of the program you suggested but dont think it matches my requirement.
Regards
Shital -
Convert OTF to PDF and print PDF from Spool
Hi,
I have searched all the forums and service market place but could not find solution to my problem.
I am using Function module
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
no_dialog = 'X'
dst_device = 'ISJB'
pdf_destination = 'S'
IMPORTING
pdf_bytecount = lv_bytecount
pdf_spoolid = lv_spoolid
otf_pagecount = lv_pagecount
btc_jobname = lv_jobname
btc_jobcount = lv_jobcount
TABLES
pdf = gt_pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
this generates spool in SP01. Ideally it should generate a PDF spool file but it generates a BIN file of Format G_RAW. When I display the spool it displays all kinds of japanese characters which does not make sense,.
I setup printer ISJB with device type JPPDF (PDF converted for Japanese characters). Does any one know where the problem could be? Why I could not print the Spool in PDF?
Thank you,
JagadishHi,
check out this program which will convert spool to pdf
REPORT zsmartform_spool_g.
*************Types Declaration ****************************
TYPES : BEGIN OF gty_tab, " Spool Requests
rqident TYPE tsp01-rqident, " Spool request number
rqdoctype TYPE tsp01-rqdoctype, " Spool: document type
rqo1name TYPE tsp01-rqo1name, " TemSe object name
END OF gty_tab.
*********Work Area ****************************************
DATA: form_name TYPE rs38l_fnam, " Used to get the function module of Smartform
wa_outopt TYPE ssfcompop, " SAP Smart Forms: Smart Composer (transfer) options
gs_tab TYPE gty_tab. " Spool Requests
*******Internal Table Declarations ************************
DATA: gt_tab TYPE STANDARD TABLE OF gty_tab, " Spool Requests
gt_pdf TYPE STANDARD TABLE OF tline, " SAPscript: Text Lines
gt_spoolid TYPE tsfspoolid, " Table with Spool IDs
gt_otfdata TYPE ssfcrescl. " Smart Forms: Return value at end of form prnt
*********Variable Declarations ****************************
DATA: gv_bytecount TYPE i, "#EC NEEDED " PDF Byte Count
gv_file_name TYPE string, " File name
gv_file_path TYPE string, " File Path
gv_full_path TYPE string, " Path
gv_binfilesize TYPE i, " Bin File size
gv_rqident TYPE tsp01-rqident, " Spool request number
gv_name TYPE tst01-dname, " TemSe object name
gv_objtype TYPE rststype-type, " TemSe: Object type name
gv_type TYPE rststype-type. " TemSe: Object type name
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPDF_G'
IMPORTING
fm_name = form_name
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.
*Get Spool IDs
wa_outopt-tdnewid = 'X'.
wa_outopt-tddest = 'LP01'.
CALL FUNCTION form_name
EXPORTING
output_options = wa_outopt
user_settings = 'X'
IMPORTING
job_output_info = gt_otfdata
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.
*Assign the spool id
gt_spoolid = gt_otfdata-spoolids.
Generate spool and pdf for the output of the form
PERFORM sub_generate_spool_pdf.
END-OF-SELECTION.
*& Form sub_generate_spool_pdf
Generate Spool and PDF output
FORM sub_generate_spool_pdf .
DATA: ls_spoolid LIKE LINE OF gt_spoolid.
*----Get the Spool Number
CLEAR ls_spoolid.
READ TABLE gt_spoolid INTO ls_spoolid INDEX 1.
IF sy-subrc = 0.
gv_rqident = ls_spoolid.
ENDIF.
CLEAR gt_tab.
SELECT rqident rqdoctype rqo1name INTO TABLE gt_tab
FROM tsp01 WHERE rqident = gv_rqident.
IF sy-subrc = 0.
CLEAR gs_tab.
Get the TemSe: Object name into variable gv_name
READ TABLE gt_tab INTO gs_tab INDEX 1.
IF sy-subrc = 0.
gv_name = gs_tab-rqo1name.
ENDIF.
ENDIF.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = sy-mandt
name = gv_name
part = 1
IMPORTING
type = gv_type
objtype = gv_objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 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.
Check if temse object name type is 'OTF' or 'LIST'
IF gv_objtype(3) = 'OTF'.
PERFORM get_otf_spool_in_pdf.
ELSE.
PERFORM get_abap_spool_in_pdf.
ENDIF.
Generate F4 functionality from spool to pdf
PERFORM write_pdf_spool_to_pc.
ENDFORM. " sub_generate_spool_pdf
*& Form get_abap_spool_in_pdf
Generate the Spool number
FORM get_abap_spool_in_pdf .
REFRESH gt_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gv_rqident
IMPORTING
pdf_bytecount = gv_bytecount
TABLES
pdf = gt_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.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_abap_spool_in_pdf
*& Form get_otf_spool_in_pdf
Generate OTF data from the Spool Number
FORM get_otf_spool_in_pdf .
REFRESH gt_pdf.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gv_rqident
IMPORTING
pdf_bytecount = gv_bytecount
TABLES
pdf = gt_pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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 <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " get_otf_spool_in_pdf
*& Form write_pdf_spool_to_pc
Generate PDF format
FORM write_pdf_spool_to_pc .
CALL METHOD cl_gui_frontend_services=>file_save_dialog
CHANGING
filename = gv_file_name
path = gv_file_path
fullpath = gv_full_path
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.
----DOWNLOADING THE PDF DATA***
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = gv_binfilesize
filename = gv_full_path
filetype = 'BIN'
TABLES
data_tab = gt_pdf
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.
ENDFORM. " write_pdf_spool_to_pc -
Display logo In PDF output ( Spool to PDF output )
Hi Experts,
In my requirement i am using 'REUSE_ALV_GRID' to display logo.
In our functionality we are executing report in background and we are converting spool into PDF output. Now our requirement is to display LOGO in PDF output.
Any pointers on this are appreciated.
Regards,
Bhanu.RHello,
Use the top-of-page parameter of the FM 'REUSE_ALV_GRID_DISPLAY' and use the FM REUSE_ALV_COMMENTARY_WRITE to add the logo to the I_LOGO export parameter to get the logo in the ALV output. Now convert this to spool and to pdf and you can get the logo in the pdf as well
Vikranth -
PDF to spool to run program in background
Hi Experts,
i have created a custom program by copying FP_TEST_00 and gave nodialog mode for out parameters which will supress the prompt for printer and that i can run it in background. i just want the data to written to spool.
call function 'FP_JOB_OPEN'
changing
ie_outputparams = iwa_outputparams
exceptions
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
others = 5.
call function module with import params
call function function_name
parameter-table
para_tab.
close job
call function 'FP_JOB_CLOSE'
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
Any pointers in this regard will be help ful.
Please provide some inputs if we can send the PDF to a spool.
Thanks in Advance,
DeepaTry:
iwa_outputparams-REQNEW = 'X'.
iwa_outputparams-REQFINAL = 'X'.
Cheers,
Andres. -
i have a spool generated whicn needs to be converted into PDF file format and Excel file format. Both the files PDF and Excel having the data from spool should be sent as attachment in an email. Is ther any function modules which can handle this scenario ?
Hi,
Check this blog where he has explained clrealy about sending email..
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
seshu. -
Printing SFP ADOBE generated pdf from spool.
I am trying to print ADOBE PDF file to HP Designjet Z5400 plotter. It successfully writes a pdf file to the spool. When I either release that spool file to print or have the print job set to print immediately I get a spool error - unable to read format G_RAW l_rc =128. However I can print the pdf from preview. It is NOT an issue with the printer printing the pdf file as I can do this. My issue is that I cannot print directly to the printer via the SAP spooler. I have entered incident to SAP with specific example of my program that produces the pdf spool file. I am directed to read notes that imply I have ADS problem which is ridiculous as I have plenty of SFP generated pdf files printing to HP and Canon laser printers. Again i am trying to print a very large label 2 X2 foot to HP Designjet Z5400 plotter directly via spool. My task is to direct label to different printers based upon MATNR field.
I would appreciate response from only people who have printed SPF ADOBE pdf to plotters.
The pdf that was created file size 5.7 KB.
SPAD settings
Device Type HPGL HPGL : Bus.Graphics: HP/GL plotter Device Class Standard printer
Model HP Designjet Z5400
Host Spool Access Method G G: Frontend print with control technologienew component SAPPDFPRINT, interactive forms can be printed on any Windows printer just like all of the other spool requests with the SAPWIN device types.
Refer to SAP notes:
1444342 - Device type-independent printing of ADS forms
968394 - Forms Printing from spool and from Preview PDF differ
1630403 - Mass printing of Adobe documents
Regards
Sandy -
ITAB to PDF without spool request
Hi Experts,
I have a requirement where I need to convert internal table data into PDF format and send it as an E-Mail with PDF attachment.
How do I achieve this .
I dont have any smart form or SCript...
In Fact I don't want to use SPOOL....
Is there any way to convert Internal Table to PDF.....
Please Guide....
Edited by: Thomas Zloch on Sep 29, 2011 1:50 PMHi,
try below stuff,
http://wiki.sdn.sap.com/wiki/display/Snippets/SENDALVGRIDASPDFATTACHMENTTOSAPINBOXUSINGCLASSES
some more info like this at ,
http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage
Thanks,
Chandra
Edited by: Chandrashekhar Mahajan on Sep 29, 2011 3:25 PM -
Hello,
I need to develop a program that reads a PDF file in a server and send it to SAP Spool.
I can use UPLOAD function to load it as a binary file, but then how to generate a spool request with this content?
I tried class CL_FP_PDF_OBJECT but it seems there is no method that can do that.
I am on Netweaver 7.0, so I have ADS available, but it would be nice if I could use something else.
I would appretiate any suggestion.
Regards,
MauricioI don't understand you're requirement. you place all the pdf files on a filesystem ? is that in SAP or outside sap ??
if it's outside SAP why do you want to print them from SAP ?? you can write a windows or unix script to print all the files daily no need to use SAP for that.
and why is it necessary to print them ? do they need to be send by post ? then it's more handy to send the pdf files to the repro department who can batch print and put the prints automaticaly in an envelop.
if you place the pdf files in DMS from SAP then there is perhaps a print function which you can use to loop through the files. I'm not sure about that
kind regards
arthur
Edited by: A. de Smidt on Mar 11, 2009 8:39 AM
Hello Arthur,
we receive the information (Certificate of Confirmity) from one of our manufacturers as PDF files. These PDF files are stored within SAP and may only be printed once. The moment of printing must be stored in SAP to avoid printing occurs more then once.
Kind regards,
Ronald Groennou -
Hi all,
is there any way to get saved in DMS PDF documents printed (spool???) in readable form ?
I was able to read the PDF document in binary form from DMS with FM C14S_DOCUMENT_ORIGINAL_COPY.
Then i did create an TemSe object and a spool task.
However the PDF document would not be printed in readable form. Any clue how to get it correct printed ?
thnx in advance.hi,
i have tried spool to PDF. the code is
*& Form DOWNLOAD
FORM DOWNLOAD .
DATA: lk_params TYPE pri_params,
lv_valid.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
immediately = ' '
layout = c_layout "'X_65_132'
no_dialog = c_x
IMPORTING
out_parameters = lk_params
valid = lv_valid.
IF lv_valid <> space .
NEW-PAGE PRINT ON PARAMETERS lk_params NO DIALOG.
*--To display the final report
perform print_report.
PERFORM DISPLAY.
NEW-PAGE PRINT OFF.
*---To convert the download to PDF
PERFORM conv_to_pdf_download.
perform download1.
ENDIF.
endif.
**--To display the final report
PERFORM DISPLAY.
perform print_report.
ENDFORM. " DOWNLOAD
*& Form conv_to_pdf_download
FORM conv_to_pdf_download .
clear it_final.
wait up to 2 seconds.
lv_spoolno = sy-spono.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = lv_spoolno
NO_DIALOG = ''
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = lv_numbytes
PDF_SPOOLID =
LIST_PAGECOUNT =
BTC_JOBNAME =
BTC_JOBCOUNT =
TABLES
PDF = it_pdf.
endform. "conv_to_pdf_download
*& Form download1
form download1 .
CHECK DOWNLOAD = 'X'.
call function 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = LV_NUMBYTES
CODEPAGE = ' '
FILENAME = P_FILE
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = P_FILE
FILESIZE = LV_NUMBYTES
CANCEL = CANCEL
tables
data_tab = IT_PDF.
endform. " download1 -
Smartforms to pdf without spool
Hello,
Is it possible to convert a smartform to pdf without a spool id ? I need to generate a pdf file from a smartform without print it.
Thanks.Hi Julián Moreno Luna,
Please check this link
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/smartform%2bto%2bmail%2bas%2bpdf%2battachment
*& Report ZTEST_NREDDY_PDF_MAIL
REPORT ZTEST_NREDDY_PDF_MAIL.
* Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
* Objects to send mail.
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
* Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
* Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_FORM_NAME
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.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
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.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
* Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
* Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
* Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
* Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = 'Write Mail ID Here'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
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.
IF SY-SUBRC <> 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
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.
Best regards,
raam -
Hi
I have a requirement to generate spool number from a webdynpro object. where I have alerady the PDF format xml output.
what is the function module that can be used to pass xml string and get spool number?
I am using RSPO_OPEN_SPOOLREQUEST function, but it is not giving any output pages on spool.
Please help me.<Link removed by moderator>
Edited by: Vinod Kumar on Mar 7, 2012 11:44 AM
Maybe you are looking for
-
Airport extreme time capsule yellow light - no Internet - cable modem does work
Is their a reset button on the time capsule or am I out of luck. Yes I have turned on and off etc. the cable modem has been tested and is functioning ... Do jthese units go bad. Thanks friends
-
How to restore/reinstall new imac
Hi folks. I just bought a 4 month old iMac 21.5 500GB model and yeah, I'm blown away. Anyway the thing is that there are a lot of empty folders from previous owner and his name keeps showing up for accounts etc, so I want to wipe the HDD and restore/
-
Runtime and Integration process
hello, I have 2 questions about Integration : first, can I assigned a Business Process to an other system than XI. For example, I have a R/3, a SAP CRM and XI between the 2. Can I assigned a BP to R/3 or CRM ? second, How BP works during runtime. On
-
I tried downloading AND RUNNING the upgrader and I'm stuck in an infinite loop. After running the upgrader from the utilities folder, it looks like things are working. Then a window pops up asking me to launch iphoto to complete the upgrade. After
-
Hi Guys I am new to SAP BW. I am trying to schedule an initial load but I end up getting the following error message. This is an extract from the dump. call function 'RSAN_LOGSYS_DETERMINE' destination g_dest exporting i_cli