Skip to Content
author's profile photo Former Member
Former Member

How to add UDF to OBNK Table using SDK

Hi

any one can help me regarding How to add the UDF to OBNK table using SDK

Regards

Sakthivel Rajendran

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 25, 2012 at 05:41 AM

    Hi,

    Try this....

    private bool AddFieldsOnSystemForm()

    {

    try

    {

    GC.Collect();

    if (Program.oMainSAPDI.CreateField("OINV", "Type", "Type", SAPbobsCOM.BoFieldTypes.db_Alpha, SAPbobsCOM.BoFldSubTypes.st_None, 50, null, null, 2, null) == false)

    {

    return (false);

    }

    return true;

    }

    catch (Exception ex)

    {

    Program.oMainSAPDI.ShowMessage(ex.Message, BoStatusBarMessageType.smt_None);

    return (false);

    }

    }

    Hope it helps

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Sakthivel Rajendran,

      Use this code to insert OBNK table.

      UserFieldsMD oUserFieldMD;
      String sErrMsg = "";

      int LRetCode, RefId;


      try
      {

      oUserFieldMD = (UserFieldsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
      oUserFieldMD.TableName = "OBNK";
      oUserFieldMD.Name = "mybank";
      oUserFieldMD.Description = "mybank";
      oUserFieldMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;
      oUserFieldMD.EditSize = 2;
      LRetCode = oUserFieldMD.Add();

      if (LRetCode != 0)
      {
      oCompany.GetLastError(out LRetCode, out sErrMsg);
      MessageBox.Show("UDF: " + oUserFieldMD.Name.ToString() + " Error Code : " + LRetCode.ToString() + " Msg: " + sErrMsg, "SAP Script");
      Exception myex = new Exception();
      throw myex;
      }

      }
      catch (Exception ex)
      {
      MessageBox.Show(ex.Message.ToString(), "SAP Script");
      Exception myex = new Exception();
      throw myex;
      }

      With regards,

      Venki .A

  • author's profile photo Former Member
    Former Member
    Posted on Jul 25, 2012 at 08:39 AM

    Hi Sakthivel Rajendran,

    Use this code to insert OBNK table.

    UserFieldsMD oUserFieldMD;
    String sErrMsg = "";

    int LRetCode, RefId;


    try
    {

    oUserFieldMD = (UserFieldsMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    oUserFieldMD.TableName = "OBNK";
    oUserFieldMD.Name = "mybank";
    oUserFieldMD.Description = "mybank";
    oUserFieldMD.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;
    oUserFieldMD.EditSize = 2;
    LRetCode = oUserFieldMD.Add();

    if (LRetCode != 0)
    {
    oCompany.GetLastError(out LRetCode, out sErrMsg);
    MessageBox.Show("UDF: " + oUserFieldMD.Name.ToString() + " Error Code : " + LRetCode.ToString() + " Msg: " + sErrMsg, "SAP Script");
    Exception myex = new Exception();
    throw myex;
    }

    }
    catch (Exception ex)
    {
    MessageBox.Show(ex.Message.ToString(), "SAP Script");
    Exception myex = new Exception();
    throw myex;
    }

    With regards,

    Venki .A

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.