cancel
Showing results for 
Search instead for 
Did you mean: 

Enable Alert in SAP

Former Member
0 Kudos

Hello experts ,

I would like to activate an alert where it is saved in alert management using di add-on.

How can i do this?

Kind Regards ,

Ifigeneia Koumbarda

Accepted Solutions (1)

Accepted Solutions (1)

former_member233854
Active Contributor
0 Kudos

Hi Ifigeneia,

You can use the message service. The example below I got from SDK Help.You can adapt it and run a query before setting the values.

Dim oCmpSrv As SAPbobsCOM.CompanyService
Dim oMessageService As MessagesService
Dim oMessage As Message
Dim pMessageDataColumns As MessageDataColumns
Dim pMessageDataColumn As MessageDataColumn
Dim oLines As MessageDataLines
Dim oLine As MessageDataLine
Dim oRecipientCollection As RecipientCollection

'get company service
oCmpSrv = oCompany.GetCompanyService

'get msg service
oMessageService = oCmpSrv.GetBusinessService(ServiceTypes.MessagesService)

'get the data interface for the new message
oMessage=oMessageService.GetDataInterface(MessagesServiceDataInterface.msdiMessage)

'fill subject
oMessage.Subject = "My Subject"

'fill text
oMessage.Text = "My Text"

'Add 
Recipient oRecipientCollection = oMessage.RecipientCollection

'Add new a recipient
oRecipientCollection.Add()

'send internal message
oRecipientCollection.Item(0).SendInternal = BoYesNoEnum.tYES

'add existing user code
oRecipientCollection.Item(0).UserCode = "manager"

'get columns data
pMessageDataColumns = oMessage.MessageDataColumns

'get column
pMessageDataColumn = pMessageDataColumns.Add()

'set column name
pMessageDataColumn.ColumnName = "My Column Name"

'get lines
oLines = pMessageDataColumn.MessageDataLines()

'add new line
oLine = oLines.Add()

'set the line value
oLine.Value = "My Value"

'send the message
oMessageService.SendMessage(oMessage)

Answers (1)

Answers (1)

former_member233854
Active Contributor
0 Kudos

The object is called AlertManagment

AlertManagementService service = (AlertManagementService)this.AddOn.Company.GetCompanyService().GetBusinessService(ServiceTypes.AlertManagementService);

AlertManagementParams parameters = service.GetDataInterface(AlertManagementServiceDataInterfaces.atsdiAlertManagementParams);

parameters.Code = 1;

AlertManagement alert = service.GetAlertManagement(parameters);
alert.Active = BoYesNoEnum.tYES;

service.UpdateAlertManagement(alert);


Former Member
0 Kudos

Hello Danilo Kasparian,

I think my question was not so clear.I would like to run the funcionality of alert management.For example i would like to return the result from a query with internal alert for the user manager.I found the code below but how can i create the data from query in one string to look like table ?

Try
                            objMsg = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMessages)
                            objMsg.Subject = "1234"
                            objMsg.MessageText = "Well Done!"
                            objMsg.Recipients.Add()
                            objMsg.Recipients.SetCurrentLine(0)
                            objMsg.Recipients.UserCode = "manager"   'USID
                            objMsg.Recipients.NameTo = "manager"     'USID
                            objMsg.Recipients.UserType = BoMsgRcpTypes.rt_InternalUser
                            objMsg.Recipients.SendInternal = SAPbobsCOM.BoYesNoEnum.tYES
                            objMsg.Recipients.SendEmail = SAPbobsCOM.BoYesNoEnum.tNO
                            objMsg.Priority = SAPbobsCOM.BoMsgPriorities.pr_High
                            lngStatus = objMsg.Add
                        Catch ex As Exception
                        Finally
                            If Not objMsg Is Nothing Then
                                System.Runtime.InteropServices.Marshal.ReleaseComObject(objMsg)
                                objMsg = Nothing
                            End If
End Try

Kind Regards ,

Ifigeneia Koumbarda