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: 

Multiple Select option in Module pool

Former Member
0 Kudos

Hi,

I wanna add a field for 'Delivery number' in the screen of a mod pool prgm.I created a subscreen area in the main screen and did the coding needed.now the problem i am having is if i giv a single value in the from field or values in the 'From' and 'To' field its not taken to the program,i saw it while debugging. but if i enter the values in the multiple selection option its taken to the program.That means from screen its not going to the program where as from the multiple select option its taken to the program,What may be the propblem.

Regards in Advance,

Nitin

5 REPLIES 5

Former Member
0 Kudos

Hi,

Have you used the select-options in the subscreen or you have placed the multiple option manually?

Either way, please check the two methods, it may solve your problem.

Create a SELECT-OPTIONS in module pool screen using two methods as shown.

Method 1

a) Create a subscreen area in your screen layout where you want to create the select options.

b) In the top include of your module pool program declare a selection screen as a subscreen e.g.

SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.

select-options s_matnr for mara-matnr.

SELECTION-SCREEN END OF SCREEN.

c) In the PBO and PAI of the main screen where the select options needs to be created do a call subscreen of the above screen (100).

CALL SUBCREEN sub_area INCLUDING <program> <screen>

This CALL SUBSCREEN statement is necessary for transport of values between screen and program.

Note: All validations of the selection screen fields e.g. the s_matnr field created above should be done in selection screen events like AT SELECTION-SCREEN etc and not in PAI. These selection screen validations etc should be done in the top include only.

Method 2

a) Create 2 separate fields in your screen layout - one for the low value and one for the high value. Insert an icon beside the high value which will call the multiple selections popup screen on user command. Use function module COMPLEX_SELECTIONS_DIALOG to achieve this.

struc_tab_and_field-fieldname = con_cust. " 'KUNNR'

struc_tab_and_field-tablename = con_kna1. " 'KNA1'.

CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'

EXPORTING*

TITLE = ' '

text = g_titl1 " 'Customers'

tab_and_field = struc_tab_and_field

TABLES

RANGE = rng_kunnr

EXCEPTIONS

NO_RANGE_TAB = 1

CANCELLED = 2

INTERNAL_ERROR = 3

INVALID_FIELDNAME = 4

OTHERS = 5.

IF NOT rng_kunnr[] IS INITIAL.

Read the very first entry of the range table and pass it to dynpro screen field

READ TABLE rng_kunnr INDEX 1.

IF sy-subrc = 0.

g_cust = rng_kunnr-low.

ENDIF.

ENDIF.

You can use the return table rng_kunnr to populate your own internal range table with the values entered by the user. Basically here you are just simulating the work of a select-options parameter by module pool screen elements.

Regards

0 Kudos

THERE IS A SYNTAX ERROR:

IF WE WRITE THE FOLLOWING CODE IT DISPLAYS AN ERROR SAYING SCREEN REQUIERD AFTER SCREEN..

SELECTION-SCREEN BEGIN OF SCREEN 9000 AS SUBSCREEN.

SELECT-OPTIONS DATE FOR VBAK-ERDAT.

SELECTION-SCREEN END OF SCREEN .

THE CORRECT SYNTAX IS :

SELECTION-SCREEN BEGIN OF SCREEN 9000 AS SUBSCREEN.

SELECT-OPTIONS DATE FOR VBAK-ERDAT.

SELECTION-SCREEN END OF SCREEN 9000 -> THE SCREEN NUMBER WAS MISSING IN THE SYNTAX

0 Kudos

This Function Module worked very well for me in my Module Pool program - thank you very much.

0 Kudos

Hi Lohitha Modupalli,

The function module you mentioned is working fine for me. The only problem I am facing is, I am not abe to populate the values from the range table (at index 1) into my screen fields.

The piece of code, I have written is:

data: is_tab_field type RSTABFIELD.

ranges: r_range for zzfcoll-pisno.

is_tab_field-fieldname = 'PISNO'.

is_tab_Field-tablename = 'ZZFCOLL'.

CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG' 

EXPORTING

text                          =  'PIS Number'    

tab_and_field             = is_tab_field  

TABLES    

RANGE                     = r_range  

EXCEPTIONS    

NO_RANGE_TAB       = 1   

CANCELLED              = 2    

INTERNAL_ERROR     = 3    

INVALID_FIELDNAME  = 4   

OTHERS                       = 5.

if sy-subrc = 2.

     message 'The entered selections were not accepted' type 'S'.

elseif sy-subrc = 0.

     read table r_range  index 1.

          pisno_l = r_range-low.               "Screen Field

          pisno_h = r_range-high.           "Screen Field

endif.

IN the above code, I am getting values in R_range. But the assignment of these values to the screen doesnt seem to work (code in Bold font). Any ideas, what might have been missed?

Message was edited by: Mou Bhattacharya The problem is solved. Dont bother.

Former Member
0 Kudos

Hi Nitin,

In the single entry case just check for if the other field is empty and then assign the same value to the other field and your problem would be solved. I think in some part of your code you have used a select query which has to fetch values based on the 2 fields so when one of the field is empty it is not peaking any value.(SELECt query must be having a key word BETWEEN <field 1> and <filed 2> in your where condition.)

Hope this will surely solve your issue.

Cheers,

Suvendu