cancel
Showing results for 
Search instead for 
Did you mean: 

print sapscript in pdf formatt

Former Member
0 Kudos

Hello Experts,

I have a requirement that print for sapscript should be in pdf formatt.

The output should internally be converted to pdf and printed in that formatt only.

Through FM 'CONVERT_OTF' I am able to convert sapscript output to PDF but how to print this PDF data.

Please help.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Thanx for prompt reply.

The requirement is without downloading the file in PC print is required in PDF format that's why after FM 'CLOSE_FORM' I am using FM 'CONVERT_OTF' to convert data in PDF format but how to print this PDF data at run time.

Program RSTXPDFT4 and FM GUI_DOWNLOAD saves the file in local PC which is not required.


gouravkumar64
Active Contributor
0 Kudos

Hi,

As per srinivas said it is good without coding....

In print preview time u have to generate spool.

Gourav .

former_member565026
Participant
0 Kudos

Hi Shubam,

SAP has given standard program RSTXPDFT4 , usin this  u can convert your Sapscripts

spools into a PDF format. You will get the spool number from transaction SP02

http://scn.sap.com/thread/767934

hope this will helps u

gouravkumar64
Active Contributor
0 Kudos

Hi,

Hope U done the remaining step properly.

Try like this & declare the global data properly.

  V_GUIOBJ                TYPE REF TO CL_GUI_FRONTEND_SERVICES,

  V_NAME                  TYPE STRING,

V_FILENAME              TYPE STRING.

CONCATENATE 'Payslip'  '.pdf' INTO V_NAME.

       CREATE OBJECT V_GUIOBJ.

       CALL METHOD V_GUIOBJ->FILE_SAVE_DIALOG

         EXPORTING

           DEFAULT_EXTENSION = 'pdf'

           DEFAULT_FILE_NAME = V_NAME

           FILE_FILTER       = V_FILTER

         CHANGING

           FILENAME          = V_NAME

           PATH              = V_PATH

           FULLPATH          = V_FULLPATH

           USER_ACTION       = V_UACT.

IF V_UACT = V_GUIOBJ->ACTION_CANCEL.

         EXIT.

       ENDIF.

*--- Download PDF to local PC

       MOVE V_FULLPATH TO V_FILENAME.

       CALL FUNCTION 'GUI_DOWNLOAD'

         EXPORTING

           BIN_FILESIZE            = V_BIN_FILESIZE

           FILENAME                = V_FILENAME

           FILETYPE                = 'BIN'

         TABLES

           DATA_TAB                = IT_LINES

         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.

*  ENDIF.

Regards

Gourav.