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

choose from list in screen painter

I have created UDO of document type and linked it to a screen painter form.

I have added my document lines table to a matrix.

I have added a choose from list to one of the cells in the matrix.

I want the choose from list to be based on the item master (object type 4).

I think I have set up the choose from list correctly, because when I put the form in preview mode and click on the choose from list icon I get a pop up window with the item code, item name etc. When I select an itemcode the value does not get returned to my cell.

Further when I key a value into the cell with the choose from list, the value disappears when I tab off the cell.

I looked at the SDK sample code and I can see how it the choose from list is accomplished thru code.

My question is: can I configure a choose from list to display a value and return a value through screen painter? Or is there additional magic that needs to be performed thru code?

I am using B1 2007, pl 6.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Sep 20, 2007 at 03:18 AM

    Hi John,

    It's not possible to define a choose from list entirely through the screen painter (or should I say, I've never found a way to do it and came to the same conclusions as you). You must still capture the choose from list event to return the value to the field. You can nick that part of the SDK sample code and then you should be ok.

    Kind Regards,

    Owen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 20, 2007 at 06:34 AM

    Hi

    It's not possible to set the choose from list by screen painter..

    and please code properly .. may be u r doing some minor mistake.. i am sending u some code for choose from list ... hope so u will get help....

    #region CHOOSE FROM LIST AFTERACTION Method

    protected override void CHOOSE_FROM_LIST_AFTERACTION(ref SAPbouiCOM.ItemEvent pVal, SAPbouiCOM.DataTable oDataTable, out bool BubbleEvent, SAPbouiCOM.Application oSboApplication, SAPbobsCOM.Company oCompany)

    {

    BubbleEvent = true;

    string ItemDescription = string.Empty;

    string ItemCode = string.Empty;

    string InStock = string.Empty;

    string UOM = string.Empty;

    string UnitPrice = string.Empty;

    ar = new ArrayList();

    if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST)

    {

    SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;

    oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal));

    string sCFL_ID = null;

    sCFL_ID = oCFLEvento.ChooseFromListUID;

    try

    {

    if (oCFLEvento.BeforeAction == false)

    {

    oDataTable = oCFLEvento.SelectedObjects;

    if (oDataTable == null)

    {

    oSboApplication.StatusBar.SetText("NO Value is Selected", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

    // To Stop Enter the Blank Entry

    BubbleEvent = false;

    return;

    }

    string ITcode = null;

    try

    {

    ITcode = System.Convert.ToString(oDataTable.GetValue(0, 0));

    }

    catch (Exception ex)

    {

    SBOAppAddOn.CreateErrorLog(ex, "CHOOSE_FROM_LIST_AFTERACTION", oSboApplication, oCompany);

    }

    string match = string.Empty;

    for (int j = 0; j < oMatrix.VisualRowCount; j++)

    {

    match = ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strSEPL_PIND_Col_ItemNo).Cells.Item(j + 1).Specific).String;

    ar.Add(match);

    }

    if ((pVal.ColUID == ClsConstant.strSEPL_PIND_Col_ItemNo) && (!ar.Contains(ITcode)))

    {

    //Setting the description of the ItemCode into the matrix

    SAPbobsCOM.Items oItem = (SAPbobsCOM.Items)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

    if (oItem.GetByKey(ITcode))

    {

    ItemDescription = oItem.ItemName;

    ItemCode = oItem.ItemCode;

    InStock = (oItem.QuantityOnStock).ToString();

    UOM = oItem.PurchaseUnit;

    }

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

    if (pVal.Row > oDBItem.Size - 1)

    {

    oMatrix.AddRow(1, oDBItem.Size);

    }

    oMatrix.FlushToDataSource();

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_ItemNo, pVal.Row - 1, ItemCode);

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_ItemDesc, pVal.Row - 1, ItemDescription);

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_Instock, pVal.Row - 1, InStock);

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_UOM, pVal.Row - 1, UOM);

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_Qty, pVal.Row - 1, "1");

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_Unit, pVal.Row - 1, "0.0");

    oDBItem.SetValue("U_" + ClsConstant.strUDFPIND_L_TotalPrice, pVal.Row - 1, "0.0");

    oMatrix.SetLineData(pVal.Row);

    oMatrix.LoadFromDataSource();

    string strDate = DateTime.Today.Date.AddDays(7).ToString("dd/MM/yy");

    ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strSEPL_PIND_Col_ReqDate).Cells.Item(oMatrix.VisualRowCount - 1).Specific).String = strDate;

    for (int i = 0; i < oDBItem.Size; i++)

    {

    ((SAPbouiCOM.EditText)oMatrix.Columns.Item(ClsConstant.strSEPL_NFrm_Column0).Cells.Item(i + 1).Specific).Value = (i + 1).ToString();

    }

    }

    else

    {

    if (pVal.ColUID != "")

    oSboApplication.StatusBar.SetText("Item already defined as the original item substitute", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error);

    }

    }

    ar.Clear();

    }

    catch (Exception ex)

    {

    }

    }

    }

    #endregion

    public void AddChooseFromList(SAPbouiCOM.Application oSboApplication, SAPbobsCOM.Company oCompany)

    {

    try

    {

    ChooseFromListCollection = oForm.ChooseFromLists;

    SAPbouiCOM.Conditions oCons = new ConditionsClass();

    oColumn = oMatrix.Columns.Item(ClsConstant.strSEPL_PIND_Col_ItemNo);

    AddChooseFromList(oColumn, "4", "ItemCode", false, oCons, oSboApplication);

    }

    catch (Exception ex)

    {

    SBOAppAddOn.CreateErrorLog(ex, "Add Choose From List", oSboApplication, oCompany);

    }

    }

    try to use this code.. hope so u will get help....

    if u will get some help... please Give rewards points...

    regards

    deepak

    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.