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: 

error in getting job_output_info-otfdata

Former Member
0 Kudos

hi experts,

i am developing the code to convert smartform into PDF after output,

to convert i need otfdata from FM but am not getting any data from job_output_info-otfdata

can any one please suggest on this

data:st_job_output_info TYPE ssfcrescl OCCURS 100 WITH HEADER LINE.

control-getotf = 'X'.

CALL FUNCTION fm_name

EXPORTING

control_parameters = control

output_options = output

user_settings = 'X'

IMPORTING

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_job_output_options

TABLES

gtbl_disdoc = gtbl_disdoc

gtbl_cust = gtbl_cust

gtbl_townadd = gtbl_townadd

EXCEPTIONS formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • error handling

ENDIF.

t_otf[] = st_job_output_info-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

  • MAX_LINEWIDTH = 132

IMPORTING

BIN_FILESIZE = v_bin_filesize

TABLES

otf = t_otf "st_job_output_info-otfdata

lines = it_lines

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

ERR_BAD_OTF = 4

OTHERS = 5

.

IF sy-subrc <> 0.

ENDIF.

CONCATENATE 'smrt' '.pdf' p_contact '_'

wc_cpudt '_' wc_cputm

INTO w_file_name.

*

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = w_file_name

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Chen,

exept from data declaration i am pasting the whole code please look into it and kindly suggest the needful.

form ssf_open .

control-no_dialog = 'X'.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

control-device = 'PRINTER'.

output-tddest = p_spool.

output-tddataset = 'BOH'.

output-tdsuffix2 = 'HEALTH LETTR'.

call function 'SSF_GET_DEVICE_TYPE'

exporting

i_language = v_language

i_application = 'SAPDEFAULT'

importing

e_devtype = v_e_devtype.

output-tdprinter = v_e_devtype.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = p_form

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

fm_name = fm_name

exceptions

no_form = 1

no_function_module = 2

others = 3

.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

exit.

endif.

call function 'SSF_OPEN'

exporting

  • ARCHIVE_PARAMETERS =

user_settings = 'X'

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJ =

output_options = output

control_parameters = control

  • IMPORTING

  • JOB_OUTPUT_OPTIONS =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

exit.

endif.

endform. " ssf_open

&----


*& Form get_bp_name_address

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_bp_name_address .

loop at gtbl_disdoc into gstr_disdoc.

clear: gtbl_cust[], gtbl_townadd[].

clear: gc_vkont, gc_name1, gc_name2, gc_servadd, gd_actdate.

gc_vkont = gstr_disdoc-refobjkey(12).

gd_actdate = gstr_disdoc-actdate.

call function 'ZUT_GET_CCSNAME'

exporting

vkont = gc_vkont

formtype = 'U'

importing

name_line1 = gc_name1

name_line2 = gc_name2

exceptions

ca_not_found = 1

bp_not_found = 2

partner_not_found = 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 the function module for retrieving the service address

select single anlage from ever into wc_anlage

where vkonto = gc_vkont and anlage ne ''.

call function 'ZUT_ADDRESS_EXTN'

exporting

x_address_type = 'I'

x_anlage = wc_anlage

importing

y_eadrdat = gstr_servadd

exceptions

not_found = 1

others = 2.

if sy-subrc <> 0.

  • If no serice address, display blank

endif.

concatenate gstr_servadd-house_num1 gstr_servadd-street

gstr_servadd-haus_num2_vbs gstr_servadd-city1 ','

gstr_servadd-region gstr_servadd-post_code1

into gc_servadd separated by space.

translate gstr_servadd-city1 to upper case.

translate gstr_servadd-region to upper case.

gstr_cust-name1 = gc_name1.

gstr_cust-name2 = gc_name2.

gstr_cust-servadd = gc_servadd.

gstr_cust-town = gstr_servadd-city1.

translate gstr_cust-town to upper case.

gstr_cust-state = gstr_servadd-region.

translate gstr_cust-state to upper case.

gstr_cust-actdate = gd_actdate.

gstr_cust-vkont = gc_vkont.

wc_town = gstr_cust-town.

append gstr_cust to gtbl_cust.

select * from ztbl_townaddress into table gtbl_townadd

for all entries in gtbl_cust

where townid = gtbl_cust-town

and state = gtbl_cust-state

order by primary key.

  • now call the generated function module

control-getotf = 'X'.

call function fm_name

exporting

  • archive_index =

  • archive_parameters =

