Skip to Content
author's profile photo Former Member
Former Member

ABAP WebDynpro Table Export to PDF File

Dear all,

I would like to export some data from ABAP WebDynpro standard Table (Not ALV and it will not be implemented with ALV) to PDF File.

Do you have any ideas how to achieve this? I searched for this subject on sap scn forum, but I found only solutions with ABAP WebDynpro ALV, but we have quite complex output table so we don't want to implement it in such way. I need some Function Module to convert data from internal table to PDF file to be opened ('Downloaded').

Best Regards

Vladislav

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • Best Answer
    Posted on Sep 09, 2013 at 02:57 PM

    Hi,

    my solution is not really beautiful ..

    Create a Smartforms, and ask your smartforms to convert in PDF

    --> Call a smartforms in webdynpro : http://www.zbalai.com/_abap/content/420_web_dynpro_for_abap_tips_and_tricks/Web_Dynpro_for_ABAP_Tips_and_Tricks_V07.pdf

    I'm sure you will find example to convert OTF to PDF 😉

    regards

    Fred

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2013 at 05:29 AM

    Hi,

    You can create an ADOBE Form from your context itself directly and use the ADOBE Interactive Form component in WDA to open the form.

    Later the form can be used in any way... View / Save / Print / download ..... 😊

    Lot of reference can be found on google...

    SAPTechnical.COM - Demo scenario on Adobe Interactive Forms using ABAP WebDynpro

    Regards

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2013 at 05:54 AM

    Hello,

    Create a smart form with all format(means table, header, paragraph using different style) you want to show in your PDF. and then it will give a FM name use that FM to generate the PDF with same data.

    <Link farm removed>

    .. Chans... 😊

    Message was edited by: Suhas Saha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2013 at 05:17 AM

    Hi,

    Could you please try with below code and let me know.

    DATA lo_nd_spool_input TYPE REF TO if_wd_context_node.

    DATA lo_el_spool_input TYPE REF TO if_wd_context_element.

    DATA ls_spool_input TYPE wd_this->element_spool_input.

    DATA lv_spool_id TYPE wd_this->element_spool_input-spool_id.

    lo_nd_spool_input = wd_context->get_child_node( name = wd_this->wdctx_spool_input ).

    lo_el_spool_input = lo_nd_spool_input->get_element( ).

    lo_el_spool_input->get_attribute(

    EXPORTING

    name = `SPOOL_ID`

    IMPORTING

    value = lv_spool_id ).

    data pdf_bytecount type i.

    data pdf type STANDARD TABLE OF tline.

    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

    EXPORTING

    src_spoolid = lv_spool_id

    * NO_DIALOG = NO_DIALOG

    * DST_DEVICE = DST_DEVICE

    * PDF_DESTINATION = PDF_DESTINATION

    IMPORTING

    PDF_BYTECOUNT = PDF_BYTECOUNT

    * PDF_SPOOLID = PDF_SPOOLID

    * LIST_PAGECOUNT = LIST_PAGECOUNT

    * BTC_JOBNAME = BTC_JOBNAME

    * BTC_JOBCOUNT = BTC_JOBCOUNT

    TABLES

    PDF = 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 <> 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    data x_pdf type xstring.

    data output type string.

    data itab LIKE LINE OF pdf.

    LOOP AT pdf INTO itab .

    TRANSLATE itab USING ' ~'.

    CONCATENATE output itab INTO output IN CHARACTER MODE.

    ENDLOOP.

    TRANSLATE output USING '~ ' .

    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

    EXPORTING

    text = output

    * MIMETYPE = ' '

    * ENCODING = ENCODING

    IMPORTING

    BUFFER = x_pdf

    * EXCEPTIONS

    * FAILED = 1

    * OTHERS = 2

    .

    IF sy-subrc <> 0.

    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

    ENDIF.

    cl_wd_runtime_services=>attach_file_to_response(

    i_filename = 'table_data.pdf'

    i_content = x_pdf

    i_mime_type = 'application/pdf'

    * i_in_new_window = ABAP_FALSE

    * i_inplace = ABAP_FALSE

    ).

    Best Regards,

    Abirami

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 10, 2013 at 05:28 AM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 10, 2013 at 07:21 AM

    Hello,

    Thanks for your answers!

    We have already Excel output (XML File) export from WD Table, can I use it to export somehow as PDF File?

    Best Regards

    Vladislav

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.