‎2007 Jan 24 7:45 AM
Hi,
I am new to module programming,
My req are - I have 4 input fields and button in my first screen(1000)
After user enters these values then I have to validate this values in the database and then
I need to update 1 field value in the database. After updating I need to display the results in second screen (2000).
Can any one please let me know what is the process in PBO and PAI modules.
How to write code .
1. where to validate field values
2. where to write code for updating database.
3. where to write code for displaying success/failure message in second screen(2000)
4. where to write declarations.
Thanks a lot for ur time .
I highly appreciate ur help.
Venkat.
‎2007 Jan 24 7:56 AM
Hello
Check this out:
************************************************************************
INCLUDES *
************************************************************************
INCLUDE ZIMMFORM001_TOP.
INCLUDE ZIMMFORM001_PBO.
INCLUDE ZIMMFORM001_PAI.
************************************************************************
Main Process
************************************************************************
START-OF-SELECTION.
CALL SCREEN 100. -> double click
END-OF-SELECTION.
***********************
Uncomment the following:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100. -> double click
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100. -> double click
&----
*
*& Include ZIMMFORM001_TOP
&----
************************************************************************
Global Definitions *
************************************************************************
"Your definitions
&----
*& Include ZIMMFORM005_PBO
&----
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MEN'. -> double click -> CREATE SCREEN STATUS 'EXE' AND 'BACK'
SET TITLEBAR 'ZTIT'. -> double click
INITIATE WHATEVER YOU NEED
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Include ZIMMFORM001_PAI
&----
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
INSIDE THE CASE YOU CAN VALIDATE.WHEN 'EXE' IS SELECTED FOR EXAMPLE.
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXE'.
PERFORM validate_form.
PERFORM save_form_to_db.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Hope this helps, dont forget to reward
GABRIEL
Message was edited by:
Gabriel Fernando Pulido V.
‎2007 Jan 24 7:51 AM
declare data as you are doing for any other program.
after that use call screen 2000.
then define the PBO of the screen 1000.
in PAI you have to validate ,update and call the 2000 screen.
for different buttons you have to assign different fncode and do appropriate.
suppose you have two three buttons save,next,exit.
save will save data.
next will call 2000 screen and exit will come out of the screen.
just code in the module of PAI.
module m1 input.
<validate your data>
case okcode.
when 'SAVE'.
save data in database.
when 'NEXT'.
call screen 2000.
when 'EXIT".
leave program.
endcase.
like that
endmodule.
for screen 2000 also you have to define PBO and PAI.
regards
shiba dutta
‎2007 Jan 24 7:52 AM
hi venkat,
all the validation code is written in PBO module.
all the data updations are done in PAI module.
data declarations and calling second screen is also done in PAI module.
if helpful dont forget to award some points.
‎2007 Jan 24 7:56 AM
Hello
Check this out:
************************************************************************
INCLUDES *
************************************************************************
INCLUDE ZIMMFORM001_TOP.
INCLUDE ZIMMFORM001_PBO.
INCLUDE ZIMMFORM001_PAI.
************************************************************************
Main Process
************************************************************************
START-OF-SELECTION.
CALL SCREEN 100. -> double click
END-OF-SELECTION.
***********************
Uncomment the following:
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100. -> double click
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100. -> double click
&----
*
*& Include ZIMMFORM001_TOP
&----
************************************************************************
Global Definitions *
************************************************************************
"Your definitions
&----
*& Include ZIMMFORM005_PBO
&----
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MEN'. -> double click -> CREATE SCREEN STATUS 'EXE' AND 'BACK'
SET TITLEBAR 'ZTIT'. -> double click
INITIATE WHATEVER YOU NEED
ENDMODULE. " STATUS_0100 OUTPUT
&----
*& Include ZIMMFORM001_PAI
&----
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
INSIDE THE CASE YOU CAN VALIDATE.WHEN 'EXE' IS SELECTED FOR EXAMPLE.
MODULE user_command_0100 INPUT.
CASE sy-ucomm.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
WHEN 'EXE'.
PERFORM validate_form.
PERFORM save_form_to_db.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
Hope this helps, dont forget to reward
GABRIEL
Message was edited by:
Gabriel Fernando Pulido V.
‎2007 Jan 24 8:00 AM
hi,
When the screen mask is displayed by the SAPgui, two events are triggered:
Before the screen is displayed, the Process Before Output (PBO) event is processed. When the
user interacts with the screen, the Process After Input (PAI) event is processed.
write the declarations in top include
write the validations and updating in PAI
weite th msg in the PBO of the screen 2000
‎2007 Jan 24 9:07 AM
Hi all,
Thanks for all ur answers,
but I not able to continue ....
I put my code like this ...
in PBO
MODULE STATUS_1000 OUTPUT.
SET PF-STATUS 'STATUS_1000'.
SET TITLEBAR 'ZTIT'.
ENDMODULE. " STATUS_1000 OUTPUT
and in PAI
IF SY-UCOMM = 'SUB'.
PERFORM VALIDATE
PERFORM UPDATE
PERFORM MESSAGE
...but when I check in debug mode, it is even comming to PAI code. not able to find whats wrong .. some one can help me...
thanks a lot.
‎2007 Jan 24 9:19 AM
in screen flow logic>
PROCESS BEFORE OUTPUT.
module m1.
PROCESS AFTER INPUT.
module m2.
in abap code.
module m1 output.
set pf-status 'ZSPD'.
endmodule.
module m2 input.
<validation>
if zzmara-matnr = ''.
message e001(zspd).
endif.
case okcode.
when 'SAVE'.
<update dbtab>
endcase.
endmodule.
in screen element tab at the last line you have to type okcode you can see it will be blank just type okcode (type will be ok there).
in your abap you have to declare the same fields like screen field and okvcode also .
data : okcode like sy-ucomm.
regards
shiba dutta
‎2007 Jan 24 8:06 AM
Hi,
(Usually screen 1000 is meant for selection screen. So try to avoid using screen 1000.)
No code sequence as follows:
step1: in PBO 0f 1000 you just output GUI status & Title.
Step 2 : in PAI of 1000 write the code to handle the push button once the user enters.
Step3: in PAI after step 2 (for screen 1000) write chain and endchain and inside it wite a module to check the values against the database field.
Step4: You don't need another screen to dispaly S/E messages.
This is automatically dispalyed, if you use Message statement.
Please feel free to revert in case any help needed on coding.
Points are welcome if this is valid for you!!
-B S B