cancel
Showing results for 
Search instead for 
Did you mean: 

SBO Addon throws a missing BP Code during "1" click (update)

ens_
Active Participant
0 Kudos
176

Dear Community,

I have been meddling with a weird error on one of my personal addons. The problem is, when I hit update button i get the following error

Below you can see the code of the Update Button;

private void Button0_PressedBefore(object sboObject, SAPbouiCOM.SBOItemEventArg pVal, out bool BubbleEvent)

        {

            BubbleEvent = true;

            if (Application.SBO_Application.Forms.ActiveForm.Mode == SAPbouiCOM.BoFormMode.fm_UPDATE_MODE)

            {

                int cnt = Grid4.Rows.Count;

                int rowIndex, ok;

                string CallID;

                int count = Grid4.DataTable.Rows.Count - 1;

                ProgressBar0 = Application.SBO_Application.StatusBar.CreateProgressBar("Checking Completed Service Calls", cnt - 1, false);

                ProgressBar0.Value = 0;

                for (int i = 0; i < cnt; i++)

                {

                    try

                    {

                        showRow = int.Parse(Grid4.DataTable.Columns.Item("CallID").Cells.Item(i).Value.ToString());

                        ProgressBar0.Value = i;

                        ProgressBar0.Text = i + "/" + cnt + " - " + showRow;

                    }

                    catch { }

                    rowIndex = Grid4.GetDataTableRowIndex(i);

                    if (rowIndex != -1)

                    {

                        try

                        {

                            CallID = Grid4.DataTable.GetValue("CallID", rowIndex).ToString();

                            oSCs = ((SAPbobsCOM.ServiceCalls)(Globals.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oServiceCalls)));

                            oSCs.GetByKey(int.Parse(CallID));

                            oSCs.UserFields.Fields.Item("U_Completed").Value = Grid4.DataTable.GetValue("Completed", rowIndex).ToString();

                           

                            oSCs.UserFields.Fields.Item("U_SalesOrder").Value = Grid4.DataTable.GetValue("Sales Order", rowIndex).ToString();

                            ok = oSCs.Update();

                            if (ok != 0)

                            {

                                Application.SBO_Application.MessageBox(Globals.oCompany.GetLastErrorDescription().ToString(), 1, "Ok", "", "");

                            }

                        }

                        catch { ProgressBar0.Stop(); }

                    }

                }

                ProgressBar0.Stop();

            }

       }

What i noticed though, is that this is caused whenever i use CFL (Choose From List). Here is the CFL Feature i use

The Properties of the EditText Field are:

The CFL datasource properties are:

Any Ideas why this happens?

View Entire Topic
ens_
Active Participant
0 Kudos

another thing, when i have a customer code in the CFL edit text and try to update, i receive the following error.

and the update does not occur

Former Member
0 Kudos

Hi Varnavas,

First of all , a silly question, BP Code 140313 exist in the database?

Secondly, -Linked Value Not Exist- error may caused for the following reasons:

  • You have assign string and not an integer as ObjectKey for the Link Button
  • You are providing a null value as ObjectKey (In this case you have to assign to the EditText at the top of the form a UserDataSource)

In any case, i want to ask you; the link button that is not working is located at the EditText or at the Grid? Because in case that you have placed it on the grid, make sure that the link button is anchored with BP Code and not CardName. You are not having a CardCode column. In case that you have a Link Button that is connected with the Editext (at the top of the form) even with the EditText contains data, is one other problem.

Kind Regards

Evangelos D. Plagianos

ens_
Active Participant
0 Kudos

Dear Vaggelis,

Yes, the BP selection filters the results on the grid, so it does exist no worries about silly questions. Many times we all face small simple problems like that one!

I use Int.Parse and i parse from string to Int. The linked button works fine.

The use of Update Button is completely irrelevant with the EditText field with the CFL.

CFL EditText field works as a FILTER for the query that will be run on the grid.

when i issue a change on the grid enabled fields, the "1" button changes to Update.

When i click update the event triggered is correct i just get an extra error below which i show on the first screenshot.

The second screenshot below pops that error when i have a value in the EditText on the top and i click update

former_member233854
Active Contributor
0 Kudos

Hi Varnavas, I believe it is the same as mentioned, did you remove the ObjectType property of the form? It must be blank in this case.

Do you have any field linked to the OCRD.GroupCode?

ens_
Active Participant
0 Kudos

Hi Danilo,

Yes I removed the ObjectType linkage between the form and '2' (BPs) and created an event that would handle the selection of the text and parse it to the TextField as Edy suggested! It works okay now.