on 03-07-2008 9:42 AM
Hi techies,
I have the following issue. I need to send a mail with attachments but I can't get the mailbody output right.
I'm using FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' which works fine but I need to supply the mailtext in RAW format. My original text is a smartform.
I'm converting my Smartform (containing the mailbodytext) to RAW by outputting it to spool and converting it like this.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_RAW'
EXPORTING
format_src = 'OTF'
format_dst = 'RAW'
format_dst = 'ASCII'
CHANGING
transfer_bin = v_boolean
content_txt = i_soli_tab
content_bin = it_content_bin
objhead = it_objhead
len = v_length
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
The problem is that the output table contains the correct text but the conversion can not handle Tab's, enters etc;
The output table is filled with ##### between the text where tabs and so should be:
any suggestions?
Kind regards,
Frederik Defour
Hi,
Please have a look in the following sample Code. Here I am getting the output as per our requirement without any issues like Tab Space is appearing like ######....Do check it out thoroughly, if possible...
Process Flow
Process flow for converting smart form into raw format is divided into 3 steps as shown below.
1.Send Smart Form output to spool using the FM <ws_formname> (FM name derived from the export parameters of SSF_FUNCTION_MODULE_NAME).
//Start of Code Sample
DATA : ws_formname TYPE rs38l_fnam.
TYPES: BEGIN OF ty_script,
trans_ref LIKE eanl-anlage,
cont_ref TYPE e_edmideservprovcontractid,
trans_code TYPE char05,
trans_reason TYPE char05,
market_sect LIKE eanl-zzmktscode,
efffrm_date LIKE sy-datum,
mprn LIKE iflot-zzmprn,
mlc TYPE char01,
subbuild_no(40) TYPE c,
build_no LIKE adrc-str_suppl1,
dep_fare LIKE adrc-str_suppl3,
post_town LIKE adrc-city1,
post_code LIKE adrc-post_code1,
asset_code LIKE egerh-kombinat,
paymnt_code(2) TYPE c,
model_code LIKE equi-typbz,
manuf_code LIKE equi-herst,
year_manuf LIKE equi-baujj,
serial_no LIKE equi-sernr,
meter_code TYPE char01,
meter_mech(2) TYPE c,
meas_cap TYPE zmeasur_cap,
role_code TYPE char03,
market_name LIKE eservice-serviceid,
status TYPE char01,
END OF ty_script.
DATA: i_scriptdata TYPE STANDARD TABLE OF ty_script
WITH HEADER LINE.
DATA: wa_output_options TYPE ssfcompop,
wa_control_params TYPE ssfctrlop,
wa_spoolnum TYPE rspoid,
wa_printdata TYPE efg_strn_printdata.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Your Form Name'
IMPORTING
fm_name = ws_formname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CALL FUNCTION ws_formname
EXPORTING
control_parameters = wa_control_params
c = wa_printdata
IMPORTING
job_output_info = wa_job_output_info
TABLES
i_scriptdata_input = i_scriptdata(Your Script Data)
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
MOVE wa_job_output_info-spoolids[] TO wa_spoolids[].
READ TABLE wa_spoolids INTO wa_spoolnum INDEX 1.
IF sy-subrc = 0.
DATA :id LIKE tsp01-rqident.
MOVE wa_spoolnum TO id.
ENDIF. .
Comments-Id Contains the Spool Request for the given smart form
//End of Code Sample
2.Convert the Spool Output to OTF using the FM RSPO_RETURN_SPOOLJOB.
//Start of Code Sample
data i_soli LIKE soli occurs 0 with header line.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = id
desired_type = 'OTF'
TABLES
buffer = i_soli
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.
Comments- i_soli contains the OTF data
//End of Code Sample
3.Convert the OTF using FM SX_OBJECT_CONVERT_OTF_RAW.
DATA content_bin TYPE solix_tab.
DATA objhead TYPE soli_tab.
DATA i_soli_tab TYPE soli_tab.
DATA boolean TYPE sx_boolean.
DATA length TYPE so_obj_len.
LOOP AT i_soli.
APPEND i_soli TO i_soli_tab[].
ENDLOOP.
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_RAW'
EXPORTING
format_src = 'OTF'
format_dst = 'RAW'
CHANGING
transfer_bin = boolean
content_txt = i_soli_tab
content_bin = content_bin
objhead = objhead
len = length
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
//comments- content_bin has the data in the raw format.
Reward poins......
Thanks & Regards,
Nagesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I was looking into your example as i need something like that.
The issue i am having is that the outout from my smartform (job_output_info-spoolids-spoolids) is empty. It has no value. But my job_output_info-otfdata does have value.
So how would i make my smartform to return value in spoolids field?
Thanks
Where you able to solve this problem? I am having the same issue.
I need the smartform otf output, which is in tline into rawstring pdf format. If you found the solution please do share.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.