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,

thanks for your very good answer. I used some parameters but not all of them.

I have sy-subrc = after the "CALL FUNCTION fm_name".

But now I have some entries in the LT_OTF.

After "CALL FUNCTION 'CONVERT_OTF' " the PDF_DATA is filled, the PDF_SIZE has also a value and sy-subrc is still 0. But my popup is empty.

After "CALL FUNCTION 'CONVERT_OTF' " I have this code:


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 = `SOURCE`
      name = `PDF`
      value = pdf_data ).

Former Member
0 Likes

Ok,

getting close. Now your smartform is being generated.

So another question. Do you really have a popup (that means a new window), or a popin (in the window, graying out the background).

Showing PDF files within popins is not supported.

Try first to integrate your InteractiveForm tag within the main view.

Showing the PDF in a real popup should be done by creating a new window. But this window will have a new session.

So start easily integrating it in the same window.