control_parameters = control

  • mail_appl_obj =

  • mail_recipient =

  • mail_sender =

output_options = output

user_settings = 'X'

importing

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_job_output_options

tables

gtbl_disdoc = gtbl_disdoc

gtbl_cust = gtbl_cust

gtbl_townadd = gtbl_townadd

exceptions formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

perform create_contact using fm_name.

endloop.

call function 'SSF_CLOSE'

  • IMPORTING

  • JOB_OUTPUT_INFO =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

others = 4.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

  • analyse internal error table of Smart Forms

call function 'SSF_READ_ERRORS'

importing

errortab = errtab.

if not errtab is initial.

  • add your handling

endif.

endform. "get_bp_name_address

" get_bp_name_address

&----


*& Form create_contact

&----


  • text

----


  • -->FM_NAME text

----


form create_contact using fm_name.

data: wa_contactdata type bapibcontact,

wa_return1 type bapireturn1,

wd_contact type bapibcontact_key-contact,

tbl_contactobjects type bapibcontact_object occurs 0 with header line.

data noticetext type bapibcontact_textline occurs 0 with header line.

loop at gtbl_disdoc into gstr_disdoc.

clear gc_vkont.

clear gc_gpart.

gc_vkont = gstr_disdoc-refobjkey(12).

gd_actdate = gstr_disdoc-actdate.

select single gpart from fkkmaze into gc_gpart

where vkont = gc_vkont

and mstyp = '09'.

if sy-subrc eq 0.

wa_contactdata-partner = gc_gpart .

wa_contactdata-class = 'DISC'.

wa_contactdata-activity = '0010'.

wa_contactdata-contact_date = sy-datum.

wa_contactdata-contact_time = sy-uzeit.

wa_contactdata-created_by = 'disconection done'.

wa_contactdata-text_line = 'letter send to board of health'.

tbl_contactobjects-objecttype = 'BCONTACT'.

tbl_contactobjects-objectkey = 'CustomerInformation'.

noticetext-text_line = 'Disconnection letter sent to health department'.

append noticetext.

call function 'BAPI_BCONTACT_CREATEFROMDATA'

exporting

contactdata = wa_contactdata

  • TEXT_LANGUAGE =

importing

return = wa_return1

contact = wd_contact

tables

contactobjects = tbl_contactobjects

  • CONTACTOBJECTS_WITH_ROLE =

noticetext = noticetext

  • EXTENSIONIN =

.

call function 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

if sy-subrc = 0.

"set parameter id 'BPC' field wc_contact.

perform create_pdf using fm_name wd_contact.

concatenate 'Contact' wd_contact 'created' into

wc_message separated by space.

endif.

endif.

endloop.

endform. "create_contact

&----


*& Form create_pdf

&----


  • text

----


  • -->FM_NAME text

  • -->P_CONTACT text

----


form create_pdf using fm_name p_contact.

t_otf[] = st_job_output_info-otfdata[].

call function 'CONVERT_OTF'

exporting

format = 'PDF'

  • MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 1

  • ASCII_BIDI_VIS2LOG = 'x'

  • PDF_DELETE_OTFTAB = 'x'

importing

bin_filesize = v_bin_filesize

  • BIN_FILE =

tables

otf = t_otf "st_job_output_info-otfdata

lines = it_lines

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.

*

wc_cpudt = sy-datum.

wc_cputm = sy-uzeit.

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

"MOVE v_fullpath TO w_file_name.

concatenate 'smrt' '.pdf' p_contact '_'

wc_cpudt '_' wc_cputm

into w_file_name.

*

call function 'GUI_DOWNLOAD'

exporting

bin_filesize = v_bin_filesize

filename = w_file_name

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.

perform get_phys_file_and_path using w_file_name.

open dataset w_file_name for output in binary mode.

if sy-subrc ne 0.

message e001 with 'File create error - on server'. exit.

endif.

loop at it_lines.

transfer it_lines to w_file_name.

endloop.

close dataset w_file_name.

if w_file_name is not initial.

lc_url = w_file_name.

else.

exit.

endif.

lc_contact = p_contact.

call function 'ZGOS_ATTACH_URL_TO_CONTACT'

exporting

contact = lc_contact

title = 'health letter'

url = lc_url

exceptions

not_created = 1

others = 2.

if sy-subrc ne 0.

message e001 with 'Error creating link attachment to Contact'.

endif.

commit work.

