Skip to Content

Choose From List Event

Dear Experts,

How can I use the choose from list in my user defined form ? Please explain in detail. I am very new to SDK.

Regards

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jan 07, 2014 at 04:20 AM

    Hi,

    Although there are many threads regarding this Choose From List event but still I am providing you following piece of code. You can try this as follows:

    On BeforeAction = false

    SAPbouiCOM.ChooseFromListEvent cflevent = (SAPbouiCOM.ChooseFromListEvent)pVal;

    SAPbouiCOM.ChooseFromList oCFLEvento = default(SAPbouiCOM.ChooseFromList);

    string strUid = cflevent.ChooseFromListUID;

    oCFLEvento = this.m_SBO_Form.ChooseFromLists.Item(strUid);

    SAPbouiCOM.DataTable oDataTable = cflevent.SelectedObjects;

    if (oDataTable == null)

    {

    return;

    }

    if (pVal.ItemUID == enControlName.BranchCode && strUid == "CFL_2" && pVal.FormMode != Convert.ToInt32(BoFormMode.fm_FIND_MODE))

    {

    string ProjectCode = oDataTable.GetValue("PrjCode", 0).ToString();

    string ProjectName = oDataTable.GetValue("PrjName", 0).ToString();

    this.oDataSource = (DBDataSource)m_SBO_Form.DataSources.DBDataSources.Add("@DMRMASTER");

    this.oDataSource.SetValue("U_CBrnch", 0, "");

    this.oDataSource.SetValue("U_NBrnch", 0, "");

    this.oDataSource.SetValue("U_CBrnch", 0, Conversions.ToString(ProjectCode));

    this.oDataSource.SetValue("U_NBrnch", 0, Conversions.ToString(ProjectName));

    }

    Hope I am pretty clear.

    Thanks & Regards

    Ankit Chauhan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2014 at 04:23 AM

    hi.

    First you have to decide on which table you want to create cfl ok..

    you have to get object id for the system from.

    like item master 2

    bp master 4

    emp master 171

    these are the ids given by sapb1 default........

    http://scn.sap.com/thread/3350614

    for your reference i had post above post you can get all the object ids..

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      have a look on above from......................

      on which field you want to put cfl

      you have to bind it first with data base ok

      means

      alias is compulsarily.........

      tablename is compulsarily.......

      choosefromlistalias is compulsarily.......

      choosefromlistuid is compulsarily.......

      next step............

      in screen painter go to collection tab and then you have to create new cfl with respective to the cfl .

      i want to create cfl for emp master so i enter 171 object id.

      There is one example is available in samples for cfl..

      C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\17.ChooseFromList

      plz check it............

      Cfl.JPG (120.6 kB)
      objectype.JPG (99.0 kB)
  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2014 at 06:12 AM

    hi dhiraj

    try this code for choose from list

    SAPbouiCOM.ChooseFromListCollection oCFLs = null;

    SAPbouiCOM.Conditions oCons = null;

    SAPbouiCOM.Condition oCon = null;

    oCFLs = oForm.ChooseFromLists;

    SAPbouiCOM.ChooseFromList oCFL = null;

    SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null;

    oCFLCreationParams = ((SAPbouiCOM.ChooseFromListCreationParams)(ClsSBOAddOn.SBOApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)));

    oCFLCreationParams.MultiSelection = false;

    oCFLCreationParams.ObjectType = "2";

    oCFLCreationParams.UniqueID = "CFL_2";

    oCFL = oCFLs.Add(oCFLCreationParams);

    oCons = oCFL.GetConditions();

    oCon = oCons.Add();

    oCon.Alias = "CardType";

    oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;

    oCon.CondVal = "C";

    oCFL.SetConditions(oCons);

    oCFLCreationParams.UniqueID = "CFL2";

    oCFL = oCFLs.Add(oCFLCreationParams);

    }

    catch (Exception ex)

    {

    ClsSBOAddOn.SBOApplication.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

    }

    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.