cancel
Showing results for 
Search instead for 
Did you mean: 

form in pdf format.

Former Member
0 Kudos

hi experts.

i want to have the pdf format on the local disk.....

please help me how to have the pdf format or any other format to have in local disk...

are they any funaction modules or standard programs to this.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi shyam,

<b>SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.

Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.

Please note that it is not restricted to sapsciprts spool only. Any reports in the spool can be converted using the program 'RSTXPDFT4'. </b>

1.Run the program RSTXPDFT4 in se38

2. Give the spool number and mention the directory and filename where to want to store the pdf file

3. press execute

Former Member
0 Kudos

thanks a lot srikanth......

it was really help ful to me

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Through your driver program or u want manually to change output into pdf , pls clarify.

Thanks

Former Member
0 Kudos

hi

through driver program....

i want to save the pdf format of layout in local disk.

Former Member
0 Kudos

hi shyam have u tied my solutions and the another solution given othere user ..... it will work

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

DATA: ws_ucomm LIKE sy-ucomm.

DATA: form_name TYPE rs38l_fnam.

DATA: wa_ctrlop TYPE ssfctrlop,

wa_outopt TYPE ssfcompop.

DATA: t_otfdata TYPE ssfcrescl,

t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.

DATA: w_filesize TYPE i.

DATA: w_bin_filesize TYPE i.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSMARTFORM_SWAR'"your smartform nameIMPORTING

fm_name = form_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

wa_ctrlop-getotf = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_outopt-tdnoprev = 'X'.

*Copy the generated fm from se37 and use patterns for displaying in ABAP editor.Then change the '/..../' fm to form_name and use the parameters as mentioned in addition to your smartform parameters.

CALL FUNCTION form_name

EXPORTING

control_parameters = wa_ctrlop

output_options = wa_outopt

user_settings = 'X'

IMPORTING

job_output_info = t_otfdata

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = w_bin_filesize

TABLES

otf = t_otf

lines = t_pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

bin_filesize = w_bin_filesize

  • CODEPAGE = ' '

filename = 'C:\test.PDF'

filetype = 'BIN'

IMPORTING

filelength = w_filesize

TABLES

data_tab = t_pdf_tab

EXCEPTIONS

file_open_error = 1

file_write_error = 2

invalid_filesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

OTHERS = 10

.

IF sy-subrc <> 0.

*You should include message-id in the report heading

MESSAGE i000 with 'File not downloaded succesfully'.

ELSE.

MESSAGE i000 WITH 'File Test.pdf downloaded succesfully'.

ENDIF.

Former Member
0 Kudos
  call function 'CLOSE_FORM'
    IMPORTING
      RESULT                   = result
      RDI_RESULT               = rdi
    TABLES
      OTFDATA                  = OTF_TABLE
    EXCEPTIONS
      unopened                 = 1
      bad_pageformat_for_print = 2
      others                   = 3.
  if sy-subrc <> 0.
*  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.
CALL FUNCTION 'CONVERT_OTF'
 EXPORTING
   FORMAT                      = 'PDF'
*   MAX_LINEWIDTH               = 132
*   ARCHIVE_INDEX               = ' '
*   COPYNUMBER                  = 0
*   ASCII_BIDI_VIS2LOG          = ' '
  IMPORTING
    BIN_FILESIZE                = LEN_OUT
*   BIN_FILE                    =
  TABLES
    OTF                         = otf_table
    LINES                       = pdf
* EXCEPTIONS
*   ERR_MAX_LINEWIDTH           = 1
*   ERR_FORMAT                  = 2
*   ERR_CONV_NOT_POSSIBLE       = 3
*   ERR_BAD_OTF                 = 4
*   OTHERS                      = 5
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CLEAR: FILE.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    BIN_FILESIZE                    = LEN_OUT
    FILENAME                        = 'C:/TESTING07.PDF'
    FILETYPE                        = 'BIN'
*   APPEND                          = ' '
*   WRITE_FIELD_SEPARATOR           = ' '
*   HEADER                          = '00'
*   TRUNC_TRAILING_BLANKS           = ' '
*   WRITE_LF                        = 'X'
*   COL_SELECT                      = ' '
*   COL_SELECT_MASK                 = ' '
*   DAT_MODE                        = ' '
*   CONFIRM_OVERWRITE               = ' '
*   NO_AUTH_CHECK                   = ' '
*   CODEPAGE                        = ' '
*   IGNORE_CERR                     = ABAP_TRUE
*   REPLACEMENT                     = '#'
*   WRITE_BOM                       = ' '
*   TRUNC_TRAILING_BLANKS_EOL       = 'X'
*   WK1_N_FORMAT                    = ' '
*   WK1_N_SIZE                      = ' '
*   WK1_T_FORMAT                    = ' '
*   WK1_T_SIZE                      = ' '
* IMPORTING
*   FILELENGTH                      =
  TABLES
    DATA_TAB                        = PDF
