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 Program error

Former Member
0 Likes
875

Hi all,

I am trying to learn Module pool programing and I have created the following program :

&----


*& Module Pool ZRAJ_MODULE_05132010

*&

&----


*&

*&

&----


PROGRAM ZRAJ_MODULE_05132010.

DATA : KUNNR TYPE KUNNR,

NAME TYPE C,

CITY TYPE C,

ADDRESS TYPE C,

OK_CODE LIKE SY-UCOMM.

DATA : NAME1 TYPE NAME1,

ORT01 TYPE ORT01,

ADRNR TYPE ADRNR.

DATA : W_NAME1 TYPE NAME1,

W_ORT01 TYPE ORT01,

W_ADRNR TYPE ADRNR.

*CALL SCREEN 9000.

&----


*& Module USER_COMMAND_9000 INPUT

&----


  • text

----


MODULE USER_COMMAND_9000 INPUT.

IF OK_CODE EQ 'DISPLAY'.

LEAVE TO LIST-PROCESSING.

SELECT SINGLE NAME1 ORT01 ADRNR FROM KNA1 INTO (W_NAME1, W_ORT01, W_ADRNR) WHERE KUNNR = KUNNR.

IF NAME EQ 'X'.

WRITE : W_NAME1.

NAME1 = W_NAME1.

ENDIF.

IF CITY EQ 'X'.

WRITE : W_ORT01.

ORT01 = W_ORT01.

ENDIF.

IF ADDRESS EQ 'X'.

ADRNR = W_ADRNR.

WRITE : W_ADRNR.

ENDIF.

ELSEIF OK_CODE EQ 'CANCEL' OR OK_CODE EQ 'BACK'.

LEAVE PROGRAM.

ENDIF.

ENDMODULE. " USER_COMMAND_9000 INPUT

I have also created the screen where the user will enter the customer number and based on his selection the customer detail should be displayed, but when I put the customer number and clicked the check box to get his name and hit display,, I am not getting anything it's going back to the initial screen. Can you please help me on this.

Thank you.

Rajeev

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
845

Hi Rajeev,

I modified u r program. Please chek it and let me know whether your problem is solved or not.

&----


*& Module Pool ZRAJ_MODULE_05132010

*&

&----


*&

*&

&----


PROGRAM ZRAJ_MODULE_05132010.

DATA : KUNNR TYPE KUNNR,

NAME TYPE C,

CITY TYPE C,

ADDRESS TYPE C,

OK_CODE LIKE SY-UCOMM.

DATA : NAME1 TYPE NAME1,

ORT01 TYPE ORT01,

ADRNR TYPE ADRNR.

DATA : W_NAME1 TYPE NAME1,

W_ORT01 TYPE ORT01,

W_ADRNR TYPE ADRNR.

CALL SCREEN 9000.

&----


*& Module USER_COMMAND_9000 INPUT

&----


  • text

-


MODULE USER_COMMAND_9000 INPUT.

IF OK_CODE EQ 'DISPLAY'.

SELECT SINGLE NAME1 ORT01 ADRNR FROM KNA1 INTO (W_NAME1, W_ORT01, W_ADRNR) WHERE KUNNR = KUNNR.

IF NAME EQ 'X'.

NAME1 = W_NAME1.

ENDIF.

IF CITY EQ 'X'.

ORT01 = W_ORT01.

ENDIF.

IF ADDRESS EQ 'X'.

ADRNR = W_ADRNR.

ENDIF.

ELSEIF OK_CODE EQ 'CANCEL' OR OK_CODE EQ 'BACK'.

LEAVE PROGRAM.

ENDIF.

ENDMODULE. " USER_COMMAND_9000 INPUT

7 REPLIES 7
Read only

Former Member
0 Likes
846

Hi Rajeev,

I modified u r program. Please chek it and let me know whether your problem is solved or not.

&----


*& Module Pool ZRAJ_MODULE_05132010

*&

&----


*&

*&

&----


PROGRAM ZRAJ_MODULE_05132010.

DATA : KUNNR TYPE KUNNR,

NAME TYPE C,

CITY TYPE C,

ADDRESS TYPE C,

OK_CODE LIKE SY-UCOMM.

DATA : NAME1 TYPE NAME1,

ORT01 TYPE ORT01,

ADRNR TYPE ADRNR.

DATA : W_NAME1 TYPE NAME1,

W_ORT01 TYPE ORT01,

W_ADRNR TYPE ADRNR.

CALL SCREEN 9000.

&----


*& Module USER_COMMAND_9000 INPUT

&----


  • text

-


MODULE USER_COMMAND_9000 INPUT.

IF OK_CODE EQ 'DISPLAY'.

SELECT SINGLE NAME1 ORT01 ADRNR FROM KNA1 INTO (W_NAME1, W_ORT01, W_ADRNR) WHERE KUNNR = KUNNR.

IF NAME EQ 'X'.

NAME1 = W_NAME1.

ENDIF.

IF CITY EQ 'X'.

ORT01 = W_ORT01.

ENDIF.

IF ADDRESS EQ 'X'.

ADRNR = W_ADRNR.

ENDIF.

ELSEIF OK_CODE EQ 'CANCEL' OR OK_CODE EQ 'BACK'.

LEAVE PROGRAM.

ENDIF.

ENDMODULE. " USER_COMMAND_9000 INPUT

Read only

0 Likes
845

Hi Subas,

Thanks for the reply, I tried commenting out the statement call transaction 9000 but I am getting the following error on doing that "Statement is not accessible"

Please advise.

Read only

0 Likes
845

Hi Rajeev,

I am not sure about your program type . I think from your error

it is Type 'M'.

we cant use call screen statement in the report but

we can use it in MODULEs and FORMs.

So, you can execute it by using transaction

so If it is first screen make it in screen number 9000 when you are

creating transaction.

otherwise call it in PAI of the first screen (Whatever Mentioned in Creation of transaction)

Regards,

Raghava Channooru.

Read only

0 Likes
845

Hi Raghava,

I created a tcode and got rid of the error that I was getting earlier, but when I tried running the tcode I am not getting anything. For example when check Name and hit display nothing is showing up, then I tried to debug it and found that even though my selecting the push button for 'Display' but in the code OK_CODE is coming out to be blank and hence it's skipping the select statement.

Please advise.

Read only

0 Likes
845

Hi Rajeev,

Did you Check OK_CODE in the Screen Attributes of 9000? if not, check it.

if You are already Checked then try,

I think ok_code is in Small Letter(Display), case must be same when you are using If statement

try by changing Function code into all Capitals(DISPLAY).

Regarding,

Raghava Channooru

Read only

0 Likes
845

Hi Raghav,

i have added the OK_CODE in the Element list of the screen and also checked that in the code it's in the upper case everywhere but still I am not getting the output. I just debugged and found that OK_CODE has a value of 'H' when I hit the display button.

Edited by: Rajeev Gupta on May 14, 2010 4:16 PM

Read only

rthoodi
Active Participant
0 Likes
845

Try with event START-OF_SELECTION just before the call screen.

Thanks

RK