10-22-2007 12:23 PM
Hi All,
I m trying to design the screen painter in which after creating the layout
In PAI modules i need to create code which will be triggerred when I perform some action in the output. In PBO module the code which needs to write gets triggered before the screen gets displayed.
for the above line can u give me one example .
i m not clear with the PAI & PBO
Pls reply as early as possible..
Thanks
10-22-2007 12:26 PM
in PBO following is the example of the code...
-> Setting of PF-STATUS
-> Moving value in display fields
in PAI following is the example of the code...
-> Check of SY-UCOMM to process further based on the use selection
10-22-2007 12:45 PM
These are 2 events for designing the screens in module pool programing
PAI is used to write the code for the User actions on the screen.
Here data moves from screen to program.
PBO is used to display the fields from the program to the screen.
and we build the gui statuses in this PBO.
see the sample code
REPORT ZBHMOD1 .
DATA:OKCODE1 LIKE SY-UCOMM,
OKCODE2 LIKE SY-UCOMM.
DATA:N1(10) TYPE N,N2(10) TYPE N,RES(12) TYPE N.
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'NEXT'.
RES = N1 + N2.
SET SCREEN 1001.
WHEN 'CLEA'.
CLEAR:N1,N2.
WHEN 'BACK'.
SET SCREEN '0'.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.
ENDMODULE. " STATUS_1000 OUTPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN 1000.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.
ENDMODULE. " STATUS_1001 OUTPUT
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
**************************************************************************
************************************************************************
2)
REPORT ZBHMOD2.
DATA: OKCODE1 TYPE SY-UCOMM,
OKCODE2 TYPE SY-UCOMM,
ENAME(10) TYPE C,
DNAME(10) TYPE C.
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT1'.
ENDMODULE. " STATUS_1000 OUTPUT
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'TIT2'.
ENDMODULE. " STATUS_1001 OUTPUT
MODULE USER_COMMAND_1000 INPUT.
CASE OKCODE1.
WHEN 'BACK'.
SET SCREEN '0'.
WHEN 'NEXT'.
DNAME = ENAME.
SET SCREEN '1001'.
ENDCASE.
ENDMODULE. " USER_COMMAND_1000 INPUT
MODULE USER_COMMAND_1001 INPUT.
CASE OKCODE2.
WHEN 'BACK'.
SET SCREEN '1000'.
ENDCASE.
ENDMODULE. " USER_COMMAND_1001 INPUT
FORM ON_CTMENU_FORM USING ZDEMO1 TYPE REF TO CL_CTMENU.
CALL METHOD ZDEMO1->LOAD_GUI_STATUS
EXPORTING
PROGRAM = 'ZDEMO1'
STATUS = 'ZDEMO1'
MENU = ZDEMO1.
ENDFORM. " ON_CTMENU_FORM
FLOW LOGIC:
PROCESS BEFORE OUTPUT.
MODULE STATUS_1000.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1000.
PROCESS BEFORE OUTPUT.
MODULE STATUS_1001.
*
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1001.
*************************************************************
Every Screen has a pbo and a pai.
Screen elements are the textbox, buttons, radio buttons and check boxes .....
If we want to pass data from a abap program to a screen element, we have to create a variable with the name we have given in the screen.So whatever the value is present in that variable is reflected on to the screen element.
Here is an example :
Using subscreens and some of the screen elements
REPORT demo_dynpro_subscreens.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: number1(4) TYPE n VALUE '0110',
number2(4) TYPE n VALUE '0130',
field(10) TYPE c, field1(10) TYPE c, field2(10) TYPE c.
CALL SCREEN 100.
MODULE status_100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
ENDMODULE.
MODULE fill_0110 OUTPUT.
field = 'Eingabe 1'(001).
ENDMODULE.
MODULE fill_0120 OUTPUT.
field = field1.
ENDMODULE.
MODULE fill_0130 OUTPUT.
field = 'Eingabe 2'(002).
ENDMODULE.
MODULE fill_0140 OUTPUT.
field = field2.
ENDMODULE.
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE.
MODULE save_ok INPUT.
save_ok = ok_code.
CLEAR ok_code.
ENDMODULE.
MODULE user_command_0110 INPUT.
IF save_ok = 'OK1'.
number1 = '0120'.
field1 = field.
CLEAR field.
ENDIF.
ENDMODULE.
MODULE user_command_0130 INPUT.
IF save_ok = 'OK2'.
number2 = '0140'.
field2 = field.
CLEAR field.
ENDIF.
ENDMODULE.
MODULE user_command_100 INPUT.
CASE save_ok.
WHEN 'SUB1'.
number1 = '0110'.
WHEN 'SUB2'.
number1 = '0120'.
CLEAR field1.
WHEN 'SUB3'.
number2 = '0130'.
WHEN 'SUB4'.
number2 = '0140'.
CLEAR field2.
ENDCASE.
ENDMODULE.
flow logic for screen 100
PROCESS BEFORE OUTPUT.
MODULE STATUS_100.
CALL SUBSCREEN: AREA1 INCLUDING SY-REPID NUMBER1,
AREA2 INCLUDING SY-REPID NUMBER2.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
MODULE SAVE_OK.
CALL SUBSCREEN: AREA1,
AREA2.
MODULE USER_COMMAND_100.
flow logic for screen 110
PROCESS BEFORE OUTPUT.
MODULE FILL_0110.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0110.
flow logic for screen 120
PROCESS BEFORE OUTPUT.
MODULE FILL_0120.
PROCESS AFTER INPUT.
flow logic for screen 130
PROCESS BEFORE OUTPUT.
MODULE FILL_0130.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0130.
flow logic for screen 140
PROCESS BEFORE OUTPUT.
MODULE FILL_0140.
PROCESS AFTER INPUT.
Check the below link:
http://wiki.ittoolbox.com/index.php/FAQ:What_is_module_pool_program_in_abap%3F
http://help.sap.com/saphelp_46c/helpdata/en/35/26b1aaafab52b9e10000009b38f974/content.htm
http://sap.mis.cmich.edu/sap-abap/abap09/sld011.htm
http://sap.mis.cmich.edu/sap-abap/abap09/index.htm
http://www.geocities.com/ZSAPcHAT
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/content.htm
http://www.sapdevelopment.co.uk/dialog/dialoghome.htm
http://help.sap.com/saphelp_46c/helpdata/en/08/bef2dadb5311d1ad10080009b0fb56/content.htm
http://www.sapgenie.com/links/abap.htm
http://help.sap.com/saphelp_nw04/helpdata/en/c9/5472fc787f11d194c90000e8353423/frameset.htm
You can also check the transaction ABAPDOCU which gives you lot of sample programs.
Also you can see the below examples...
Go to se38 and give demodynpro and press F4.
YOu will get a list of demo module pool programs.
One more T-Code is ABAPDOCU.
YOu can find more examples there.
See the prgrams:
DEMO_DYNPRO_TABLE_CONTROL_1 Table Control with LOOP Statement
DEMO_DYNPRO_TABLE_CONTROL_2 Table Control with LOOP AT ITAB
10-22-2007 12:53 PM
hi anushree,
hereis the sample program where screen 500 asks for employee id and based on that employye address will be displayed in the screen 501.
Screen 500 contains 2 buttons.
1) submit : Its Function code is SUBMIT. Its takes us to screen 501.
2) Logout : Its Function code is LOGOUT. Its leaves the program.
Screen 501 contains 1 button whose Function code is OK which takes back to first screen 500.
data : t_emp type standard table of ydb_7760_empinfo,
wa_emp type ydb_7760_empinfo, "<b>Custom table -YDB_7760_empINFO</b>
ok_code like sy-ucomm,
w_eid type ydb_7760_empinfo-eid,
w_street type ydb_7760_empinfo-street,
w_city type ydb_7760_empinfo-city,
w_state type ydb_7760_empinfo-state,
w_country type ydb_7760_empinfo-country.
start-of-selection.
call screen 500.
&----
*& Module USER_COMMAND_0500 INPUT
&----
text
----
module user_command_0500 input.
case ok_code.
when 'SUBMIT'.
select single * from ydb_7760_empinfo into wa_emp where eid = w_eid.
w_street = wa_emp-street.
w_city = wa_emp-city.
w_state = wa_emp-state.
w_country = wa_emp-country.
call screen 501 starting at 60 5.
when 'LOGOUT'.
leave program.
endcase.
endmodule. " USER_COMMAND_0500 INPUT
&----
*& Module STATUS_0501 OUTPUT
&----
text
----
module status_0501 output.
set pf-status 'ADDR'. " GUI Status of Screen 501.
set titlebar '001'. " Title for screen 501.
endmodule. " STATUS_0501 OUTPUT
&----
*& Module USER_COMMAND_0501 INPUT
&----
text
----
module user_command_0501 input.
case ok_code.
when 'OK'.
call screen 500.
endcase.
endmodule. " USER_COMMAND_0501 INPUT
&----
*& Module STATUS_0500 OUTPUT
&----
text
----
module status_0500 output.
set pf-status 'EMP1'. "GUI Status of Screen 500.
set titlebar '004'. " Title for screen 500.
<b><REMOVED BY MODERATOR></b>
Harimanjesh AN
Message was edited by:
Alvaro Tejada Galindo
10-22-2007 1:09 PM
Hi,
PAI-process after input
PBO-process after output
in the PBO module you can set PF-STATUS(buttons in the application toolbar,standard tool bar etc...),set TITLEBAR of your choice,
you can even reset values since this PBO will be called before calling the respective screen.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
in the PAI module you can handle the event(say click of the button with fcode "ENTER")........
data: ok_code like sy-ucomm. //recommended to declare in top include
case ok_code.
when 'ENTER'.
//what is to be done when the button with f-code BUTTON is clicked...
endcase.
<b><REMOVED BY MODERATOR></b>
regards,
Vinod Samuel.
Message was edited by:
Alvaro Tejada Galindo