Module Pool Program


Scenario : Here we would design a single screen(9000) with two i/p fields & one o/p field. Upon entering the values in the i/p field, if the user clicks on the add button then the sum will be displayed in the o/p field.

Step-1. Go to SE80. Choose Program And Give a Name ( zmp_test1 ) and press Enter.

Step2. Choose Yes.

Step -3. Un check the check box and Click Yes button.

Step-4. Select Module Pool From the Type and Click on Save button.

Step-5.  Click on Local Package.

Step-6. Double Click on Program Name & Click on Change Button.

Step-7. Create A screen – right click on Program Name ->Create->Screen

 Step-8.  Give Screen number – 9000 & click on Yes Button.

Step-9. Give a short Description &  It’s a normal Screen.

Step-10. Click on layout Button & the Screen Painter Window will appear .

Step-11. Create two input fields , one push button & an output field & at last click on flow logic button on the toolbar.

Step-12.  Now uncomment the two modules in PBO & PAI . Double click on the module name and create it in main program.

Step-13. Write the code in the program.

PROGRAM  zmp_test1.

DATA : num1 TYPE i,
num2 TYPE i,
res TYPE i.

MODULE status_9000 OUTPUT.
SET PF-STATUS ‘STATUS’.
*  SET TITLEBAR ‘xxx’.

ENDMODULE.                 ” STATUS_9000  OUTPUT

MODULE user_command_9000 INPUT.
CASE sy-ucomm.
WHEN ‘SHOW’.
res = num1 + num2.
WHEN ‘BACK’ OR ‘EXIT’ OR ‘CANCEL’.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE.                 ” USER_COMMAND_9000  INPUT

 

 

Step-14. Uncomment the SET PF-STATUS ‘XXXX’  line  and give any name(STATUS) & double click  on it to create it. From the popup click on yes .

Step-15. Give A short text and Click on yes button.

Step-16. Click on the (+) Button on the right of Function keys to expand it. Give SAVE, BACK,   EXIT & CANCEL in the standard toolbar & activate it and press back button to come back to the program.

Step-17. Now create a transaction code for the program. Right click on program name->create->transaction.

Step-18. Give a T-code, short description and click yes button.

Step-19. Give program name , screen number and click on the three check boxes and then click on save button on the standard toolbar. Click on back button to come the program.

Step-20. Now  open a new session and put the T-code of the program in the Command field and press Enter.

Step-21. Fill the two input field with some values and then press ADD button. Find the Result.


 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s