Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OO replacement for FM SO_NEW_DOCUMENT_SEND_API1

Former Member
0 Likes
978

Hello all,

This function module will send an e-mail or a SAP office message depending upon the value of the rec_type field in the receivers internal table.

  • call function 'SO_NEW_DOCUMENT_SEND_API1'

  • EXPORTING

  • document_data = email_data

  • document_type = 'RAW'

  • put_in_outbox = 'X'

  • TABLES

  • object_content = data_tab

  • receivers = email_send.

We recently found out that after we converted our 4.7 system to Unicode, about a year ago, the function module was no longer creating a non-deliverable e-mail message if the recipient did not exist. So I'm in the process of replacing the function module in our custom programs. I'm using a function module that Thomas Jung described in a blog with this title "Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface". So far so good.

Now I found that one of our programs is using this function module to send a SAP Office message. Does anybody have an example using any of the BCS classes to send a SAP office message?

Thanks

Bruce

Hello all,

This function module will send an e-mail or a SAP office message depending upon the value of the rec_type field in the receivers internal table.

  • call function 'SO_NEW_DOCUMENT_SEND_API1'

  • EXPORTING

  • document_data = email_data

  • document_type = 'RAW'

  • put_in_outbox = 'X'

  • TABLES

  • object_content = data_tab

  • receivers = email_send.

We recently found out that after we converted our 4.7 system to Unicode, about a year ago, the function module was no longer creating a non-deliverable e-mail message if the recipient did not exist. So I'm in the process of replacing the function module in our custom programs. I'm using a function module that Thomas Jung described in a blog with this title "Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface". So far so good.

Now I found that one of our programs is using this function module to send a SAP Office message. Does anybody have an example using any of the BCS classes to send a SAP office message?

Thanks

Bruce

6 REPLIES 6
Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
916

Hi Bruce,

this is exactly what the function module you built from Thomas' blog does.

Just look through the code for the function module.

Cheers

Graham Robbo

Read only

0 Likes
916

Graham,

In the recipient table that is passed to Thomas's function module:

- if the recipient-c_address is populated it sends an e-mail to that address,

- if the recipient-uname field is populated it gets the e-mail address from the user master and sends an e-mail.

I have not found a way to send an SAP Office message using Thomas's function module.

Here's the code from Thomas's function module that is creating the recipients. I don't see anything in the code that would allow anything other than an e-mail to be created. Am I missing something?

  • Following the sender, we can add our recipients to the e-mail. If

  • requested by the calling program we will lookup the recipients e-mail

  • address from their SAP User Master using the BAPI,

  • BAPI_USER_GET_DETAIL. If an e-mail address isn't maintained there,

  • we will try and create one by concatenating their user id together

  • with our default company domain name.

************************************************************************

data: recipients_line like line of recipients.

loop at recipients into recipients_line.

if recipients_line-c_address is initial.

  • Create recipient

clear iaddsmtp.

refresh iaddsmtp.

clear bapiadsmtp.

clear recipient.

  • Read the E-Mail address for the user

call function 'BAPI_USER_GET_DETAIL'

exporting

username = recipients_line-uname

tables

return = ireturn

addsmtp = iaddsmtp.

loop at iaddsmtp where std_no = 'X'.

clear bapiadsmtp.

move iaddsmtp to bapiadsmtp.

endloop.

  • If no E-mail address was found, create one.

if bapiadsmtp-e_mail = ''.

concatenate recipients_line-uname local_domain

into recipients_line-c_address.

else.

move bapiadsmtp-e_mail to recipients_line-c_address.

endif.

endif.

recipient = cl_cam_address_bcs=>create_internet_address(

recipients_line-c_address ).

  • Add recipient with its respective attributes to send request

call method send_request->add_recipient

exporting

i_recipient = recipient

i_express = recipients_line-i_express

i_copy = recipients_line-i_copy

i_blind_copy = recipients_line-i_blind_copy

i_no_forward = recipients_line-i_no_forward.

endloop.

Thanks

Bruce

Read only

0 Likes
916

Hi Bruce,

unfortunately I am unable to connect to a system at the moment to look closer at this, so I am sort of guessing what the anser might be.

I seem to remember there is a different method for creating each communication path ( CREATE_INTERNET_ADDRESS, CREATE_FAX_ADDRESS, etc.) and a generic method where you pass the username and the communication type required. I think the communication type for SAPOffice addresses is 'RML'.

So replace this code..


        recipient = cl_cam_address_bcs=>create_internet_address(
                                           recipients_line-c_address ).

with something like this


        recipient = cl_cam_address_bcs=>create_generic_address(
                                           exporting i_user = user i_commtype = 'RML' ).

You will need to look at the class CL_CAM_ADDRESS_BCS to find the actual method name.

Cheers

Graham

Read only

0 Likes
916

Graham,

This is the code that I used.

DATA: w_ad_symbdst TYPE ad_symbdst.

*

w_ad_symbdst = sy-sysid.

recipient = cl_cam_address_bcs=>create_rml_address(

i_syst = w_ad_symbdst

i_client = sy-mandt

i_username = sy-uname ).

In addition, I had to set up a new RML node in transaction SCOT. Thomas Jung helped me resolve my problem.

Thanks

Bruce

Read only

0 Likes
916

Thanks Bruce,

I am a bit surprised a new RML node had to be setup. I would have expected it to work "out of the box". Anyway I'm happy you have solved the problem.

That Thomas Jung is a handy guy to know isn't he?

Cheers

Graham Robbo

Read only

0 Likes
916

Hi , anyone can u explain me how to set up the rml note