Search This Blog

Monday, May 24, 2010

The SMTP Node

If you want to use the SMTP plug-in to send Internet mails, faxes, and/or SMSs externally, use the SMTP node. This node is delivered with SAPconnect and has to be adjusted to meet the requirements of your system landscape. In contrast to the other nodes, you cannot create any more SMTP nodes, nor can you delete the existing one. If you do not use the SMTP node, you cannot activate it (that is, you cannot set the Node in use indicator).

To send using the SMTP plug-in, you have to set parameters for the profile of the Internet Communication Manager (ICM).
 
Activities

In SAPconnect administration (transaction SCOT), double-click on the SMTP node.

Specify the following parameters with the ICM server/port combination to be used to send the messages:

Parameter

Description

Mail host

Host name of mail server for outgoing messages

Mail port

Port number for mail server for outgoing messages

Code page

The code page to be used when sending messages.

Also specify the following attributes:

Attribute

Description

Maximum waiting time for repeat send attempt procedure

Specify how long the send attempts are to be repeated for before the send process is cancelled, in the event of a communication error occurring when connecting to the mail server.

Node in use

Select this attribute when you are using the node.

Choose Set for the communication methods that the node can process. For each communication method, enter the formats and address areas that the node is to process. In the case of the communication methods FAX and SMS, also specify the domains to be used for address conversion. If, for example, you enter faxserver.company.com, the fax number DE 06227/7-455555 is converted into the following address:

FAX=+4962277455555@faxserver.company.com.

Authorizations in SAPconnect

 

External communication systems log onto the SAP System as an RFC user. The authorizations for this user are contained in the profile S_A.SCON. The profile is made up of the following authorizations:

Authorization object

Authorization

Field values

S_OC_SEND

S_OC_ALL

Range of the permitted number of recipients: *

Permitted communication methods: ' '

S_DATASET

S_DS_WF_USER

Program name: SAPLSWT1

Activity: 034

Physical file name: *

S_RFC

S_RFC_SCON

Activity: 016

Name of the RFC object to be protected: SX02, SYST

Type of the RFC object to be protected: FUGR

S_OC_TCD

S_OC_USER

Transaction codes: SBWP, SO00, SO03 - SO07, SO09, SO12, SO13, SO15, SOAD, SOCP, SODS

Authorizations for SAPconnect administrators

The SAPconnect administrator requires the authorizations for the RFC user and the authorizations for table maintenance, which are checked using the authorization object S_TABU_DIS. These authorizations are contained in the following roles:

  • SAP_BC_SRV_COM_ADMIN
  • SAP_BC_SRV_GBT_ADMIN

HTTP Configuration

The kernel of the SAP Web Application Server supports HTTP (Hyper Text Transfer Protocol). This enables text messages (pager/SMS) to be sent directly to external text message servers, or to the provider packed, as a URL, such as http://sms-provider.com/
sendmsg?password=<password>&to=<to>&from=<from>&text=<message>.

You cannot use this technology to receive text messages or confirmations of receipt. Status notifications, however, confirming that the message has been sent to the provider, are possible.

Prerequisites

Your provider must support SAPconnect HTTP for text messages (pager/SMS), you must have obtained all the required information and have performed all the required configurations. You want to be able to send a text message in a Web Browser using the template supplied by the provider for the SMS packed as a URL.

Process Flow

SAPconnect Administration (Transaction SCOT)

You have to configure the SAPconnect settings that you require for sending text messages using HTTP.

·        Nodes

Create an HTTP node and configure it. Proceed as follows:

i.         Make sure you are in the Node view.

ii.       Choose Node ® Create.

A wizard then leads you through the creation process.

iii.      Enter a node name and a description.

iv.      Choose HTTP Node.

v.        Enter the URL that is specified by the provider and has already been tested. When entering the parameters, use the pushbuttons if you need help.

vi.      If required, enter your personal provider password.

vii.     Enter the values specified by your provider. If your provider has not supplied you with any values, enter 160 for the Maximum Length and use the default values for Character Set and Coding.

viii.   Specify the messages your provider returns if a dispatch was successful and if an error occurred.

ix.     Enter the address area for which this HTTP node is to be responsible.  In general, * is used here.

x.       Specify the maximum waiting time for repeating the send attempt procedure if an error occurs.

xi.     Select Node is ready for use.

·        Send Job

