cancel
Showing results for 
Search instead for 
Did you mean: 

events surrounding choosefromlist on system form.

Former Member
0 Kudos

Hello everyone,

On the Production Order form, I am trying to update a user-defined field whose value I will retrieve from OITEM based on the product number entered (for both add mode & update mode).

I need to be able to capture the value that is loaded into the product number field right afer the users selects one from the Choose from list screen so that the new user-defined value displays on the form at the same time as the new product number does. I actually have accomplished that by setting a flag in the after event of the choosefromlist event and then on formactivate for the prod order form I retrieve & load the value. Great so far!

BUT! If the user keys in a new value, I also need to load the new user-defined field. I can do that too in a couple of ways, each of which leaves me with problems.

If I retrieve the user-typed-in value on lost focus for the product number field, that works unless they go hit the update/add button right away, in which case lost-focus for that field is not being triggered (at least consistently). For this problem, I have also tried to update the UDF or the datasource when the add/update button is pressed but that prevents the update since the system detects the field changes and the user must press add/update again!

If I do it on item validate, that works too unless the user is changing a value in update mode. When this happens the message about the product structure message appears twice, I think because now I am loading the UDF twice, once on form activate and once for item validate.

I am like a dog chasing it's tail! can anyone offer some guidance.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

former_member185703
Active Contributor
0 Kudos

Hi John,

I think I can help you with this:

I think you need to handle the ChooseFromList event!

This will even get fired when the user just entered a new ItemCode...

I have taken some old event logging code + adapted it to the latest UI API version...

I'll edit this thread soon and enter the link for the download - even though you could just do it yourself

Regards,

Frank

Message was edited by: Frank Moebius

Here you go:

https://sapmats-de.sap-ag.de/download/download.cgi?id=498U1X5SMI6YBV97SBG9Q4SMHLRFMRSUHJ77VHSQREFH2N...

Former Member
0 Kudos

Hi Frank,

Thanks for the awesome event-logger tool! (I never use that word lightly, either, as a teenager would LOL).

I use console.writeline to see what's going on, but that is very difficult. Your tool is great!

I have tried to use the CFL event though, but perhaps I've asked the wrong question. The Product number field on the form does not appear to have the value loaded after the CFL list box closes upon the user's selection of a value.

 
 Case Is = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
   If pVal.ItemUID = "6" And pVal.FormMode <> _
	SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
       If pVal.InnerEvent And Not pVal.Before_Action Then
           g_ProdNoChoseFromList = True
           Console.WriteLine("CFL: " & g_ProductNo.Value.ToString)
           UpdateDrawingsOnForm()
       End If
   End If

(In the code above, g_ProductNo is defined as EditText like this:

        g_oItem = g_SBOForm.Items.Item("6")
        g_ProductNo = g_oItem.Specific
)

. If a user keys in a new value & tabs out, then everything is OK. But when the CFL screen displays because the user tabbed when the field was blank, The code above does not work because my field (g_productno is still blank.

Perhaps my question should have been how do I get the new value the user selected on the CFL form.

Thanks again!

former_member185703
Active Contributor
0 Kudos

Sorry, it seems that I overlooked that you already use the ChoosefromList event in your original question!

The ChooseFromList event provides the information about the "Product number" (or ...numbers) chosen in a DataTable!

Please check whether the source code in the sample works for you:

Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String = oCFLEvento.ChooseFromListUID
Dim sVal As String

' exit when nothing had been chosen / found...
If Not oCFLEvento.SelectedObjects Is Nothing Then
  Dim oDataTable As SAPbouiCOM.DataTable
  oDataTable  = oCFLEvento.SelectedObjects

  ' nothing selected... => exit
  If oDataTable.Rows.Count = 0 Then Exit 
  Try
    sVal = oDataTable.GetValue(0, 0)
    Dim i As Integer

    For i = 1 To oDataTable.Rows.Count - 1
      Try
        sVal = sVal & "; " & oDataTable.GetValue(0, i)
      Catch ex As Exception
      End Try
    Next
...

HTH,

Frank

PS: The BubbleChecker from the B1TE tools logs events too, but with much less details...

Former Member
0 Kudos

It worked perfectly, thank you!!

I find it interesting that it also works when the user keys the value right into the field & doesn't even see the choose from list table form. Cool.

Answers (0)