Hi Anil,
Thanks a lot for your advise & I'm sorry for late response: I totally forgot my "eliminate-Document-type" task in form Document handling of Purchase requisition. Following your instructions, I can find codes of the method Init & I've tried to modify a little bit like below. I haven't done any similar tasks in AX before, so please show me what to do next to test. Those codes in Red are just added.
void init()
{
#define.ctrlBuildAdd('ctrlAdd')
DocuType docuType;
DocuTemplate docuTemplate;
FormBuildMenuButtonControl menuCtrl;
FormBuildFunctionButtonControl itemButtonCtrl;
FormRun formRun;
tableName primaryTable;
int64 templateLibraryCount;
allowView = true;
// Determine if there is more than one template library
templateLibraryCount = docuType::getTemplateLibraryCount();
if (! infolog.parmDocuHandlingActive())
{
throw(error("@SYS60737"));
}
if (infolog.parmDocu().isDocuViewSet())
{
infolog.parmDocu().setActive();
throw Exception::Info;
}
optionView = new DocuOptionView();
optionView.getLast();
DocuType::createDefaults();
docuTypeIdFile = DocuType::typeFile();
formRun = infolog.parmLastActivatedForm().object();
primaryTable = tableId2name(formRun.docCursor().TableId);
select language from userInfo
where UserInfo.id == curUserId();
menuCtrl = this.form().design().control(#ctrlBuildAdd);
while select @TypeId,ActionClassId from docuType
index TypeIdx
where docuType.ActionClassId != classNum(DocuLibrary)
{
// <GBR>
if (BrazilParameters::isEnabled()
&& BrazilParameters::find().FiscalDocumentTextDocuTypeId
&& docuType.TypeId == BrazilParameters::find().FiscalDocumentTextDocuTypeId)
{
continue;
}
// </GBR>
// Thai Hodac: Only add those document type (i.e. TypeId) different from “Document” into the menu item
if docuType.TypeId!=” Document”
{
itemButtonCtrl = menuCtrl.addControl(FormControlType::MenuFunctionButton,docuType.TypeId);
itemButtonCtrl.menuItemType(MenuItemType::Action);
itemButtonCtrl.menuItemName(menuitemactionstr(DocuActionNew));
itemButtonCtrl.text(docuType.TypeId);
}
}
// Now add the menu item buttons associated with the template libraries (this list is dynamic based on record selection)
// We are adding them at the end to ensure we reduce the visual impact as controls appear/disappear when record selection changes.
while select @TypeId,ActionClassId from docuType
index TypeIdx
where docuType.ActionClassId == classNum(DocuLibrary)
{
while select TypeID, TemplateID from docuTemplate
where docuTemplate.TypeID == DocuType.TypeId
&& DocuTemplate.Enabled == NoYes::Yes
&& docuTemplate.PrimaryTable == primaryTable
&& (docuTemplate.LanguageID == userInfo.Language
|| docuTemplate.LanguageID == '')
{
itemButtonCtrl = menuCtrl.addControl(FormControlType::MenuFunctionButton, this.getControlNameWithTemplateID(docuTemplate.TypeID, docuTemplate.TemplateID));
itemButtonCtrl.menuItemType(MenuItemType::Action);
itemButtonCtrl.menuItemName(menuitemactionstr(DocuActionNew));
// If documents are being stored in more than 1 Template library(TypeID) append the Template library name to the button.
if (templateLibraryCount > 1)
{
if (currentSessionLanguageRTL())
{
itemButtonCtrl.text(DocuType.TypeID + " - " + docuTemplate.TemplateID);
}
else
{
itemButtonCtrl.text(docuTemplate.TemplateID + " - " + DocuType.TypeID);
}
}
else
{
itemButtonCtrl.text(docuTemplate.TemplateID);
}
}
}
super();
link.enabled(false);
multiPaste.enabled(false);
formSplitter_Y = new SysFormSplitter_Y(grpSplit,grpRefGrid,this);
fromPrimaryTable = primaryTable;
}


Thanks so much
Thai