A periodical background process, the SAPconnect send job, sends the text messages to the provider. To schedule this job in SAPconnect: Administration, proceed as follows:

i.         Choose View ® Jobs.

ii.       If no other job has been scheduled, choose Job ® Create.

iii.      Enter a job name and confirm it.

iv.      Select the variant SAP&CONNECTPAG by positioning the cursor on it.

v.        Choose Schedule Job.

vi.      Choose Schedule periodically.

vii.     Select the interval you require, such as 10 minutes.

viii.   Choose Create.

SMTP Configuration

 

The kernel of the SAP Web Application Server supports SMTP (Simple Mail Transfer Protocol). This enables e-mail exchange between the SAP system and each SMTP mail server, without having to use additional external components.  The SAP system sends the outbound e-mails to a separate mail server, whilst the e-mails in the inbound direction can be received by any number of mail servers.

Exchanging faxes and text messages (pager/SMS) using SMTP is also possible. For this, faxes and messages are packed as e-mails. For the send process, the mail server analyzes the domain of the recipient addresses and either forwards the e-mails to an internal fax-/text message server (for example SMS=+491759628717@sms-server.company.com) or to an external provider (for example FAX=+16105954900@fax-provider.com). For receiving, the fax-/text message server or provider sends e-mails to addresses that have the domain of the SAP system (for example FAX=+496227751624@crm-prod.company.com).

Prerequisites

The mail server in question must be SMTP-compatible.

If you want to send text messages in the SAP system, the names of the corresponding data transfer services (such as SMS) have to be defined in transaction SA14.

Settings for the Profile Parameters (Transaction RZ10)

You have to adjust the profile of the SAP Web Application Server if you want to use the SMTP function. The SAPconnect send job can only be scheduled for servers on which SMTP has been activated. For this reason, you must activate SMTP for all of the SAP system's application servers.

The following profile parameters have to be configured. The placeholder <*> stands for the sequence number (starting at zero) of frequently occurring parameters.

·        icm/server_port_<*> = PROT=SMTP,PORT=<port>

Parameter icm/server_port_<*> opens a TCP/IP port for receiving mails through the SMTP plug-in. <port> describes the number of the port that is to be used. The port cannot yet be used by another program on this host. If no mails are to be received in this SAP system (including notifications about the status), set <port> to 0.

Optionally, you can use TIMEOUT to define a maximum waiting time (in seconds) to be applied until the mail server responds.

·        is/SMTP/virt_host_<*> = <host>:<port>,<port>,...;

This parameter defines a virtual mail host for receiving mails. If all incoming mails (including status notifications) are to be received and processed by one single client of the SAP system, this parameter is not required. In this instance, is/SMTP/virt_host_0 = *:*; is used by default. If multiple clients are to be used as recipients, a virtual host has to be created for each of these clients. <host> describes the name of the host to which the incoming mails are addressed. You can enter * here if the mails are to be sent independently of the host being addressed. <port> describes the number of the port to which the incoming mails are addressed.

 

For UNIX, the profile parameters may look like this:

   rdisp/start_icman = true

   icm/server_port_0 = PROT=HTTP,PORT=1080

   icm/server_port_1 = PROT=HTTPS,PORT=1443                     

   icm/server_port_2 = PROT=SMTP,PORT=25000,TIMEOUT=180         

   icm/server_port_3 = PROT=SMTP,PORT=25001,TIMEOUT=180         

   is/SMTP/virt_host_0 = *:25000;                               

   is/SMTP/virt_host_1 = *:25001; 

 

User Maintenance (Transaction SU01)

·        Service user

You have to create a service user for processing incoming mails in every SAP system client in which you want to receive mails (or status notifications). Call transaction SU01 to create a user with type Service and assign the profile S_A.SCON to this user.

·        User addresses

Every user that is to receive e-mails in an SAP system requires an Internet mail address. This is also used as a sender address. Enter the Internet mail address for a user in transaction SU01, under E-Mail on the tab page Address.

 
Assigning the Client (Transaction SICF)

Every SAP system client that is to receive and process incoming mails (or status notifications) must have an SMTP server. One SMTP server (SAPconnect) has already been created in transaction SICF and is delivered with every SAP system. Use this to create the first client and then create another SMTP server for each additional client. Configure the following settings on the SMTP servers:

·        Host data

