on 11-08-2017 3:31 PM
Hi all,
How can I get UDF value from system form of SAP B1?
Actually I know how I can get value from field like this
Dim oForm As SAPbouiCOM.Form
Dim oEditTotal As SAPbouiCOM.EditText
oForm = SBO_Application.Forms.GetForm("133", 1)
oEditTotal = SBO_Application.Forms.ActiveForm.Items.Item("2").Specific
But if I try to use UDF like this it bring error message
Dim oForm As SAPbouiCOM.Form
Dim oEditTotal As SAPbouiCOM.EditText
oForm = SBO_Application.Forms.GetForm("133", 1)
oEditTotal = SBO_Application.Forms.ActiveForm.Items.Item("U_return").Specific
How can I do that?
Please anyone can help me
Hi Rurangwa,
In this case you need identify if your user field is on the main form or is in the User-Defined Fields form.
If your user field was moved to the main form with IU Edit functionality, the suggestion provided by Ankit should do the work well. But if your field is on User-Defined Fields window, the correct is get the form type equals = -133.
A sample:
SAPbouiCOM.Form oForm = SBO_Application.Forms.GetForm("-133", 0);
SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("your_user_field").Specific;
Or
SAPbouiCOM.Form oForm = SBO_Application.Forms.Item(SBO_Application.Forms.ActiveForm.UDFFormUID);
SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("your_user_field").Specific;
But I would like to suggest another approach, if you are trying to get values from header table of the form, in your scenario OINV, you can read directly the DBDataSource.
A sample:
SAPbouiCOM.Form oForm = SBO_Application.Forms.ActiveForm;
SAPbouiCOM.DBDataSource db = oForm.DataSources.DBDataSources.Item("OINV");
string value = db.GetValue("your_user_field", 0);
Hope it helps.
Kind Regards,
Diego Lother
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much, that works fine
Hi,
It should be used something as below:
SAPbouiCOM.EditText oEditDays = (SAPbouiCOM.EditText)oMatrix.Columns.Item("U_NumDays").Cells.Item(SelectedRow).Specific;
SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("U_Item").Specific;
Hope it helps!
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.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
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.