cancel
Showing results for 
Search instead for 
Did you mean: 

/SAPTRX/CREATE_ALERT

Former Member
0 Kudos

Hi experts,

would like to copy the above function module to send an E-Mail to a customer when the load event has been posted. For this, I want to copy this FM and read the address of the consignee and get the E-Mail. If it is filled, I will send the mail. But, I have set a breakpoint and posted the connected Event manually and it does not stop. Can u kindly give me a hint?

MAny thanks in advance

Petra

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Petra,

Before coming to this functional module, why don't you use SAP Alert Management to achieve which is already available in system.

You can set a rule set and call Alert to send an email to Consignee.

This is a straight forward straight you don't need to create custom functional module to send an email.

Regards


GGOPI

Former Member
0 Kudos

Hi Ggopi,

I want to use the alert framework and I have pre-defined an E-Mail with Parameters(Containers)  in the alert framework. But, I can only see the possibility to assign an sap user and not an e-Mail. Also, to read the E-Mail from the consignee master, I have to copy the ALERT_CREATE FM. If there is a Standard way in the alert framework, please let me know.

Also, please let me know how I can trigger this and set a break-point.

Petra

Former Member
0 Kudos

Hi Petra,

I can guide you to setup but before that can I understand... are you passing consignee email id in any control or system or info parameters in SAP EM.

Regards

GGOPII

Former Member
0 Kudos

Hi Gopi,

no, the consignee id will be in the freight unit as a Partner. In node root, association BUPA_CONSIGNEE_ROOT. Field PARTNER and from there, we Need to read the E-Mail.

via association addressinformation.

Right?

Petra

Former Member
0 Kudos

Hi Petra,

1. IMG -> SAP - Implementation Guide -> Event Management -> Event Handlers and Event Handler Data -> Expected Events -> Define Activities for the Expected Event Monitor -> Multitask EE Monitor Activities -> Create a new Multitask EE Monitor activity

2. Create a new task like Task - IS_EE_LOADING, Activity – COMPARE, Log, operator – Blank, Log task – checked, Activity parameters as Field 1 - “your expected event”, Field 2 - <EXP_EVENT-EVENT_CODE>Comparison -     “=”

3. Create next task sequence Activity - CHECK_PARAM_VALUE, Previous Task - IS_EE_LOADING, Parameter Name “Control or Info or system parameter name”, Parameter Type C or I or S

Parameter Value – Blank, Log. Operator <>

4. Create Next task sequence activity - ALERT_CREATE, Previous task CHECK_PARAM_VALUE, Log. Operator = “0”, and enable log task and give alert category.

5. IMG -> SAP - Implementation Guide -> Event Management -> Reactions to Event Messages -> Define Alert Framework Connection -> Define Alert Framework Integration to SAP Event Management -> Assign Param ID, give Internet Email address in communication, communication data (you parameter id will come here and assign consignee email id field... Can you check your PARTNER field coming here).

6. -> Map Event Management Parameters: Assign all container element fields here.

This will take variable data email id (consignee) from communication data e-g check Activity Param.ID LTL_DELIV or other activity param. ID.

Check and let me know.

Regards

GGOPII

Former Member
0 Kudos

Hi Petra,

Can you check on your expected event monitor, parameters etc for above solution which I said and let me now?

You are extracting data from SAP TM data I believe instead of SAP EM if I am not wrong.

Regards


GGOPII

Former Member
0 Kudos

Hi Gopi,

I did step 5 as described by you, but I do not know which structure to use to get the consignee email. In structure /SAPTRX/ODT20 that I used for the other fields, I only get the Consignee number, not the email. Also, These are the Parameters within the mail, not the recipient's E-Mail. Are u sure, the Standard will use those? I think, I Need to copy the FM and read the E-Mail myself and Transfer it to the recipient Parameter.

Former Member
0 Kudos

Hi Petra,

I am working in different timezone, so I couldn't reply to you immediately.

There is an other option to bring consignee email via control parameters and you can achieve but it is little bit extra work.

So, you can follow your custom functional module solution to implement.

Regards

GGOPII

Former Member
0 Kudos

Hi Gopi,

the e-mail is available in the event handler.

I have set up Tasks "check Event" and "create alert". The first one checks my custom event Z-LOAD and the 2nd one sends the alert (calls FM /SAPTRX/CREATE_ALERT). I have to assign alert id. This is not the alert category, but the Parameter id defined in alert Framework to EM Integration. I think thats ok, but the Debugger quits before because of the update activity ODT30_TO_UPDATE_ACTIVITY. Tomorrow with new energy, I will try to see why it quits. I have tried to not have the update activity, but it does not help. thanks for your help. I hope I can resolve this tomorrow.

Have a good day. Petra

Former Member
0 Kudos

Gopi,

