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: 

Print form in PDF

Former Member
0 Kudos

Hi experts. I have a task with prd form. I need to display data in the pdf form. But I don't know the number of columns, it will be depend on the data. It can be 10 or 20, I don't know. Each page have to have header and footer with number of page. Do you know how to realize this task.

15 REPLIES 15

FredericGirod
Active Contributor
0 Kudos

Hi,

do you need to print a form or do you need to have a result of a report in PDF ?

regards

Fred

0 Kudos

report in PDF

0 Kudos

Try searching with a search term ' Convert internal table to PDF in sap'. Kindly search in SCN before you raise a question.

Regards,

Siva

0 Kudos

For me you have to separate two points

-> dynamic table

-> PDF

there is a lot of doc about dynamic table

PDF, you just have to print the result of your report, and convert the OTF into PDF using function CONVERT_OTF_2_PDF Like in program RSTXPDFT4

you could also,  call a report and catch the result using :

Call the report and catch the result


* Perform the program and export the restult in memory.
  
SUBMIT (p_prog) VIA SELECTION-SCREEN AND RETURN EXPORTING LIST TO MEMORY.

This command will call the selection screen of the report, and get the result in memory, you will not see the result in the screen.

* Catch the memory of the report result.
   CALL FUNCTION 'LIST_FROM_MEMORY'
     TABLES
       listobject = it_listobj
     EXCEPTIONS
       not_found  = 1
       OTHERS     = 2.





Former Member
0 Kudos

it's not suit for me, because I have display in special form with header and footer on each page

0 Kudos

So, use Smartforms, but I'm not sure you could do something dynamic in smartforms ..

0 Kudos

You can use events TOP_OF_PAGE  and END OF PAGE, which will get triggered when a spool is generated from list display or grid display.

Regards,

Siva      

0 Kudos

I've created web dynpro application with the table. Now I need it to output into pdf in a special form. I can attach this form if will require

VijayaKrishnaG
Active Contributor
0 Kudos

Hi,

Develop a classical report with Header and Footer (Top of page, End of page) and then convert that into PDF form and download it.

Follow this link to know 'How to convert Report into PDF'.  http://scn.sap.com/community/abap/blog/2012/03/28/convertdownload-abap-report-to-pdf

Regards,

Vijay

0 Kudos

I've created web dynpro application with the table. Now I need it to output into pdf in a special form. I can attach this form if will require

0 Kudos

hello fedor..

If You want to create a pdf file of your code..then its help you..

so, shift+p is your shortcut key to save your code into a pdf file

Regards

Niraj Sinha

0 Kudos

I don't want to create a pdf file of my code. I want to output data from report in pdf file.

Former Member
0 Kudos

You can output your report into a spool then capture the spool and convert it to a pdf file which you can download.  Please see code below.

*-- Setup the Print Parmaters

  call function 'GET_PRINT_PARAMETERS'

    exporting

     authority              = space

      copies                 = '1'

     cover_page             = space

     data_set               = space

     department             = space

     destination            = space

      expiration             = '1'

     immediately            = space

     in_archive_parameters  = space

     in_parameters          = space

     layout                 = space

     mode                   = space

      new_list_id            = 'X'

      no_dialog              = 'X'

      user                   = sy-uname

    importing

      out_parameters         = mstr_print_parms

      valid                  = mc_valid

    exceptions

      archive_info_not_found = 1

      invalid_print_params   = 2

      invalid_archive_params = 3

      others                 = 4.

  submit (p_repid) to sap-spool without spool dynpro

                   spool parameters mstr_print_parms

                   via selection-screen

                   and return.

*-- Find out the spool number

  perform get_spool_number using sy-repid

             sy-uname

    changing mi_rqident.

*-- Convert Spool to PDF

  call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

    exporting

      src_spoolid              = mi_rqident

      no_dialog                = space

      dst_device               = mstr_print_parms-pdest

    importing

      pdf_bytecount            = mi_bytecount

    tables

      pdf                      = mtab_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.

*-- Download the file

  call function 'DOWNLOAD'

    exporting

      bin_filesize = mi_bytecount

      filename     = mc_filename

      filetype     = 'BIN'

    importing

      act_filename = mc_filename

    tables

      data_tab     = mtab_pdf.

0 Kudos

I also need to put the picture in PDF file.

Former Member
0 Kudos

This message was moderated.