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: 

PDF truncation using CONVERT_ABAPSPOOLJOB_2_PDF

venu_001
Participant
0 Kudos

Hi All,

I am facing a problem in PDF conversion, i have a custom program which converts spool to PDF and writes to server using CONVERT_ABAPSPOOLJOB_2_PDF. when i download loaded pdf file from server the file is truncated and also font size is increased than previous.

it was working fine previously, from past few days it's getting truncated and reported to be font size is increased. from program side there are no recent changes. below is the code.

  if lv_otf is initial .

    call function 'CONVERT_ABAPSPOOLJOB_2_PDF'

      exporting

        src_spoolid              = lv_spool

        get_size_from_format     = 'X'

        pdf_destination          = 'X'

      importing

        bin_file                 = lv_pdf

  else.

     call function 'CONVERT_OTFSPOOLJOB_2_PDF'

      exporting

        src_spoolid              = lv_spool

        no_dialog                = ' '

        pdf_destination          = 'X'

      importing

        bin_file                 = lv_pdf

   endif.

*** Converting XString format to SOLIX format ----

    lt_pdf = cl_document_bcs=>xstring_to_solix( lv_pdf ).

  open dataset lv_fname for output in binary mode .

  if sy-subrc = 0.

    loop at lt_pdf into ls_pdf.

      transfer ls_pdf to pv_fname.

    endloop.

    close dataset lv_fname .

  endif.

I am not able to get any clue, please help.

Regards,

shiva.

10 REPLIES 10

0 Kudos

I wonder what could be the reason to convert to XSTRING format.

Use the internal table LV_PDF instead of LT_PDF.


OPEN DATASET lv_fname FOR OUTPUT IN BINARY MODE  .   

IF  sy-subrc = 0 .    

LOOP AT lv_pdf .     

TRANSFER lv_pdf TO lv_fname .     

ENDLOOP.    

CLOSE DATASET lv_fname .   

ELSE.    

WRITE : / 'operating system could not open file' . 

ENDIF.

0 Kudos

You may need to convert it from 132-long string to 255-long strings

In this case we attach for e-mail using    'SO_DOCUMENT_SEND_API1'

See sample code:

DATA: t_msg_att  TYPE STANDARD TABLE OF solisti1 WITH HEADER LINE,
      l_spono LIKE tsp01-rqident,
      t_pdf   LIKE tline OCCURS 0 WITH HEADER LINE,
      l_buff  TYPE string.

* Transfer the 132-long strings to 255-long strings
LOOP AT t_pdf.

* in order to preserve spaces
  TRANSLATE t_pdf USING ' ~'.
  CONCATENATE l_buff t_pdf INTO l_buff.
ENDLOOP.

TRANSLATE l_buff USING '~ '.

DO.
  t_msg_att = l_buff.
  APPEND t_msg_att.
  SHIFT l_buff LEFT BY 255 PLACES.
  IF l_buff IS INITIAL.
    EXIT.
  ENDIF.
ENDDO.

0 Kudos

Hi Thanks  for reply,

It was working previously for same report output, even currently working in other systems except prod system.

From program side there are no recent changes.

Thanks.

0 Kudos

1) Please check if lv_spool:

lv_spool = sy-spono.

2)

Because data is diffenrent it may not working in PRD and working in DEV.

please try the same file in DEV and check.

you may need to convert it to 255-long please see my post or the post of our friend Kiran

Former Member
0 Kudos

Hi Shiva,

tline format will be coverted as 255 char format ! so that OBJbin will compressed!

  CALL FUNCTION 'QCE1_CONVERT'

    TABLES

      t_source_tab         = lv_pdf

      t_target_tab         = objbin

    EXCEPTIONS

      convert_not_possible = 1

      OTHERS               = 2.

Lokeshchemiti
Explorer
0 Kudos

Hi shiva ,

As you said ,the output was working fine previously, from past few days it's getting truncated and font size is increased and mainly from program side there are no recent changes.then,

Check with Your basis team whether any changes(increasing support packages or change in printer settings ,--) has been done in the system recently .

Regards ,

Lokesh

0 Kudos

Hi All,

When i check the output in prod system, it is truncated at exactly at 255 characters. but in dev looks ok. any clue?

Regards.

0 Kudos

Hi Shiva ,

check the following notes ,and also confirm with your basis team whether your DEV & PRD system's environment is same .

521978 - ALI lists with more than 255 characters are truncated


186603 - Spool list width always 255 in further processing


Regards,

Lokesh

0 Kudos

Hi All,

Thanks for your valuable inputs.

All the while it was printing with full width but recently started truncating. In SPAD there are no setting changes recently.

Even there is no chance of changing default format by login to that id because it's not for login and just for giving in for batch job while scheduling job.

it's started happening in prod system only, all other systems are ok and SPAD settings same for all systems.

Former Member
0 Kudos

Shiva,

Some months back I also faced this type of problem i.e. font size and value truncate.

Just check you changed any fields recently. I was facing this problem because one of our ABAPer changed the field length. Then I changed the field again and it worked fine.

quality(13)   TYPE c.


Earlier it was

quality   TYPE ausp-atwrt.


you just please check this thing.


Regards


Vivek