on 11-22-2017 1:34 PM
Hi all,
How can I set condition by using Yes or No of message box of You cannot change this document after you have added it. Continue?
Actually I can do codes of to execute instructions before and after adding Document in SAP B1 like this
If pVal.FormType = 133 AndAlso pVal.ActionSuccess = False AndAlso pVal.EventType = BoEventTypes.et_ITEM_PRESSED AndAlso pVal.ItemUID = "1" AndAlso pVal.FormMode = 3 Then
'Instructions here
End If
But Now I want if I click Yes button of message box then execute instructions before adding document in DB, if I click No then no execution of instructions will be
Please anyone can help me
Hi,
It can be done something as below:
int ithReturnValue;
ithReturnValue = SBO_Application.MessageBox("Do you want to continue ?", 1, "Continue", "Cancel", "");
if (ithReturnValue == 1)
{
BubbleEvent = true;
}
else
{
BubbleEvent = false;
}
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, it is something tricky however you can achieve it something like this:
if (pVal.FormType == 0 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_LOAD)
{
SAPbouiCOM.Form oForm = (SAPbouiCOM.Form)SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount);
SAPbouiCOM.StaticText oStatic = (SAPbouiCOM.StaticText)oForm.Items.Item("7").Specific;
if (oStatic.Caption == "You cannot change this document after you have added it. Continue?")
{
oForm.Close();
return;
}
}
Remember to check it for the all the forms for which you want to do it. (In this case, A/R Invoice) since the FormType will always be "0" for other system forms.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP SME Support
Hi Ankit,
That was exactly what I wanted but the only problem is when i press "Yes" or "No" button it still gives me the same results.And what i what is that it can only work with the "Yes"button
If pVal.FormType = 0 AndAlso pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE Then
Dim oFormM As SAPbouiCOM.Form = DirectCast(SBO_Application.Forms.GetForm(pVal.FormType.ToString(), pVal.FormTypeCount), SAPbouiCOM.Form)
Dim oStatic As SAPbouiCOM.StaticText = DirectCast(oFormM.Items.Item("7").Specific, SAPbouiCOM.StaticText)
If oStatic.Caption = "You cannot change this document after you have added it. Continue?" Then
Dim udfFormUID As String = SBO_Application.Forms.Item(FormUID1).UDFFormUID
Dim UDFForm As Form = SBO_Application.Forms.Item(udfFormUID)
DirectCast(UDFForm.Items.Item("U_msgbox").Specific, EditText).Value = 20
'oFormM.Close()
'Return
End If
End If
How can control Yes and No buttons?
Hi Ankit,
It was done successfully, I added pVal.ItemUID = "1" in the if condition
Thank you so much
Hi peo traco (Gail),
No, you cannot use this code inside stored procedure. It is a .NET code for SAP Business One SDK.
Kind regards,
ANKIT CHAUHAN
SAP Business One Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.