cancel
Showing results for 
Search instead for 
Did you mean: 

convert smartform output to pdf

Former Member
0 Kudos

Hi all.

I am using CONVERT_OTF_2_PDF function to convert smartforms output in PDF format . I can convert it But after saving it does not ask for print preview or print option .

For convert smartforms output in PDF format I am using Following functions :

1. CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

2. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

3. CALL FUNCTION fm_name

4. CALL FUNCTION 'CONVERT_OTF_2_PDF'

5. CALL METHOD V_GUIOBJ->FILE_SAVE_DIALOG

6. CALL FUNCTION 'GUI_DOWNLOAD'

Please help me.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

Refer to this link....

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/convertSmartformtoPDFformat

Information "OTF end command // missing in OTF data...

Answers (1)

Answers (1)

Former Member
0 Kudos

HI,

Pass the blank value to no_dialog while passing the control_parameters structure to the

CALL FUNCTION fm_name. Now you will get the Pop-up for print option. if you pass 'X' the pop for print preview or print option will not be displayed.

Former Member
0 Kudos

Hi Avinash

If i am doing this way it gives below error.

"Output type LOCAL does not have the device type PDF1"

plz help me..

Former Member
0 Kudos

Hi,

Provide the valid value in the OutputDevice. the out put type LOCAL doesnot support for the PDF conversion.

need to pass all these parameters in the control_parameters structure..

tdprinter = valid printer name.

no_dialog = ''.

getotf = 'X'.

Edited by: avinash kodarapu on Dec 14, 2008 2:35 PM

Former Member
0 Kudos

Yes I passed all three parameters .

ST_OUTPUT_OPTIONS-TDPRINTER = V_E_DEVTYPE.

ST_CONTROL_PARAMETERS-NO_DIALOG = 'X'.

ST_CONTROL_PARAMETERS-GETOTF = 'X'.

but i am using below function is this right

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

I_LANGUAGE = V_LANGUAGE

I_APPLICATION = 'SAPDEFAULT'

IMPORTING

E_DEVTYPE = V_E_DEVTYPE.

please help me..

Former Member
0 Kudos

Hi,

Yes ..what you are doing is right.

One more thing what you can do is .....comment this code ...ST_CONTROL_PARAMETERS-GETOTF = 'X'. and pass space to ST_CONTROL_PARAMETERS-NO_DIALOG ...when you get the Pop-up screen for the Print and print priview ..click on the print privew you get the view window from the menu TEXT->Print. then the spool is generated.

Use this RSTXPDFT4 to convert the spool to PDF. If the there is any error in generating the PDF then the what ever deveice type your getting in this V_E_DEVTYPE is enable to conver to PDF....try check for the any other Device Type and test.

You can find the Device types from Tcode SPAD.

Former Member
0 Kudos

HI avinash..

If i am able to see Print preview then I am not able to save the output in PDF format..

and information seen is "OTF end command // missing in OTF data"

Plz help me...

Former Member
0 Kudos

I dont want to generate spool and save in pdf but I want to save Output of smartform in Pdf format..

Former Member
0 Kudos

check this code

ls_control_param-getotf = l_c_x. " Chk this to get otf data

call function l_v_fm_name

exporting

  • control_parameters = l_control_parameters "Smart Forms: Control structure "64417

control_parameters = ls_control_param

mail_recipient = ls_recipient

mail_sender = ls_sender "Structure for Object ID

output_options = ls_composer_param "SAP Smart Forms: Smart Composer (transfer) options

user_settings = ' '

shipment_num = shipment_num "Shipment Number

vttkvb = vttkvb "Shipment Head

tvtk = tvtk "Shipmenttype

tvtkt = tvtkt "Description Shipmenttype

ttds = ttds "Disposition

ttdst = ttdst "Description Disposition

vbpla = vbpla "Packages

num = l_v_num "Master or Individual BOL

nast = nast "Message Status

importing

job_output_info = it_job_output_info "Smart Forms: Return value at end of form printing "mod-001

tables

vttp = xvttp "Shipment Items

trlk = slk "Delivery

trlp = slp "Delivery Item

vtts = xvtts "Shipment Segments

vtsp = xvtsp "Segments/Items

vbpa = xvbpa "Partner

vbadr = xvbadr "Address

vtfa = xvtfa "Flow

vbplk = xvbplk "Shipment Unit Header

vbplp = xvbplp "Shipment Unit

vbpls = xvbpls. "Shipment Unit Sum

  • Get data in pdf format

it_itcoo = it_job_output_info-otfdata[].

if it_itcoo[] is not initial.

call function 'CONVERT_OTF'

exporting

format = 'PDF'

importing

bin_filesize = v_bin_filesize

tables

otf = it_itcoo

lines = it_tline

exceptions

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3.

if it_tline[] is not initial.

concatenate 'ABC.PDF'

into v_file.

  • Write the PDF file to above specified path in application server

open dataset v_file for output in binary mode.

if not sy-subrc is initial.

retcode = sy-subrc.

exit.

endif.

loop at it_tline.

transfer it_tline to v_file.

endloop.