About this topics I spent some time and at the end I’m not able to call by code the standard AX 2012 command in order to Close All Forms, see picture below.
// Exclude ListPage Forms
If (this.form().formTemplate() != 1
Finally, using the sendMessage WinApi Function I have closed all Forms, like below :
WinApi::sendMessageEx( WindowHandle, #WM_CLOSE, 0, 0);