Application Development and Automation 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: 
Read only

module pool

Former Member
0 Likes
1,794

Hi guyz,

In a module pool program .....I create display button in layout....... created a function code......on which events do i need to declare this( PAI or PBO)....plz advise

thanks

sudheer

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,765

Hi,

You need to do the following things.

1)In the element list tab of the screen,declare ok_code.

2)In the top declaration,write this:

DATA:OK_CODE type sy-ucomm.

3)In the PAI of the screen,uncomment the user_command module and double-click on it and write the following code.

Case ok_code.

When 'SAVE'.

...logic

When 'BACK'.

...logic

When 'Display'.

...logic

endcase.

(Display is the function code created for the display button).

Regards,

Beejal

**Reward if helpful

20 REPLIES 20
Read only

Former Member
0 Likes
1,765

Hi,

For defining the function code of the button you do it in the PF-STATUS in the PBO of the screen.

For the functionality that the button has to do you define it in the PAI of the screen.

Hope this helps

Read only

Former Member
0 Likes
1,765

Hello,

U need to write the functionality of the Button in the PAI event.

Try like this.

Flow Logic.

PROCESS AFTER INPUT.

MODULE TEST.

In the report

MODULE TEST.

if sy-ucomm = 'DISP'.

.....

endif.

ENDMODULE TEST.

Regards,

Vasanth

Read only

learnsap
Active Participant
0 Likes
1,765

Hi Sudheer,

You have to write the code in the PAI module.

case sy-ucomm.

when <function-code>

-


-


when <function-code>

-


-


endcase.

Regards,

Ramesh

*Award the points if the reply is useful

Read only

Former Member
0 Likes
1,765

in PAI event flow logic u will be having a default module_usercommand

uncomment that & write ue coding there.

case save_ok

when 'Fcode'.

logic.

endcase.

Read only

Former Member
0 Likes
1,765

assign OKCODE as ok type in screen element tab.

now in your program

data : okcode like sy-ucomm.

in pai module

i.e.

module m1 input.

case okcode.

when 'FCOD'.

code here

endcase.

endmodule.

regards

shiba dutta

Read only

Former Member
0 Likes
1,765

Hi Sudheer,

Declare the PF status in PBO.

use the sy-ucomm to capture the funcion code in PAI

Regards,

Sunil

Read only

Former Member
0 Likes
1,765

Hi sudheer

Irrespective of all the things you can make it generic by saying

Actions will be done in PAI always...

Declaration and assignment can be done in PBO as it would get processed before displaying the screen everytime.

when you hit aby button on a screen PAI gets triggered and then if the same screen is displayed or any other screen is called then the PBO of that would trigger.

-

Santosh

Read only

Former Member
0 Likes
1,765

hi,

U have to declare in PAI since its process after input, which means it should be triggered after any input command by the user.

in ur case its on click of a button,

for eg:

case sy_ucomm.

when 'EXIT'. " exit is the func code for button, always in CAPS

leave program.

endcase.

Reward points if helpful.

Regards,

Bijal

Read only

Former Member
0 Likes
1,765

Hi,

The Function code will be triggered when the User click something in the screen, if the user clicks that Pushbutton, then this function code will be triggerd, and these will be trigger in the PAI event.

so in the PAI event ..

write a Module. and double click and create that Module, and write the code over there .. like

IF SY-UCOMM = 'FUN_CODE'

do this.

ENDIF.`

Read only

Former Member
0 Likes
1,766

Hi,

You need to do the following things.

1)In the element list tab of the screen,declare ok_code.

2)In the top declaration,write this:

DATA:OK_CODE type sy-ucomm.

3)In the PAI of the screen,uncomment the user_command module and double-click on it and write the following code.

Case ok_code.

When 'SAVE'.

...logic

When 'BACK'.

...logic

When 'Display'.

...logic

endcase.

(Display is the function code created for the display button).

Regards,

Beejal

**Reward if helpful

Read only

0 Likes
1,765

hello every1......

thanks for ur replies....... save is wrkin...........back is working ........but display is not wrkin......

code is

when 'display'

call function <function module name>

-


-


plz advise.....

regards

sudheer

Read only

0 Likes
1,765

check the fn code of display button and try to use capital letters in quote.

or go to debugmode and check when you are clicking the display button which okcode it is taking? and match with the when.

regards

shiba dutta

Read only

0 Likes
1,765

Hi all....

thanks for that........i did everythin but its not workin..........

sheeba......could u plz explain me how to debug module pool prgrm....

regrads

sudheer

Read only

0 Likes
1,765

hi every1 thaks for that........

i did everythin whateva u sed........but no change......

shiba ...........could u plz explain how to debug the module pool prgram.....

regards,

sudheer

Read only

0 Likes
1,765

Hi,

Type DISPLAY in Caps.

Go to the screen and check the attributes.Make sure if the Function code is in Caps.

Place a breakpoint on case ok_code and check which value it takes after clicking on the DISPLAY button.Also in the PBO,make sure to clear the ok_code.

To debug the code,place a breakpoint on case ok_code in user command(utilities->breakpoint->set).And then execute the program.Check the value of field ok_code which should ideally be DISPLAY.

Hope this helps.

Regards,

Beejal

Read only

0 Likes
1,765

Hi Sudheer,

When you are at the Screen put /h in the command field and then click on the Function key button.

you wil go to the PAI of the screen

check out the value of sy-ucomm . This will be the function code of your button.

so in the PAI of your screen give the value you see in sy-ucomm in CAPS and it should solve your problem.

Read only

Former Member
0 Likes
1,765

Hi Sudheer,

When u have placed the button in the layout . U need to give a valid function code for that

After that U need to trigger the same in the PAI module of the screen

Case ok_code.

When'Fcode'.

Action

Endcase.

Read only

Former Member
0 Likes
1,765

you have to write display in uppercase like "DISPLAY"

Read only

Former Member
0 Likes
1,765

Hi.......thanks everybody.....i gave u all, points......thanks again for everythin and spending time for me.Am closing this thread now.

regards,

sudheer

Read only

Former Member
0 Likes
1,765

define the FCODE in design time that is when you are designing the screen,and write a

CASE.

ENDCASE.

inside this check for the value of the ok_code (which is ur fcode)

when 'OK_CODE'.

WRITE LOGIC.

ITS REALLY EASY