Application Development and Automation 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: 
Read only

Blank lines between data when Converting Spool to Pdf

Former Member
0 Likes
1,299

Hi Everyone,

When I convert Spool to Pdf, I get some additional blank line between each line containing data.

But these blank lines are not present in the spool.

Could anyone tell me the reason for the same and how to resolve it as I don't need these blank lines in Pdf.

Thanks

9 REPLIES 9
Read only

former_member215575
Active Participant
0 Likes
1,266

Hi Kush,

Let us know, How are you converting spool to PDF? Using custom logic calling function modules or calling standard programs(like RSTXPDFT4) ?

Regards,

Sravan Guduru

Read only

0 Likes
1,266

Hi Sravan,

I am creating Spool using NEW-PAGE PRINT ON NO DIALOG PARAMETERS l_params and then passing the spool number in FM CONVERT_ABAPSPOOLJOB_2_PDF. To get print parameters am using FM GET_PRINT_PARAMETERS.

Regards,

Kush

Read only

0 Likes
1,266

Hi Sharma,

        Can i know , how to get the spool id dynamically to get form in pdf using  SUBMIT RSTXPDFT4 ?

Read only

0 Likes
1,266

In the above code, after getting spool no. & preparing file name, call program RSTXPDFT4 and see how the PDF is.

Read only

0 Likes
1,266

Hi Sravan,

     Yes I can get the pdf. But I need to give the spool id manually. What can i do set spool id as dynamically. Can you see my codings in thread..

http://scn.sap.com/thread/3277195

Thanks..

Read only

0 Likes
1,266

Hi Sravan,

I used the spool number generated from SP01 and passed it externally to RSTXPDF4 in se38 but I am still getting the same result.

Regards,

Kush

Read only

VijayCR
Active Contributor
0 Likes
1,266

Can you paste the entire code?Please.

Read only

Former Member
0 Likes
1,266

Hi Vijay,

Please find the code below:

   * Get Print parameters
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
    EXPORTING
      immediately    = ''
      no_dialog      = c_x
      release        = ''
    IMPORTING
      out_parameters = l_params
      valid          = l_valid.

  NEW-PAGE PRINT ON NO DIALOG PARAMETERS l_params.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program = sy-repid
      is_layout          = w_layout
      it_fieldcat        = t_fieldcat
      it_events          = t_events_list
      is_print           = w_print
    TABLES
      t_outtab           = t_final_table
    EXCEPTIONS
      program_error      = 1
      OTHERS             = 2.

  NEW-PAGE PRINT OFF.

* Save Spool Number in local variable
  g_spool_nr = sy-spono.

* Prepare File name
  CONCATENATE c_file
              c_dash
              sy-datum
              sy-uzeit
         INTO l_filename.

* Pop up to save file
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      default_extension = c_ext
      default_file_name = l_filename
      initial_directory = c_dir
    CHANGING
      filename          = l_filename
      path              = l_path
      fullpath          = l_fullpath
      user_action       = l_result.

  IF l_result EQ 0.
* Convert Spool to Pdf
    CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = g_spool_nr
        no_dialog                = space
      IMPORTING
        pdf_bytecount            = l_bytecount
      TABLES
        pdf                      = lt_line
      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 EQ 0.
* Download Pdf File
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = l_fullpath
          filetype                = c_bin
        TABLES
          data_tab                = lt_line
        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.
      IF sy-subrc EQ 0.
*        MESSAGE s002.
      ELSE.
*        MESSAGE s003 DISPLAY LIKE c_e.
      ENDIF.
    ENDIF.
  ELSE.
*    MESSAGE s004.
  ENDIF.

Regards,

Kush

Read only

0 Likes
1,266

check this link http://scn.sap.com/message/9328383 it is not exactly the same as your requirement but do talk about formatting and fonts in pdf... hope this helps..