Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

hi all next doc number of form

Hi all,

i am using udo and bind with docnum but when i open that form next doc number of form not showing.

Is necessary to right separate code to retrieve max doc number and show in the form as document number.

if any one have sample code post it.

Thanks in Advance.

Awaiting soon reply

Rajkumar Gupta

Edited by: Rajkumar Gupta on Sep 29, 2008 2:59 PM

Former Member
Former Member replied

hi,

Declare Public FormCount as Integer=0

i m using this code for displaying form

If (pVal.MenuUID = "mnuPurRequi") And (pVal.BeforeAction = False) Then

Try

'Closing any lookup windows if open"

For Each oFormTest As SAPbouiCOM.Form In SBO_Application.Forms

If oFormTest.UniqueID = "GLS_PurRequ" Then

oFormTest.Close()

Exit For

End If

Next

DrawForm()

Dim RS As SAPbobsCOM.Recordset = Nothing

RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

RS.DoQuery("Select DocNum from [@Table] where DocEntry in (Select Max(DocEntry) from [@Table])")

Dim oEdit As SAPbouiCOM.EditText = SBO_Application.Forms.Item("FormUID").Items.Item("ItemUID").Specific

oEdit.Value = RS.Fields.Item("DocNum").Value + 1

FormCount=SBO_Application.Forms.Item("FormUID").TypeCount

Catch ex As Exception

End Try

repeat same in MenuEvent for Changing to AddMode.

If (pVal.MenuUID = "1282") And (pVal.BeforeAction = False) Then 'AddMode

If FORMCOUNT = 1 Then

Dim RS As SAPbobsCOM.Recordset = Nothing

RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

RS.DoQuery("Select DocNum from [@Table] where DocEntry in (Select Max(DocEntry) from [@Table])")

Dim oEdit As SAPbouiCOM.EditText = SBO_Application.Forms.Item("FormUID").Items.Item("ItemUID").Specific

oEdit.Value = RS.Fields.Item("DocNum").Value + 1

End If

End If

use this in FormClose event

If pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_CLOSE Then

FORMCOUNT = 0

End If

regards,

varma

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question