cancel
Showing results for 
Search instead for 
Did you mean: 

Manipulating team members (HTM1)

Former Member
0 Kudos

Hello everyone,

I'm trying unsuccessfully to add a member to a team via SDK TeamMembers object (table HTM1).

Here is my code:

SAPbobsCOM.Teams teams = DataModulo.ConexaoSAP.Instance.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oTeams);

teams.GetByKey(1);

SAPbobsCOM.TeamMembers members = teams.TeamMembers;

members.EmployeeID = 2;

members.RoleInTeam = SAPbobsCOM.BoRoleInTeam.borit_Leader;

members.Add();

No exception happens, so I don't have any idea why it doesn't work.

Any ideas?

Thank you already.

Accepted Solutions (1)

Accepted Solutions (1)

pedro_magueija
Active Contributor
0 Kudos

Hi Camilla,

Just to be sure, are you calling the teams.Update() method after adding the member?

Best regards,

Pedro Magueija

Former Member
0 Kudos

Pedro,

I wasn't calling that method!

Now it works. Thank you!

Former Member
0 Kudos

Hi, Pedro! Do you know if it's possible do delete a team member?

It doesn't seem to be.

Also, updating team members' role worked just fine, but updating the teamId is not possible, because it's a read only property.

Do you know how to update this property, using SDK?

Thank you

pedro_magueija
Active Contributor
0 Kudos

Hi Camilla,

Hmm... I checked and there is actually no method for the removal.

Try removing the employeeID (set it to 0 or -1) then run update. I'm not sure this will work as I never tried it and I don't have my system with me.

If this fails you can also try to use the SaveXML method, then perform the necessary changes using XSLT and loading the object back into memory, then running update.

Dim vInvoice As SAPbobsCOM.Documents

Set vInvoice = vCmp.GetBusinessObject(oInvoices)

'Retrieve an invoice document from the database

RetVal = vInvoice.GetByKey("1023")

If RetVal <> 0 Then

     vCmp.GetLastError ErrCode, ErrMsg

     MsgBox "Failed to Retrieve the record " & ErrCode & " " & ErrMsg

     Exit Sub

End If

'Save the object as an xml file

vInvoice.SaveXML ("C:\Program Files\SAP\XML\Invoice.xml")

'Retrieve the object back from the XML file

Set vInvoice = vCmp.GetBusinessObjectFromXML("C:\Program Files\SAP\XML\Invoice.xml", 0)

This is an example from the SDK help for invoices. Do your changes to the XML file in line 15.

Let me know how it goes.

Best regards,

Pedro Magueija

Former Member
0 Kudos

As you suggested here, I'm doing the following:

DataModulo.ConexaoSAP.Instance.getOCompany().XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;

            SAPbobsCOM.Teams equipes = DataModulo.ConexaoSAP.Instance.getOCompany().GetBusinessObject(SAPbobsCOM.BoObjectTypes.oTeams);

            equipes.GetByKey(Int32.Parse(code["teamID"].ToString()));

            equipes.SaveXML("C:\\Team.xml");

//THE CHANGES TO THE FILE Team.xml ARE DONE HERE!

            DataModulo.ConexaoSAP.Instance.getOCompany().XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;

            equipes = DataModulo.ConexaoSAP.Instance.getOCompany().GetBusinessObjectFromXML("C:\\Team.xml", 0);

            equipes.Update();

But, even after the update method, the changes doesn't happen in the database. Is anything missing?

Answers (1)

Answers (1)

Former Member
0 Kudos

up