cancel
Showing results for 
Search instead for 
Did you mean: 

Attachments need to be sent per e-mail to notification parties in the Appointments.

mahendra_143
Explorer
0 Kudos

Hi everyone,

My Question in below we can see an attachment in the attachment table in the over view tab.

The attachement which is present in the attachment table should go to a person name Ralf via email who is in the notification parties table. is it possible? Can any body help me. it it is an urgent project requirement.

Here both attachment table and notification table are standard fields.

Accepted Solutions (1)

Accepted Solutions (1)

mpfandler
Participant

Hello,

check out this blog post that describes the attachment sending process: SAP Blog

You have to implement BADI ExitForGettingWorkflowAttachment in order to use this function.

BR,
Matthias

mahendra_143
Explorer
0 Kudos

Not with workflow rules. Can we do with the SDK by writing script please can anybody help.

mpfandler
Participant

Okay, I understand.
In repository explorer there is example code to create an email activity. You only need to read the attachment folder from your appointment and create the files in the attachment folder of your email activity.

My example code is a custom action that is called from the appointment bo.

import ABSL;
import AP.PC.ActivityManagement.Global;

 //Activity: Root node
var elActivityRoot :  elementsof Activity;
var instActivity;

// Activity: define party node
var elActivityParty : elementsof Activity.Party;
var instParty;

// Activity: define text collection
var elActivityTxtCollTxt:      elementsof Activity.TextCollection.Text;
var elActivityTxtCollTxtCntnt: elementsof Activity.TextCollection.Text.TextContent;
var instActivityTxtColl;
var instActivityTxtCollTxt;

// Activity: define attachment folder
var elActivityAttachmDoc:      elementsof Activity.AttachmentFolder.Document;
var instActivityAttachm;


// Activity: maintain Business Object type - mandatory (12 = Appointment; 39 = Email; 86 = Phonecall; 542 = Task)
elActivityRoot.TypeCode = "39"; // create Email

// Activity: maintain description - mandatory
elActivityRoot.SubjectName = "PSM CRM ABSL Test - CallActivityExample Email Example_01";

// Activity: create new instance 
instActivity = Activity.Create(elActivityRoot);

// Activity: Organizer party - mandatory
if (! instActivity.MessageFromParty.IsSet()) {
		elActivityParty.PartyUUID = this.EmployeeResponsibleParty.PartyUUID; 
		instActivity.MessageFromParty.Create(elActivityParty);
	}

// Activity: Attendee party - optional
elActivityParty.PartyUUID = this.EmployeeResponsibleParty.PartyUUID; 
instActivity.MessageToParty.Create(elActivityParty);

// Activity: Set Employee Responsible  mandatory
if (! instActivity.EmployeeResponsibleParty.IsSet()) {
		elActivityParty.PartyUUID = this.EmployeeResponsibleParty.PartyUUID; 
		instActivity.EmployeeResponsibleParty.Create(elActivityParty);
	}

// Create a text of type "Body Text"
instActivityTxtColl = instActivity.TextCollection.Create();
elActivityTxtCollTxt.TypeCode.content = "10002";
instActivityTxtCollTxt = instActivityTxtColl.Text.Create(elActivityTxtCollTxt);
elActivityTxtCollTxtCntnt.Text.content = "Body text of the Activity Email";
instActivityTxtCollTxt.TextContent.Create(elActivityTxtCollTxtCntnt);

// copy attachment from appointment to email activity
if(this.AttachmentFolder.IsSet())
{
	instActivityAttachm = instActivity.AttachmentFolder.Create();
	foreach (var attachment in this.AttachmentFolder.DocumentList) 
	{
		elActivityAttachmDoc = attachment.GetFromDB();
		//retrieve Binary Object
		var binaryObject = attachment.FileContent.BinaryObject;
		instActivityAttachm.CreateFile(elActivityAttachmDoc.TypeCode,elActivityAttachmDoc.Name,elActivityAttachmDoc.AlternativeName,elActivityAttachmDoc.Description, binaryObject);
		//instActivityAttachm.Document.Create(elActivityAttachmDoc);
	}
}

instActivity.Send();

Answers (0)