Adding document handling notes in Axapta

to Adding document handling notes write following code in a job

 DocuRef docuRef;  
 #define.vend('V123')  
 #define.docuType('Note')  
 ;  
 docuRef.RefCompanyId = curext();  
 docuRef.RefTableId = tablenum(VendTable);  
 docuRef.RefRecId = VendTable::find(#vend).RecId;  
 docuRef.TypeId = #docuType;  
 docuRef.Name = 'ImportedT';  
 docuRef.Notes = 'This vendor imported.';  
 docuRef.insert();