Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

PBO and PAI

Former Member
0 Kudos

what is PBO and PAI in Dialog Progamming?

I know this definitions :

PBO (Process Before Output) – Before the screen is displayed, the PBO event is processed.

PAI (Process After Input) – When the user interacts with the screen, the PAI event is processed.

But I want clear meaning of this two.....Before screen means what and

when user interacts means what?

5 REPLIES 5

Former Member

hi,

<b>PROCESS BEFORE OUTPUT (PBO)</b> is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.

<b> PROCESS AFTER INPUT (PAI)</b> is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI processing, the system either calls the next screen or carries on processing at the point from which the screen was called.

follow this link for clear meaning of this two.....Before screen means what and

when user interacts...........

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9ce935c111d1829f0000e829fbfe/frameset.htm

regards,

Ashok Reddy

Former Member
0 Kudos

Screen Flow Logic

Screen flow logic contains the procedural part of a screen. You create it in the flow logic editor in the Screen Painter, which is very similar to the ABAP Editor. The language used to program screen flow logic has a similar syntax to ABAP, but is not part of ABAP itself. It is sometimes referred to as screen language.

Unlike ABAP programs, screen flow logic contains no explicit data declarations. You define screen fields by placing elements on the screen mask.

The screen flow logic is like an ABAP program in that it serves as a container for processing blocks. There are four event blocks, each of which is introduced with the screen keyword PROCESS:

PROCESS BEFORE OUTPUT.

...

PROCESS AFTER INPUT.

...

PROCESS ON HELP-REQUEST.

...

PROCESS ON VALUE-REQUEST.

As in ABAP, the event block is introduced by the corresponding keyword statement, and it concludes either when the next block is introduced, or at the end of the program. The first two statements are created automatically by the Screen Painter when you create a new screen. The corresponding events are triggered by the runtime environment:

· PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.

· PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI processing, the system either calls the next screen or carries on processing at the point from which the screen was called.

· PROCESS ON HELP-REQUEST (POH) and PROCESS ON VALUE-REQUEST (POV) are triggered when the user requests field help (F1) or possible values help (F4) respectively. You can program the appropriate coding in the corresponding event blocks. At the end of processing, the system carries on processing the current screen.

As is normal with events, you must only program event blocks for the events to which you want the flow logic to react. However, the screen flow logic must contain at least the two statements PROCESS BEFORE OUTPUT and PROCESS AFTER INPUT in the correct order.

Example of Flow Logic Example

The following example shows some use of screen flow logic:

*----

-


  • Sample Code

*----

-


*Processing Before Screen Output

PROCESS BEFORE OUTPUT.

MODULE INIT_FIELDS.

  • Self-programmed F1 Help

PROCESS ON HELP-REQUEST.

FIELD GSSG-BUKRG MODULE V-BUKRG.

  • Processing after user input

PROCESS AFTER INPUT.

  • Lock customer master record

CHAIN.

FIELD GSSG-KTNRG

MODULE ENQUEUE_CUSTOMER_MASTER.

  • Read customer master record

MODULE READ_CUSTOMER_MASTER.

  • Read business area

MODULE READ_GSSG.

ENDCHAIN.

  • Process function code

FIELD OK-CODE MODULE OKCODE ON INPUT.

________________________________________

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://www.sap-img.com/

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

http://www.geocities.com/ZSAPcHAT

http://www.allsaplinks.com/files/using_table_in_screen.pdf

regards,

srinivas

reward for useful answers*

Former Member
0 Kudos

Hi,

Heres some explanation..

PROCESS BEFORE OUTPUT (PBO) is automatically triggered after the PAI processing of the previous screen and before the current screen is displayed. You can program the PBO processing of the screen in this block. At the end of the PBO processing, the screen is displayed.

PROCESS AFTER INPUT (PAI) is triggered when the user chooses a function on the screen. You can program the PAI processing of the screen in this block. At the end of the PAI processing, the system either calls the next screen or carries on processing at the point from which the screen was called.

please check out the link below it will help you in understanding PBO and PAI asspects.

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2d67358411d1829f0000e829fbfe/content.htm

for PBO of the Selection Screen please check out the below link it will help you

http://help.sap.com/saphelp_nw04/helpdata/en/79/34a234d9b511d1950e0000e8353423/content.htm

FOR MORE INFORMATION ON PAI PLEASE CHECK OUT THE LINK BELOW IT WILL HELP YOU

http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbabfe35c111d1829f0000e829fbfe/content.htm

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://www.sap-img.com/

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

http://www.geocities.com/ZSAPcHAT

http://www.allsaplinks.com/files/using_table_in_screen.pdf

Regards

Former Member
0 Kudos

kuoli_jing
Explorer
0 Kudos

PBO => Process before output. PBO event triggers before the screen will displayed in the screen. So if you want any default values like Date you can put it in PBO. Itw works likes Initialization.

PAI => Process after input. PAI event triggers after the user interaction. If the user enters any values at the screen and then click any button means the PAI Event will triggered.