You are on page 1of 13

Sending Mails Using Dynamic Action When Administrator Create or Change the Info-types of an Employee in HR Master Data.

Business Scenario: In a company there are thousands of employees and the


administrator creates or changes the info types to maintain the HR Master Data. The client has a specific requirement that the employee should be notified by sending a mail that his details have been changed. The Time and Payroll Administrator must be aware that what data has been updated or created for employees under them.

Solution from SAP HCM Consultant: When an employee is hired, we use


personnel Action PA40 to hire the employee and to maintain the Master Data we use Maintain Master Data PA30. When ever we use any of this Transaction to create or change info type we can initiate a Dynamic Action which would send mail to the employee as well as to the Administrator.

Configuration of Dynamic Action:


Step1. Got to SAP Reference IMG by typing SPRO in the Command field. Then click on the Personnel Management->Personnel Administration->Customizing Procedure ->Dynamic Action.

Click on the Dynamic Action. The next page of Change View Dynamic Action Overview appears.

Here we need to create our own Dynamic Action. To Create a Dynamic Action Click on the tab New Entries. Select the info type for which mails should be sent. Here we will firstly use info type 0001 and then info type 0007. In both the cases mail will be sent to the Administrator, to the employee and a copy will be there in senders outbox.

ITy Info type selection. StySub type Selection SIndicator for Step where the following values can be given
P - Check conditions W - Set default values when creating a new record I - Maintain infotype record V - Reference to another step

F - Call routine Other entries in this column mean "comment line". Field Field of that certain Info type

M - Send mail

FCFunction character of step.

The Function character of step controls which type of processing (Create, Change and/or delete a record) a dynamic action should be carried out. The Processing type is indicated by two digit numeric value, they are SAP standard. Example 00 for Independent of the current function carried out
02 for Change 04 for Create 06 for Change and create 08 for Delete 10 for Change and delete 12 for Create and delete

Configuring the Dynamic Action : The Dynamic Action for dropping mail is
shown below. Here we have to configure the entire logic when and how the mail will be generated.

In the first Line:

Here just a line is written to make it easy to understand where the logic for mail generation is beginning. The line number is given 01 (numbers dont matters). It can be any number depending on the system, so that its not used for the same info type.

In the column S, * is given which means comment. So the system will not take that line into consideration. In the Second Line:

Here we are checking the Transaction class. In Info type we have taken 0001 i.e Org Assignment; it has no sub type hence its blank for example info type 0006(Address) there are many sub types like permanent address or temporary address etc. There we can consider the Sty field. . We are considering all field in 0001 hence the field is also blank for example if we would have used the field Sub Area we then need to use BTRTL in the field N box. Since a mail will be generated for Create and Change of 0001 hence 06 is taken. P stands for Plausibility Check in the S column (Indicator for Step), system will check MOLGA i.e. Country Grouping. The written format T001P-MOLGA=40is SAP Standard which resemble System will check the Country Grouping. In the Third Line:

In the third line we are checking the Plausibility Check P is for Transaction Class which means the Employee similarly for Applicant Transaction Class will be B. The format PSPAR-TCLASS=A is a SAP standard, and more of a Syntax. In the Fourth Line:

For any changes irrespective of any field the system will shoot a mail hence in the column S (Indicator for Step) we have given M-Send a Mail. The mail will be controlled by a feature M0001.

Configuration of Feature M0001:

Here the Feature M0001 enables us to control to whom we will send a mail, the text of the mail we will send and the processing type used. The feature can be used for all Master Data Info types for both Transactions class A (employees) and B (Applicant). Decision field TClass helps us to control the processing.

The return matrix of the feature has the following form XXXX ZZZZZ. XXXXX is the mail Attributes. IDTXT: Name of the standard text. The mail that will be send to employees for any change in their Info type i.e. 0001. RECV1: Recipient 1 is the Administrator for HR Master Data from the Organizational Assignment info type (0001), who is responsible for the employee on todays date. RECV2: Recipient 2 is the Payroll administrator taken from Organization Assignment info type (0001), who is responsible for employee on todays date. RECV3: Recipient 3 is the Time Administrator taken from Organization Assignment info type (0001), who is responsible for employee on todays date. SUBTY: Employees whose data is changed should receive the email. Here we mention the subtype which is to be used to read the employees info type record 0105, in which subtype stores the employees mail id. The employee will only receive a mail if subtype is filled. OUTBX: The mail should be in senders Out Box. DISTR: Distribution List is stored in general folder in SAP Office SO04. We will also configure an distribution list. NAME1: If the Info type that Triggers the mail is not the Organizational Assignment info type (0001), then the feature specified is read. We can define the distribution list and the recipient in this feature. The standard SAP system contains the feature RCIEV, which can be used as example. NAME2: If the Info type that Triggers the mail is the Organizational Assignment info type (0001), then the feature specified is read using the new data contained in info type 0001.New data means data contained in an info type record for info type 0001that has been changed after the mail was sent. We can define the distribution list and the recipient in this feature. The standard SAP system contains the feature RCNEW, which can be used as example NAME3: If the Info type that Triggers the mail is the Organizational Assignment info type (0001), then the feature specified is read using the old data contained in info type 0001.Old data means data prior to changing the info type record that triggered a mail to be sent. We can define the distribution list and the recipient in this feature. The standard SAP system contains the feature RCOLD, which can be used as example

