Hi Parvatha,
The DocNumber is finalised by SAP when you save the document.
Hence, you cannot save this number into your UDF at the same time.
This has to be a two step process.
On After Data Add event,
1 get the DocEntry from the pVal.ObjectKey
2 Call up the Doc using this object key and update your UDF
Dim oDoc As SAPBobsCOM.Documents = oCompany.GetBusinessObject(yourDocObjType)
oDoc.GetByKey(DocEntry)
oDoc.UserFields.Fields.Item("UDF").Value = oDoc.DocNum
oDoc.Update
On the other hand, why would you want to save the docnum in the user field ?
Regards
Edy