Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

PDF output

former_member553808
Participant
0 Kudos

Hi,

I have a requirement where in the data which is in a database table( eg. All entries of PA0001) has to be displayed in the form of a PDF when I execute the program.

The layout in the PDF file should be similar to the table contents in SE16 - i.e. Heading, all columns seperated by lines.

I donot want to send the data to spool.

Please provide me the logic.

Regards,

Kiran

Edited by: Kiran KN on Jun 17, 2010 10:28 AM

5 REPLIES 5

satyajit_mohapatra
Active Contributor
0 Kudos

Have you tried the Adobe forms?

0 Kudos

No, I am not aware of that. Actually, I donot need any interaction, only data has to de displayed in the form of a table in PDF file on executing the rpogram.

Can you provide more few more inputs into that.

satyajit_mohapatra
Active Contributor
0 Kudos

As per my understanding, you need to display a PDF document inplace in your report. I'm not sure whether, PDF can be displayed Inplace using BDS or any other DOI classes. But, it can be easily done using Adobe forms.

JerryWang
Advisor
Advisor
0 Kudos

Hello friend,

actually there are lots of approach which can meet with your requirement.

1. using ADS to generate PDF and display it

Can you please check if the demo program FP_PDF_TEST_01 exists in your system? this is a very simple example which tells you how to use ADS to generate PDF.

INITIALIZATION.
  MOVE cl_fp=>get_ads_connection( ) TO p_dest.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_xfd.
  PERFORM value_help_for_file USING 'XML' CHANGING p_xfd.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_xft.
  PERFORM value_help_for_file USING 'XDP' CHANGING p_xft.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dest.
  PERFORM value_help_for_destination USING 'P_DEST'.

START-OF-SELECTION.
  PERFORM load_file USING p_xfd CHANGING l_xfd.
  PERFORM load_file USING p_xft CHANGING l_xft.

* Get FP reference.
  l_fp = cl_fp=>get_reference( ).

  TRY.
* Create PDF Object.
      l_pdfobj = l_fp->create_pdf_object( connection = p_dest ).

* Set template.
      l_locale = p_loc.
      l_pdfobj->set_template( xftdata  = l_xft
                              fillable = p_fill
                              locale   = l_locale ).

* Set usage rights to none if requested.
      IF p_fill = 'N'.
        l_pdfobj->set_usagerights( default_rights = abap_false ).
      ENDIF.

* Set data.
      l_pdfobj->set_data( formdata = l_xfd ).

* Tell PDF object to create PDF.
      l_pdfobj->set_task_renderpdf( tagged            = p_tagged
                                    dynamic           = p_dynami
                                    printable         = p_print
                                    changesrestricted = p_change ).

* Execute, call ADS.
      l_pdfobj->execute( ).

* Get result.
      l_pdfobj->get_pdf( IMPORTING pdfdata = pdfresult ).

0 Kudos

2. and the second approach is the most traditional one: to send your report output to spool and convert it into a PDF, there are lots of discussion regarding on this topic:

http://wiki.sdn.sap.com/wiki/display/Snippets/SaveReportOutputtoaPDFFile

http://wiki.sdn.sap.com/wiki/display/Snippets/GeneratePDFfromABAPList+Output

3. if ABAP webdynpro is acceptable from your side, you can display your output in ABAP webdynpro using ALV component, which has a built-in button "Print version", which can convert the table content into PDF automatically.

Hope it can help you a bit.

Best Regards,

Jerry