endform. "create_pdf

&----


*& Form get_phys_file_and_path

&----


  • text

----


  • -->W_FILE_NAME text

----


form get_phys_file_and_path using w_file_name.

call function 'FILE_GET_NAME_USING_PATH'

exporting

logical_path = 'ZAQ_PWB_PDF_STORAGE_FISC'

operating_system = sy-opsys

file_name = w_file_name

eleminate_blanks = 'X'

importing

file_name_with_path = w_file_name

exceptions

path_not_found = 1

missing_parameter = 2

operating_system_not_found = 3

file_system_not_found = 4

others = 5.

"IF sy-subrc <> 0.

if sy-subrc = 1.

message e001 with 'Error retrieving physical path name'.

clear w_file_name.

exit.

endif.

endform. "get_phys_file_and_path

6 REPLIES 6

Former Member
0 Kudos

Hi Santhosh,

One observation, the export parameter job_output_info should be a structure instead of a internal table as you have declared.

data:st_job_output_info TYPE ssfcrescl OCCURS 100 WITH HEADER LINE.

Although that is not the problem in this case as you have declared it with header line.

Is this exactly how you are assigning the value or are you doing a read table before this? because if you are doing a read table, then you would loose the actual value in the header line too.

t_otf[] = st_job_output_info-otfdata[].

Just to be sure you are passing X in caps right

control-getotf = 'X'

Also, make sure that the output format on the SMARTFORMS-Output Options tab is set to STANDARD

If all of the above hold good, please provide more info or post the complete code, including variable declarations.

Regards,

Chen

Former Member
0 Kudos

hi chen,

to read table,

t_otf[] = st_job_output_info-otfdata[].

yes tht is caps only.

from the FM only am not getting that otfdata..,

now where i have to check for that.

thanks in advance.

Santhosh

0 Kudos

Hi Santhosh,

now where i have to check for that.

I am not sure what you mean by the above, did you mean this part "make sure that the output format on the SMARTFORMS-Output Options tab is set to STANDARD"

If yes, then go to TCODE: SMARTFORMS and open up the smartform in concern, on the right side pane you will have two tabs, the second one will be Output Options, on this tab check if the output format is set to standard.

Like i said before if this checks out too, then post the complete code so that we can be of any help.

Regards,

Chen

Former Member
0 Kudos

Hi Chen,

exept from data declaration i am pasting the whole code please look into it and kindly suggest the needful.

form ssf_open .

control-no_dialog = 'X'.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

control-device = 'PRINTER'.

output-tddest = p_spool.

output-tddataset = 'BOH'.

output-tdsuffix2 = 'HEALTH LETTR'.

call function 'SSF_GET_DEVICE_TYPE'

exporting

i_language = v_language

i_application = 'SAPDEFAULT'

importing

e_devtype = v_e_devtype.

output-tdprinter = v_e_devtype.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = p_form

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

fm_name = fm_name

exceptions

no_form = 1

no_function_module = 2

others = 3

.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

exit.

endif.

call function 'SSF_OPEN'

exporting

  • ARCHIVE_PARAMETERS =

user_settings = 'X'

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJ =

output_options = output

control_parameters = control

  • IMPORTING

  • JOB_OUTPUT_OPTIONS =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

  • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

  • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

exit.

endif.

endform. " ssf_open

&----


*& Form get_bp_name_address

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_bp_name_address .

loop at gtbl_disdoc into gstr_disdoc.

clear: gtbl_cust[], gtbl_townadd[].

clear: gc_vkont, gc_name1, gc_name2, gc_servadd, gd_actdate.

gc_vkont = gstr_disdoc-refobjkey(12).

gd_actdate = gstr_disdoc-actdate.

call function 'ZUT_GET_CCSNAME'

exporting

vkont = gc_vkont

formtype = 'U'

importing

name_line1 = gc_name1

name_line2 = gc_name2

exceptions

ca_not_found = 1

bp_not_found = 2

partner_not_found = 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 the function module for retrieving the service address

select single anlage from ever into wc_anlage

where vkonto = gc_vkont and anlage ne ''.

call function 'ZUT_ADDRESS_EXTN'

exporting

x_address_type = 'I'

x_anlage = wc_anlage

importing

y_eadrdat = gstr_servadd

exceptions

not_found = 1

others = 2.

if sy-subrc <> 0.

  • If no serice address, display blank

endif.

concatenate gstr_servadd-house_num1 gstr_servadd-street

