cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
Former Member
0 Likes

Hi Sebastian,

I've checked the lt_otf and it has no data. It's empty. I checked the "CALL FUNCTION fm_name" and in web gui and windows gui the ls_formdata-otfdata[] is empty. So lt_otf is also empty.

I also checked the pdf_data and it is also empty. The " data: pdf_data type xstring." code is direct in front of the function "CONVERT_OTF".

I tried to do my coding like this:

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0de1eb8-0b98-2910-7996-8a3c2fcf...

But if I do everything like in this PDF, I have the same problem. My Dynpro is still empty.

Thanks for your help.

Regards, Markus

Former Member
0 Likes

Ok,

we are getting nearer. So first of all, has your user a printer assigned?

Take a look at SU01.

Secondly check sy-subrc after calling the function.

The call of SSF_FUNCTION_MODULE_NAME is neccessary as you did. Calling the smartform needs to be done with the function got by this function.

Additionally set the following parameters:

ls_control_pars-no_dialog = 'X'.
ls_control_pars-langu = sy-langu.
ls_control_pars-getotf = 'X'.

call function 'SSF_GET_DEVICE_TYPE'
 exporting
   i_language = ls_control_pars-langu
 importing
  e_devtype = l_devtype.

ls_output_options-tdprinter = l_devtype.

This needs to be done before calling the smartform.

Do not forget to hand ls_output_options to your smartform after control parameters.