Enter the sequence number of a parameter is/SMTP/virt_host_<*> from the profile. If you have only created one client and therefore have not specified this parameter type, enter 0.

·        Service data

Enter the client to which the mails received through the virtual mail host are to be forwarded, and then enter the logon data of the system user that you created for the incoming mails.

·        Handler list

Enter CL_SMTP_EXT_SAPCONNECT at position 1.

 

Note that each SMTP server must be activated (Service/Virt. Host ® Activate) after being created or changed. Inactive servers are grayed out.

 
SAPconnect Administration (Transaction SCOT)

You have to configure SAPconnect settings for every client that is used for send processes.

·        Default Domain

Under Settings ® Default Domain, define the domain of the SAP system client. This allows for the following to take place:

·         The SMTP plug-in logs on to the mail server using the domain as ID.

·         The message ID of the outbound e-mails is assembled with this domain.

·         If an SAP user who does not have an Internet mail address sends an e-mail, a sender address consisting of the SAP user name and this domain is generated.

·        Nodes

Each client has an SMTP node. This node is created by the SAP system and cannot be deleted. The following steps need to be carried out to configure the node so that sending Internet mail is possible:

i.         Make sure you are in the Node view.

ii.       Double-click the node name.

iii.      Choose Node in use.

iv.      In the Mail Host and Mail Port fields, specify the mail server to which the outbound mails are to be sent.

v.        Next to Internet, choose Settings.

vi.      Enter the address area of the recipient addresses that are to be reached using this node. In general, * is used if all e-mails are to be sent using SMTP.

vii.     Enter the output format for SAP documents. We recommend that you use the following settings:

SAPscript/Smart Forms

PDF

ABAP list

HTM

Business Object / Link

HTM

RAW Text

TXT

viii.   Confirm your selection.

If you also want to configure the node for sending faxes:

i.         Next to Fax, choose Settings.

ii.       Enter the address area of the recipient addresses that are to be reached using this node. In general, * is used if all faxes are to be sent using SMTP.

iii.      Enter the output format for SAP documents. We recommend that you use the following settings:

SAPscript/Smart Forms

PDF

ABAP list

PDF

Business Object / Link

TXT

RAW Text

TXT

iv.      Enter the domain of the fax server or fax provider under Conversion into Internet Address. The system generates the local part of the Internet address automatically. The address therefore takes this format: FAX=+RecipientNumber@Domain.

v.        Confirm your selection.

If you also want to configure the node for sending text messages (pager/SMS):

i.         Next to Pager (SMS), choose Settings.

ii.       Enter the address area of the recipient addresses that are to be reached using this node. In general, * is used if all text messages (pager/SMS) are to be sent using SMTP.

iii.      Enter the domain of the text message (pager/SMS) server or provider under Conversion into Internet Address. The system generates the local part of the Internet address automatically. The address therefore takes this format: SMS=+RecipientNumber@Domain.

iv.      Confirm your selection.

·        Send Job

E-mails sent from an SAP application are first stored in a queue. A periodical background process, the SAPconnect send job, gets the e-mails from this queue and sends them over the Internet. To schedule this job in SAPconnect: Administration, proceed as follows:

i.         Choose View ® Jobs.

ii.       If no other job has been scheduled, choose Job ® Create.

iii.      Enter a job name and confirm it.

iv.      Select the variant SAP&CONNECTALL by positioning the cursor on it.

v.        Choose Schedule Job.

vi.      Choose Schedule periodically.

vii.     Select the interval you require, such as 10 minutes.

viii.   Choose Create.

·        Inbound

If you want incoming e-mails that have a particular address or particular content to automatically start a program that processes these mails, you can configure this under Settings ® Inbound Processing.

If you want incoming e-mails that have a particular address or come from a particular sender to be automatically forwarded to another recipient or another distribution list, you can configure this under Settings ® Inbound Processing.

SAP Connect (SCOT)

 

SAPconnect contains an integrated administration interface, which you can use to set up external communications systems and monitor sending. You can display different views of your communications environment. Transaction SCOT is used to call the administration interface of SAPconnect.
 
The authorizations for SAPconnect administration are contained in the roles SAP_BC_SRV_COM_ADMIN and SAP_BC_SRV_GBT_ADMIN.
 
If you are using the SMTP plug-in, you can find information about configuring your system under SMTP Configuration Guide. The STMP plug-in is available for Internet mail from SAP WEB AS 6.10 and for fax and text messages (pager/SMS) from SAP WEB AS 6.20. This is the configuration recommended by SAP.
 