gstr_servadd-haus_num2_vbs gstr_servadd-city1 ','

gstr_servadd-region gstr_servadd-post_code1

into gc_servadd separated by space.

translate gstr_servadd-city1 to upper case.

translate gstr_servadd-region to upper case.

gstr_cust-name1 = gc_name1.

gstr_cust-name2 = gc_name2.

gstr_cust-servadd = gc_servadd.

gstr_cust-town = gstr_servadd-city1.

translate gstr_cust-town to upper case.

gstr_cust-state = gstr_servadd-region.

translate gstr_cust-state to upper case.

gstr_cust-actdate = gd_actdate.

gstr_cust-vkont = gc_vkont.

wc_town = gstr_cust-town.

append gstr_cust to gtbl_cust.

select * from ztbl_townaddress into table gtbl_townadd

for all entries in gtbl_cust

where townid = gtbl_cust-town

and state = gtbl_cust-state

order by primary key.

  • now call the generated function module

control-getotf = 'X'.

call function fm_name

exporting

  • archive_index =

  • archive_parameters =

control_parameters = control

  • mail_appl_obj =

  • mail_recipient =

  • mail_sender =

output_options = output

user_settings = 'X'

importing

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_job_output_options

tables

gtbl_disdoc = gtbl_disdoc

gtbl_cust = gtbl_cust

gtbl_townadd = gtbl_townadd

exceptions formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

perform create_contact using fm_name.

endloop.

call function 'SSF_CLOSE'

  • IMPORTING

  • JOB_OUTPUT_INFO =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

others = 4.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

  • analyse internal error table of Smart Forms

call function 'SSF_READ_ERRORS'

importing

errortab = errtab.

if not errtab is initial.

  • add your handling

endif.

endform. "get_bp_name_address

" get_bp_name_address

&----


*& Form create_contact

&----


  • text

----


  • -->FM_NAME text

----


form create_contact using fm_name.

data: wa_contactdata type bapibcontact,

wa_return1 type bapireturn1,

wd_contact type bapibcontact_key-contact,

tbl_contactobjects type bapibcontact_object occurs 0 with header line.

data noticetext type bapibcontact_textline occurs 0 with header line.

loop at gtbl_disdoc into gstr_disdoc.

clear gc_vkont.

clear gc_gpart.

gc_vkont = gstr_disdoc-refobjkey(12).

gd_actdate = gstr_disdoc-actdate.

select single gpart from fkkmaze into gc_gpart

where vkont = gc_vkont

and mstyp = '09'.

if sy-subrc eq 0.

wa_contactdata-partner = gc_gpart .

wa_contactdata-class = 'DISC'.

wa_contactdata-activity = '0010'.

wa_contactdata-contact_date = sy-datum.

wa_contactdata-contact_time = sy-uzeit.

wa_contactdata-created_by = 'disconection done'.

wa_contactdata-text_line = 'letter send to board of health'.

tbl_contactobjects-objecttype = 'BCONTACT'.

tbl_contactobjects-objectkey = 'CustomerInformation'.

noticetext-text_line = 'Disconnection letter sent to health department'.

append noticetext.

call function 'BAPI_BCONTACT_CREATEFROMDATA'

exporting

contactdata = wa_contactdata

  • TEXT_LANGUAGE =

importing

return = wa_return1

contact = wd_contact

tables

contactobjects = tbl_contactobjects

  • CONTACTOBJECTS_WITH_ROLE =

noticetext = noticetext

  • EXTENSIONIN =

.

call function 'BAPI_TRANSACTION_COMMIT'

  • EXPORTING

  • WAIT =

  • IMPORTING

  • RETURN =

.

if sy-subrc = 0.

"set parameter id 'BPC' field wc_contact.

perform create_pdf using fm_name wd_contact.

concatenate 'Contact' wd_contact 'created' into

wc_message separated by space.

endif.

endif.

endloop.

endform. "create_contact

&----


*& Form create_pdf

&----


  • text

----


  • -->FM_NAME text

  • -->P_CONTACT text

----


form create_pdf using fm_name p_contact.

t_otf[] = st_job_output_info-otfdata[].

call function 'CONVERT_OTF'

exporting

format = 'PDF'

  • MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 1

  • ASCII_BIDI_VIS2LOG = 'x'

  • PDF_DELETE_OTFTAB = 'x'

importing

bin_filesize = v_bin_filesize

  • BIN_FILE =

tables

