Module pool program has different modules which contains
different logic for different screen. Module pool program can be called dialog
programming. Any number of screens can be developed by module pool programming.
Every screen has a logic which runs at the back end. Module pool program can be
executed by Transaction Code only.
Here we have created a program which contains two screens.
Initial screen contains an input field and some check boxes. In the input field
we are getting the Customer number manually. We have three check boxes. The box
which is clicked will be shown on the second screen. That means if we check
Name and Country boxes then on the second screen we shall see only the customer
name and country code with the customer number. Two push buttons are there and
these two buttons have separate functionality for the data processing. Push
button DISPLAY only displays the entered customer details and CANCEL will clear
the initial screen.
Below is the logic which is written according to the
Includes.
*&---------------------------------------------------------------------*
*& Module Pool ZSR_MOD
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
INCLUDE ZSR_TOP . " global Data
INCLUDE ZSR_O01 . " PBO-Modules
INCLUDE ZSR_I01 . " PAI-Modules
INCLUDE ZSR_F01 . " FORM-Routines
*&---------------------------------------------------------------------*
*& Include ZSR_TOP Module Pool ZSR_MOD
*&
*&---------------------------------------------------------------------*
PROGRAM zsr_mod.
TABLES: kna1.
TYPES: BEGIN OF ty_kna1,
kunnr TYPE kna1-kunnr,
land1 TYPE kna1-land1,
name1 TYPE kna1-name1,
ort01 TYPE kna1-ort01,
END OF ty_kna1.
DATA: wa_kna1 TYPE ty_kna1,
it_kna1 TYPE STANDARD TABLE OF ty_kna1,
ok_code TYPE sy-ucomm,
ok_code2 TYPE sy-ucomm,
name TYPE c,
country TYPE c,
city TYPE c.
*&---------------------------------------------------------------------*
*& Include ZSR_O01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module STATUS_9001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9001 OUTPUT.
SET PF-STATUS 'GUI_9001'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_9001 OUTPUT
*&---------------------------------------------------------------------*
*& Module STATUS_9002 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_9002 OUTPUT.
SET PF-STATUS 'GUI_9002'.
* SET TITLEBAR 'xxx'.
PERFORM process_list.
ENDMODULE. " STATUS_9002 OUTPUT
*&---------------------------------------------------------------------*
*& Include ZSR_I01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9001 INPUT.
CASE ok_code.
WHEN 'BACK'.
PERFORM leave.
WHEN 'EXIT'.
PERFORM leave.
WHEN 'CANCEL'.
PERFORM leave.
WHEN 'DISP'.
PERFORM display.
WHEN 'CANC'.
PERFORM cancel.
ENDCASE.
ENDMODULE. " USER_COMMAND_9001 INPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_9002 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_9002 INPUT.
CASE ok_code2.
WHEN 'BACK2'.
PERFORM leave2.
WHEN 'EXIT2'.
PERFORM leave2.
WHEN 'CANCEL2'.
PERFORM leave2.
ENDCASE.
ENDMODULE. " USER_COMMAND_9002 INPUT
*&---------------------------------------------------------------------*
*& Include ZSR_F01
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form LEAVE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM leave .
LEAVE TO SCREEN 0.
LEAVE LIST-PROCESSING.
ENDFORM. " LEAVE
*&---------------------------------------------------------------------*
*& Form DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display .
IF kna1-kunnr IS NOT INITIAL.
SELECT SINGLE kunnr land1 name1 ort01
FROM kna1 INTO wa_kna1
WHERE kunnr = kna1-kunnr.
IF sy-subrc = 0.
CALL SCREEN 9002.
ELSE.
MESSAGE 'Customer Number doesn''t Exist' TYPE 'I'.
ENDIF.
ELSE.
MESSAGE 'Invalid Customer Number' TYPE 'I'.
LEAVE LIST-PROCESSING.
ENDIF.
ENDFORM. " DISPLAY
*&---------------------------------------------------------------------*
*& Form CANCEL
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM cancel .
CLEAR: kna1-kunnr, country, name, city.
LEAVE TO SCREEN 9001.
LEAVE LIST-PROCESSING.
ENDFORM. " CANCEL
*&---------------------------------------------------------------------*
*& Form LEAVE2
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM leave2 .
CLEAR: kna1-land1, kna1-name1, kna1-ort01.
LEAVE TO SCREEN 0.
LEAVE LIST-PROCESSING.
ENDFORM. " LEAVE2
*&---------------------------------------------------------------------*
*& Form PROCESS_LIST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM process_list .
IF name = 'X'.
kna1-name1 = wa_kna1-name1.
ENDIF.
IF country = 'X'.
kna1-land1 = wa_kna1-land1.
ENDIF.
IF city = 'X'.
kna1-ort01 = wa_kna1-ort01.
ENDIF.
ENDFORM. " PROCESS_LIST
We have created two screens here as follows:
PROCESS BEFORE OUTPUT.
MODULE STATUS_9001.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9001.
and
PROCESS BEFORE OUTPUT.
MODULE STATUS_9002.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_9002.
We have created a Transaction Code here and below is the output of first screen:
Then we have the first screen as follows:
Now we are entering the input value and check the boxes as per requirement:
Finally we click on the display button and then following output has come:
Now by clicking BACK button on the standard toolbar we come back to the first screen and then again by clicking BACK button we shall go to the home screen:
9 comments:
simply awesome thanks for sharing from Sankar
Hi,
My self Ram i have a doubt here how to get in first screen check box as a default.
Thanks,
Hi,
There should not be any problem for 1st screen. If you face problem then please check OK_CODE. You have to enter the OK_CODE on the Element List tab of the screen painter.
SAP Success Factors Real Time Hands on Training in Chennai...
Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286
Both Classroom/Online Training is Available!!!!!!
Best SAP Success Factors Training Institute in Chennai
Best SAP MM Training in Chennai
Best SAP SD Training in Chennai
Best SAP ABAP Training in Chennai
Best SAP FICO Training in Chennai
Best SAP BASIS Training in Chennai
http://thecreatingexperts.com/sap-successfactors-training-in-chennai/
http://thecreatingexperts.com/sap-mm-training-in-chennai/
http://thecreatingexperts.com/sap-sd-training-in-chennai/
http://thecreatingexperts.com/sap-hr-training-in-chennai/
http://thecreatingexperts.com/sap-fico-training-in-chennai/
http://thecreatingexperts.com/sap-abap-training-in-chennai/
http://thecreatingexperts.com/sap-basis-training-in-chennai/
If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/
Both Classroom/Online Training is Available!!!!!!
Hi, I learned SAP Training in Chennai from THE CREATING EXPERTS. The training was good and i got selected in leading MNC company as SAP Consultant.
contact 8122241286
www.thecreatingexperts.com
Hi, I learned SAP Training in Chennai from THE CREATING EXPERTS. The training was good and i got selected in leading MNC company as SAP Consultant.
contact 8122241286
www.thecreatingexperts.com
I have a requirement wherein I have to keep the checkbox checked by default but the user can later on uncheck it as per his convenience. How can I achieve this ?
I have read your blog and I got very useful and knowledgeable information from your blog. It’s really a very nice articlesap hr apap training
Post a Comment