cancel
Showing results for 
Search instead for 
Did you mean: 

Smartforms->PDF->Application server (unix server)

Former Member
0 Kudos

Hi experts,

I read a lot of message about this but nothing helps me. I hope you will.

I can reach to create a pdf file with the smartforms utilitie and i can save it on my desktop (or wherever on my laptop) but when i try to create it on the unix server i have no problem but the the file is not readable (when i download it on my laptop).

Here you are code :

lt_otf TYPE STANDARD TABLE OF itcoo,

lw_us(1),

lt_lines TYPE STANDARD TABLE OF char255, "tline,

gwa_lines TYPE char1024, "tline,

st_job_output_info TYPE ssfcrescl,

st_document_output_info TYPE ssfcrespd,

st_job_output_options TYPE ssfcresop,

st_output_options TYPE ssfcompop,

st_control_parameters TYPE ssfctrlop,

lw_bin_filesize TYPE i,

lw_filename TYPE string,

lw_fm_name TYPE rs38l_fnam,

dsn TYPE string.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 255

IMPORTING

bin_filesize = lw_bin_filesize

TABLES

otf = st_job_output_info-otfdata

lines = lt_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

IF sy-subrc <> 0.

EXIT.

ENDIF.

dsn = '\usr\sap\DEV\SYS\global\TEST.pdf'.

"CONCATENATE dsn gwa_segm-segmname '.PDF' INTO dsn.

OPEN DATASET dsn FOR OUTPUT IN BINARY MODE.

IF sy-subrc <> 0.

EXIT.

ENDIF.

LOOP AT lt_lines INTO gwa_lines.

TRANSFER gwa_lines TO dsn.

ENDLOOP.

CLOSE DATASET dsn.

Many thanks.

Accepted Solutions (0)

Answers (1)

Answers (1)

kesavadas_thekkillath
Active Contributor
0 Kudos

Add this code after convert_otf


data:w_buffer    TYPE string."To convert from 132 to 255
i_record    LIKE solisti1 OCCURS 0 WITH HEADER LINE.

* Convert PDF from 132 to 255.
  LOOP AT lt_lines.
* Replacing space by ~
    TRANSLATE lt_lines USING ' ~'.
    CONCATENATE w_buffer lt_lines INTO w_buffer.
  ENDLOOP.

* Replacing ~ by space
  TRANSLATE w_buffer USING '~ '.
  DO.
    i_record = w_buffer.
* Appending 255 characters as a record
    APPEND i_record.
    SHIFT w_buffer LEFT BY 255 PLACES.
    IF w_buffer IS INITIAL.
      EXIT.
    ENDIF.
  ENDDO.

use the table i_record for final mailing.