otf = t_otf "st_job_output_info-otfdata

lines = it_lines

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.

*

wc_cpudt = sy-datum.

wc_cputm = sy-uzeit.

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

"MOVE v_fullpath TO w_file_name.

concatenate 'smrt' '.pdf' p_contact '_'

wc_cpudt '_' wc_cputm

into w_file_name.

*

call function 'GUI_DOWNLOAD'

exporting

bin_filesize = v_bin_filesize

filename = w_file_name

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.

perform get_phys_file_and_path using w_file_name.

open dataset w_file_name for output in binary mode.

if sy-subrc ne 0.

message e001 with 'File create error - on server'. exit.

endif.

loop at it_lines.

transfer it_lines to w_file_name.

endloop.

close dataset w_file_name.

if w_file_name is not initial.

lc_url = w_file_name.

else.

exit.

endif.

lc_contact = p_contact.

call function 'ZGOS_ATTACH_URL_TO_CONTACT'

exporting

contact = lc_contact

title = 'health letter'

url = lc_url

exceptions

not_created = 1

others = 2.

if sy-subrc ne 0.

message e001 with 'Error creating link attachment to Contact'.

endif.

commit work.

endform. "create_pdf

&----


*& Form get_phys_file_and_path

&----


  • text

----


  • -->W_FILE_NAME text

----


form get_phys_file_and_path using w_file_name.

call function 'FILE_GET_NAME_USING_PATH'

exporting

logical_path = 'ZAQ_PWB_PDF_STORAGE_FISC'

operating_system = sy-opsys

file_name = w_file_name

eleminate_blanks = 'X'

importing

file_name_with_path = w_file_name

exceptions

path_not_found = 1

missing_parameter = 2

operating_system_not_found = 3

file_system_not_found = 4

others = 5.

"IF sy-subrc <> 0.

if sy-subrc = 1.

message e001 with 'Error retrieving physical path name'.

clear w_file_name.

exit.

endif.

endform. "get_phys_file_and_path

0 Kudos

Hi Santhosh,

The code looks ok, i see that you are open_ssf and the actual call to the SF are in different sub routines, so

1) Are you sure that that control_parameters still has proper values when the SF is being called.

2) Also the SY-SUBRC value after the SF is called, is it Zero or some other value.

Could you try calling the SF like below, without SSF_OPEN and SSF_CLOSE and let me know the results.


  DATA: ssfcrescl      TYPE ssfcrescl,
        output_options TYPE ssfcresop,
        ssfcompop      TYPE ssfcompop,
        ssfctrlop      TYPE ssfctrlop,
        l_spoolid      TYPE tsp01-rqident,
        li_pdf         TYPE STANDARD TABLE OF tline.

  ssfctrlop-no_dialog = 'X'.
  ssfctrlop-device    = 'PRINTER'.
  ssfcompop-tdnewid   = 'X'.
  ssfcompop-tdimmed   = 'X'.
  ssfctrlop-preview = 'X'.
  ssfcompop-tdprinter = 'PDF1'.
  ssfcompop-tddest    = 'LP01'.
  ssfctrlop-getotf    = 'X'.

  CALL FUNCTION '/1BCDWB/SF00000024'
    EXPORTING
      control_parameters = ssfctrlop
      output_options     = ssfcompop
      user_settings      = 'X'
    IMPORTING
      job_output_info    = ssfcrescl
      job_output_options = output_options
    TABLES

      gtbl_disdoc = gtbl_disdoc 

      gtbl_cust = gtbl_cust 

      gtbl_townadd = gtbl_townadd 
    EXCEPTIONS
      formatting_error   = 1
      internal_error     = 2
      send_error         = 3
      user_canceled      = 4
      OTHERS             = 5.

  IF sy-subrc NE 0.

    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  ELSE.

    DATA: li_otf TYPE STANDARD TABLE OF itcoo,
          l_bin_size TYPE i,
          l_bin_file TYPE xstring.

    CALL FUNCTION 'CONVERT_OTF'
     EXPORTING
       format                      = 'PDF'
     IMPORTING
       bin_filesize                = l_bin_size
       bin_file                    = l_bin_file
      TABLES
        otf                         = ssfcrescl-otfdata[]
        lines                       = li_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.
    ELSE.
      bin_file = l_bin_file.
    ENDIF.

  ENDIF.

Regards,

Chen

Former Member
0 Kudos

hi Chen,

Thanks it is working now.