cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert an alv report to PDF format?

Former Member
0 Kudos

Hi all,

I'm wondering, is it possible to convert an alv report to pdf format without using a spool no?

Thanks for your attention.

Accepted Solutions (0)

Answers (2)

Answers (2)

Aashish28
Contributor
0 Kudos
Former Member
0 Kudos

I read all documents, but it's not what i need, i don't want to use printing settings.

Actually my idea is to put a new button as 'PDF' . When i push the button, firstly it should ask where will be the file saved and then it will do the action which is converting the pdf from alv.

Former Member
0 Kudos

Hey,

Just create a PDF Button in the Menu Bar . Then write the coding as per your requirement and calll the function module GUI_DOWNLOAD.

Before this your alv final output internal table should be populated.

Thanks,

Pradeep.

Former Member
0 Kudos

it's good idea, but when i do this, adobe can't open the file.

Former Member
0 Kudos

Okay.. What is the error about . " File cannot be open due to corrupted" Similar like this ?

Former Member
0 Kudos

actually, i think it doesn't convert the alv to pdf, so it can't open that. The error is like this.

"Adobe Reader could not open 'xxx.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."

Former Member
0 Kudos

Send your code

Former Member
0 Kudos

FORM pc_download TABLES it_data

                 USING  e_filename LIKE rlgrap-filename.


  CLEAR e_filename.                                         "hah074648

* FB mit Eingabe-Popup

  DATA ld_title TYPE string.

  DATA ld_fullpath TYPE string.

  DATA ld_dummy TYPE string.


  ld_title = text-001.

  CLEAR e_filename.

* FB mit Eingabe-Popup

  CALL METHOD cl_gui_frontend_services=>file_save_dialog

    EXPORTING

      window_title      = ld_title

*     default_extension = '*.txt'

      default_file_name = '*.pdf'

    CHANGING

      filename          = ld_dummy

      path              = ld_dummy

      fullpath          = ld_fullpath.

  e_filename = ld_fullpath.

  CALL FUNCTION 'GUI_DOWNLOAD'

    EXPORTING

*     BIN_FILESIZE                  =

      filename                      = ld_fullpath

*     FILETYPE                      = 'ASC'

*     APPEND                        = ' '

*     WRITE_FIELD_SEPARATOR         = ' '

*     HEADER                        = '00'

*     TRUNC_TRAILING_BLANKS         = ' '

*     WRITE_LF                      = 'X'

*     COL_SELECT                    = ' '

*     COL_SELECT_MASK               = ' '

      codepage                      = '1101'                "mix772413

*   IMPORTING

*     FILELENGTH                    =

    TABLES

      data_tab                      = it_data

   EXCEPTIONS

     file_write_error              = 1

     no_batch                      = 2

     gui_refuse_filetransfer       = 3

     invalid_type                  = 4

     no_authority                  = 5

     unknown_error                 = 6

     header_not_allowed            = 7

     separator_not_allowed         = 8

     filesize_not_allowed          = 9

     header_too_long               = 10

     dp_error_create               = 11

     dp_error_send                 = 12

     dp_error_write                = 13

     unknown_dp_error              = 14

     access_denied                 = 15

     dp_out_of_memory              = 16

     disk_full                     = 17

     dp_timeout                    = 18

     file_not_found                = 19

     dataprovider_exception        = 20

     control_flush_error           = 21

     OTHERS                        = 22.

ENDFORM.                    "pc_download

Former Member
0 Kudos

Hi ,

can you please send the whole program because i need the declaration part also.

Former Member
0 Kudos

Hi Ghan,

Try ,

Execute the ALV Report.

In left corner .

LIST --> EXPORT --> LOCAL FILE--> PATH & FILE TYPE.

Thanks,

Pradeep.