By referring this document you can understand step by step procedure to generate stack file using maintenance optimizer in solution manager.
Example : Generation of Stack File to Upgrade Support Patch Level of SAP NetWeaver 740_SP_8 to NetWeaver 740_SP_9
1) Login to your Solution Manager System.
2) Use transaction SM_WORKCENTER.
3) Select “Change Management” tab from tool bar, go to “Maintenance Optimizer” and click on New button as shown in figure.
4) Select SAP System for SP Upgrade as shown in below figure.
5) Select option Calculate Files Automaticaliy-Recommended.
6) Select Support Package Stacks.
7) Select your standalone system and target stack, in our case it is SAP NetWeaver 7.4 and target stack 09. Press continue.
8) Summary Screen will be displayed as shown in below figure.
9) Here we are generating Stack file for SP level upgrade, not necessary to select any Add-on Products. Just press continue and you will get another screen for OS/DB-Dependent files.
10) Also select DB independent files.
11) It is recommended to update SPAM/SAINT, so also select stack independent files.
12) Select tool (Download Basket) to download files.
As shown in above image .txt and .xml files have been generated successfully at location /usr/sap/trans/EPS/in.
I tried to give step by step procedure for stack file generation. Hope you all will find it helpful.