cancel
Showing results for 
Search instead for 
Did you mean: 

Update value UDF in OCRY table

0 Kudos

Hi, I add a UDF in OCRY table with this code


            SAPbobsCOM.UserFieldsMD oUserFieldsMD;

            oUserFieldsMD = (SAPbobsCOM.UserFieldsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);

            oUserFieldsMD.TableName = "OCRY";

            oUserFieldsMD.Name = "MyField";

            oUserFieldsMD.Description = "My Field";

            oUserFieldsMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;

            oUserFieldsMD.EditSize = System.Convert.ToInt32(3);

            lRetCode = oUserFieldsMD.Add();

            // Check for errors

            if (lRetCode != 0)

            {

                int temp_int = lErrCode;

                string temp_string = sErrMsg;

                oCompany.GetLastError(out temp_int, out temp_string);

                Console.WriteLine("Field not Add: " + sErrMsg);

            }

            System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserFieldsMD);

Now I want update this UDF's value.

I had try with the following code, but in this way the UDF is not able to modify


            SAPbobsCOM.CountriesService oCountries;

            oCountries = (SAPbobsCOM.CountriesService)oCompany.GetCompanyService().GetBusinessService(SAPbobsCOM.ServiceTypes.CountriesService);

            SAPbobsCOM.ICountriesParams oCountriesParams = oCountries.GetCountryList();

            SAPbobsCOM.CountryParams oCountryParams;

            for (int i = 0; i < oCountriesParams.Count - 1; i++)

            {

                oCountryParams = oCountriesParams.Item(i);

                SAPbobsCOM.Country oCountry = oCountries.GetCountry(oCountryParams);

                String name = oCountry.Name;

                String code = oCountry.Code;

            }

    

In this thread I mean that it is not possibile update the UDF value, but the thread have 10 years old and I hope in a solution.


Someone can help me?

Thanks

Riccardo

Accepted Solutions (0)

Answers (1)

Answers (1)

julie_jamieson2
Active Contributor
0 Kudos

I think OCRY table is still not exposed to the DI, so it is not possible