on 02-20-2015 6:09 PM
Dears,
Please their collaboration with this matter.
I need access throught AddOn using UI API, to UDF in Marketing Documents, in order to read the content using specific EditFields.
For Example, i have a UDF named U_MG_State in headers of Marketing Documents, and i tried to read value using the follow Code
Dim oForm as SAP
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.ActiveForm
Try
If oForm.TypeEx = "133" Or oForm.TypeEx = "141" Or oForm.TypeEx = "179" Then
Dim oItem1 As SAPbouiCOM.Item
Dim oState As SAPbouiCOM.EditText
oState = CType(oItem1.Specific, SAPbouiCOM.EditText)
SBO_Application.MessageBox(oState.Value.Trim)
Marshal.ReleaseComObject(oState)
Marshal.ReleaseComObject(oItem1)
End If
Catch ex As Exception
Throw New System.Exception(ex.Message)
Finally
Marshal.ReleaseComObject(oForm)
End Try
but in resalted underline, obtain this error.
Item - Invalid item [66000-3]. Form Unique Id: 'F_70', Item Unique Id: 'U_MG_State'
Thans in advance for your assintance.
Best Regards
Pablo Salazar
Hi Salazar,
you can use the UDFFormUID property in the Form object of UI API, as in the following example:
SAPbouiCOM.Form oProductionOrder = SBO_Application.Forms.ActiveForm;
SAPbouiCOM.Form oUDFFrm = null;
try
{
oUDFFrm = SBO_Application.Forms.Item(oProductionOrder.UDFFormUID);
}
catch (Exception ex)
{
SBO_Application.Menus.Item("6913").Activate();
oUDFFrm = SBO_Application.Forms.Item(oProductionOrder.UDFFormUID);
}
((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_raDocEntry").Specific).Value = sDocEntryRA.ToString();
((SAPbouiCOM.EditText)oUDFFrm.Items.Item("U_raLineNum").Specific).Value = sLineNumRA.ToString();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Salazar,
you need to use the item unique ID of the edittext - you are using the database field name. To get the ID switch on System Information ( View -> System Information ), afterwards you can hover over the edittext and get the id in statusbar.
regards,
Maik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Salazar,
you want to get a value from the UDF form - this is slighty different.
First of all this form type is -133 ( with a leading minus) then I guess you meant an other field ( your sample doesn't fit the screenshot )?
If you "just" want the value of the field there is a much better way of getting it :
oForm.DataSources.DBDataSources.Item(0).GetValue("Fieldname",0).ToString().Trim()
regards,
Maik
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
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.