on 01-08-2014 12:50 AM
Hi Bryan,$riniva$ Rachumallu and Edy
Thanks your ideas and Support.
But that is our Add-on and is customization form.
if I use the SBO_SP_TransactionNotification, I am worried it will be too much thing in one Stored Procedures.
I use the sample of CatchingEvents, and use the event of et_FORM_CLOSE,But the order it runs is as the picture.
I can't use my Validation after user click "Yes" .
Can I catch the event that after user click "Yes" ?
Remark: To use Validation that just I want to prevent user run it out of our rule.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
En,But the confirm MessageBox is not dispear from me,just dispear when I Add a part data in the
form(Add-on) ,and click the icon of close.
Now,I can't catch the event.
Now I know the confirm MessageBox's Form ID is 0 and "Y" itemID is 1,But I don't know How to
use source Code to get confirm MessageBox's Form ID to compare "0" and itemID to compare 1.
Remark: pVal.FormTypeEx can get Form ID,But I can't use it to get MessageBox's Form ID.
Remark(some of my source code):
SBO_Application.FormDataEvent += new _IApplicationEvents_FormDataEventEventHandler(FormDataEvent);
protected void FormDataEvent(ref BusinessObjectInfo busObj, out bool bubbleEvent)
{
bubbleEvent = true;
if ((busObj.EventType == BoEventTypes.et_FORM_DATA_ADD || busObj.EventType == BoEventTypes.et_FORM_DATA_UPDATE) && busObj.BeforeAction)
{
if (busObj.FormTypeEx == "FORMID")
{
//if (!Validation())
//{
SBO_Application.MessageBox("Can not Save", 1, "Ok", "", "");
bubbleEvent = false;
//}
}
}
}
Hi Mingwei,
Catch the event of On Before Form Close. Do your validation on the form and stop the closing event if your validation does not meet.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi.
Try below code..
first i need a small information..
which form u want to validate ..
system form or customization form..
i would like to support Mr.Bryan
why dont u use sp..
suppose u r validating system form..
before clicking they have not started the addon .
addon can not validate it..
if u still need through the code
try below sample code..
one more information i need ..
why u need validation at from close i am not understanding..
normally people are closing the form after they complete the work..
'before clicking save button
If (pVal.FormTypeEx = "140" And pVal.BeforeAction = True And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
''Do your validation
'' above scenario for system form chagne pval.formtypex to your from uid
End If
If (pVal.FormUID = "yourCustomizationFormuid" And pVal.BeforeAction = True And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) Then
oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
''Do your validation
End If
'Form close
If (pVal.FormUID = "yourCustomizationFormuid" And pVal.BeforeAction = True And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE) Then
oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
''Do your validation
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What information you want to validate? In this example from PO, I will block the transaction the the Project field is NULL or no value.
IF (@object_type = '22' AND @transaction_type IN ('A', 'U'))
BEGIN
SELECT TOP 1
@LineNum = a.LineNum + 1
FROM POR1 a
INNER JOIN OPOR b ON a.DocEntry = b.DocEntry
WHERE (a.Project = '' OR a.Project IS NULL) AND b.DocEntry = @list_of_cols_val_tab_del
IF NOT @LineNum IS NULL
BEGIN
SELECT @error = -22,
@error_message = 'Please define project at line #. '+ @LineNum +'. '
END
END
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If I were you. I would used the SBO_SP_TransactionNotification instead of creating add-on.
If you used add-on.
1. You will deploy it on all SAP user.
2. You need to maintain the source code.
3. Will cost more time.
Don't make things so complicated if it is there's a minimal way to do it. Anyway, here's a sample to block NULL or empty value.
Dim oNumAtCard As SAPbouiCOM.EditText
oNumAtCard = frmManualDep.Items.Item("14").Specific
If oNumAtCard.Value = "" Then
MsgBox("NULL")
End If
There's a sample to catch the event here at :
C:\Program Files (x86)\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\02.CatchingEvents
Regards,
User | Count |
---|---|
92 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.