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: 

code in the module not triggered..

Former Member
0 Kudos
843

hi,

i have designed a screen with 2 radio buttons, aa and bb. its associated program is of Type M and named as

SAPMZXXXXX and screen number is 100.

i created 2 subscreens in the same program SAPMZXXXXX , number 101 and 102.

now by default the first subscreen 101 shud be displayed as the first radio button will be selected. this I achieve in

PBO of screen 100. I write a call subscreen. it is working fine.

Now to capture the user's click on second radio button and to call the second subscreen, i double clicked on the MODULE USER_COMMAND_0100 under PAI and created that module and included the code as follows:

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'RADIO'.

IF AA = 'X'.

CALL SUBSCREEN OPTIONS_SUBSCREEN INCLUDING 'SAPMZXXX' '0101'.

ELSEIF BB = 'X'.

CALL SUBSCREEN OPTIONS_SUBSCREEN INCLUDING 'SAPMZXXX' '0102'.

ENDIF.

ENDCASE.

also i created a top include in SE38 named MZXXXXX_TOP of type Include program and included the data declarations like

DATA: AA TYPE C,

BB TYPE C.

DATA: OK_CODE TYPE SY-UCOMM,

SAVE_OK TYPE SY-UCOMM.

and finally in the main screen program SAPMZXXXXX i included this top include. under that i cud see the module included as

INCLUDE MZXXXXX_USER_COMMANI02.

whats wrong ?? its not working !! am i missing any step ??

thks

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos
342
PROGRAM  zmodule.

DATA: a value 'X',
           b.
DATA: v_dynnr TYPE sy-dynnr value  '0200'.


*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  IF a = 'X'.
    v_dynnr = '0200'.
  ELSE.
    v_dynnr = '0300'.
  ENDIF.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Flow logic of Fist screen.

PROCESS BEFORE OUTPUT.

 MODULE STATUS_0100.
call subscreen sub including sy-repid v_dynnr.

*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

Regards

Vijay babu Dudla

17 REPLIES 17

former_member188685
Active Contributor
0 Kudos
343
PROGRAM  zmodule.

DATA: a value 'X',
           b.
DATA: v_dynnr TYPE sy-dynnr value  '0200'.


*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.

  IF a = 'X'.
    v_dynnr = '0200'.
  ELSE.
    v_dynnr = '0300'.
  ENDIF.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

Flow logic of Fist screen.

PROCESS BEFORE OUTPUT.

 MODULE STATUS_0100.
call subscreen sub including sy-repid v_dynnr.

*
PROCESS AFTER INPUT.
 MODULE USER_COMMAND_0100.

Regards

Vijay babu Dudla

0 Kudos
342

not working !! actually i dont understand the flow here !!

call subscreen under PBO will be triggered the first time and the first subscreen will be displayed.

now when the user chooses the second button, v_dynnr is set to the new subscreen number,but then where is call subscreen again trrigged for the new subscreen ? pl explain !! thks

0 Kudos
342

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

call subscreen sub including sy-repid v_dynnr.

*

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

By Default i am displaying the First screen.

When the user selects the second radiobutton then i am changing the screen number dynamically inside user command.

in PAI user_Command

if b = 'X'.

v_dynnr = '0300'.

endif.

now again it will go to screen 100 PBO, here the code will be executed.

call subscreen sub including sy-repid v_dynnr.  "now it is 300

0 Kudos
342

thanks vijay, so after evry user command control will go back to PBO ?

0 Kudos
342

so shud it be RADIO for all the three ?? or what ?? please explain. anything more to do ? If you set for one, it will be set for all.

I thought you set the function code to them...

And For every action it go to PAI, and then control back to PBO and displays the screen.

0 Kudos
342

I am sorry, i tried very hard...still the PAI is not triggered..

i assigned the function code as RADIO to all the 3 buttons!!

any other tips !!

0 Kudos
342

Hi,

There will be same Function code for all Radio buttons belongs to same Radio Group. Or you can say that we are assigning Function code to 'Radio Button Group'

Leave FctType blank.

I just gave a try and it worked.

Your OK_CODE will have Function code value. And your Radio button variable will have 'X' or SPACE based on selection.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'RADIO'.

IF AA = 'X'.

  • Your logic when AA Radio is selected

