Step 1. Creating Your Real WAM Command Handler
In this step, you will create a real WAM command handler for the Details command.
1. Start the Program Coding Assistant.
2. Select the iii HR application, then the Details command handler.
3. Select Web – using WAM components as the platform.
4. Select Basic Command Handler as the type of code you want create.
5. Click the Next button.
6. On the next page specify PSLMST as The physical file that most closely resembles this business object.
The Program Coding Assistant detects the Visual and Programmatic Identifiers required.
7. Click the Next button.
8. On the next page specify PSLMST in the field Add fields from this physical file in the section Fields that you want to appear at the top of your command handler.
9. Click on the Add All button.
10. On the next page select the Include Default Save Button and Logic and click the Generate Code button.
The next page, Generated Code, displays the source code for your command handler. You now need to create the component that will contain the code:
11. Specify iiiCOM06 (where iii are your initials). Make the description of the component Details command handler.
12. Click on the Create button button and wait until you see a message saying the component has been created in the development environment.
13. Switch to the Visual LANSA editor. The iiiCOM06 WAM is displayed in the editor.
14. If you are using a partition with language NAT, you need to change the default value of the #UB_SAVE field to SAVE and change this Web_Map statement to:
Web_Map For(*both) Fields((#UB_SAVE *Desc) #EMPNO #SURNAME #GIVENAME #ADDRESS1 #ADDRESS2 #ADDRESS3 #POSTCODE #PHONEHME #PHONEBUS #STARTDTER #TERMDATER #DEPTMENT #SECTION #SALARY #STARTDTE #TERMDATE #MNTHSAL)
15. Locate the #avFrameworkManager.uWAMEvent_1 handler and add a statement to save any changes made to the employee details. For example:
UPDATE FIELDS(#WAM_HEAD) IN_FILE(PSLMST) WITH_KEY(#EMPNO)
16. Locate the uInitialize event routine. This routine is always called when the command handler is invoked. Notice that it uses #avListManager.GetCurrentInstance method to get the key value of the currently selected item.
17. The uExecute event routine is only ever executed when the WAM is executed (that is, when a filter is started or a command handler is executed). When events occur inside an active WAM (for example a button click) uExecute is not signalled, just the registered uWAMEvent_N event.
18. Save the WAM.
19. Check in your changes to the server:
First check in the layout weblet for your WAM::
a. Locate the layout weblet for your WAM under Weblets in the Repository. It is called iiiCOM06_layout (where iii correspond to your initials).
b. Right-click the weblet to bring up the associated pop-up menu and choose the Check in option.
c. Click OK.
Then:
a. Compile your WAM locally.
b. If it compiles ok, select it in the Repository tab.
c. Right-click the WAM to bring up the associated pop-up menu and choose the Check in option.
d. In the Check in Options dialog select the option to generate XSL for all webroutines.
e. Click OK to check the changes in.
f. Wait until the compiles have finished.