on 10-06-2008 1:11 PM
Dear All,
How can I validate a UDF field in Business Partner screen? As I don't want to set any default value for that UDF, I could not make it as Mandatory also. Please help me to resolve this problem.
Thanks in advance.
Hi,
Or u can also check for the value of the UDF of the Button Press in Add and Update mode....
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well u can get the value of the UDF with a Edit Text. Just chekc the code snippet...
Dim oEdit as SAPboUI.EditText
Dim strUDFVal as String
oEdit = oForm.Items.Item("UDF").Specific
strUDFVal = oEdit.String
If strUDFVal = ""
MsgBox("Plz enter the correct value")
EndIF
And for the form object, to get the value of the UDF form its the negative of the form ID,
So for BP Master its "134" so for the UDF its "-134".
Hope it helps,
Vasu Natari.
Hi,
The SBO_sp_TransactionNotification proc can be used for this type of validation but you could also use code in your addon. The benefit of using the proc is that this will work with BPs created using the DI API (eg DTW import or another addon).
As you are only trying to read data on a system form, you can use the DBDataSources already attached to it to check the UDF value. This is a better solution because it does not rely on the UDF tab being open. You cannot use this method to write to the UDF due to the restrictions on a system form.
You could add something like the following to the item pressed event (when BeforeAction is true) of the Add button on the BP form:
SAPbouiCOM.DBDataSource sboDS = (SAPbouiCOM.DBDataSource)sboForm.DataSources.DBDataSources.Item("OCRD");
string sValue = sboDS.GetValue("U_MYUDF", 0).TrimEnd();
if(sValue == "")
{
BubbleEvent = false;
_sboApp.SetStatusBarMessage("You must enter a value in the UDF", SAPbouiCOM.BoMessageTime.bmt_Long, true);
}
You'll also need to check the form mode to make sure you only validate the field when the form is in Add or Update mode.
Kind Regards,
Owen
The easiest way is use transaction notification stored procedure. Try to search in history of this forum and youll see many code examples how to do it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
110 | |
12 | |
11 | |
6 | |
5 | |
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.