ELSEIF BB = 'X'.

    • Your logic when BB Radio is selected

ENDIF.

ENDCASE.

One more suggestion, instead of testing/debugging directly from Screen painter (SE51), Please created Z T-code and test it from there.

Regards

Nisarg

0 Kudos
342

It should work actually.

show me your Flow logic for the Main screen.

and corresponding module. May be your screen is not active . Check it and activate the screen.

Make sure you assign the function code to Radiobutton , other wise No action will be Triggered.

0 Kudos
342

thanks for all ur patience. Vijay find below my work, it is still not working !! PAI does not seem to be triggered..thanks

1. I have created a screen program named SAPMZXXXXX with screen number 100 and 3 subscreens 101, 102 and 103.

2. The radio buttons have the function code RADIO and function type is blank !!

3. a subscreen area named SUBSCREEN1 is created in screen 100.

4. the code in screen 100 is as follows:

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

call subscreen SUBSCREEN1 including 'SAPMZXXXXX' v_dynnr.

PROCESS AFTER INPUT.

MODULE USER_COMMAND_0100.

5.created one include MZXXXXX_TOP that holds the data declarations and included in module pool PROGRAM SAPMXXXXX.

DATA: AA TYPE C VALUE 'X',

BB TYPE C,

CC TYPE C.

DATA: OK_CODE TYPE SY-UCOMM,

SAVE_OK TYPE SY-UCOMM.

DATA: V_DYNNR TYPE SY-DYNNR VALUE '0101'.

6. MODULE USER_COMMAND_0100 INPUT.

SAVE_OK = OK_CODE.

CLEAR OK_CODE.

CASE SAVE_OK.

WHEN 'RADIO'.

IF AA = 'X'.

V_DYNNR = '0101'.

ELSEIF BB = 'X'.

V_DYNNR = '0102'.

ELSEIF CC = 'X'.

V_DYNNR = '0103'.

ENDIF.

WHEN 'EXIT'.

LEAVE PROGRAM.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

0 Kudos
342

Vijay, to add, when i select the second radio button, screen flickers for a moment and control again goes back to the first radio button. my screen is active !!

0 Kudos
342

PROCESS BEFORE OUTPUT.

MODULE STATUS_0100.

call subscreen SUBSCREEN1 including SY-REPID v_dynnr.

in PAI Module keep the break point.

and see what happenes.

0 Kudos
342

hi when i do that, and try to test the screen from se51, i get a popup initially which says

encountered the statement call subscreen subcreen1

and then 2 radio buttons that say

do not execute

execute with parameters

where i have two input boxes, one for sy-repid and another for v_dynnr.

i have set v_dynnr in the top include as

DATA: V_DYNNR TYPE SY-DYNNR VALUE '0101'.

also the PAI is not triggered !!

should the function type for the radio buttons be blank ??

also in the elements list of screen 100, i had included one ok_code. is it correct or not ??

whats wrong ??

0 Kudos
342

If you want to test it , You need to create the Tcode.

You are testing the Screen. But you should test the Program.

First create the Transaction code ,

and see/

I thought you are doing or testing it using the Transaction code.

If you are not created TCODE for the program create and Test it.

0 Kudos
342

Yes Vijay, that did solve the problem,,,thanks..

but now the new issue is when i select the second radio button, i am getting a runtime error that says system attempted to use the dynpro 0110 in the program but that dynpro does not exist !! actually i have my subscreens numbered 101, 102 and 103 !! also the code checks the same !!

i get this error in line number 50 of include SYSINI module name %_CTL_END !!

whats wrong ??

0 Kudos
342

sorry, my bad...i had the next screen set as 110 !! thanks to all for resolving this issue and staying with me for soooo long !! thank u.

Former Member
0 Kudos
342

Hi,

Put breakpoint and see if PAI event is getting triggered or not

Make sure you assign 'FctCode' (Function code) to radio button. Until you assign function code to Radio button it will not trigger PAI event.

Regards

Nisarg

0 Kudos
342

Yes Nisarg, u r right, i did not assign the function code to the radio buttons and also my PAI does not seem to trigger.

what shud be the value for the function code ? different for each radio button or what ??

in my code i check

CASE SAVE_OK.

WHEN 'RADIO'.

so shud it be RADIO for all the three ?? or what ?? please explain. anything more to do ? thanks