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

how to display the data in PDF format : problem is splitting into 2 lines

Hi ,

I developed one report which downloads the data into PDF format and saved in C drive but my problem is

in my program : Line size of the report is 255 in PDF it is splitting into 2 lines. it has to show in a single line. how to do it. how to reduce the width of the output? i am sending my code below. anybody can suggest me how to do it. if possible please send me the code.

my code:

report zmaheedhar.

  • maheedhar-start

TABLES : vbak.

parameters : p_vbeln type vbak-vbeln.

data : begin of itab occurs 0,

vbeln type vbak-vbeln,

ERDAT type vbak-erdat,

ERZET type vbak-erzet,

ERNAM type vbak-ernam,

ANGDT type vbak-angdt,

BNDDT type vbak-bnddt,

AUDAT type vbak-audat,

VBTYP type vbak-vbtyp,

TRVOG type vbak-trvog,

AUART type vbak-auart,

AUGRU type vbak-augru,

GWLDT type vbak-gwldt,

SUBMI type vbak-submi,

LIFSK type vbak-lifsk,

FAKSK type vbak-faksk,

NETWR type vbak-netwr,

WAERK type vbak-waerk,

VKORG type vbak-vkorg,

end of itab.

  • maheedhar-end

DATA: pripar TYPE pri_params,

arcpar TYPE arc_params,

lay TYPE pri_params-paart,

lines TYPE pri_params-linct,

rows TYPE pri_params-linsz.

DATA: val(1), val1(1).

*---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer

DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.

DATA: name TYPE pri_params-plist VALUE 'Testing'.

DATA: i_pdf TYPE STANDARD TABLE OF tline.

DATA: spono TYPE tsp01-rqident.

  • maheedhar-start

top-of-page.

write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',

'Date','Document Date','SD document category','Transaction group','Sales Document Type',

'Order reason'.

start-OF-SELECTION.

select vbeln ERDAT ERZET ERNAM ANGDT BNDDT AUDAT

VBTYP TRVOG AUART AUGRU GWLDT SUBMI LIFSK

FAKSK NETWR WAERK VKORG from vbak

into table itab

where vbeln = p_vbeln.

  • maheedhar-end

--- Retreive local printer details

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

destination = dest

no_dialog = 'X'

immediately = ' '

IMPORTING

out_archive_parameters = arcpar

out_parameters = pripar

valid = val

valid_for_spool_creation = val1

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

*-- Set Spool printer details w.r.t local printer

pripar-prdsn = 'DSN'.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

in_archive_parameters = arcpar

in_parameters = pripar

no_dialog = 'X'

list_name = name

IMPORTING

out_archive_parameters = arcpar

out_parameters = pripar

valid = val

valid_for_spool_creation = val1

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

IF sy-subrc EQ 0.

  • ---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen

NEW-PAGE PRINT ON

NEW-SECTION

PARAMETERS pripar

ARCHIVE PARAMETERS arcpar

NO DIALOG.

ELSE.

WRITE:/ 'Unable to create spool'.

ENDIF.

*--- Output statements

*WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.

*WRITE:/ 'Second Line'.

LOOP at itab.

write: itab-vbeln,

itab-ERDAT,

itab-ERZET,

itab-ERNAM,

itab-ANGDT,

itab-BNDDT,

itab-AUDAT,

itab-VBTYP.

ENDLOOP.

"---> Close spool

NEW-PAGE PRINT OFF.

spono = sy-spono.

  • Convert ABAP Spool to PDF

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = spono

no_dialog = 'X'

TABLES

pdf = i_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 PDF contents to presentation server

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'c:\test.pdf'

filetype = 'BIN'

TABLES

data_tab = i_pdf

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.

thanks,

maheedhar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 17, 2008 at 10:59 AM

    Hi Maheedhar!

    Tripat here.

    After your FM call for 'GET_PRINT_PARAMETERS' , check the value of your PRIPAR structure, it has a field called PAART, change that value to 'X_65_255' and it will give PDF in landscape format, please check and verify.

    Reward points if useful, get back in case of query...

    Cheers!!!

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Firstly, in your REPORT statement add LINE-SIZE 255 and check.

      if it doesn't help then there is a table TSP1D, see all the values in that table for field PAPART, now you have to Hit and Try and i hope one of these values similar to 'X_65_255', i hope this will fullfill your requirement.

      If helpful please reward.

      Tripat!!!

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.