cancel
Showing results for 
Search instead for 
Did you mean: 

Choose From List Problem.

Former Member
0 Kudos

Hi SAP Gurus,

i am facing problem in et_Choose From List.

when i select Choose From List for Vendor in Landed cost, after making selection for particular vendor, Choose_From_List is getting displaying again.

i.e, Choose_From_List is getting displayed twice

during debug, the program line is executing in following manner.

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, pVal As SAPbouiCOM.IItemEvent, BubbleEvent As Boolean)

Case et_CHOOSE_FROM_LIST

oTmpForm.Items("52").Click (ct_Regular) ** if i comment this program line, Choose_From_List works normal

                                        ** after executing the above line, execution directly jumps to below                                                 subroutine i.e, recursion.

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, pVal As SAPbouiCOM.IItemEvent, BubbleEvent As Boolean)


does any one have any idea about this problem..?

i appreciate your help..

Thanks and Regards,

kaviprashu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Have you assigned the ChooseFromList to item 52 in your form?

Regards

Former Member
0 Kudos

Hi,

Thanks Pari, item 52 is a tab control(folder) in Landed Cost Screen. how can i assign Choose_From_List to item 52 ..?

i appreciate your help.

Thanks and Regards,

kaviprashu

Former Member
0 Kudos

Hi,

No you can't assign CFL to tab control.., can you please paste your code here?

Regards

Former Member
0 Kudos

Hi,

Thanks Pari,

Sorry for late reply.,

Choose From List Problem is almost solved!

actually the problem is with '*' (asterisk) string.

Choose from List was getting displayed twice when i pass * string in Card Code, or Card Name..

i.e, when i put * + 'Enter' key , Choose_From_List is displayed, after selecting particular vendor, the Choose_From_List is displayed again..

for test purpose i cleared  * , then everything is working fine

below is my program lines. please check.

   If pVal.FormType <> 0 Then    

        If pVal.Before_Action = False Then       

          Select Case pVal.FormType              

                Case 922:

                    Set oTmpForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)

                    Select Case pVal.EventType

                    Case et_FORM_LOAD

'-- program lines for form load

Case et_ITEM_PRESSED

'-- program lines for Item Pressed

Case et_CHOOSE_FROM_LIST

'** clear * 🙂

     Set oRefItem = oTmpForm.Items.Item("3")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("33")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("43")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("47")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

On Error Resume Next

    oTmpForm.Items("52").Click (ct_Regular)

    actual_cost1 = actualcost

    baseentry = baseentry1 = 0

    actualcost = 0

    'card

    If oTmpForm.Mode = fm_ADD_MODE Then

    oTmpForm.Items.Item("ActualCost").Enabled = True

    oTmpForm.Items.Item("1").Enabled = False

    oTmpForm.Items("53").Click (ct_Regular)

    Set o_Matrix = oTmpForm.Items("54").Specific

    If o_Matrix.Columns.Item(3).Editable = False Then

    o_Matrix.Columns.Item(3).Editable = True

    End If

    For c_count = 1 To o_Matrix.RowCount

    o_Matrix.Columns.Item(3).Cells.Item(c_count).Specific.Value = 0#

    Next c_count

    If cardcode_1 = 110 Then o_Matrix.Columns.Item(3).Editable = False

    oTmpForm.Items("52").Click (ct_Regular) '-spk240312

    Else

    'do nothing

    End If

          End Select     '--pVal.EventType

          End Select     '--pVal.FormType              

End If      '--pVal.Before_Action

End If     '--pVal.FormType

i appreciate your help..

Thanks and Regards,

kaviprashu

Answers (2)

Answers (2)

Former Member
0 Kudos

From the few lines of code you posted, what I can see is that you aren't checking pVal.BeforeAction (unless that's being done in previous lines that were not posted). And if that's the case then your code will always execute twice.

Besides that, I've had the same issue you mention, that when you click an object programmaticaly another thread runs and executes the SBO_Application_ItemEvent method and that's something you cannot control (as far as I know). What I've done to overcome this issue is to create a global flag indicating to catch events or not, something like this:

bProcessEvents = false

oTmpForm.Items("52").Click (ct_Regular)

'Execute your code here

bProcessEvents = true

And within your SBO_Application_ItemEvent method your first line would be something like:

IF bProcessEvents <> true THEN
     return

But this is just an idea and it all depends on what you're trying to accomplish and your program logic.

Hope this helps you somehow.

Cheers

Former Member
0 Kudos

Hi,

Thanks Sergio,

Sorry for late reply.,

your Idea about passing a boolean value is superfine, i tried to execute but my other settings like disabling Cost field for Import Vendors is not executing.

this happen because i need to pass that boolean value in every events i.e, in et_Item_pressed events, too..

Choose From List Problem is almost solved!

actually the problem is with '*' (asterisk) string.

Choose from List was getting displayed twice when i pass * string in Card Code, or Card Name..

i.e, when i put * + 'Enter' key , Choose_From_List is displayed, after selecting particular vendor, the Choose_From_List is displayed again..

for test purpose i cleared  * , then everything is working fine

below is my program lines. please check.

   If pVal.FormType <> 0 Then    

        If pVal.Before_Action = False Then       

          Select Case pVal.FormType              

                Case 922:

                    Set oTmpForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)

                    Select Case pVal.EventType

                    Case et_FORM_LOAD

'-- program lines for form load

Case et_ITEM_PRESSED

'-- program lines for Item Pressed

Case et_CHOOSE_FROM_LIST

'** clear * 🙂

     Set oRefItem = oTmpForm.Items.Item("3")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("33")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("43")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

     Set oRefItem = oTmpForm.Items.Item("47")

     Set card_code = oRefItem.Specific

     crd_code = CStr(card_code.String)

     If crd_code = "*" Then card_code.String = ""

On Error Resume Next

    oTmpForm.Items("52").Click (ct_Regular)

    actual_cost1 = actualcost

    baseentry = baseentry1 = 0

    actualcost = 0

    'card

    If oTmpForm.Mode = fm_ADD_MODE Then

    oTmpForm.Items.Item("ActualCost").Enabled = True

    oTmpForm.Items.Item("1").Enabled = False

    oTmpForm.Items("53").Click (ct_Regular)

    Set o_Matrix = oTmpForm.Items("54").Specific

    If o_Matrix.Columns.Item(3).Editable = False Then

    o_Matrix.Columns.Item(3).Editable = True

    End If

    For c_count = 1 To o_Matrix.RowCount

    o_Matrix.Columns.Item(3).Cells.Item(c_count).Specific.Value = 0#

    Next c_count

    If cardcode_1 = 110 Then o_Matrix.Columns.Item(3).Editable = False

    oTmpForm.Items("52").Click (ct_Regular) '-spk240312

    Else

    'do nothing

    End If

          End Select     '--pVal.EventType

          End Select     '--pVal.FormType              

End If      '--pVal.Before_Action

End If     '--pVal.FormType

i appreciate your help..

Thanks and Regards,

kaviprashu

Former Member
0 Kudos

Choose from list in a Tab?

Why don't you put your choose from list in a editbox to make it easier.

Former Member
0 Kudos

Hi,

Sorry for late reply..

Thanks Bry Bry, this idea is good but how should i put choose from list in editbox..?

i appreciate your help.

Thanks and Regards,

kaviprashu

Former Member
0 Kudos

Hi,

Sorry for late reply..

Thanks Bry Bry, this idea is good but how should i put choose from list in editbox..?

i appreciate your help.

Thanks and Regards,

kaviprashu