cancel
Showing results for 
Search instead for 
Did you mean: 

Check Box in UDO Form

Former Member
0 Kudos

Hi !

I have a form made with Screen Painter and i put in it a check box. The field is binded to my UDO table. When i click on add in my form all the data are added in my UDO table and the values for my checkbox are Y or null in the Table.

My question is that i would like to catch an event when i click on add to print a message on screen when my check box is checked .

Can you help me with code please...

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I tried the code but it still doesnt work. all the data is correctly added to the table but no message on screen...

Former Member
0 Kudos

Hi,

do you also tried to read the value from the datasource ?

REgards,

Christian

Former Member
0 Kudos

The main reason why i want to use the check box is to confirm that the client really wants to add that part of information in the table... So i have check the box so when he will click on add if the check box is checked it will add the data to the table... Maybe it explains more what i want todo with all this.. and maybe it will change the code...

Thanks for your time

Former Member
0 Kudos

Hi,

no Problem ....

Do you already tried to ask the user via Messagebox to add the data. If the user answers no, then don't save the data ....

Regards,

Christian

Former Member
0 Kudos

Hi,

i found this code in the sdk documentation ....

'MessageBox return value (the index of the button pressed, 1 based).
Dim iReturnValue As Integer

iReturnValue = MessageBox("Do you want to continue?", 3, "&Yes!", "&No", "&Maybe")

Select Case iReturnValue
    Case 1:
        'continue
    Case 2:
        'abort
    Case 3:
        'Maybe pressed
End Select

Former Member
0 Kudos

I would prefer just a validation with the check box and the add button then a popup window with a question. Do you think you can help ??

Thanks

former_member184566
Active Contributor
0 Kudos

Hi Alain

The above code should have worked, well here is some code, try the following

If (pVal.BeforeAction = False) Then

If (pVal.ItemUID = "SelAll") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then

Dim oCheckSellAll As SAPbouiCOM.CheckBox

oCheckSellAll = SBO_Application.Forms.Item(FormUID).Items.Item("SelAll").Specific

If (oCheckSellAll.Checked = True) Then sbo_Application.messagebox("hello")

End If

End If

SelAll is the combobox ID. The above code works perfect for me.

If you want a message box with a yes or no you must use something like

iReturnValue = SBO_Application.MessageBox("Are you sure you want to UFREEZE frozen Business Partners", 1, "&Yes!", "&No")

Then use the following to test his answer

Select Case iReturnValue

Case 1

UNFreeze_BP()

End Select

Select Case iReturnValue2

Case 1

freeze_BP()

End Select

Hope it helps

Former Member
0 Kudos

Hi Louis !!!

It's been a while.... Since it's a UDO form and table how can i make it so the ADD button on the form will work only when my checkbox is checked ???

That would solven my problem... sorry if i'm not clear enough

Thanks

former_member184566
Active Contributor
0 Kudos

Hi Alain

Not a problem, i just scanned over the question and did not read in detail.

You'll use the same as i did above, except now we will enable the button instead of showing the message. For this to work the button should of been disabled. Now we can enable and disable a button as required, done it lots, but i haven't done it on a UDO primary button. So we will have to try. The code to enable the button is

If (pVal.BeforeAction = False) Then

If (pVal.ItemUID = "SelAll") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) Then

Dim oCheckSellAll As SAPbouiCOM.CheckBox

oCheckSellAll = SBO_Application.Forms.Item(FormUID).Items.Item("SelAll").Specific

If (oCheckSellAll.Checked = True) Then SBO_Application.Forms.Item("FormId").Items.Item("BtnID").Enabled = True

End If

End If

When the form loads you should ensure the buttons is not enabled, and is disabled.

Example

if pVal.FormTypeEx = "PF" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then

SBO_Application.Forms.Item("FormID").Items.Item("BtnID").Enabled = False

End If

Hope this helps

Former Member
0 Kudos

It Works !!!!!

Thanks alot Louis !!!

Again !!!!

Alain

former_member184566
Active Contributor
0 Kudos

Not a problem.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

try this in the itemevent :

if (pVal.ItemUID = "1" And pVal.BeforeAction = True and SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED = pVal.EventType) Then
   Dim oForm As SAPbouiCOM.Form
   Dim oItem As SAPbouiCOM.Item
   Dim oCheckbox As SAPbouiCOM.CheckBox

   oForm = oApplication.Forms.Item(pVal.FormUID)
   oItem = oForm.Items.Item("checkbox")
   oCheckbox = ctype(oItem.specific, SAPbouiCOM.CheckBox)
if (oCheckBox.checked) then
oApplication.MessageBox("Some message")
end if
end if