Skip to Content
0
Nov 16, 2017 at 02:42 PM

Problem with CFL when loading UDO data

224 Views

Hi all,

In order to explain easily the problem we are facing in our UDO form, let's consider we have a simple UDO form with Code and Name columns only. After creating a simple AddOn in B1Studio with user form mapped for this simple UDO, we then added a CFL type 4 (Items) and mapped in the Code TextField of our user form, to allow the selection of any SAP Item (OITM.ItemCode) and add it to our UDO.

The form works correctly when we add, find or delete UDO data.

However, when we select an item in the CFL whose data already exists in or UDO, its data is loaded correctly into the form but BUT the form ALWAYS changes to UPDATE mode, even if we force it to OK mode! We are only showing the UDO data for selected item in CFL, so the form should stay in OK mode after data is loaded into form...

This is the code we use to load UDO data during CFL after event:

        private void EditText0_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
{
    SAPbouiCOM.ISBOChooseFromListEventArg pCflArgs = (SAPbouiCOM.ISBOChooseFromListEventArg)pVal;
    if (pCflArgs.SelectedObjects == null) return;

    // Get select CFL ItemCode
    SAPbouiCOM.DataTable dt = pCflArgs.SelectedObjects;
    string sItemCode = dt.GetValue(0, 0).ToString().Trim();

    // Load UDO data for selected Model on form
    SAPbouiCOM.Conditions pConds = new SAPbouiCOM.Conditions();
    SAPbouiCOM.Condition pCond = pConds.Add();
    pCond.Alias = "Code";
    pCond.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    pCond.CondVal = sItemCode;
    UIAPIRawForm.DataSources.DBDataSources.Item("@TAB").Query(pConds);

    // Force form to go to OK mode: DOES NOT WORK!
    UIAPIRawForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;
}

Is there any way to force the UDO form to show in OK mode?

We tried several other alternatives, but can't find a solution for it. The last line does not work, and the form ALWAYS changes to UPDATE mode...

Thanks!

mdias