Skip to Content

Enable Alert in SAP

May 11, 2017 at 07:21 AM


avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Danilo Kasparian May 12, 2017 at 12:03 PM

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

'fill subject
oMessage.Subject = "My Subject"

'fill text
oMessage.Text = "My Text"

Recipient oRecipientCollection = oMessage.RecipientCollection

'Add new a recipient

'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
10 |10000 characters needed characters left characters exceeded
Danilo Kasparian May 11, 2017 at 12:54 PM

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;


Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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 ?

                            objMsg = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMessages)
                            objMsg.Subject = "1234"
                            objMsg.MessageText = "Well Done!"
                            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
                            If Not objMsg Is Nothing Then
                                objMsg = Nothing
                            End If
End Try

Kind Regards ,

Ifigeneia Koumbarda