Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
mk1909_sap
Active Participant
2,629
 #region For Alert Management - Variable Declarations
public static SAPbobsCOM.CompanyService oCmpSrv;
public static MessagesService oMessageService;
public SAPbobsCOM.Message oMessage = null;
public SAPbobsCOM.Messages oMessages = null;
MessageDataColumns pMessageDataColumns = null;
MessageDataColumn pMessageDataColumn = null;
MessageDataLines oLines = null;
MessageDataLine oLine = null;
RecipientCollection oRecipientCollection = null;
#endregion



// Write a Code On Item Event Or any Suitable Trigger
if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK)
{
if (pVal.ItemUID == "16")
{

oCmpSrv = Mahi_Company.GetCompanyService();
oMessageService = (SAPbobsCOM.MessagesService)oCmpSrv.GetBusinessService(ServiceTypes.MessagesService);
oMessage = (SAPbobsCOM.Message)oMessageService.GetDataInterface(MessagesServiceDataInterfaces.msdiMessage);
oMessages = Mahi_Company.GetBusinessObject(BoObjectTypes.oMessages);
string alert = "Select distinct " + '"' + "DocEntry" + '"' + "";
alert += " , " + '"' + "DocNum" + '"' + "";
alert += " , " + '"' + "CardCode" + '"' + "";
alert += " , " + '"' + "CardName" + '"' + "";
alert += " from " + '"' + "ORDR" + '"';
alert += " where " + '"' + "DocEntry" + '"' + " = 4 ";
oRs = (SAPbobsCOM.Recordset)(Main.Mahi_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
oRs.DoQuery(alert);

oMessage.User = 1; // Manager - User ID
oMessage.Subject = "Back to BD";
oMessage.Text = System.DateTime.Now.ToString() + " " + "Please Check Sales Orders";

SAPbobsCOM.RecipientCollection RecipientCollection = oMessage.RecipientCollection;
RecipientCollection.Add();
RecipientCollection.Item(0).SendInternal = BoYesNoEnum.tYES;
RecipientCollection.Item(0).SendEmail = BoYesNoEnum.tYES;
RecipientCollection.Item(0).UserCode = "manager";

SAPbobsCOM.MessageDataColumns MessageDataColumns = null;
SAPbobsCOM.MessageDataColumn MessageDataColumn = null;
MessageDataColumns = oMessage.MessageDataColumns;

MessageDataColumn = MessageDataColumns.Add();
MessageDataColumn.ColumnName = "Sales Order";
MessageDataColumn.Link = BoYesNoEnum.tYES;
oLine = MessageDataColumn.MessageDataLines.Add();
oLine.Value = oRs.Fields.Item("DocEntry").Value.ToString();// "DocEntry";
oLine.Object = "17";
oLine.ObjectKey = oRs.Fields.Item("DocEntry").Value.ToString();// "17";


MessageDataColumn = MessageDataColumns.Add();
MessageDataColumn.ColumnName = "BP";// "DocEntry";
MessageDataColumn.Link = BoYesNoEnum.tYES;
oLine = MessageDataColumn.MessageDataLines.Add();
oLine.Value = oRs.Fields.Item("CardCode").Value.ToString(); //"CardCode";
oLine.Object = "2";
oLine.ObjectKey = oRs.Fields.Item("CardCode").Value.ToString(); //"CE00001";

oMessages.Add();
oMessageService.SendMessage(oMessage);
}
}

Alert Message will be like this -

5 Comments
Labels in this area