Send a mail to partner of shipping point
Hi,
For shipment document (VT01N / VT02N), I need to send a mail to partner assign to shipping point irrespective of output type.
That is when the user make an output entry as output type, communication medium (email),function(shipping point) and partner for the shipment document and click on save button, the document should go to the partner.
The email id of partner is maintained using T-Code OVXD.
Thanks
You can use JavaMail, or tcEmailOperations and the NotificationResolver to send email notification. Not sure what help you are looking on this.
-Bikash
Similar Messages
-
Sending E-mail by Partner Function when i save an Activity in the IC WC
Hi Experts,
I am trying to send an E-mail to a specific Activity Partner defined in the BP Partner Functions associated with the transaction type after the activity is saved
in the Interaction Center WinClient.
For this, I am using actions profiles and conditions. I have checked that I can send E-mails, but only when I directly specify the E-mail address of the person I want to send the E-mail to in the Action Conditions. However, as I mentioned before, what I need is to automatically determine the BPs E-Mail address from the Business Partner Function (Activity Partner) in the transaction (in this case I am using a contact transaction type) in order to send the E-mail.
Can anyone shed some light on this issue?Hi Pratik,
I'm facing a similar issue than Alberto, but I' ve already performed the customizing you indicated.
Also, we have maintained as Processing types, a standard "Smart Forms Mail", with the following Mail Settings:
- Form Name CRM_ACTIVITY_BUSACT01
- Processing Class CL_DOC_PROCESSING_CRM_ORDER
- Processing Method Z_CRM_ACTIVITY_EXEC_SMART_FORM
- Archive Mode Mail Only
Also in the "Define Conditions" customizing, in the "Processing Details" we added "External Communication" and "Smart Forms Email" as Assigned Processings:
- External Communication
- Communication Method - INT Internet Mail
- Form Name - CRM_REMINDER_MAIL_01
- Form Type - Smart Forms
- Format - CRM_ACTIVITY_EXEC_SF
- Storage Mode - Send Only
- Email Smart Form (default)
- Forms Name- CRM_ACTIVITY_BUSACT01
- Proc Class. - CL_DOC_PROCESSING_CRM_ORDER
- Proc Method Z_CRM_ACTIVITY_EXEC_SMART_FORM
Finally, we assured that the employee email communication data was maintained on the Master Data (trx. BP).
However, although we can receive and send emails to the outside (i.e. SCOT /SMTP are fully customized) I'm not able to send a Email from the business activity to the Employee external email address.
Can you help us?
Thanks in advance,
Joao Fleming -
EDI: partner profile for shipping point or plant
I want to issue idocs for delivery notes based on shipping point or plant, not shipto party as is usual.
How can I go about this?
It looks like I need to create a new partner type. Or can I use logical systems?
If logical system is used, then how do I make the connection document->LS?
The external system uses the RCVPRN to determine which warehouse to handle the delivery for.
I am changing the RCVPRN in a user exit now, but this still requires creating/ changing all partner profiles for shipto parties.
Any ideas? previous experiences?
Thanks,
phillipHi Phillip,
it looks like I need to create a new partner type. Or can I use logical systems?
> Yes, you can use LS
If logical system is used, then how do I make the connection document->LS?
> You can use FM: MASTER_IDOC_DISTRIBUTE to send the outbound IDOC...
Regards,
Hendy -
Sending external mail using SO_NEW_DOCUMENT_ATT_SEND_API1
When i use this RFC by appending the internal table receiver with receiver: sapuser name and rec_type B it triggers mail to the sap user login .But when i give external email address for receiver with rec_type 'U' it is not triggering any mail.Can anyone please tell me how to use this RFC in sending external mails??
I went back and you are right "INT" was not the REC_TYPE it was the COM_TYPE.
Sorry for any confusion caused.
However,
I suggest 2 more tests and then I give up and can not think about anything else.
Try:
#1
REC_TYPE = 'X'.
if it does not work.
#2
REC_TYPE = 'R'.
Hope that will do the trick. I was trying a lot when I had to get that working some time ago.
And surely the other colleagues point to something which must be setup as well. Transaction SCOT the SMTP settings.
Furthermore there could be another issue. I remember that I worked at a client who had turned off the send settings on their email server. So SAP finished everything and handed the emails on to a mail server. The mail server had a setting to block any emails from the development environment.
So that might be another cause of your issue. -
Can't send e-mails to personal e-mail account outside the company
Hello
I'm trying to use UTL_SMTP package to send e-mails to users either by pressing a button, or deployed by a trigger. I'm using procedure Send_mail to do it but encountered a problem:
if it's a company e-mail address, it works fine - although i haven't been able to put more than 2 recipients at the same time (ORA-29279: SMTP permanent error: 501 5.1.3 Invalid address). if it's a personal account, it returns error ORA-29278: SMTP transient error: 421 Service not available.
At this point, procedure's parameters are all static.
I've tried using procedure Send of UTL_MAIL package but, having also static parameters, when sending to a personal account outside the company it also returns error ORA-29278.
What am i doing wrong?
Many thanks for your replies!I forgot to pass port 26 as a parameter in UTL_SMTP package.
-
Shipping Point Determination for Sub contracting Process
Dear Experts,
While processing the GR for a Sub Contract Purchase Order, we are getting an Error 'VL 100 - Shipping Point XXX doesn't exists'
However, I am not understanding where from this Shipping point is picked.
Checked the Shipping point determination based on Loading Grp, Shipping conditions & Plant. But that is a different shipping point, and it is being picked while processing the outbound delivery for sending components thru 541 Movement.
It is clear that the Shipping point XXXX is not existing, but not sure, as where from that Shipping point is being determined while doing GR
Request for your inputs please
Thank you,
Best Regards,
Ramakrishna MangenaHi Ramakrishna ,
What u earlier said is perfectly right : Shipping point determination based on Loading Grp, Shipping conditions & Plant
Check the following :
Are u posting GR through VL31N .
If yes, just check the receiving pt entered in Header Data - Shipment Tab.
Regards
Ramesh Ch -
Controlling PO incoterms/delivery address from SO shipping point
Hi,
We want to be able to create sales orders with individual Purchase orders ( Purchase orders created with sales order as account assignment - one PO for SO/SO Item )
We want to select freely between multiple shipping point in different countries within the same plant ( in free trade zones )
What is the best way to ensure that the purchase order reflects the different shipping point ? As this is DDU, the Vendor needs to know where to send the goods. You could imagne that the Incoterm 2 would be dynamically set according to the shippingpoint, but the Incoterms in the PO are static - header from vendor master, item from inforecord. Also is the PO delivering address not updated.
We are afraid that the vendor sends the goods to one place and the DSP will attempt to pick up at another ...Thanks much for your time!
All i need is 2 W/days for picking and 2 W/days for loading from the shipping point. Do i need to delete duration also? i have deleted the workign times. Also , i do not need anything from Routes as well. I maintain duration , do i need to maintain them in days for all the possible routes ?? Since my pick/loading times are based on shipping points only , do i have to maintain this data for routes and wt grps ?
Really appreciate ur sharing ur experience!!
-Amit -
Need to send a mail while safty stock goes down compare with actual stock
Dear experts,
I Need to send a mail to concern persion while stock goes down compare with safty stock. We plan to put a check at the point of MARD table updation, Because we not able to put a check at the all transaction codes, So please LET ME KNOW HOW TO PUT A CHECK AT STANDARD TABLE UPDATION?
Thanks in adv,
jayakumar.MYour best bet may to be place your check in the a user exit for goods movements. The enhancement is MB_CF001, the component is EXIT_SAPLMBMB_001.
Hope this helps,
Mark -
Need to send a mail while safty stock goes down
Dear experts,
I Need to send a mail to concern persion while stock goes down from safty stock. We plan to put a check at the point of MARD table updation, Because we not able to put a check at the all transaction codes, So please LET ME KNOW HOW TO PUT A CHECK AT STANDARD TABLE UPDATION?
Thanks in adv,
jayakumar.MHi Jai,
According to my understanding,
As soon as the stock goes down from the safety stock a mail should be triggered.
Probable solution (in my opinion)
create a flag in the table set it whenever the stock value goes down.
make calculations like (safety stock as today - safety stock previous date) = 0 if not set the flag and construct a workflow withe receiver settings based on the flag field and trigger a mail to the concerned person.
This is just my idea.
Try it and revert
Thanks and Regards
Srikanth.P -
Error in sending external mail
hi ..
while sending mail using BCS objects .... i am geting error
Internal error: SO_OBJECT_MIME_GET Exception: 2
....i too configured SCOT transaction wit port number 25 , mail host and also given the internet email id for mailing user....
plz do help me ...This error occurs when you send a mail via the SMTP node and can have several causes:
1. Default domain not set
2. Default code page not set (only with multi-codepage systems)
3. Code page not suitable for sending mail
4. COMMIT WORK is missing (programming error)
5. Workplace plug-in is missing
Solution
Activate the SAPconnect trace and resend the document if necessary. The next time the SAPconnect send job is running, search for the entries marked in red in the SAPconnect trace of the document. The applicable solutions, depending on these entries, are listed below:
1. Default domain not set
Trace entries:
BCS->MIME_MESSAGE_GENERATE
Sender Address Not Found 80
SO_OBEJECT_MIME_GET
No MIME Document Received. Error Code: SENDER_BCS
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
or
SX_GENERATE_NDR
Internal error: SO_OBJECT_MIME_GET Exception: 2
or:
BCS->MIME_MESSAGE_GENERATE
Error during MIME Flow Generation
BCS->MIME_MESSAGE_GENERATE
Error During Automatic Determinaton of Default Internet Domain
SO_OBEJECT_MIME_GET
No MIME Document Received. Error Code: MIME_BCS
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
or
SX_GENERATE_NDR
Internal error: SO_OBJECT_MIME_GET Exception: 2
Solution: In the SAPconnect Administration (transaction SCOT), you must set the domain of the SAP System (Settings --> Default Domain).
2. Default code page not set (only with multi-codepage systems)
Trace entries:
CL_BCOM_MIME->GET_CODEPAGE
Termination: Multi-Codepage Systems Not Supported
SO_OBEJECT_MIME_GET
No MIME Document Received. Error Code: MNA_DOC
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
or
SX_GENERATE_NDR
Internal error: SO_OBJECT_MIME_GET Exception: 2
Solution: In the SAPconnect Administration (transaction SCOT), you must specify a code page on the SMTP node.
3. Code page not suitable for sending mail
Trace entries:
CL_BCOM_MIME->GET_CHARSET
Termination: Charset Cannot Be Determined for SAP Code Page
SO_OBEJECT_MIME_GET
No MIME Document Received. Error Code: MNA_DOC
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
or
SX_GENERATE_NDR
Internal error: SO_OBJECT_MIME_GET Exception: 2
Solution: In the SAPconnect Administration (transaction SCOT), you must specify a code page (an entry is available in table TCP00A) that is suitable for sending mail on the SMTP node.
4. COMMIT WORK is missing (programming error)
Trace entries:
SO_OBEJECT_MIME_GET
No Send Order Exists -> Termination
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
Solution: See note 429427 for the correction.
5. Configuration for the sending of Business Objects
An attempt is made to send a document of type OBJ to an external recipient. This requires a conversion to TXT/HTML format, but the necessary modules are not configured correctly.
Trace entries:
SX_OBJECT_CONVERT_OBJ_HTM
Converting Document Format from OBJ to TXT/HTML
SO_OBEJECT_MIME_GET
No MIME Document Received. Error Code: MNA_DOC
SX_GENERATE_NDR
Internal Error: SO_OBJECT_MIME_GET Exception: 0
or
SX_GENERATE_NDR
Internal error: SO_OBJECT_MIME_GET Exception: 2
Solution:
Please refer to Note 530932.
1. You can refer to SAP Note 487754.
2. Error in Sending External Mail
3. Re: BWCCMS: send email if process chain fails?
Hope this will solve your issue.
Re: Send mails
Re: SCOT Setup
Reward points.. -
We want to send a mail with attachment pdf file.
Hi!!!
We want to send a mail with attachment pdf file.
The PDF file this is in the server sap.Hi,
Pls check web logs like
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
Eddy
PS.
Put yourself on the SDN world map (http://sdn.idizaai.be/sdn_world/sdn_world.html) and earn 25 points.
Spread the wor(l)d! -
How to send a mail with attaching a report
hi gurus,
my requirment is i have to send a mail with attaching the report of a program to the client.. is it possible? help me with sample code.
Thanks in advance.
Regards,
Indira DHi Indira,
plz check out this code below,
*& Report ZATTACH *
REPORT ZATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
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,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_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.
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[] = pit_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.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform.
" POPULATE_EMAIL_MESSAGE_BODY
<b>
Reward points if this helps,</b>
Kiran -
How to send a mail to the user when a job gets canceled?
Hi experts,
I need to send a mail when a job gets canceled to the user.I know the FM for sending mail and i can find if a job is canceled from tbtco,but i want to know how to send the mail from the same program ,once it got canceled ?
thanks in advance,
helpful answers will be awarded with points
regards,
ashwinHi Ashwin
Use the below peace of code:
REPORT ZBCJOBMONITOR .
TABLES: SOMLREC90,
TBTCO.
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: I_TBTCO LIKE TBTCO OCCURS 0 WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
SELECT-OPTIONS: S_JOB FOR TBTCO-JOBNAME.
SELECT-OPTIONS: S_JOBC FOR TBTCO-JOBClass.
SELECT-OPTIONS: S_REC FOR SOMLREC90-RECEIVER.
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION.
CLEAR: MAILDATA, MAILTXT, MAILREC, I_TBTCO.
REFRESH: MAILTXT, MAILREC, I_TBTCO.
PERFORM GET_ABENDED_JOBS.
PERFORM BUILD_RECEIVERS.
LOOP AT I_TBTCO.
PERFORM BUILD_TEXT_MESSAGE.
PERFORM SEND_MAIL_NODIALOG..
ENDLOOP.
Form BUILD_TEXT_MESSAGE
FORM GET_ABENDED_JOBS.
SELECT * FROM TBTCO
INTO CORRESPONDING FIELDS OF TABLE I_TBTCO
WHERE JOBNAME IN S_JOB
AND STATUS = 'A'
AND JOBCLASS IN S_JOBC
AND SDLSTRTDT = SY-DATUM.
ENDFORM.
Form BUILD_TEXT_MESSAGE
FORM BUILD_TEXT_MESSAGE.
DATA: DATE(10) TYPE C.
DATA: TIME(10) TYPE C.
MAILDATA-OBJ_NAME = 'MONITOR'.
MAILDATA-OBJ_DESCR = 'Batch Job Monitor'.
MAILDATA-OBJ_LANGU = SY-LANGU.
CONCATENATE 'Job Name:' I_TBTCO-JOBNAME
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
PERFORM FORMAT_DATE USING I_TBTCO-SDLSTRTDT
DATE.
CONCATENATE I_TBTCO-SDLSTRTTM+0(2) ':'
I_TBTCO-SDLSTRTTM+2(2) ':'
I_TBTCO-SDLSTRTTM+4(2)
INTO TIME.
CONCATENATE 'Start Date/Time:' DATE TIME
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
CONCATENATE 'Job Class:' I_TBTCO-JOBCLASS
INTO MAILTXT-LINE SEPARATED BY SPACE.
APPEND MAILTXT.
MAILTXT-LINE = 'Job has terminated abnormally'.
APPEND MAILTXT.
ENDFORM.
Form BUILD_RECEIVERS
FORM BUILD_RECEIVERS.
LOOP AT S_REC.
CLEAR MAILREC.
MAILREC-RECEIVER = S_REC-LOW.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
ENDLOOP.
ENDFORM.
Form SEND_MAIL_NODIALOG
FORM SEND_MAIL_NODIALOG.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
DOCUMENT_TYPE = 'RAW'
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_HEADER = MAILTXT
OBJECT_CONTENT = MAILTXT
RECEIVERS = MAILREC
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 SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Form FORMAT_DATE
FORM FORMAT_DATE USING IN
OUT.
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = IN
IMPORTING
DATE_EXTERNAL = OUT
EXCEPTIONS
DATE_INTERNAL_IS_INVALID = 1
OTHERS = 2.
ENDFORM.
Regards,
Sree -
XLS as MAIL attachment....points Guranteed
I am sending one xls file as mail attachment.
The following code is sending the mail pefectly, but the attchment appears with a different icon, not as xls icon in the attchment, as it normaly does if we use so00 for sending a xls attchment thorugh mail.
If i download the xls attchment in local pc after opening the mail, it does open with Excel application, but if double click on it in the mail itself, its not opening in normal text format in sap text-editor in read only mode, not as xls file.I suspect something is wrong...here is the code..please let me know about your suggestion..
For Max, and those who answered my last question, i will reward point to deserving answer after this post.. i got disconnected while surfing...sory for the delay.
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
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,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_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.
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[] = pit_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.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODYSorry for a mistake...this the code..i was talking about
REPORT ztest3.
E-mail an Abap report *
DATA : w_name TYPE sos04-l_adr_name.
SELECT-OPTIONS :
Recipient address
s_name FOR w_name DEFAULT sy-uname NO INTERVALS.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
START-OF-SELECTION.
E-mail Abap report
PERFORM CREATE_XLS_FILE_DATA.
PERFORM f_send_mail.
Form f_send_mail
FORM f_send_mail.
Data Declaration
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,
l_tab_lines TYPE i,
l_att_type LIKE soodk-objtp.
WRITE sy-datum TO l_datum.
NOTE: Creation of attachment is finished yet.
For your report, the attachment should be placed into table
objtxt for plain text or
objbin for binary content.
Now create the message and send the document.
Create Message Body
Title and Description
ls_docdata-obj_name = 'Sample Records From Ekpo in XLS Format'.
CONCATENATE 'Sample Records From Ekpo' 'In XLS FORMAT'
into ls_docdata-obj_descr SEPARATED BY space.
Main Text
lt_objtxt = 'Sample Records From Ekpo in XLS Format'. "#EC *
APPEND lt_objtxt.
Write Packing List (Main)
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.
Create Message Attachment
Write Packing List (Attachment)
LT_OBJHEAD = 'TEST.XLS'.
APPEND LT_OBJHEAD.
DESCRIBE TABLE it_attach LINES l_tab_lines.
READ TABLE it_attach INDEX l_tab_lines.
lt_objpack-doc_size = l_tab_lines * 255.
lt_objpack-transf_bin = 'X'.
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
lt_objpack-obj_name = 'ATTACHMENT'.
lt_objpack-obj_descr = 'TEST.XLS'. "#EC *
APPEND lt_objpack.
Create receiver list
LOOP AT s_name.
lt_reclist-receiver = s_name-low.
lt_reclist-rec_type = 'B'.
APPEND lt_reclist.
ENDLOOP.
Send Message
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 = it_attach
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.
ENDFORM. " F_SEND_MAIL
*& Form CREATE_XLS_FILE_DATA
form CREATE_XLS_FILE_DATA .
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
" DATA_RETRIEVAL
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
" BUILD_XLS_DATA_TABLE
endform. " CREATE_XLS_FILE_DATA -
Standard SAP functionality to send e-mail Text on PO Output?
Hi,
I have a new requirement to send E-mail body along with the PO as an attachment to our vendors.
We are using '5' as tranmission medium to send the PO as e-mail and we call the Smart Form Interface with the Sender and Receipient information. Is there anything we can use as part of standard functionality to send e-mail text. I tried PO Title and Texts option when we define the output type, but the system doesn't seem to be picking it up.
I also tried to setup '7' as transmission medium, but when i use '7' system accepts 'MA' partner type only, when defining the condition records. But for Vendors we cannot define MA partner type in partner schema, so i am not able to define a MA partner when defining the condition record.
thanks
UdaiHi Srini,
Sorry SDN was not available at the time i wanted to write a reply yesterday.
The way i did this was, we were using call to SMARTFORM function module in the custom print program.
When we call the SMARTFORM function module, if you have to send an e-mail, then usually you would pass the recepient information to the function module. The RECPIENT is a business obect in SAP, which has a method called add note, which is what i used to add the e-mail text. One other thing i did was, i read the e--mail text from the Text object when you define the output. Usually the name of this text object is Application concatenated with Output type (eg.: EFNEU ).
I am including the code, please go through it and let me know if you have any questions.
swc_container container.
RECIPIENT-Object
swc_create_object recipient 'RECIPIENT' space.
Container
swc_clear_container container.
*Address type (Internet)
swc_set_element container 'TypeId' 'U'.
Get Vendor Email address
SELECT smtp_addr INTO lv_smtp_addr FROM adr6
UP TO 1 ROWS
WHERE addrnumber = lfa1-adrnr AND
flgdefault = 'X'.
ENDSELECT.
address_string = lv_smtp_addr.
swc_set_element container 'AddressString' address_string.
RECIPIENT.CreateAddress
swc_call_method recipient 'CreateAddress' container.
Update Log
IF sy-subrc NE 0.
ex_retco = '1'.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = sy-msgid
msg_nr = sy-msgno
msg_ty = 'W'
msg_v1 = sy-msgv1
msg_v2 = sy-msgv2
msg_v3 = sy-msgv3
msg_v4 = sy-msgv4
EXCEPTIONS
message_type_not_valid = 1
no_sy_message = 2
OTHERS = 3.
EXIT.
ENDIF.
Read textd defned in NACE
Add E-mail Body from 'Mail Texts and Title', created when creating Output Types
Text Name, usually 'EFNEU', Application and Output type concatenated
CONCATENATE nast-kappl nast-kschl INTO obj_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = c_txtid_stam
language = SY-LANGU
name = obj_name
object = c_txtob_ocs
IMPORTING
header = header
TABLES
lines = lines_tab
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
IF sy-subrc <> 0.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = sy-msgid
msg_nr = sy-msgno
msg_ty = 'W'
msg_v1 = sy-msgv1
msg_v2 = sy-msgv2
msg_v3 = sy-msgv3
msg_v4 = sy-msgv4
EXCEPTIONS
message_type_not_valid = 1
no_sy_message = 2
OTHERS = 3.
ENDIF.
E-mail BODY
Call 'AddNote' Method of RECIPIENT object
swc_clear_container container.
PERFORM replace_text_symbols USING header
lines_tab.
LOOP AT lines_tab INTO txtline.
email_line = txtline-tdline.
append email_line to email_body_tab.
ENDLOOP.
swc_set_element container 'NoteText' email_body_tab.
swc_call_method recipient 'AddNote' container.
If E-mail body creation failed
IF sy-subrc NE 0.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = sy-msgid
msg_nr = sy-msgno
msg_ty = 'W'
msg_v1 = sy-msgv1
msg_v2 = sy-msgv2
msg_v3 = sy-msgv3
msg_v4 = sy-msgv4
EXCEPTIONS
message_type_not_valid = 1
no_sy_message = 2
OTHERS = 3.
ENDIF.
Persistent RECIPIENT object
swc_object_to_persistent recipient recipient_id.
Call the Smartform function module name
CALL FUNCTION lv_fm_name
EXPORTING
control_parameters = ls_control_parameters
mail_appl_obj = appl_object_id
mail_recipient = recipient_id
mail_sender = sender_id
output_options = ls_output_options
user_settings = space
ekko = ekko
pekko = pekko
t166u = t166u
header = ls_header
ls_komv = ls_komv
ix_subtotal = lv_subtotal
ix_surcharge = lv_surcharge
ix_tax = lv_tax
iv_print_tax = lv_print_tax
iv_comp_name = lv_comp_name
iv_invlp1_txt1 = lv_invlp1_txt1
iv_invlp1_txt2 = lv_invlp1_txt2
iv_invlp1_txt3 = lv_invlp1_txt3
TABLES
ekpo = doc-xekpo
it_text = lt_text
it_line = lt_line
it_eket = it_eket
it_srvc = gt_srvc
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
ex_retco = '1'.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = sy-msgid
msg_nr = sy-msgno
msg_ty = 'W'
msg_v1 = sy-msgv1
msg_v2 = sy-msgv2
msg_v3 = sy-msgv3
msg_v4 = sy-msgv4
EXCEPTIONS
message_type_not_valid = 1
no_sy_message = 2
OTHERS = 3.
Maybe you are looking for
-
Subscriptions and Notifications on replies in Discussions
Hi, I´m having the problem that I only getting notifications on subscribed discussions for the initial posts Folder: abc/def/....). As replies are stored in another folder (at least in our installation collaboration/discussions) and the are reference
-
Hi We have a requirement to create a custom e mail. For the same I am trying to use Java Mail API.I am facing an issue with the following code: session session1 = session.getInstance(properties, null); System gives an error Sourced file: inline evalu
-
Searching a char in 2d array any direction
the method will take a string argument and convert them into char and try to find them in a 2d array. It is more like a word puzzle(wordSearcher).Here's what i've done so far... public void find(String word) for(int a = 0; a < word.length(); a++) { c
-
How to get the organization structures of a compnay code (BUKRS)?
Hi Friends, I have a requirement to get the organization structures of a compnay code (BUKRS), such as Controlling area, Credit control area, Plant, Sales Organization, Purch. Organization, Personnel area. How can I get them, I only know the compnay
-
When I create a document and add an image or when I recieve a dicument with an image on it, when I attemot to print it does.t print. ALL the writen/typed stuff is included but the image is eliminated!! How can I fix this?