cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Docentry in UI API

Former Member
0 Likes
1,154

Hi,

I need docentry when i post the document through UI API.

Accepted Solutions (0)

Answers (1)

Answers (1)

pedro_magueija
Active Contributor

Hi Nandappa,

The form object contains the DBDataSource which contains the fields (including the DocEntry). This only works when the document has already been created (form in OK mode). E.g.: form.DataSources.DBDataSources.Item("OINV").GetValue("DocEntry", 0);

If you are creating the document, then you need to capture the "after" FormDataAdd event and prompt for the last created key (Company.GetNewObjectKey();).


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn

Former Member
0 Likes

Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent

        Try

            Select Case BusinessObjectInfo.FormTypeEx

                Case "139"

                    Select Case BusinessObjectInfo.EventType

                        Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE

                            'If BusinessObjectInfo.BeforeAction = False Then

                            '    oForm = SBO_Application.Forms.ActiveForm

                            '    oForm.Items.Item("tab_RData").Visible = False

                            'ElseIf BusinessObjectInfo.BeforeAction = False And BusinessObjectInfo.ActionSuccess = True Then

                            'End If

                            'Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD

                            '    oForm = SBO_Application.Forms.ActiveForm

                            '    oForm.Items.Item("tab_RData").Visible = False

                        Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD

                            If BusinessObjectInfo.BeforeAction = False Then

                                docentry = oForm.DataSources.DBDataSources.Item(0).GetValue("DocEntry", 0) ' Convert.ToInt32(oForm.DataSources.DBDataSources.Item(0).GetValue("DocEntry", 0))

                                Call FRDCheck(docentry, oForm.TypeEx)

                            End If

                        Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD And BusinessObjectInfo.ActionSuccess = True

                            oForm = SBO_Application.Forms.Item(BusinessObjectInfo.FormUID)

                            Dim soDocEntry As String

                            Dim odbds As SAPbouiCOM.DBDataSource = CType(oForm.DataSources.DBDataSources.Item(0), SAPbouiCOM.DBDataSource)

                            Dim oSaleOrder As SAPbobsCOM.Documents

                            oSaleOrder = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders)

                            soDocEntry = odbds.GetValue("DocEntry", odbds.Offset).Trim

                                                        

                    End Select

            End Select

        Catch ex As Exception

            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)

            BubbleEvent = False

            Exit Sub

        End Try

    End Sub

pedro_magueija
Active Contributor
0 Likes

Hi Nandappa,

Do you have a question regarding the above code?


Best regards,

Pedro Magueija


View Pedro Magueija's profile on LinkedIn