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: 

alv + pdf trunated

Former Member
0 Kudos

Hi,

i have added a specefic button ton convert by grid alv to PDF.

it's works, but my las column of alv grid is truncated in the pdf document (may it's exceed the limit)

How can i see all my alv columns in the converted pdf document.

PS:

I am using this FM:

ALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = w_spool

NO_DIALOG = 'X'

DST_DEVICE = 'LP01'

PDF_DESTINATION = 'X'

TABLES

PDF = it_pdf

Where it_pdf as:

DATA: it_pdf Type TABLE OF tline.

and tline is a structure with 2 fields:

tdformat: char 2

tdline: char 132.

is the probleme 132?

Many thanks

10 REPLIES 10

Former Member
0 Kudos

as per my understanding, its default property of a pdf.

just think can you put huge number of column in to a single A4 size paper ?

this is the reason we use excel.

venkat_o
Active Contributor
0 Kudos

Hi Abybak, <li>Try to use SX_TABLE_LINE_WIDTH_CHANGE after converting to PDF using CONVERT_ABAPSPOOLJOB_2_PDF.


   CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
      EXPORTING
        src_spoolid              = g_spool_no
        no_dialog                = ' '
      IMPORTING
        pdf_bytecount            = l_no_of_bytes
        pdf_spoolid              = l_pdf_spoolid
        btc_jobname              = l_jobname
        btc_jobcount             = l_jobcount
      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.

    CASE sy-subrc.
      WHEN 0.
      WHEN 1.
        MESSAGE s000(0k) WITH 'No ABAP Spool Job'.
        EXIT.
      WHEN 2.
        MESSAGE s000(0k) WITH 'Spool Number does not exist'.
        EXIT.
      WHEN 3.
        MESSAGE s000(0k) WITH 'No permission for spool'.
        EXIT.
      WHEN OTHERS.
        MESSAGE s000(0k)
           WITH 'Error in Function CONVERT_ABAPSPOOLJOB_2_PDF'.
        EXIT.
    ENDCASE.

    CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
      EXPORTING
        line_width_src              = 134
        line_width_dst              = 255
      TABLES
        content_in                  = i_pdf
        content_out                 = l_attachment
      EXCEPTIONS
        err_line_width_src_too_long = 1
        err_line_width_dst_too_long = 2
        err_conv_failed             = 3
        OTHERS                      = 4.
    IF sy-subrc NE 0.
      MESSAGE s000(0k) WITH 'Conversion Failed'.
      EXIT.
    ENDIF.
Thanks Venkat.O

Former Member
0 Kudos

Thanks for all,

Venkat:

is the table l_attachment has the same format of i_pdf ?

after conversion with CONVERT_ABAPSPOOLJOB_2_PDF and after your FM SX_TABLE_LINE_WIDTH_CHANGE

i am using also GUI_DOWNLOAD,

i have to pass l_attachment to this FM, no?

Many Thanks

Former Member
0 Kudos

Hi,

I have added SX_TABLE_LINE_WIDTH_CHANGE after CONVERT_ABAPSPOOLJOB_2_PDF but i have the same problem: the content (last column) of my alv is truncated in PDF document.

I think to add SX_TABLE_LINE_WIDTH_CHANGE aftre CONVERT_ABAPSPOOLJOB_2_PDF cannot solve the problem because the problem is happend before that in CONVERT_ABAPSPOOLJOB_2_PDF (in this step, the it_pdf is truncated).

any idea ?

Many thanks

0 Kudos

Hi,

The PDF generated after the FM CONVERT_ABAPSPOOLJOB_2_PDF is just like a mirror image of the spool in pdf format. Check if the spool data format is proper in SP01. If it is not, try changing the line-size to 1023 (maximum) in the report statement of the program


report ztest line-size 1023.

Regards,

Vikranth

Former Member
0 Kudos

Hi Vikranth,

In fact the spool data format is not proper in SP01, the las column of my alv grid is truncated in the spool.

i have changed line-size to 1023 but i have always the same problem.

i dont know if it's possible to cutomize the number of characters of the spool that can be displayed.

Regards

0 Kudos

Hello,

It is because of the printer formatting. You need to specify the correct format for this.

In the FM: GET_PRINT_PARAMETERS, you have the export param OUT_PARAMETERS(struc. PRI_PARAMS). You have the field PAART which should be changed to adjust the spool.

You can check in the table TSP1D for the printing format. I feel it should be X_65_255.

Just one question, how are you generating the spool ?

Plz revert back in case of any doubts.

BR,

Suhas

Edited by: Suhas Saha on Sep 30, 2009 12:08 PM

0 Kudos

Hi, Try to set Layout of the ALV like below.

DATA:wa_LAYOUT TYPE  SLIS_LAYOUT_ALV.
wa_layout-max_linesize = '1020'.
"value set: 0, 80 - 1020
"maximum list width (to change the default of 250)
"interactively-definable maximum list width setting.
"Caution: wide lists are difficult to read and to print.
Thanks Venkat.O

Former Member
0 Kudos

Hi,

Many thanks for your help,

First i have tried wa_layout-max_linesize = '1020' but there is no effect on my problem.

seocnd time i have tried the solution of "Suhas" :

I excuted FM: GET_PRINT_PARAMETERS

i found OUT_PARAMETERS-PAART = 'X_PAPER' and changed it to a given value

I have coded like this:

Data : wa_pri_params TYPE pri_params.

wa_pri_params-paart = 'X_65_80'. " I tried also 'X_65_255'

NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params . " crea spool request

PERFORM DISPLAY_ALV_LIST_FOR_PDF.

NEW-PAGE PRINT OFF. "closing spool request

But Nothing has changed my spool is always truncated comparing to the columns of my alv gris.

Best regards

0 Kudos

What is the current format settings of the output device associated with the spool? Try changing it to a output device which can hold as many as 1024 columns.

If you are on release greater than 4.6 check if your system has the output device formats SWIN and ZSWIN.