Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to add a new Activity in C#

Hello Experts,

I want to add a new Activity using C#. Can anyone help me, by giving example code?

Best regards

ES.

replied

This is a method we use to create an activity when we send a BP our Brochure....information is coming from a grid within a form and is being used to create the activity.

private void UpdateBrochu(int nSelected) // form update to db

{

SAPbouiCOM.Grid oGrid = (SAPbouiCOM.Grid)theForm.Items.Item("grdBrochr").Specific;

// add activity to database..............................................................................................

int nErr = 0;

string sErr = "";

SAPbobsCOM.Contacts oACT = ((SAPbobsCOM.Contacts)(theCompany.GetBusinessObject (SAPbobsCOM.BoObjectTypes.oContacts)));

oACT.CardCode = m_sCardCode;

oACT.Details = "Brochure to be Sent: " + oGrid.DataTable.GetValue("Item", nSelected).ToString() + " "

+ oGrid.DataTable.GetValue("Description", nSelected).ToString();

oACT.Notes = "Brochure to be Sent.";

oACT.ContactDate = System.DateTime.Now;

oACT.Add();

theCompany.GetLastError(out nErr, out sErr);

if (nErr != 0)

theApp.MessageBox("Your record was not able to be added.\nError: " + sErr, 1, "Ok", "", "");

else

{

theApp.StatusBar.SetText("Operation Completed Successfully.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success);

}

}

Hopes this helps.

Mitch

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question