I am testing the Event Tasks by entering the Events manually into the execution tab of the freight unit. Shall I better use the FM /SAPTRX/BAPI_EH_ADDEVENTMSG_02 because it sets the Events via EM. I can use this one because we have tested it before and I know which fields to fill. Is this the Problem? Thanks for your help.

Petra

Former Member
0 Kudos

Hi Petra,

Yes, I could see that email id present in control parameters.

You are doing config in Rule set now I believe.  I will guide you to do set up this.

1. IMG -> SAP - Implementation Guide -> Event Management -> Reactions to Event Messages -> Define Rule Sets - > Define rule conditions -> Click New Entries -> Express. 1 &_SAPTRX_EVM_HDR.INT_EV_COD&, Operatat "=", Express. 1 - Z-LOAD.

2. IMG -> SAP - Implementation Guide -> Event Management -> Reactions to Event Messages -> Define Rule Sets - > Multitask Activities -> Create Z-SEND-MAIL

Task Sequence - 10

Task EVTCODECHK

Activity        EVENT_CODE_CHECK

Log Task = Checked

Int. Event Code - Z-LOAD

Task Sequence - 20

Activity - CHECK_PARAM_VALUE,

Previous Task - EVTCODECHK,

Parameter Name “RESP_EMAIL_ADDR”,

Parameter Type - C

Parameter Value – Blank,

Log. Operator "<>"

Log Task - Checked

Task Sequence - 30

Activity - ALERT_CREATE

Previous task CHECK_PARAM_VALUE

Log. Operator = “0”

Log Task - Checked

Actvty. Param ID - Your Alert Category"

4. IMG -> SAP - Implementation Guide -> Event Management -> Reactions to Event Messages -> Define Alert Framework Connection -> Define Alert Framework Integration to SAP Event Management ->

create Param ID

Description E-Mail to Consignee

Assign Alert Category

Communication Method - INT Internet Email address

Communication Data - Press F4

Assign RESP_EMAIL_ADDR here.

5. -> Map Event Management Parameters: Assign all container element fields here.

6. Define Alert category as you have done previously.

Regards

GGOPII

Former Member
0 Kudos

Ggopii,

the activity Check_param_value does not exist.

Answers (1)

Answers (1)

Former Member
0 Kudos

Today, I finally had time to continue the testing and I have debugged the function module /SAPTRX/ALERT_CREATE. It fills the Parameters that I have defined in the alert category. In order to achieve this, we need only two Tasks:

1. TASK 10: Check Event code (this one is to identify the Event Z-LOAD)

2. TASK 20: Alert Create (this one has to have the activity assigned with the FM /SAPTRX/ALERT_CREATE)

Two things  are a bit tricky:

1: the Parameters that need to be transferred must be defined BEFORE. To do this, go to the the rule set customizing and choose "function activities". Choose the activity that has above FM assigned (in Standard alert_create, in my case Z-FM-ALERT-CREATE) Then, double-click on the activity name. This is how you get to the Parameter Screen.

In this Parameter Screen, you can call the parameters as you like. In the function module, these Parameters are simply parameter1 to 7. But, in the fm /SAPTRX/ALERT_CREATE, each Parameter has a certain effect. For example, Parameter 1 has the link to the alert framework. Parameter 6 has a different processing because it is marked as synchronious processing. Parameter 8 has the email address of the recipient. In order for this to work, you need to do the 2nd tricky Thing:

2: fill the Parameters befind the task

for this, you go to the multitaks activities and assign the same activity and press enter. If you just Change it, it does not work. It will Show u the old Parameters. Remove it and assign it again and it will Show the new Parameters:

Former Member
0 Kudos

after some debugging, I managed to send an E-Mail after loading! Yippie. In my own user's data, I have set up an E-Mail address and communication method as INT. but, the Receiver E-Mail comes from the consignee via the Parameter RESP_EMAIL_ADDR. also, you have to assign the standard ALERT_CREATE FM in the task as described. There is a place in the coding where the name of the function module is checked. the good News is: you do not Need to Change the function module at all.

the correct Setting in the Task is as follows:

the correct Setting in the customizing "define alert framework integration to EM" is as follows:

  to be sure, you need to debug to see which parameter values are filled by the standard function module by which field in the bapi structures trackingheader and tracklocation. The possible fields in this transaction can be viewed in table /SAPTRX/UCPD . As the table also contains the technical field names of the BAPI, you can find out which fields you have to assign in customizing. You sort by BAPI field name and then, you get all fields that can be filled using the BAPI structures

Former Member
0 Kudos

this is what the E-Mail looks like.

Former Member
0 Kudos

Hi Petra,

Excellent!

Regards


GGOPII

Former Member
0 Kudos

yes and thanks for your help. It has really helped a lot!!