on 08-16-2010 12:45 PM
Hi all,
I have designed a PDF file in tcode: SFP in order to take into account a table of data ..
In the other side of my WEBDYNPRO application i display this table data in an ALV
and what i want is :
When the user clik on a button, i want to automate the download of
this file :(with taking into account its template + DATA issues from the ALV) .
otherwise : to display the pop up of downloading the PDF file
I do not want to navigate to an other VIEW that contain an interractive form which contain the template of the PDF
So please if you have any idea, that will be helpful
Best regards
This is easy. Create a printing program or copy one from a testing report like FP_TEST_00. If you check the importing parameters of the FMs used there, one of the structure has element GETPDF which you need to check TRUE (I mean 'X'). Then you will get the PDF data back as data stream, no printing or previewing will occur. Use PDF parameter of another structure (search a little, there are not many of the structures involved in the coding) called PDF to get the actual data stream. Send this stream back to the WD and create a request content from this data there. Like when you return any other file.
I am sure there are plenty of examples.
Regards Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
FUNCTION z_yourname.
IMPORTING
*" VALUE(GET_PDF) TYPE CHAR1 DEFAULT SPACE
EXPORTING
*" VALUE(PDF_STREAM) TYPE FPCONTENT
DATA fp_outputparams TYPE sfpoutputparams.
fp_outputparams-getpdf = get_pdf.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
DATA fp_form_out TYPE fpformoutput.
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = lv_sfpdocparams
zzdata = data
IMPORTING
/1bcdwb/formoutput = fp_form_out
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
formatting_error = 4
send_error = 5
user_canceled = 6
OTHERS = 7.
pdf_stream = fp_form_out-pdf.
regards Otto
and in WD use CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE( ). Otto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It solved now !
Thank you Otto .
1) note the execution FP_FUNCTION_MODULE_NAME and pass the form name to it. The parameter e_funcname will contain the name of the generated function module name fm_name.
2) call function 'FP_JOB_OPEN'
changing
ie_outputparams = fp_outputparams
exceptions
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
others = 5.
3) call function fm_name
exporting
/1bcdwb/docparams = fp_docparams " not obligatory
Z_DATA = wa_vndbnk " check the fm_name parametters
importing
/1BCDWB/FORMOUTPUT = fp_formoutput
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
4) Close spool job
call function 'FP_JOB_CLOSE'
exceptions
usage_error = 1
system_error = 2
internal_error = 3
others = 4.
5) finally call
DATA pdf_stream TYPE fpcontent.
pdf_stream = fp_form_out-pdf.
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'PDF.pdf'
i_content = pdf_stream
i_mime_type = '/Desktop').
Hi Otto
Please i have an additional Question related to the same subject.
Can we generate 2 documents :
fp_form_out1 TYPE fpformoutput
fp_form_out2 TYPE fpformoutput
and concatenate both fp_form_out1-PDF fp_form_ou2-PDF in a variable :
DATA pdf_stream TYPE fpcontent.
In order to have 2 independant letters in the same PDF file (if it s possible) .
Is it possible ? if so how can we concatenate them in order to have two letters in the same PDF file
Thank you for your help .. i'm stuck on this
Best regards
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.