on 12-12-2018 11:15 AM
Hi,
I am trying to add UDO using SAP HANA Service Layer WCF but I am not be able to add child tables into it.
try
{
UserObjectsMD oUserObjectMD = new ServiceReference1.SAPB1.UserObjectsMD();
oUserObjectMD.Code = _StrUDOCode;
oUserObjectMD.Name = _StrUDOName;
string _StrUDOType = UDOType.ToString().Replace(" SAPbobsCOM.BoUDOObjType.", "");
oUserObjectMD.ObjectType = _StrUDOType;
oUserObjectMD.TableName = _StrParentTableName;
oUserObjectMD.CanCancel = "tYES";
oUserObjectMD.CanClose = "tYES";
oUserObjectMD.CanCreateDefaultForm = "tNO";
oUserObjectMD.CanDelete = "tYES";
oUserObjectMD.CanFind = "tYES";
oUserObjectMD.CanLog = "tYES";
oUserObjectMD.LogTableName = "A" + _StrParentTableName;
oUserObjectMD.CanYearTransfer = "tYES";
oUserObjectMD.ManageSeries = _StrSeriesManaged;
/*************************************************************************/
// Adding Child Tables to UDO
/*************************************************************************/
try
{
Cls_SBOAddOn.serviceLayer.AddToUserObjectsMD(oUserObjectMD);
Cls_SBOAddOn.serviceLayer.Configurations.RequestPipeline.OnEntryStarting((arg) => { arg.Entry.Properties = FilterNullValues(arg.Entry.Properties.ToList(), true); });
DataServiceResponse response = Cls_SBOAddOn.serviceLayer.SaveChanges(); //HERE IS WHERE THE ERROR HAPPENS!!!!!!!
if (null != response)
{
ChangeOperationResponse opRes = (ChangeOperationResponse)response.SingleOrDefault();
object retDoc = ((System.Data.Services.Client.EntityDescriptor)(opRes.Descriptor)).Entity;
if (null != retDoc)
{
return true;
}
}
}
catch (Exception ex)
{
string sError = ex.Message;
if (ex.InnerException != null) { sError = ex.InnerException.Message; }
Cls_SBOAddOn.serviceLayer.Detach(oUserObjectMD);
return false;
}
return false;
}
catch (Exception ex)
{
return false;
}
Kindly help me.
Thanks & Regards.
Manish Pant
Hi Manish Pant,
Can you please provide an explanation why it will not work for you if single sign-on is being used?
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manish Pant,
Try to use UserObjectMD_ChildTables for Service Layer as shown below:
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manish Pant,
Use the following piece of code to add the Child Tables to the UDO:
oUserObjectMD.ChildTables.TableName = "TableName";
oUserObjectMD.ChildTables.Add();
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.