Hello,
I have a problem with generating a PDF file with ABAP WebDynpro. I have an ALV and there I read a line. From this line I want to build a smartform which should be converted into PDF. I think my coding works. I have no syntax errors and when I debug the coding, everything looks good. I also get my popup that I want to have. But then I got an error: "File does not begin with '%PDF-'."
I look for this error here in SDN but I could not find a solution. I have also tried to do what is mentioned in note 1042424.
Can anybody helps me?
Regards, Markus
Request clarification before answering.
If you have a binary pdf (xstring), you can give an output via element "InteractiveForm".
This also supports display of common pdfs generated by smartforms.
Just unmark "enabled" in that element.
Thank you for your very quick reply.
In the view for the PDF I have the element "InteractiveForm" and I unmark "enabled".
Now I got no errors, but the popup is empty.
Here are my last rows of coding:
data: pdf_size type i,
pdf_data type xstring,
lt_otf TYPE tsfotf,
lt_pdf TYPE STANDARD TABLE OF tline.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
* max_linewidth = 132
IMPORTING
bin_filesize = pdf_size
bin_file = pdf_data
TABLES
otf = lt_otf
lines = lt_pdf
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.
data:
node_pdf type ref to if_wd_context_node,
elem_pdf type ref to if_wd_context_element,
stru_pdf type if_componentcontroller=>element_pdf ,
item_source like stru_pdf-source.
* navigate from <CONTEXT> to <PDF> via lead selection
node_pdf = wd_context->get_child_node( name = if_componentcontroller=>wdctx_changing ).
* get element via lead selection
elem_pdf = node_pdf->get_element( ).
* set single attribute
elem_pdf->set_attribute(
exporting
name = `PDF`
value = pdf_data ).
Which fields/tables should be filled that I get results in the popup?
Thanks for your help.
Regards, Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you ever generated smartforms, before.
The OTF function needs the output of your smartform in order to generate a pdf.
You need to generate your smartform like this:
data ls_control_pars type ssfctrlop.
data ls_ouput_options type ssfcompop.
data ls_output type ssfcrescl.
call function 'FUNCTION_MODULE_NAME'
exporting
control_parameters = ls_control_pars
outout_options = ls_output_options
user_settings = false
.
.
importing
job_outputinfo = ls_output
then
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filsize = l_file_size
bin_file = l_xstring
tables
otf = ls_output-otfdata
lines = lt_lines.the element lt_lines can be defined as dummy.
But this is just pseudo code. You need to have know how in generating smartforms.
Regards
Edited by: Sebastian Menger on May 14, 2008 12:00 PM
| User | Count |
|---|---|
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.