You have to create an RFC user for the RFC interface, so that you can receive messages in your SAP system. For each external communications system, create an RFC destination and a Node.
You can add more systems, that is, create new nodes, even during operation. Since new Customizing settings may be necessary, you can branch directly from SAPconnect administration to Customizing (for example, to maintain the rules for recipient number adjustment).
 
Outgoing messages are first stored in a queue. You have to schedule send processes so that the messages are sent from the queue to the external communications system. You can distribute incoming messages with inbound distribution using the recipient addresses.
 
You can also change the default settings for confirmations of receipt in the Internet. You can specify a default domain to enable messages to be sent externally to users or objects to which no Internet address is assigned.
 
The tools for monitoring and error analysis are available for monitoring sending. You can check the operating status of the external communication components in the SAP System and evaluate the send status of the documents. If errors occur, you can configure a trace that logs the processing of messages.
 
 
 

qRFC Monitor

 

Report: RSTRFCM1

In Release 3.0 you can execute function modules asynchronously in another R/3 System or in an external program. The function modules are not called immediately, but when the next Commit Work  is executed. Until this time point the calls are collected in an internal table. They form one Logical Unit of Work for each destination (LUW) .

With COMMIT WORK all calls are processed in an available work process in the sequence they were called in. If update records were also used before the COMMIT WORK, the asynchronous function modules are not executed until the update function modules can be processed without errors.

The transactional asynchronous tRFC guarantees that all database operations are fully executed or, if one of the function modules responds with a termination, they are fully rejected (rollback). If an LUW is executed without errors, it cannot be executed again. In some cases it may be necessary, to rollback an LUW in an application program, for example, because a table is locked. The function module RESTART_OF_BACKGROUNDTASK is used for this.

It executes a rollback and the LUW is executed again at a later time. Each LUW is assigned a Transaction ID. You only have to know the ID, if, for example, you want to execute the function module in a BACKGROUND TASK.
The function module ID_OF_BACKGROUNDTASK returns the ID of the LUW. It must be called after the 1. CALL... IN BACKGROUNDTASK and before COMMIT WORK. With the function module STATUS_OF_BACKGROUNDTASK and the ID you can check whether the LUW can be executed error free at a later time. Usually the LUW is executed immediately after COMMIT WORK in the target system specified. If it is to be started at a specific time, you can set a time with the function module START_OF_BACKGROUNDTASK. This function module is also in the LUW,and is called after 1. CALL... IN BACKGROUNDTASK and before COMMIT WORK.

Technical Implementation

All calls are contained in tables ARFCSSTATE and ARFCSDATA. Each LUW is identifed a globally unique ID. When a COMMIT WORK is executed, all the calls with this ID are executed in the target system. The system function module ARFC_DEST_SHIP transports the data to the target system and the function module ARFC_EXECUTE executes the function module calls. If an error or exception occurs in one of the calls, all of the database operations made in the previous calls are reset. (ROLLBACK) and an error message is written to file ARFCSSTATE. This error message can be evaluated in Transaction SM58.
If an LUW could be successfully executed in the target system, the function module ARFC_DEST_CONFIRM is called  that confirms the successful execution in the target system. Then the affected entries in ARFCSSTATE and ARFCSDATA are deleted.
If the target system could not be reached, because, for example, the connection is not active, the report RSARFCSE is scheduled in the background with the ID as the parameter and it is called at regualr intervals The standard values can be displayed in 'Info -> System settings' in SM58. If you want to use your own settings for each destination, you can specify these in the TRFC options in Transaction SM59. If no connection can be made in the time scheduled, the entry in ARFCSSTATE will be deleted after a length of time that you specify. The deletion is done in the background in report RSARFCDL.

Debugging

Call the transaction in the debugger and choose 'Goto -> settings' and select the field 'In Background Task:...'. The LUW will not be sent immediately.

RFC API

It is also possible to execute function modules implemented in 'C' asynchronously. (Connection type TCP/IP in SM59). The function modules are implemented in connection with the RFC-API. The function modules ARFC_DEST_SHIP and ARFC_DEST_CONFIRM are contained here and call the relevant functions.

Restrictions:

  • The Windows API does not yet support asynchronous calls.
  • The once-only execution must be guaranteed by the implementation of the function module.