TCODE: Transaction Code that will be executed to change the data in info type record 0001 (Organization Assignment). PAINF: Info type which is taken into account. PASUB: Sub type if any. PABEG: Begin Date. PAEND: End date. PAFCD- Function Code

Feature M0001 specifically Designed.

Here in the first step of the feature we have designed our own mail MAILSR. Hence XXXXX=IDTXT and ZZZZZ=MAILSR. We will later on see how to write a mail in standard form. XXXXX=RECV1, RECV2 and RECV3 and ZZZZZ= 01, 02 and 03 i.e. Personnel, Time and Payroll Administrator. XXXXX=SUBTY and ZZZZZ=0010(Subtype email address) for info type 0105.

XXXXX=OUTBX and ZZZZZ=X the mail is put in senders outbox XXXXX=TCODE and ZZZZZ=PA30, PA20, PB10 or PB20. XXXXX=PAINF and ZZZZZ=4 digit number of the info type. XXXXX=PASUB and ZZZZZ=4 digit number of the sub type. XXXXX = PABEG, PAEND: ZZZZZ= either an 8-digit date in the format YYYYMMDD, e.g. ZZZZZ=19950630 for "30.06.1995", or enter the name of a variable in inverted commas, e.g. ZZZZZ='P0001-ENDDA'. The following exist: P0001-BEGDA, P0001-ENDDA, P0002-BEGDA, P0002-ENDDA, Pnnnn-BEGDA, Pnnnn-ENDDA, nnnn is the number of the infotype that triggers the mail to be sent. XXXXX = PAFCD: ZZZZZ=COP Copy, ZZZZZ=DEL Delete, ZZZZZ=DIS Display, ZZZZZ=EDQ Lock/Unlock, ZZZZZ=INS Create, ZZZZZ=MOD Change

Configuration of Feature RCNEW:

The return matrix of the feature has the following structure X-VVVVVVVV. X- Indicator M for mail or V for Distribution List. VVVVVVVV- Valid mailing name or distribution list, which is stored in shared folder in SAP office i.e. Transaction SO04. Here we have given V for distribution list and DEMOSANT is a Distribution List created by us (will de discussed later).

Creating Standard Text for Mail Connection .


A mail has to be sent to the employee, to the administrators and the distribution list. So we need to create a text now. To create a text we need to go to SAP IMG. Path : SPROPersonnel management Personnel administration Setting Up Mail Connection for info type changesCreate standard text for mail connection.

In the next page we need to mention a Text Name, Text Id and the Language.

MAILSR is just the name given. The ID PAMA is the format of mail for employee and master data. So we need to be careful in selecting it. Only PAMA must be selected. The Language is English. Now click on Create. In the next page Click on Go To in the Task Bar and then Change Editor. Here we need to write the body of the mail in standard SAP format (ABAP help may be required).

The mail is ready for sending. Save it and come out of the screen.

Creating a Distribution List :


The transaction for SAP Business Workplace is SO04. In the SAP Business Workplace we need to create a Distribution list. To create it we need to click on the distribution list.

Click Here

In the next page we need to create our own distribution list. We need to select the Type as Shared

Distribution and Name our distribution list and give a title to it. Now to create our own distribution list we need to click on the create button.

Now add the email address, to which we want to send the mail.

The sign The Sign The Sign

means send it to the id as express message. means a Copy to the person means a blind copy.

So our distribution List is ready.

Go Live Experiment:
Lets select and employee Chetan Bhagat whose personnel no is 1421. The Personnel Area is 0063 i.e. IBM India and his Personnel Sub area is 39 i.e. Siliguri. His Employee Group is 1 i.e. Regular FT and his Employee Subgroup is 13 i.e. Salaried BTO.

We Change his Personnel Area from 0039 (Siliguri) to 0038 (Gurgaon). A mail will be sent to chetan Bhagat, administrators; distribution list and a copy in senders outbox. In chetan Bhagat Inbox:

In the Outbox of Sender:

So this is how we can use the dynamic action to send mail when info type records are changed.

You might also like