*   FIELDNAMES                      =
* 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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Regards

Prabhu

Former Member
0 Kudos

hi

in imporing of the smart form call u will get the JOB_OUTPUT_INFO.

in this u'll get the spool id.. then call the FM

****...................................PRINTING.........................

CALL FUNCTION fm_name

EXPORTING

CONTROL_PARAMETERS = P_CONTROL_PARAMETERS

OUTPUT_OPTIONS = P_OUTPUT_OPTIONS

RB_WCR = RB_WCR

IMPORTING

JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO

tables

ZBASIS_EXCEL_TRANS = FP_IT_EXCEL_TRANS.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.

****...................................CONVERT TO PDF...............

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

BIN_FILESIZE = P_BIN_FILESIZE

TABLES

OTF = P_OTF

DOCTAB_ARCHIVE = P_DOCS

LINES = P_LINES

EXCEPTIONS

ERR_CONV_NOT_POSSIBLE = 1

ERR_OTF_MC_NOENDMARKER = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

concatenate 'xxxx' '.pdf' into name.

****..................................REQUEST FILE NAME.................

create object guiobj.

call method guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = name

file_filter = filter

CHANGING

filename = name

path = path

fullpath = fullpath

user_action = uact.

if uact = guiobj->action_cancel.

exit.

endif.

move fullpath to filename.

****..................................DOWNLOAD AS FILE................

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

BIN_FILESIZE = P_BIN_FILESIZE

FILENAME = filename

FILETYPE = 'BIN'

TABLES

DATA_TAB = P_LINES

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11.

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

hi

i want to save it on local disk........

with pdf format..

Former Member
0 Kudos

REPORT yKTREE_smartform1_new .

***************************DECLARATIONS*******************************

TABLES: zKTREE_t1,sflight.

DATA: cparam TYPE ssfctrlop,

outop TYPE ssfcompop,

fm_name TYPE rs38l_fnam,

my_tabix TYPE sy-tabix,

file_size TYPE i,

bin_filesize TYPE i.

DATA: tab_otf_data TYPE ssfcrescl,

pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE,

itab LIKE TABLE OF zshail_t1 WITH HEADER LINE,

otab TYPE TABLE OF sflight WITH HEADER LINE,

tab_otf_final TYPE itcoo OCCURS 0 WITH HEADER LINE.

start-of-selection.

                                  • suppressing the dialog box****************************

outop-tddest = 'LP01'.

cparam-no_dialog = 'X'.

cparam-preview = space.

cparam-getotf = 'X'.

****************for the first smartform*******************************

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSHAIL_SMFORM2'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

SELECT my_id my_income my_name FROM zshail_t1 INTO TABLE itab.

CALL FUNCTION fm_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = cparam

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = outop

user_settings = space

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = tab_otf_data

  • JOB_OUTPUT_OPTIONS =

TABLES

it_tab = itab[]

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*********appending the otf data into the final table*********************

tab_otf_final[] = tab_otf_data-otfdata[].

*************for the second smartform************************************

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSHAIL_SMTAB'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

SELECT carrid connid fldate price FROM sflight INTO CORRESPONDING FIELDS

OF TABLE otab.

CALL FUNCTION fm_name

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = cparam

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = outop

user_settings = space

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = tab_otf_data

  • JOB_OUTPUT_OPTIONS =

TABLES

itab = otab[]

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

**removing the initial and final markers from the OTF data*********

DELETE tab_otf_data-otfdata WHERE tdprintcom = '//'.

                                  • searching for the end-of-page in OTF table************

READ TABLE tab_otf_final WITH KEY tdprintcom = 'EP'.

my_tabix = sy-tabix + 1.

                        • appending the modified OTF table to the final OTF table****

INSERT LINES OF tab_otf_data-otfdata INTO tab_otf_final INDEX my_tabix.

                        • converting OTF data into pdf data**************************

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

  • ASCII_BIDI_VIS2LOG = ' '

IMPORTING

bin_filesize = bin_filesize

  • BIN_FILE =

TABLES

otf = tab_otf_final

lines = pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

************downloading the converted PDF data to your local PC*******

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = bin_filesize

filename = 'D:\TEST.PDF'

filetype = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

IMPORTING

filelength = file_size

TABLES

data_tab = pdf_tab

  • FIELDNAMES =

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

.

hope this works.....i got this from one friend in sdn and it worked for me with small changes hope the same with u

regards,

Durgaprasad