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 with Selection Screen

Former Member
0 Likes
1,233

I have a module pool in which I've created a sub screen to accommodate select-options.

SELECTION-SCREEN BEGIN OF SCREEN 1010 AS SUBSCREEN.

select-options: r_matnr for mara-matnr.

selection-screen end of screen 1010.


I've put this selection screen in an include of the module pool.


Now I can't seem to see my variable, r_matnr, in the program. How to I pass the value to the program and what have I done wrong. Perhaps where I placed the selection-screen.


Any help would be appreciated.


PS... I can see my screen but when I put the debug on, no value is in r_matnr.


Thanks Marianne

4 REPLIES 4
Read only

former_member196651
Contributor
0 Likes
1,138

Hi Mariane,

Placing the selection screen declarations in an include does not make any issues. Can you please check your code. For your reference, I am placing a simple piece of code, in which I am also calling a selection screen from within a module pool and displaying the output of the select options. Execute this code and check what is the difference between your code and this.

REPORT zabi_test04.

INCLUDE zabi_test04_i001.

INCLUDE zabi_test04_i002.

START-OF-SELECTION.

   CALL SCREEN 9000.

*&---------------------------------------------------------------------*

*&      Module  STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE status_9000 OUTPUT.

   SET PF-STATUS 'STAT9000'.

   SET TITLEBAR 'TL1'.

ENDMODULE.                 " STATUS_9000  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_9000  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE user_command_9000 INPUT.

   save_ok = ok_code.

   CLEAR ok_code.

   CASE save_ok.

     WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

       LEAVE PROGRAM.

     WHEN '&SELECT'.

       lv_dynnr  = '1001'.

       CALL SCREEN 9001.

   ENDCASE.

ENDMODULE.                 " USER_COMMAND_9000  INPUT

*&---------------------------------------------------------------------*

*&      Module  STATUS_9001  OUTPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE status_9001 OUTPUT.

   SET PF-STATUS 'STAT9001'.

   SET TITLEBAR 'TL2'.

ENDMODULE.                 " STATUS_9001  OUTPUT

*&---------------------------------------------------------------------*

*&      Module  USER_COMMAND_9001  INPUT

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

MODULE user_command_9001 INPUT.

   save_ok = ok_code.

   CLEAR ok_code.

   CASE save_ok.

     WHEN 'BACK' OR 'EXIT' OR 'CANCEL'.

       LEAVE TO SCREEN 0.

     WHEN '&EXECUTE'.

       WRITE s_matnr-low.

       LEAVE TO  LIST-PROCESSING.

   ENDCASE.

ENDMODULE.                 " USER_COMMAND_9001  INPUT


*&---------------------------------------------------------------------*

*&  Include           ZABI_TEST04_I001

*&---------------------------------------------------------------------*

TABLES : mara.

DATA : ok_code    TYPE sy-ucomm,

        save_ok    TYPE sy-ucomm,

        lv_dynnr   TYPE sy-dynnr VALUE '1001'.


*&---------------------------------------------------------------------*

*&  Include           ZABI_TEST04_I002

*&---------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF SCREEN 1001 AS SUBSCREEN.

*PARAMETERS p_werks  TYPE t001w-werks.

SELECT-OPTIONS s_matnr FOR mara-matnr.

SELECTION-SCREEN END OF SCREEN 1001.


Regards,

Abijith

Read only

srikanth_d4
Participant
0 Likes
1,138

Hello,

It will be automatically accessible from your program.

once you include an include in a program all the variables in the include will be accessible in the main program.

Regards,

Srikanth

Read only

0 Likes
1,138

make the call subscreen statement in PAI then it'll available in your other module as well.

Read only

0 Likes
1,138

hi Atchison,

Try using this function module  DYNP_VALUES_READ .

Here u will get the internal table with parameter or select option value.

CALL FUNCTION 'DYNP_VALUES_READ'

     EXPORTING

       DYNAME     = SY-REPID

       DYNUMB     = SY-DYNNR

       REQUEST    = 'A'

     TABLES

       DYNPFIELDS = IT_DYPREAD.

   READ TABLE IT_DYPREAD INTO LS_DYPREAD WITH KEY

        FIELDNAME = 'P_MATNR' STEPL = LV_STEPL.

IF SY-SUBRC IS INITIAL.

    P_MATNR = LS_DYPREAD-FIELDVALUE.

   ENDIF.


I had similar problem for report with includes. So tried this ,it worked out.


Check it may be the same issue.