cancel
Showing results for 
Search instead for 
Did you mean: 

link button (choose from list ) in a system form

Former Member
0 Kudos

Dear All

How do i create a link button (choose from list ) in a system form. Kindly suggest me the code

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

here is the code of creating a link button and a ChooseFromList for an editText (in this case, linking it to the clients)

public static void setUp()
{
    //in your case this should be the system form
    Form form = B1Connections.theAppl.Forms.ActiveForm; 
    form.DataSources.UserDataSources.Add("CustomerDS", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254);
    AddChooseFromList(form);
    // 12 is an edittext to write down the customer 
    SAPbouiCOM.Item item = form.Items.Item("12");
    EditText customerField = (EditText)item.Specific;

    customerField.DataBind.SetBound(true, "", "CustomerDS");
            
    customerField.ChooseFromListUID = "CFL1";
    customerField.ChooseFromListAlias = "CardCode"; 
            
    // 11 is a link button which links the customer text fields to business partners
    item = form.Items.Item("11");
    item.LinkTo = "12";
    LinkedButton customerLink = (LinkedButton)item.Specific;
    customerLink.LinkedObject = BoLinkedObject.lf_BusinessPartner;
}

//this methods adds a choose form list which shows the clients
private static void AddChooseFromList(Form form)
{
    try
    {
        ChooseFromListCollection oCFLs = form.ChooseFromLists;
        Conditions oCons = null;
        Condition oCon = null;
        SAPbouiCOM.ChooseFromList oCFL = null;
        ChooseFromListCreationParams oCFLCreationParams  = ((ChooseFromListCreationParams)(B1Connections.theAppl.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)));

        oCFLCreationParams.MultiSelection = false;
        oCFLCreationParams.ObjectType = "2";
        oCFLCreationParams.UniqueID = "CFL1";

        oCFL = oCFLs.Add(oCFLCreationParams);

        //  Adding Conditions to CFL1
        oCons = oCFL.GetConditions();
        oCon = oCons.Add();
        oCon.Alias = "CardType";
        oCon.Operation =   SAPbouiCOM.BoConditionOperation.co_EQUAL;
        oCon.CondVal = "C";
        oCFL.SetConditions(oCons);
    }
    catch{}
}

hope this might help you...

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

What exactly do u need, to add a link button or a choose from list, because these are different things