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: 

restricitng the selection

Former Member
0 Kudos

hi folks,

I have a question in the use of 'parameters' syntax for the selection screen.

parameters: adpcc like z5uff-adpcc obligatory.

and I need to have only 4 values in the option 'A1' ,'A2','A3' and 'A4'. By default that field has several values from the drop down list.

I need to restrict it to these four valuesout of that drop down list.

How can I do that?

Thanks in advance

Santhosh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Create a Custom data element and domain and assign all those 4 values at the domain level under value tab.

Then use the custom element with the parameter.

parameters: adpcc type <CUSTOM ELEMENT> obligatory.

Now if you press drop down you will get only 4 values which you have mentioned at domain level.

Regards

Aman

8 REPLIES 8

rahulkavuri
Active Contributor
0 Kudos

use the views in SE11

and also check this forum

<b>Refer this one too, this one exactly satisifies</b>

Former Member
0 Kudos

hii

u can take help of matchcode and

AT SELECTION-SCREEN ON VALUE-REQUEST

hope this helps

thanks& regards

Naresh

suresh_datti
Active Contributor
0 Kudos

You can use the AT SELECTION-SCREEN ON VALUE-REQUEST event & put your validation there..

Regards,

Suresh Datti

Former Member
0 Kudos

Create a Custom data element and domain and assign all those 4 values at the domain level under value tab.

Then use the custom element with the parameter.

parameters: adpcc type <CUSTOM ELEMENT> obligatory.

Now if you press drop down you will get only 4 values which you have mentioned at domain level.

Regards

Aman

Former Member
0 Kudos

Hi vinu,

LIST BOX in SELECTION SCREEN

List Box is created in selection screen using PARAMETERS statement

with AS LISTBOX addition other attributes like VISIBLE LENGTH (width of listbox)

can be specified with the declaration.

PARAMETERS name(n) AS LISTBOX VISIBLE LENGTH n.

Here n is an integer and name is the name of parameter.

To populate the value list we use the FM VRM_SET_VALUES and the

selection screen event AT SELECTION-SCREEN OUTPUT is used to write the code to fill it.

VRM_SET_VALUES

The function module VRM_SET_VALUES is used to fill the value list associated with a List Box .This FM uses types which are declared in type group VRM. So

we should declare TYPE-POOLS VRM before using this FM.

Some important types declared in the VRM type group are

VRM_ID

It refers to the name of the input/output field associated with list box

VRM_VALUES

It refers to the internal table consisting of two fields TEXT(80C) and KEY(40)C

that will be used to create the list values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

ID = name of screen element ,it is of TYPE VRM_ID

VALUES = internal table containing values,of TYPE VRM_VALUES

LIST BOX with value list from input help

In this example the screen element attribute value list is set to blank as such the value list will be filled with the 1st column of the input help,We use PROCESS ON VALUE-REQUEST event to pass the value list to the listbox.In the MODULE call used to fill the value list we can use FM like F4IF_INT_TABLE_VALUE_REQUEST to create input help as explained in the input help.The value of first column will be shown in the field when selected.

PROCESS ON VALUE-REQUEST

FIELD list MODULE fill_list_100

FIELD list MODULE fill_list_100 INPUT

SELECT f1 f2 FROM table INTO int

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'input/output screen field'

value_org = 'S'

TABLES

value_tab = itab "it contains 2 fields that will be shown in the list box

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

IF sy-subrc <> 0.

...

ENDIF.

ENDMODULE.

VALUE LIST CREATED IN PBO

In this method we set the value list attribute to 'A'.The value list will be filled in the PBO by using FM VRM_SET_VALUES .

TYPE-POOLS : VRM

DATA : field_id TYPE VRM_ID ,

values TYPE VRM_VALUES,

value LIKE LINE OF values.

PROCESS BEFORE OUTPUT

MODULE list_fill_100

MODULE list_fill_100 OUTPUT

SELECT f1 f2 f3 FROM tab WHERE condition.

value-KEY = f1.

value-TEXT = f2

APPEND value TO VALUES

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'i/o screen field'

values = values.

ENDMODULE.

LIST BOX with Selection Screen

For this the FM VRM_SET_VALUES is used to fill the value table and is passed to the parameter created with TYPE LISTBOX in the selection screen event

AT SELECTION-SCREEN.

PROGRAM zlist

TYPE-POOLS : VRM.

DATA: param TYPE vrm_id,

values TYPE vrm_values,

value LIKE LINE OF values.

PARAMETERS: p_name(10) AS LISTBOX VISIBLE LENGTH 10.

AT SELECTION-SCREEN OUTPUT.

param = 'P_NAME'.

value-key = '1'.

value-text = 'JOHN'.

APPEND value TO values.

value-key = '2'.

value-text = 'PETER'.

APPEND value TO values.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = param

values = values.

award with points if helpful.

regards,

keerthi.

Former Member
0 Kudos

Hi Vinu,

I have answered this question before...

Please have a look at

In your case,

data: itab like table of z5uff-adpcc,

wa_itab like line of itab.

wa_itab = 'A1'.

append wa_itab to itab.

wa_itab = 'A2'.

append wa_itab to itab.

wa_itab = 'A3'.

append wa_itab to itab.

wa_itab = 'A4'.

append wa_itab to itab.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = adpcc

values = itab.

Hope that helps.

Regards,

Tanveer.

<b>Please mark helpful answers</b>

0 Kudos

Thanks a lot for everyone guys. I shall ward the points accordingly.

Vinu

Former Member
0 Kudos

Hi,

or you can provide a DROP DOWN LIST for this parameter instead of asking user to enter the value.

i mean you will code such a way that user can see only the given 4/5 values & can select among one.

check the below link of how to do DROP DOWN LIST BOX, as this way we can avoid creating of another domain for this particular purpose. check this out.

regards

srikanth