Problem of sending email with attachment by SO_NEW_DOCUMENT_ATT_SEND_API1
Hi experts,
When I sent email with FM 'SO_NEW_DOCUMENT_ATT_SEND_API1' with TXT attachment, I found the there were no new line after each row of the content of TXT file attachment . All the rows in the internal table are concatenated into a string without any new line mark. It damaged the format of my attachment.
You need to concatenate your text with l_c_cr_lf (For enter button or new line) after every 255 char to get new line. Below is the code. Let me know in case of ny clarifications.
CONSTANTS: l_c_cr_lf TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf,
l_c_255 TYPE char3 VALUE '255'.
DATA: l_v_cr_lf TYPE abap_cr_lf,
l_v_n TYPE i,
l_v_dif TYPE i,
l_v_strlen TYPE i.
l_v_cr_lf = l_c_cr_lf.
l_v_n = 0.
LOOP AT fp_i_mail_out INTO wa_mail_out.
l_v_strlen = STRLEN( wa_mail_out ).
CLEAR l_v_n.
DO.
l_v_dif = l_v_strlen - l_v_n.
IF l_v_dif < l_c_255.
EXIT.
ELSE.
l_wa_attachment = wa_mail_out+l_v_n(255).
APPEND l_wa_attachment TO l_i_attachment.
CLEAR l_wa_attachment.
l_v_n = l_v_n + 255.
ENDIF.
ENDDO.
IF l_v_strlen > l_v_n.
l_v_dif = l_v_strlen - l_v_n.
l_wa_attachment = wa_mail_out+l_v_n(l_v_dif).
APPEND l_wa_attachment TO l_i_attachment.
CLEAR l_wa_attachment.
ENDIF.
DESCRIBE TABLE l_i_attachment LINES l_v_lines.
LOOP AT l_i_attachment ASSIGNING <l_fs_attach>.
IF sy-tabix = l_v_lines.
CONCATENATE <l_fs_attach>-line l_v_cr_lf INTO <l_fs_attach>-line.
ENDIF.
ENDLOOP.
ENDLOOP.
Similar Messages
-
Problem in sending email with attachment more than 32kb through utl_mail
Hi friends
I am able to send an email with attachment upto 32kb using utl_mail.
But whenever I increase the size of attachment from 32kb, it prompts me an error.
===============================================
ORA-20001: The following error has occured:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
===============================================
i have also used LONG RAW instead of RAW, bu still the problem is same.
please help me in solving this issue.
Thanks in advance,
AnkurYeah that's an issue with UTL_MAIL it only has 3 procedures, and none of them let you send data to the SMTP server incrementally. To send files larger than 32k you will need to switch over to using UTL_SMTP directly or via a helper package such as the [DEMO_MAIL package|http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html] available from otn.
-
Send Email with attachment further .
Hello All,
Thank Raja Thangamani for giving me an answer about <b>Send Email with attachment</b> . But now I have a new question that when I sene Email with attachment beyond 500M , this funtion is not applied .
Pls give me some advice! Thanks very much!Look at this link & thread..
http://www.thespot4sap.com/Articles/SAP_Mail_UNIX_Example_ABAP.asp
Send PDF Attachment to SAP Mail Inbox.
Hope this will solve your problem.
Raja T
Message was edited by:
Raja Thangamani -
XI Mail Adapter: sending emails with attachment with help of java mapping
Hi ,
On trying out the scenerio mentioned in the blog, using the java mapping provided
"XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
The scenerio works just fine.
But the payload as the content of the attachment is not getting generated in proper XML format.
I suppose it's because of the replace special characters code part..
Can anyone help me state the modification required in the code.
Thanks!
Regards,
Faria MithaniIt might be a codepage issue. Is your original payload UTF-8?
-
Sharepoint Online - Send email with attachment
Hi All,
is there some way how to send email with attachment, which is attached to list item in host web?
I tried some of solutions but none of them not working.
Server side:
For example event receiver after added list item with attachment - Because it is office 365, in SandBox solution I can´t use SmtpClient class.
Any other ideas?
Client side:
For example client web part with REST call. It works fine until I don´t need access to attachment.
string oDataUrlAttach = "/_api/Web/lists/getbytitle('ListName')/Items(6)/AttachmentFiles('Document.docx')/$value";
HttpWebRequest itemRequestAttach = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrlAttach);
itemRequest.Method = "GET";
itemRequest.Accept = "application/atom+xml";
itemRequest.ContentType = "application/atom+xml;type=entry";
itemRequest.Headers.Add("Authorization", "Bearer " + accessToken);
HttpWebResponse itemResponseAttach = (HttpWebResponse)itemRequestAttach.GetResponse();
Here I get error: The remote server returned an error: (403) Forbidden.
But other calls are OK. I can get all items from my list except attachments.
Any ideas?
Thank you.Why hasn't this been answered?
Sam Ogle -
How i can send email with attachment ?
any body can help me ..............??????????????????
Hello,
please, use "Search" utility in the forum before ask something like this...
I've just tried with :
"send email with attachment"
and ... you have the solution in the first result...
Regards,
Jose. -
Sending email with attachment from iCloud
when i am sending email with attachment, when i am sending email with attachment I found that the mail was send and still on draft on the client software on my mac book pro. Any solution please??
That happens at times. Don't know why. Just delete the email in the drafts folder, as long as you are sure it was sent (check the sent folder). I've wondered whether it's a timing issue.
-
BPEL send email with attachment
Hi guys,,
Now i want to send email with attachment from the bpel console. In bpel console, if i want to use, "browse" button, how can i create this button in my xsd file?Hello,
Well I'm using the BPEL build in decoder. It works for txt file but how about PDF? Will it be the same?
it give me this message in the email process.
XML Parsing Error: reference to invalid character number
p/s: it working to txt but not pdf.
below is the script
<bpelx:exec name="decoder" language="java" version="1.5">
<![CDATA[String inputString = new String();
inputString =(String)getVariableData("attachmentContentVar");
try {
String decoded = Base64Decoder.decode(inputString);
setVariableData("decoded",decoded);
catch(Exception e)
e.printStackTrace();
}]]>
</bpelx:exec>
<copy>
<from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
part="WfattachmentCollection"
query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:encoding"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
</copy>
<copy>
<from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
part="WfattachmentCollection"
query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:name"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
</copy>
<copy>
<from expression="bpws:getVariableData('decoded')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
</copy>
</assign>
Edited by: kpchong on Oct 20, 2009 12:00 AM -
Send Email with Attachment Callable Object
Hello,
I have a GP Application where i have 2 steps....in the first action the initiator attaches a document through standard GP functionality......i want to send this attachment to the approver alongwith the email i am already sending using 'Send email with Attachment (optional)' callable obejct.....how can i implement this....?
Any help would be highly appreciated.
Regards,
AnilHello Anil!
Well, if i really undestand your question, i think you resolve it using callable object mail with attachment, you said that do it, so, you only need to configure your smtp on youser server and you don´t need more work.
Please write any doubts. -
Send Email with Attachment in BSP?
Hello,
I have trouble about sending Email in BSP .
I don't know how to <b>Send Email with attachment in BSP</b> . Please give me some advice .
Thank you very much!Here is a sample application..
<b>Layout</b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<htmlb:page title="Send Mail with Attachment " >
<htmlb:form id = "form1"
encodingType = "multipart/form-data" >
<htmlb:label for = "MAILTO"
text = "Mail to" />
<htmlb:inputField id = "MAILTO"
size = "20"
value = "<%= mail_to %>"
type = "string" />
<htmlb:fileUpload id = "myUpload"
onUpload = "HandleUpload"
upload_text = "Attach"
size = "90" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b>Page attributes:</b>
mail_to TYPE ADR6-SMTP_ADDR E-Mail Address
<b> Event handler OnInputprocessing..</b>
DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD,
file_content TYPE XSTRING,
file_length TYPE STRING,
file_mime_type TYPE STRING,
file_name TYPE STRING.
fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
request = request
id = 'myUpload'
name = 'fileUpload' ).
if fileUpload is not INITIAL.
file_name = fileUpload->file_name.
file_mime_type = fileUpload->file_content_type.
file_length = fileUpload->file_length.
file_content = fileUpload->file_content.
mail_to = request->get_form_field( `MAILTO` ).
* Send mail part..
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
* Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lt_att_content_hex type solix_tab,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear Vendor,' TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Please find the attached report.'
TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Visit report' ).
data: data_tab type solix_tab,
p_data type XSTRING.
* Pass the data of the document we have uploaded..
p_data = file_content.
call function 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = p_data
TABLES
binary_tab = data_tab.
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Visit Report'
i_att_content_hex = data_tab ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
* Add attachment
* Pass the document to send request
lo_send_request->set_document( lo_document ).
* Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
l_send type ADR6-SMTP_ADDR value '[email protected]'.
* Set sender
l_send = mail_to.
lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
* Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
** Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
* Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
endif.
Hope this will be helpful.
Raja T -
Problem sending email with attachment by android
Good Morning, I'm Luca.
I have this problem:
through a smartphone with Android system,
synchronized via ActiveSync, the user
is unable to send emails with attachments.
While you can receive them and
open them without problem.
We have a server with Exchange 2010.
Is there any authorization that I have to give
you?
Other devices, always with Android system,
with other accounts of course,
does not have the same problem.
Thank you very much
Best regardsLuca, if one user is able to send attachments, the other should be able to as well. However, if an attachment is too large, it won't be delivered.
Agreed, This does sound like a size limitation issue.
Have the person try to send the same file from his outlook on his PC and see if he can send it out, that should be a good indication. -
Problem in sending mail with attachment
Hi All,
I am using the function module <b>'SO_NEW_DOCUMENT_ATT_SEND_API1'</b> to send mail with attachment.
the program executes properly and shows a message <b>'Document Sent'</b>. But neither the sent mail appears in <b>'SOST'</b> nor I get it on the specified email id.
Below is my code:
<b>***</b> As attachment I am sending resume whose contents are stored in table 'ZResume' corresponding to personnel no.(pernr) and serial No.(srno).
<b>START OF PROGRAM</b>----
REPORT ZPTEST_SEND_MAIL_ATTATCHMENT.
DATA : w_name TYPE sos04-l_adr_name.
DATA: RESUME TYPE table of XSTRING with header line.
START-OF-SELECTION.
<b>* Data Declaration</b>
DATA:
l_datum(10),
ls_docdata TYPE sodocchgi1,
lt_objpack TYPE TABLE OF sopcklsti1 WITH HEADER LINE,
lt_objhead TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objtxt TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_objbin TYPE TABLE OF solisti1 WITH HEADER LINE,
lt_reclist TYPE TABLE OF somlreci1 WITH HEADER LINE,
lt_listobject TYPE TABLE OF abaplist WITH HEADER LINE,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
WRITE sy-datum TO l_datum.
SELECT SINGLE RESUME FROM ZRESUME INTO RESUME
WHERE PERNR EQ '00001182'
AND SRNO EQ '1'.
APPEND RESUME.
<b>* Because RESUME may be of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy</b>
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = resume
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
<b>* Create the message and send the document.
Create Message Body</b>
<b>* Title and Description</b>
ls_docdata-obj_name = 'Resume'.
ls_docdata-obj_descr = 'Resume'.
<b>* Main Text</b>
lt_objtxt = 'Resume of the candidate' .
APPEND lt_objtxt.
<b>* Write Packing List (Main)</b>
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
ls_docdata-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objtxt ).
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
<b>* Create Message Attachment
Write Packing List (Attachment)</b>
l_att_type = 'ALI'.
DESCRIBE TABLE lt_objbin LINES l_tab_lines.
READ TABLE lt_objbin INDEX l_tab_lines.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255 + STRLEN( lt_objbin ).
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = l_att_type.
lt_objpack-obj_name = 'ATTACHMENT'.
lt_objpack-obj_descr = 'Resume'.
APPEND lt_objpack.
<b>* Create receiver list</b>
lt_reclist-receiver = '[email protected]'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
<b>* Send Message</b>
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = ls_docdata
put_in_outbox = ''
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_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.
Document sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '022'.
ELSE.
Document <&> could not be sent
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH ls_docdata-obj_name.
ENDIF.
<b>END OF PROGRAM</b>----
Can anybody tell me where I am making mistake?
Thanks in advance,
PragyaHi Pragya,
Refer the code below. It's working fine and try to match up the things from your program.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
*file_open_error = 1
*file_read_error = 2
*no_batch = 3
*gui_refuse_filetransfer = 4
*invalid_type = 5
*no_authority = 6
*unknown_error = 7
*bad_data_format = 8
*header_not_allowed = 9
*separator_not_allowed = 10
*header_too_long = 11
*unknown_dp_error = 12
*access_denied = 13
*dp_out_of_memory = 14
*disk_full = 15
*dp_timeout = 16
*OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra -
Sending email with attachment SO_DOCUMENT_SEND_API1, chinese Charactors
Hi all,
Using SO_DOCUMENT_SEND_API1 to send an email with attachment of an xls file, those chinese charactors cant be written properly into the xls file. During my debug proccess, those chinese charactors seems fine, look good in the internal table. But the xls file received, those chinese charactors changed into weird charactors....
Thank you....Hai Kokwei Wong
Check the following Code
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA L_NUM(3).
Creation of the document to be sent
File Name
DOC_CHNG-OBJ_NAME = 'SENDFILE'.
Mail Subject
DOC_CHNG-OBJ_DESCR = 'Delivered Mail'.
Mail Contents
OBJTXT = 'Object text'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
LOOP AT ITAB_DATA.
CONCATENATE ITAB_DATA-PRODUCTOR
ITAB_DATA-VBELN
ITAB_DATA-POSNR
ITAB_DATA-MATNR INTO OBJBIN.
APPEND OBJBIN.
ENDLOOP.
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'ORDERS'.
APPEND OBJHEAD.
Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'TXT'.
OBJPACK-OBJ_NAME = 'WEBSITE'.
OBJPACK-OBJ_DESCR = 'ORDERS.TXT'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
target recipent
clear RECLIST.
RECLIST-RECEIVER = '[email protected]'.
RECLIST-EXPRESS = 'X'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
copy recipents
clear RECLIST.
RECLIST-RECEIVER = '[email protected]'.
RECLIST-EXPRESS = 'X'.
RECLIST-REC_TYPE = 'U'.
RECLIST-COPY = 'X'.
APPEND RECLIST.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
Thanks & regards
Sreenivasulu P -
Send email with attachment PDF
Hi,
i have two environments. One is updated with support package 16 and the other environment isn't updated.
in the environment that is not updated i can send normally email with attachment using smartforms with the function 'SO_NEW_DOCUMENT_ATT_SEND_API1' but now i copied this program to the environment that is updated but the attachment have issue...it don't open.
anybody have some idea to solution?
tks
PatriciaHi,
Check the program 'BCS_EXAMPLE_6' for sending PDF as an attachment. Try sending your PDF using the method specified.
Regards,
Sagar -
Send email with attachment via XI
Hi,
I need some help regarding sending out email with attchment via XI. My scenario will be I will need to send an email with attachment of Purchase Order (PDF format). I need to do it via XI. Is there any best way for me to configure my SENDER/RECEIVER Mail Adapter in order to send the email with PDF attachment via XI.
Appreciate any valuable thoughts and advice.
Thanks,
ZubairHave you seen these blogs
https://weblogs.sdn.sap.com/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
regards
SKM
Maybe you are looking for
-
HT2736 Can I take a voucher from one account and put it on another account
I am really struggling to get a voucher from one account to another any suggestions ?
-
Hard drive crash: Repurchasing Music?
Hey guys, im new here, but over the summer I had a major hard drve issue and lost nearly 1 TB of files, pictures, video, AND MUSIC. And now, I can see the soundtracks I bought in iTunes, but since the downloadedalbums are gone, i can't listen to them
-
GRC 10.1 - Routing at Request Submission in case of SOD violations
I am trying to configure MSMP workflow or risks analysis while creating userid 1. No Risks >> User created and access assigned automatically 2. Risks found >> forward to security team to review and approve I have checked the standard functional modul
-
Playlist problem....Please help!!!!!!
Hello all. I have an ipod 5th gen. I'm trying to update my playlist and when I synced it, itunes synced with my ipod but it did not sync in the order I put in the playlist. Itunes synced my ipod with the playlist in alphabetical order and not in the
-
제품 : FIN_AP 작성날짜 : 2004-05-19 AP ACCOUNTING EVENT의 종류 및 설명 ============================ PURPOSE AP에서는 Accounting이라는 Process가 존재한다. Accounting작업시 AP Data의 상태에 따라 서로 다른 Event가 발생한다. Event에 대해서 종류별로 간단하게 설명한다. Explanation 1. Invoice Invoice Event :