Smartform in mail
Hi all,
I can send smartform as body of the mail. I want colors and fonts that i maintained in smartform to the mail.
Can any one give me the soln?
I used the sample program SF_XSF_DEMO_MAIL.
Regards,
Pon
Hi,
You can have following code for sending smarform out put as html in the body of the.
Do the changes as , <smartform name> & mail ID.
REPORT ZSENDMAIL.
Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN2 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSM_MAIL_LOGO'
IMPORTING
FM_NAME = V_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.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
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.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT I_TLINE.
move i_tline-TDLINE to i_record.
append i_record.
ENDLOOP.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
*I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
data : htm_str type string.
data : len type i,
len1 type i.
move '<html><body>' to htm_str.
loop at I_OBJBIN.
concatenate htm_str i_objbin-LINE '<br>' into htm_str.
endloop.
concatenate htm_str '<br>Thank you...</body></HTML>' into htm_str.
LEN = STRLEN( HTM_STR ).
DATA : CON TYPE I.
CLEAR CON.
CLEAR LEN1.
WHILE LEN1 LT LEN.
CON = LEN - LEN1.
IF CON LT 255.
MOVE HTM_STR+LEN1(CON) TO I_OBJBIN2-line.
APPEND I_OBJBIN2.
ELSE.
MOVE HTM_STR+LEN1(255) TO I_OBJBIN2-line.
APPEND I_OBJBIN2.
ENDIF.
LEN1 = LEN1 + 255.
ENDWHILE.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = <URMAILID>.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = WA_DOC_CHNG
document_type = 'HTM'
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
object_header =
object_content = I_OBJBIN2
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = I_RECLIST
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
Reward if it helps.
regards,
mahantesh
Similar Messages
-
Sapscript/Smartform via mail with PDF attachment: logo is missing
Hi all
I'm implementing my function to send Sapscript/smartform via mail.
I need to do it because when a message needs to be sent, I have to insert the message as attachment but also to add a text in the body mail.
So I've just created a simple sapscript having a logo (as graphic) and a little text.
I use the fm CONVERT_OTF to convert the OTF to PDF format and the following code to increase the pdf string from 132 to 255 char:
LOOP AT t_pdf.
TRANSLATE t_pdf USING ' ~'.
CONCATENATE l_buffer t_pdf INTO l_buffer.
ENDLOOP.
TRANSLATE l_buffer USING '~ '.
DO.
MOVE l_buffer TO l_attachment.
APPEND l_attachment TO x_attachment.
SHIFT l_buffer LEFT BY 255 PLACES.
IF l_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
All seem to work fine, but as soon as I open the pdf file attached to the mail I can't see the logo
So after calling fm CONVERT_OTF, I've created a pdf file by method GUI_DOWNLOAD, and then upload this file (by GUI_UPLOAD) into internal table for attachment and send the mail.
Now really all work very fine, becaus I can see the logo
Of course I don't want to dowload the file before sending a mail, but I need to send my print directly as pdf attachment
The two ways seem to be equal, they use the same print and the same functions, only the way to upload the internal table for attachment is different:
1) tha abap code above to expand the line from 132 to 255
2) the method GUI_UPLOAD
So something seems to be wrong in the first way because ithe logo is missing in the pdf attachment generated for the mail
MaxHi
I'm not working on unicode system, anyway I didn't see that parameter BIN_FILE, so I didn't use it
I've read the note 1324547 and I've done just as it explaines: now works fine
I don't know why it doesn't work with old manner (i.e data is treated as character-type), but it worls with the new one (If the data is treated as xstring-type)
I can only suppose the data are corrupted while being elaborated for expand to 255 char....but I don't why
Anyway your suggestion works for me
Thank
Max -
How to put smartform in mail body
Hi colleagues,
I would like to send a mail with content build from a SMARTFORM. I call the smartform function module and get the corresponding OTF file, but I did not succeed to put it in a readable way in the mail body.
How ot get the smartform as mail body?
My body contains this kind of data, if I do the conversion to PDF:
═䑆ⴱ⸳ഊ◢팍ਲu2030扪ഊ⽗楮䅮獩䕮捯摩湧ഊ敮摯扪ഊ㌠〠潢樍਼㰍ਥ䑥癴祰攠南䥎u2020u2020⁆潮琠䍏啒䥅删潲浡氠䱡湧⁅不ਯ呹灥 䙯湴ഊ⽓畢瑹灥 呹灥ㄍਯ䉡獥䙯湴 䍯畲楥爍ਯ乡浥 䘰〱ഊ⽅湣潤楮朠㈠〠刍ਾ㸍湤潢樍u2030扪ഊ㰼ഊ⽌敮杴栠㔠〠刍ਾ㸍ੳ瑲敡洍ਠ⽆〰ㄠㄲ⸰〠呦u2030⁂吠
㜰⸸㔠㜵㤮
and the pdf itself (I also try to attached it to the mail for test) cannot be open.
I already check a lot of thread, but cannot find any to solve this issue.
Thanks for your help.
BarbaraHi,
Refer to this link..Send an smartform as body of a mail -
Need to send the logo in smartform via mail.
Hi All,
I have smartform with the company logo uloaded. I have requirement to send the smartform with logo output via mail .
Points will be rewarded....
thanks,
mahanteshhi,
1. check if are getting the logo in the print preview, ifso
2. use the following piece of code to send the mail (by converting otf to pdf)
*For sending email
DATA:
i_otf type standard table of itcoo ,"OCCURS 0 WITH HEADER LINE,
i_tline type table of tline with header line,
i_receivers type standard table of somlreci1 ,
i_record type table of solisti1 initial size 0 with header line,
Objects to send mail.
i_objpack type table of sopcklsti1 initial size 0 with header line,
i_objtxt type table of solisti1 initial size 0 with header line,
i_objbin type table of solisti1 initial size 0 with header line,
i_reclist type table of somlreci1 initial size 0 with header line,
Work Area declarations
wa_objhead type soli_tab,
w_ctrlop type ssfctrlop,
w_compop type ssfcompop,
w_return type ssfcrescl,
wa_doc_chng type sodocchgi1,
wa_buffer type string, "To convert from 132 to 255
Variables declarations
v_len_in like sood-objlen,
v_lines_txt type i,
v_lines_bin type i.
clear v_len_in.
i_otf[] = w_return-otfdata[].
clear v_len_in.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
max_linewidth = 132
importing
bin_filesize = v_len_in
tables
otf = i_otf
lines = i_tline
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
if sy-subrc eq 0.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body Title and Description
i_objtxt = 'PFA are the Service Entry Sheet details.'.
append i_objtxt.
append initial line to i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'Service Entry Sheet '.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
concatenate 'Service Entry Sheet' nast-objky(10) into wa_doc_chng-obj_descr separated by space.
Main Text
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment (pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'Service Entry Sheet '.
append i_objpack.
Get email id .
clear i_reclist.
i_reclist-receiver = '[email protected]'. "email address
i_reclist-rec_type = 'U'.
append i_reclist.
if i_reclist[] is not initial.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if sy-subrc <> 0.
Error When Sending the File
retcode = sy-subrc.
perform protocol_update1 .
endif.
endif.
else.
Error When generating the File
retcode = sy-subrc.
"perform protocol_update .
endif.
Reward if u find it useful
Regards
Arun T -
Send output of smartforms by mail to a specified e-mail adress.
Dear all ,
How can I send output of smartforms to purchase order pdf format and send this pdf file to a specified e-mail address.
Best regards,
Merryzhang for the pdf you need to put the code as given below..........:-) .This include the complete sequence.
Converting the Smartform into PDF Format
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = C_PDF
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE 'Error in CONVERT_OTF'(049) TYPE C_MSGTYPE_I.
ENDIF.
Convert PDF from 132 to 255.
LOOP AT I_TLINE INTO W_TLINE.
TRANSLATE W_TLINE USING ' ~'.
CONCATENATE W_BUFFER W_TLINE INTO W_BUFFER.
APPEND W_BUFFER TO I_BUFFER.
ENDLOOP.
LOOP AT I_BUFFER INTO W_BUFFER.
TRANSLATE W_BUFFER USING '~'.
DO.
W_RECORDS = W_BUFFER.
APPEND W_RECORDS TO I_RECORD.
SHIFT W_BUFFER LEFT BY 255 PLACES.
IF W_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDLOOP.
Object with PDF.
I_OBJBIN[] = I_RECORD[].
Content of the email.
W_OBJTXT-LINE = 'Smartform_output is attched'(020).
APPEND W_OBJTXT TO I_OBJTXT.
*I_OBJTXT[] = I_RECORDS[].
DESCRIBE TABLE I_OBJTXT LINES V_LINES_BIN.
Document Data
CLEAR W_DOC_CHNG.
W_DOC_CHNG-OBJ_NAME = 'ZSAS_TRAVAGREE'.
W_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
W_DOC_CHNG-OBJ_DESCR = 'Form for Travel Agreement'(021).
W_DOC_CHNG-PRIORITY = C_HIGH_1.
W_DOC_CHNG-DOC_SIZE = V_LINES_BIN * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
Start line of object header in transport packet
CLEAR W_OBJPACK.
REFRESH I_OBJPACK.
I_OBJPACK-HEAD_START = 1.
Number of lines of an object header in object packet
I_OBJPACK-HEAD_NUM = 0.
Start line of object contents in an object packet
I_OBJPACK-BODY_START = 1.
Number of lines of the object contents in an object packet
I_OBJPACK-BODY_NUM = V_LINES_TXT.
Code for document class
I_OBJPACK-DOC_TYPE = 'RAW'.
CLEAR I_OBJPACK-TRANSF_BIN.
APPEND I_OBJPACK.
To specify the mail content and subject.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
Packing as PDF.
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'ZSAS_TRAVAGREE'.
I_OBJPACK-OBJ_DESCR = 'Form for Travel Agreement'(021).
APPEND I_OBJPACK.
Document information.
REFRESH I_RECLIST.
e-mail receivers.
W_RECVLIST-RECEIVER = G_MAIL_ID.
W_RECVLIST-EXPRESS = C_X.
W_RECVLIST-REC_TYPE = C_EXTERNAL_EMAIL. "Internet address
APPEND W_RECVLIST TO I_RECLIST.
REFRESH I_OBJHEAD.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_CHNG
PUT_IN_OUTBOX = C_X
COMMIT_WORK = C_X
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = W_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF SY-SUBRC <> 0.
ENDIF.
let me know if you wanna any help ....
Edited by: varghese oommen on Apr 29, 2009 10:16 AM -
I have developed a Smartform ..i want to send this to my friend in denmark who got same requirement . Can i send it to my friend through mail....I want to send every screen of tht form..
Points will be awarded
regards,
Reddyhi
check with this material
here is the sample program to convert the smartform into pdf format
Re: SMARTFORMS TO PDF FORMAT?
Here is the sample code.
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
Work Area declarations
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i.
Step 1:
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST2'
importing
fm_name = v_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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
Step 2:
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
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.
Step 3:
i_otf[] = w_return-otfdata[].
Step 4:
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
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.
do reward if useful
regards
dinesh -
Dear friends,
I have to send the mails vai my smartforms parameters.
that are...
ARCHIVE_INDEX type TOA_DARA
ARCHIVE_INDEX_TAB TYPE TSFDARA
ARCHIVE_PARAMETERS TYPE ARC_PARAMS
CONTROL_PARAMETERS TYPE SSFCTRLOP
MAIL_APPL_OBJ TYPE SWOTOBJID
MAIL_RECIPIENT TYPE SWOTOBJID
MAIL_SENDER TYPE SWOTOBJID
OUTPUT_OPTIONS TYPE SSFCOMPOP
USER_SETTINGS TYPE TDBOOL
please help me how we can use this paramaters.
Thanks and regards
vivekhi,
check this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
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.
LOOP AT li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin[] = li_mess_att[].
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL -
Sending Smartform via Mail as PDF
Hi at all,
how can I realize the sending of a smartform as a PDF file via Mail as attachment?
This is the functiom module I call:
IF p_mail EQ 'X' AND p_adress IS NOT INITIAL.
CLEAR: wa_ssfcompop,
wa_ssfctrlop,
ls_tab_otf_data.
wa_ssfcompop-tdprinter = 'PDF1'.
wa_ssfctrlop-langu = 'D'.
wa_ssfctrlop-no_dialog = 'X'. "KEIN DIALOG
wa_ssfctrlop-preview = 'X'.
wa_ssfctrlop-getotf = 'X'. "NUR DAS OTF IST INTERESSANT
ENDIF.
CALL FUNCTION fm_name "'/1BCDWB/SF00000033'
EXPORTING
output_options = wa_ssfcompop
control_parameters = wa_ssfctrlop
user_settings = space
* im_redat_von = so_redat-low
* im_redat_bis = so_redat-high
im_beleg_waers = rb_beleg "DV_M964
im_sum = p_summe "DV_M1464
im_wert = p_ertrag "DV_M1464
im_stueck = p_stueck "DV_M1464
im_period = p_monat "DV_M1464
IMPORTING
* DOCUMENT_OUTPUT_INFO =
job_output_info = ls_tab_otf_data "DV_M1464
job_output_options = wa_ssfcompop2 "FE 20100429
TABLES
i_umsatz = it_umsatz_ergebnis
i_faknr = it_faknr
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
After this I have a otf string that I convert with the following coding:
lt_tab_otf_final[] = ls_tab_otf_data-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
bin_file = lv_file
TABLES
otf = lt_tab_otf_final
lines = lt_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
But now I am stuck. How can I send this xString to the next function module? The other structures / tables are still filled, only the it_attachment has to be filled, but how?
wa_receivers-receiver = p_adress.
wa_receivers-rec_type = 'U'.
APPEND wa_receivers TO it_receivers.
CONCATENATE 'Umsatznachweis Druck' sy-datum sy-uzeit INTO wa_document_data-obj_descr SEPARATED BY space.
wa_message = 'Dies ist ein Test'.
APPEND wa_message TO it_message.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES wa_packing_list-body_num.
wa_packing_list-doc_type = 'RAW'.
APPEND wa_packing_list TO it_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_document_data
put_in_outbox = 'X'
* sender_address = sy-uname
* sender_address_type = 'B'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
packing_list = it_packing_list
* OBJECT_HEADER =
* CONTENTS_BIN =
contents_txt = it_message
contents_hex = it_attachment
* OBJECT_PARA =
* OBJECT_PARB =
receivers = it_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.Hi,
After
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
archive_index = ' '
copynumber = 0
ascii_bidi_vis2log = ' '
pdf_delete_otftab = ' '
IMPORTING
bin_filesize = ls_bin_file
bin_file = bin_file <-- get this
Convert this to string ...
DATA : lv_strlen TYPE i.
DATA : it_raw TYPE STANDARD TABLE OF char255,
ia_raw TYPE char255.
lv_strlen = STRLEN( bin_file ).
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = bin_file
APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_strlen
TABLES
binary_tab = it_raw.
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = it_raw
t_target_tab = lt_objbin.
*call the FM ... to send mail ..
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lv_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = lt_objpack
object_header = lv_objhead
contents_txt = lt_objtxt
contents_bin = lt_objbin
receivers = lt_reclist
EXCEPTIONS
document_not_sent = 1
OTHERS = 2.
Regards,
Srini. -
Trigger smartform through mail
Hi All,
I am working on Interest Calculation(FINT) smartform.I am able to print the smartform Now i want to sent this smartform to the mail.I need to send this as a text.How can i d o this.Pease anybody helpme out.
Thanks
Swapna.Hi Swapna,
I have the same requirement, I have used badi FI_INT_CUS01, and I set get_otf = 'X' in the method INT_PRINT_OPTIONS, so before the spool is closed (method INT_PRINT_SPOOL_CLOSED), I could have the OTF data to send it by email.
The only problem is that in that method you cannot get details about partner, so that you can send the the mail to that particular partner.
Would you be so kind to share with me the solution you have found for this?
Many thanks,
Ana-Maria -
hi experts,
i want to learn how to send a pdf as mail. can any one plz help me. plz give me step by step procedure.
thanks in advance for ur responce.this code will help you.
create your own smartfrom first..
*& Report YSMARTFORM_EMAIL
REPORT YSMARTFORM_EMAIL.
TABLES: VBAK.
Constants *
CONSTANTS:
C_X TYPE C VALUE 'X', " Value X
C_0 TYPE C VALUE '0', " Value 0
C_1 TYPE C VALUE '1'. " Value 1
Work Variables declaration *
DATA:
W_UCOMM LIKE SY-UCOMM, " Function code
W_TABLN TYPE I, " Lines
W_LINE TYPE SO_TEXT255, " Line of text
W_EADDR(60) TYPE C. " FieldLength for Email
DATA: VBAP_TAB LIKE VBAP OCCURS 0 WITH HEADER LINE.
DATA: W_FUNMOD TYPE RS38L_FNAM.
Structure to hold the Attributes of new Document
DATA: FS_DOCDATA TYPE SODOCCHGI1.
Internal table for storing OTF data form Smart-Form
DATA: BEGIN OF FS_OTF_DATA.
INCLUDE STRUCTURE ITCOO.
DATA: END OF FS_OTF_DATA,
T_OTF_DATA LIKE STANDARD TABLE OF FS_OTF_DATA.
Internal table for storing PDF data form Smart-Form
DATA: BEGIN OF FS_PDF_DATA.
INCLUDE STRUCTURE TLINE.
DATA: END OF FS_PDF_DATA,
T_PDF_DATA LIKE STANDARD TABLE OF FS_PDF_DATA.
Internal table to hold the attachment data text of the email
DATA: BEGIN OF FS_ATTACH_DATA.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF FS_ATTACH_DATA,
T_ATTACH_DATA LIKE STANDARD TABLE OF FS_ATTACH_DATA.
Internal table to hold Message body of the email
DATA: BEGIN OF FS_MESSBODY.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF FS_MESSBODY,
T_MESSBODY LIKE STANDARD TABLE OF FS_MESSBODY.
Internal table for packing list for main document
DATA: BEGIN OF FS_OBJPACK.
INCLUDE STRUCTURE SOPCKLSTI1.
DATA: END OF FS_OBJPACK,
T_OBJPACK LIKE STANDARD TABLE OF FS_OBJPACK.
Internal table for header text of the attachment
DATA: BEGIN OF FS_OBJHEAD.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF FS_OBJHEAD,
T_OBJHEAD LIKE STANDARD TABLE OF FS_OBJHEAD.
Internal table receiver information
DATA: BEGIN OF FS_RECEIVER.
INCLUDE STRUCTURE SOMLRECI1.
DATA: END OF FS_RECEIVER,
T_RECEIVER LIKE STANDARD TABLE OF FS_RECEIVER.
*Internal table to store data upto 255 lines
DATA: BEGIN OF FS_OBJCONT.
INCLUDE STRUCTURE SOLI.
DATA: END OF FS_OBJCONT,
T_OBJCONT LIKE STANDARD TABLE OF FS_OBJCONT.
*DATA : P_VBELN LIKE VBAK-VBELN.
DATA: P_EADDR(60) TYPE C
VALUE '[email protected]'.
PARAMETERS : P_VBELN LIKE VBAK-VBELN.
*PARAMETERS:
P_EADDR(60) TYPE C. " Email address
SELECT SINGLE *
FROM VBAK
WHERE VBELN EQ P_VBELN.
SELECT *
FROM VBAP
INTO TABLE VBAP_TAB
WHERE VBELN EQ P_VBELN.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'YSMARTFORM_EMAIL'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = W_FUNMOD
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3 .
IF SY-SUBRC <> 0.
Do nothing
ENDIF.
DATA: FS_CONT_PARM TYPE SSFCTRLOP,
T_JOB_INFO TYPE SSFCRESCL.
CLEAR FS_CONT_PARM.
FS_CONT_PARM-GETOTF = 'X'.
FS_CONT_PARM-NO_DIALOG = 'X'.
FS_CONT_PARM-PREVIEW = ''.
CALL FUNCTION W_FUNMOD
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = FS_CONT_PARM
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
VBAK = VBAK
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_JOB_INFO
JOB_OUTPUT_OPTIONS =
TABLES
VBAP = VBAP_TAB
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.
PERFORM CONVERT_OTF_TO_PDF.
*& Form convert_otf_to_pdf
text
--> p1 text
<-- p2 text
FORM CONVERT_OTF_TO_PDF .
DATA: LV_BYTES TYPE P.
IF FS_CONT_PARM-GETOTF EQ 'X'.
REFRESH T_OTF_DATA.
CLEAR FS_OTF_DATA.
LOOP AT T_JOB_INFO-OTFDATA INTO FS_OTF_DATA.
APPEND FS_OTF_DATA TO T_OTF_DATA.
CLEAR FS_OTF_DATA.
ENDLOOP. " LOOP AT t_outtab-otfdata
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 255
IMPORTING
BIN_FILESIZE = LV_BYTES
TABLES
OTF = T_OTF_DATA
LINES = T_PDF_DATA
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC EQ 0 AND LV_BYTES IS NOT INITIAL.
PERFORM TABLE_SHIFT.
To send the output by email
PERFORM SET_UP_EMAIL.
PERFORM SEND_MAIL.
ENDIF. " IF sy-subrc EQ space.
ENDIF. " IF gs_control_pars-getotf
ENDFORM. " convert_otf_to_pdf
Form set_up_email *
This subroutine is used to set mail attributes *
There are no interface parameters to be passed to this subroutine. *
FORM SET_UP_EMAIL .
To setup attributes of the document
PERFORM SET_EMAIL_HEADER.
To set body of email
PERFORM SET_EMAILBODY.
To convert output table data with tab delimiter
PERFORM PREPARE_OUTPUT_DATA_FOR_ATTACH.
To set the Receipents
PERFORM SET_RECEIPENTS.
ENDFORM. " Set_up_email
Form set_email_header *
This subroutine is used to Setup the attributes of the Document *
There are no interface parameters to be passed to this subroutine. *
FORM SET_EMAIL_HEADER.
CONSTANTS :
LC_P TYPE C VALUE 'P', " Production system name
LC_F TYPE C VALUE 'F', " Sensitivity
LC_OBJNAME(6) TYPE C " Object name
VALUE 'SAPRPT'.
CLEAR FS_DOCDATA.
Populate the subject/generic message attributes
FS_DOCDATA-DOC_SIZE = 1.
FS_DOCDATA-OBJ_LANGU = SY-LANGU.
FS_DOCDATA-OBJ_NAME = LC_OBJNAME.
FS_DOCDATA-SENSITIVTY = LC_F.
IF SY-SYSID+0(1) NE LC_P.
CONCATENATE 'Test mail'(003)
'Sales Order Details'(002)
INTO FS_DOCDATA-OBJ_DESCR
SEPARATED BY SPACE.
ELSE.
MOVE TEXT-002 TO FS_DOCDATA-OBJ_DESCR.
ENDIF. " IF sy-sysid+0(1)...
ENDFORM. " Set_email_header
Form set_emailbody *
This subroutine is used to set body of an email *
There are no interface parameters to be passed to this subroutine. *
FORM SET_EMAILBODY.
CONSTANTS:
LC_DOC_TYPE(3) TYPE C VALUE 'RAW'. " Document type
REFRESH : T_OBJPACK,
T_MESSBODY.
CLEAR : FS_OBJPACK,
FS_MESSBODY.
MOVE:
'Hi,'(004) TO FS_MESSBODY-LINE.
APPEND FS_MESSBODY TO T_MESSBODY.
CLEAR FS_MESSBODY.
MOVE:
'The attachment contains sales order details.'(005)
'www.google.com'
TO FS_MESSBODY-LINE.
APPEND FS_MESSBODY TO T_MESSBODY.
CLEAR W_TABLN.
DESCRIBE TABLE T_MESSBODY LINES W_TABLN.
CLEAR FS_MESSBODY.
READ TABLE T_MESSBODY INTO FS_MESSBODY INDEX W_TABLN.
FS_DOCDATA-DOC_SIZE = ( W_TABLN - 1 ) * 255 + STRLEN( W_LINE ).
MOVE:
SPACE TO FS_OBJPACK-TRANSF_BIN,
C_1 TO FS_OBJPACK-HEAD_START,
C_0 TO FS_OBJPACK-HEAD_NUM,
C_1 TO FS_OBJPACK-BODY_START,
W_TABLN TO FS_OBJPACK-BODY_NUM,
LC_DOC_TYPE TO FS_OBJPACK-DOC_TYPE.
APPEND FS_OBJPACK TO T_OBJPACK.
ENDFORM. " Set_emailbody
Form prepare_output_data_for_attach *
To convert the output table data with comma delimiter *
There are no interface parameters to be passed to this subroutine. *
FORM PREPARE_OUTPUT_DATA_FOR_ATTACH.
CONSTANTS:
LC_DOC_TYPE(3) TYPE C VALUE 'PDF', " Document type
LC_OBJNAME(6) TYPE C VALUE 'SAPRPT'. " Object name
REFRESH T_OBJHEAD.
REFRESH T_ATTACH_DATA[].
CLEAR FS_ATTACH_DATA.
T_ATTACH_DATA[] = T_OBJCONT[].
DESCRIBE TABLE T_ATTACH_DATA LINES W_TABLN.
FS_DOCDATA-DOC_SIZE = ( W_TABLN - 1 ) * 255 + STRLEN( W_LINE ).
FS_OBJPACK-BODY_NUM = W_TABLN.
FS_OBJPACK-DOC_SIZE = W_TABLN * 255.
FS_OBJPACK-TRANSF_BIN = C_X.
FS_OBJPACK-HEAD_START = C_1.
FS_OBJPACK-HEAD_NUM = C_1.
FS_OBJPACK-BODY_START = C_1.
FS_OBJPACK-DOC_TYPE = LC_DOC_TYPE.
FS_OBJPACK-OBJ_NAME = 'Attachment'.
FS_OBJPACK-OBJ_DESCR = 'Sales Order Details.PDF'(007).
APPEND FS_OBJPACK TO T_OBJPACK.
ENDFORM. " Prepare_output_data_for_attach
Form set_receipents *
This subroutine is used to set the Receipents *
There are no interface parameters to be passed to this subroutine. *
FORM SET_RECEIPENTS .
CONSTANTS
LC_REC_TYPE TYPE C VALUE 'U'. " Receipent type
REFRESH T_RECEIVER.
IF P_EADDR IS NOT INITIAL.
MOVE:
P_EADDR TO FS_RECEIVER-RECEIVER,
LC_REC_TYPE TO FS_RECEIVER-REC_TYPE.
APPEND FS_RECEIVER TO T_RECEIVER.
ENDIF. " IF P_EMAIL IS NOT.....
ENDFORM. " Set_receipents
Form send_mail *
This subroutine is used to send output by email *
There are no interface parameters to be passed to this subroutine. *
FORM SEND_MAIL.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = FS_DOCDATA
PUT_IN_OUTBOX = C_X
SENDER_ADDRESS = SY-UNAME
SENDER_ADDRESS_TYPE = 'B'
COMMIT_WORK = C_X
TABLES
PACKING_LIST = T_OBJPACK
OBJECT_HEADER = T_OBJHEAD
CONTENTS_BIN = T_ATTACH_DATA
CONTENTS_TXT = T_MESSBODY
RECEIVERS = T_RECEIVER
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC NE 0.
MESSAGE I007(CLAIM).
ELSE.
MESSAGE S592(EI).
ENDIF. " IF sy-subrc NE 0.
ENDFORM. " Send_mail
*& Form table_shift
The PDF file that is generated out of the above function module
cannot be transported as it needs to be of 255 chars.Hence
converting the file to get a 255 char single line,internal table.
*There are no interface parameters to be passed to this subroutine
FORM TABLE_SHIFT .
CONSTANTS:
CNV_HEXCONST_ZERO TYPE X VALUE '00'.
DATA:
LV_BIG_LINES(268) TYPE C
OCCURS 0 WITH HEADER LINE.
DATA:
LFL_FLAG TYPE C,
LV_LEFT_T(268) TYPE C,
LV_LEFT_I TYPE I,
TV_LEFT_I TYPE I,
LV_CURR_I TYPE I.
FIELD-SYMBOLS: <F>.
Get the lines into a table of 268 char as the first step to put it in
the pdf file of 255 chars
CLEAR LFL_FLAG.
LOOP AT T_PDF_DATA INTO FS_PDF_DATA.
IF LFL_FLAG EQ ' '.
CLEAR LV_BIG_LINES WITH CNV_HEXCONST_ZERO.
ASSIGN LV_BIG_LINES(134) TO <F>.
<F> = FS_PDF_DATA.
LFL_FLAG = 'X'.
ELSE.
LV_BIG_LINES+134 = FS_PDF_DATA.
APPEND LV_BIG_LINES.
CLEAR: LFL_FLAG.
ENDIF. " If lfl_flag = ''..
ENDLOOP. " Loop at t_pdf
IF LFL_FLAG EQ 'X'.
APPEND LV_BIG_LINES.
ENDIF. " If lflf_flag eq 'X'..
Next fill it into a 255 char table
CLEAR: LV_LEFT_T, LV_LEFT_I, TV_LEFT_I.
LV_CURR_I = 255.
LOOP AT LV_BIG_LINES.
IF LV_LEFT_I NE 0.
IF LV_CURR_I NE 0.
FS_OBJCONT(LV_LEFT_I) = LV_LEFT_T(LV_LEFT_I).
FS_OBJCONT+LV_LEFT_I(LV_CURR_I) = LV_BIG_LINES(LV_CURR_I).
ELSE.
FS_OBJCONT = LV_LEFT_T(LV_LEFT_I).
ENDIF. " IF lv_curr_i NE 0
ELSE.
FS_OBJCONT = LV_BIG_LINES(LV_CURR_I).
ENDIF. " IF lv_left_i NE 0
APPEND FS_OBJCONT TO T_OBJCONT.
TV_LEFT_I = 268 - LV_CURR_I.
IF TV_LEFT_I > 255.
FS_OBJCONT = LV_BIG_LINES+LV_CURR_I(255).
APPEND FS_OBJCONT TO T_OBJCONT.
LV_LEFT_I = TV_LEFT_I - 255.
TV_LEFT_I = 255 + LV_CURR_I.
LV_CURR_I = 255 - LV_LEFT_I.
LV_LEFT_T = LV_BIG_LINES+TV_LEFT_I.
ELSE.
LV_LEFT_T = LV_BIG_LINES+LV_CURR_I.
LV_LEFT_I = 268 - LV_CURR_I.
LV_CURR_I = 255 - LV_LEFT_I.
ENDIF. " IF tv_left_i > 255
ENDLOOP. " LOOP AT lv_big_lines.
CLEAR FS_OBJCONT WITH CNV_HEXCONST_ZERO.
ASSIGN FS_OBJCONT(LV_LEFT_I) TO <F>.
<F> = LV_LEFT_T(LV_LEFT_I).
APPEND FS_OBJCONT TO T_OBJCONT.
ENDFORM. " Table_shift -
Send Smartforms Output as pdf Attachment in E-Mail
Hi!
I've searched quite a long time and tried to use different examples I've found in the forum but it doesn't work for me.
I tried to do the following:
Send output of smartforms by mail to a specified e-mail adress. Sometimes there have to be sent 2 pdf's (both are output of smartforms) in one e-mail.
The function to download the output of smartform with FM CONVERT_OTF_2_PDF and GUI_DOWNLOAD works fine for me but I couldn't get the FM SO_NEW_DOCUMENT_SEND_API1 to work.
Can someone give me an example or a description to get from the output of the smartform to the e-mail with attachment?
I'm pretty new to this so it maybe is a very simple question.
Regards,
JackoTry the following code
report zpp430_report_in_pdf no standard page heading line-size 255.
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
tables: tsp01.
parameter: p_email1 like somlreci1-receiver.
p_sender like somlreci1-receiver.
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132', " Paper Format
p_slset like sy-slset, "Variant name
p_odescr like sodocchgi1-obj_descr,
p_adescr type so_obj_nam,
p_delspl as checkbox.
*DATA DECLARATION
data: gd_recsize type i.
* Spool IDs
types: begin of t_tbtcp.
include structure tbtcp.
types: end of t_tbtcp.
data: it_tbtcp type standard table of t_tbtcp initial size 0,
wa_tbtcp type t_tbtcp.
* Job Runtime Parameters
data: gd_eventid like tbtcm-eventid,
gd_eventparm like tbtcm-eventparm,
gd_external_program_active like tbtcm-xpgactive,
gd_jobcount like tbtcm-jobcount,
gd_jobname like tbtcm-jobname,
gd_stepcount like tbtcm-stepcount,
gd_error type sy-subrc,
gd_reciever type sy-subrc.
data: w_recsize type i,
mc_valid(1) type c.
data: gd_subject like sodocchgi1-obj_descr,
it_mess_bod like solisti1 occurs 0 with header line,
it_mess_att like solisti1 occurs 0 with header line,
gd_sender_type like soextreci1-adr_typ,
gd_attachment_desc type so_obj_nam,
gd_attachment_name type so_obj_des,
mi_rqident like tsp01-rqident.
* Spool to PDF conversions
data: gd_spool_nr like tsp01-rqident,
w_spool_nr like tsp01-rqident,
gd_destination like rlgrap-filename,
gd_bytecount like tst01-dsize,
gd_buffer type string.
data:
mstr_print_parms like pri_params.
* Binary store for PDF
data: begin of it_pdf_output occurs 0.
include structure tline.
data: end of it_pdf_output.
constants: c_dev like sy-sysid value 'DEV',
c_no(1) type c value ' ',
c_device(4) type c value 'LOCL'.
*START-OF-SELECTION.
start-of-selection.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
* WRITE 'Hello World'.
* NEW-PAGE.
* COMMIT WORK.
* NEW-PAGE PRINT OFF.
* IF SY-BATCH EQ 'X'.
* PERFORM GET_JOB_DETAILS.
* PERFORM OBTAIN_SPOOL_ID.
*** Alternative way could be to submit another program and store spool
*** id into memory.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
call function 'GET_PRINT_PARAMETERS'
exporting
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
* in_archive_parameters = space
* in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
using selection-set p_slset
and return.
* Get spool id from program called above
perform get_spool_number using sy-repid sy-uname changing mi_rqident.
* IMPORT w_spool_nr FROM MEMORY ID SY-REPID.
perform convert_spool_to_pdf.
perform process_email.
if p_delspl eq 'X'.
perform delete_spool.
endif.
if sy-sysid = c_dev.
wait up to 5 seconds.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
* ELSE.
* SKIP.
* WRITE:/ 'Program must be executed in background in-order for spool'
* 'request to be created.'.
* ENDIF.
* FORM obtain_spool_id *
form obtain_spool_id.
check not ( gd_jobname is initial ).
check not ( gd_jobcount is initial ).
select * from tbtcp
into table it_tbtcp
where jobname = gd_jobname
and jobcount = gd_jobcount
and stepcount = gd_stepcount
and listident <> '0000000000'
order by jobname
jobcount
stepcount.
read table it_tbtcp into wa_tbtcp index 1.
if sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
message s004(zdd) with gd_spool_nr.
else.
message s005(zdd).
endif.
endform. "OBTAIN_SPOOL_ID
* FORM get_job_details *
form get_job_details.
* Get current job details
call function 'GET_JOB_RUNTIME_INFO'
importing
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
exceptions
no_runtime_info = 1
others = 2.
endform. "GET_JOB_DETAILS
* FORM convert_spool_to_pdf *
form convert_spool_to_pdf.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = mi_rqident
no_dialog = c_no
dst_device = c_device
importing
pdf_bytecount = gd_bytecount
tables
pdf = it_pdf_output
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
check sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
loop at it_pdf_output.
translate it_pdf_output using ' ~'.
concatenate gd_buffer it_pdf_output into gd_buffer.
endloop.
translate gd_buffer using '~ '.
do.
it_mess_att = gd_buffer.
append it_mess_att.
shift gd_buffer left by 255 places.
if gd_buffer is initial.
exit.
endif.
enddo.
endform. "CONVERT_SPOOL_TO_PDF
* FORM process_email *
form process_email.
describe table it_mess_att lines gd_recsize.
check gd_recsize > 0.
perform send_email using p_email1.
* perform send_email using p_email2.
endform. "PROCESS_EMAIL
* FORM send_email *
* --> p_email *
form send_email using p_email.
check not ( p_email is initial ).
refresh it_mess_bod.
* Default subject matter
gd_subject = p_odescr.
gd_attachment_desc = p_adescr.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'This is an automated report from SAP.'.
append it_mess_bod.
it_mess_bod = 'Please do not reply to this mail id.'.
append it_mess_bod.
*IT_MESS_BOD = 'For any clarification on the details of this report'
* APPEND IT_MESS_BOD.
* IT_MESS_BOD = 'please contact Business Planning. Thank you'.
* APPEND IT_MESS_BOD.
* If no sender specified - default blank
if p_sender eq space.
gd_sender_type = space.
else.
gd_sender_type = 'INT'.
endif.
* Send file by email as .xls speadsheet
perform send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
p_odescr
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
endform. "SEND_EMAIL
* FORM delete_spool *
form delete_spool.
data: ld_spool_nr type tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
check p_delspl <> c_no.
call function 'RSPO_R_RDELETE_SPOOLREQ'
exporting
spoolid = ld_spool_nr.
endform. "DELETE_SPOOL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
form send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
data: ld_error type sy-subrc,
ld_reciever type sy-subrc,
ld_mtitle like sodocchgi1-obj_descr,
ld_email like somlreci1-receiver,
ld_format type so_obj_tp ,
ld_attdescription type so_obj_nam ,
ld_attfilename type so_obj_des ,
ld_sender_address like soextreci1-receiver,
ld_sender_address_type like soextreci1-adr_typ,
ld_receiver like sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
clear w_doc_data.
read table it_attach index w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + strlen( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
clear t_attachment.
refresh t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
clear t_packing_list.
refresh t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
describe table it_message lines t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
append t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
describe table t_attachment lines t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
append t_packing_list.
* Add the recipients email address
clear t_receivers.
refresh t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
append t_receivers.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
importing
sent_to_all = w_sent_all
tables
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
loop at t_receivers.
ld_receiver = t_receivers-retrn_code.
endloop.
endform. "SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form GET_SPOOL_NUMBER
* text
* -->P_SY_REPID text
* -->P_SY_UNAME text
* <--P_MI_RQIDENT text
form get_spool_number using f_repid
f_uname
changing f_rqident.
data:
lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(9)
f_uname+0(3)
into lc_rq2name.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform. " GET_SPOOL_NUMBER
there are lot's of posts available on sdn which u can refer to.
tx
ashwa -
Smartforms in pdf and send via mails
Dear friends
I have to send the smartforms via mail.
but only have a preview of the smartform.
please help.
no spool no is generated.
please help.
thanks and reagrds
vivekHi Vivek,
After the FM 'SSF_FUNCTION_MODULE_NAME' and fm_name,
Change smartform preview formate(OTF) to PDF . call FM.
*---Function module to convert OTF data to PDF data format
call function 'CONVERT_OTF'
exporting
format = 'PDF'
max_linewidth = 132
importing
bin_filesize = l_v_pdf_size "l_v_pdf_size type i,
tables
otf = l_it_otf_data "l_it_otf_data type standard table of itcoo initial size 0,
lines = l_it_pdf_data. "l_it_pdf_data type standard table of tline,
then
*---Function module to chnage width of PDF file to 255
call function 'SX_TABLE_LINE_WIDTH_CHANGE'
exporting
line_width_dst = '255'
tables
content_in = l_it_pdf_data[]
content_out = l_it_pdf[]
exceptions
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
others = 4.
and finelly.
*---Function module to send mail
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = l_wa_doc_chng
put_in_outbox = c_check
commit_work = c_check
tables
packing_list = l_it_objpack
object_header = l_wa_objhead
contents_bin = l_it_pdf
receivers = l_it_receivers
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Thanks.
Mona.
Edited by: Mona Singh on Dec 4, 2008 3:06 PM -
How to convert smartform into pdf and send through mail
Hi Guru,
I want to send smartform to mail after converting into pdf format.
if anyof u gives solution its greate.
Thanks & Regards,
Lakshmi..Hi,
i can help you till
downloading the smartform as pdf format
check this
DATA: GIT_BSIK LIKE BSIK OCCURS 0 WITH HEADER LINE.
Variable declarations
DATA:
W_FORM_NAME TYPE TDSFNAME VALUE 'ZFII_EDD001',
W_FMODULE TYPE RS38L_FNAM,
W_CPARAM TYPE SSFCTRLOP,
W_OUTOPTIONS TYPE SSFCOMPOP,
W_BIN_FILESIZE TYPE I, " Binary File Size
W_FILE_NAME TYPE STRING,
W_FILE_PATH TYPE STRING,
W_FULL_PATH TYPE STRING.
Internal tables declaration
Internal table to hold the OTF data
DATA:
T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
Internal table to hold OTF data recd from the SMARTFORM
T_OTF_FROM_FM TYPE SSFCRESCL,
Internal table to hold the data from the FM CONVERT_OTF
T_PDF_TAB LIKE TLINE OCCURS 0 WITH HEADER LINE.
This function module call is used to retrieve the name of the Function
module generated when the SMARTFORM is activated
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = W_FORM_NAME
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = W_FMODULE
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.
Calling the SMARTFORM using the function module retrieved above
GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF
format of the output
W_CPARAM-NO_DIALOG = 'X'.
W_CPARAM-PREVIEW = SPACE. " Suppressing the dialog box
" for print preview
W_CPARAM-GETOTF = 'X'.
Printer name to be used is provided in the export parameter
OUTPUT_OPTIONS
W_OUTOPTIONS-TDDEST = 'ZPC_'.
CALL FUNCTION W_FMODULE
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = W_CPARAM
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = W_OUTOPTIONS
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = T_OTF_FROM_FM
JOB_OUTPUT_OPTIONS =
TABLES
ITAB = GIT_BSIK
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_OTF_FROM_FM-OTFDATA[].
Function Module CONVERT_OTF is used to convert the OTF format to PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = W_BIN_FILESIZE
BIN_FILE =
TABLES
OTF = T_OTF
LINES = T_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.
*To display File SAVE dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
WINDOW_TITLE =
DEFAULT_EXTENSION =
DEFAULT_FILE_NAME =
FILE_FILTER =
INITIAL_DIRECTORY =
WITH_ENCODING =
PROMPT_ON_OVERWRITE = 'X'
CHANGING
filename = w_FILE_NAME
path = w_FILE_PATH
fullpath = w_FULL_PATH
USER_ACTION =
FILE_ENCODING =
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 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.
Use the FM GUI_DOWNLOAD to download the generated PDF file onto the
presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_bin_filesize
filename = w_FULL_PATH
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 = T_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
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
thanks & regards,
Venkatesh -
Smartforms - CRM - Sending as an email - avoid e-mail read confirmation
Hi Experts,
I've got a question concerning the e-mail read confirmation of a Smartform which we send by channel e-mail in crm system...
I've created a smartfrom which we send with an action in crm as an e-mail, for this I use the standard class
CL_DOC_PROCESSING_CRM_ORDER with method CRM_ACTIVITY_EXEC_SMART_FORM and processing type "smartforms e-mail".....
The E-mail will be deliverd successfully, but the e-mail want's a read confirmation. Is it possible to set a variable in the class I mentioned above to avoid the reading confirmation?
regards
marcHi Experts,
I've got a question concerning the e-mail read confirmation of a Smartform which we send by channel e-mail in crm system...
I've created a smartfrom which we send with an action in crm as an e-mail, for this I use the standard class
CL_DOC_PROCESSING_CRM_ORDER with method CRM_ACTIVITY_EXEC_SMART_FORM and processing type "smartforms e-mail".....
The E-mail will be deliverd successfully, but the e-mail want's a read confirmation. Is it possible to set a variable in the class I mentioned above to avoid the reading confirmation?
regards
marc -
How to use SSFCTRLOP-DEVICE = 'MAIL'. in smartform to send mail
There are parameter in smartform interface called
MAIL_RECIPIENT = GWA_RECIPIENT
MAIL_SENDER = GWA_SENDER
I want to use them to send mail.
I have set my device type = 'MAIL' But I am getting error email address, is not valid . i.e. it is taking blank email address where as i have mention email address in
GWA_RECIPIENT-OBJKEY = <Emailaddress>
is there any other parameter i have to sent..
I wont want to go via long route of converting smartform into OTF or into PDF, whereas i think smartform interface itself is capable of sending contains as emails.
Regards
--AL.Hi VL,
You can't simply assign the email address to GWA_RECIPIENT-OBJKEY.
Inorder to use the standard smartform interface to sent the smartform via mail, the partner details need to be maintained in SAP. Say for example if you want to sent a PO to a vendor via email, the email address need to be maintained in XK01/02 transaction for that vendor in the address view.
Before calling the smart form function module, you need to populate the receipent data, with function module WFMC_PREPARE_SMART_FORM. If you give the address number and land, it will populate the receipent data.
See the report RLB_INVOICE (form set_print_param).
Regards,
Maddy.
Maybe you are looking for
-
Aloha everyone, I've read through a lot of the post here and I have not found anything that seems to solve my problem. I have been trying to restore a couple of directories from my Time Machine backup and I get a message telling me 'The operation can
-
Help for Mac Browser Launcher for jvm 5 for Mac OS X 10.5.1
hi im using Mac OS X 10.5.1 and im having a java code BrowserLauncher.java which works properly for earlier verioson of Mac but its not working on this version on jdk1.5. can anyone suggest me how can i get a browser launcher in java for Mac Os X 10.
-
Pass/Fail issue with Quiz and Click Buttons
Got a complicated one for ya! I have a project that has about 100 quiz questions. I want to add slides with an image for backgrownd, a voice over and a "Click Button" to be used like a Simulation. If the "Click Button" is not clicked on, I want the
-
Display offset problems with 1bit RenderedImage
Hi, I am loading a 1 bit image with JAI and display two versions of it. The first is unmodified and has an IndexColorModel together with MultiPixelPackedSampleModel. The second version has a lookup table applied and therefore has a ComponentColorMode
-
No alerts in Setup Monitoring / Keine Alerts bei Systemu00FCberwachung
Hello together. After a long search on the internet, and after reading a mass of books about this, i have no clue, why it isn't working... I try to create a monitoring for some of our ERP-Systems with the SAP Solution Manger (7.0). I edited the RFC-c