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: 

Dropdown list in dialog programming

Former Member
0 Kudos
2,256

Moved to correct forum by moderator. Subject amended. Please use meaningful subjects in future

Hi Experts,

How to get a drop down list in Dialog Programming. I need a drop down list for a field called country. Should it be done in Layout Editor or in the coding part. If at coding part can you please help me out with some pointers?

TIA

Edited by: Matt on Nov 16, 2008 4:11 PM

1 ACCEPTED SOLUTION

former_member1245113
Active Contributor
0 Kudos
578

HI,

try this out.

once you select country, based on country add the values to the dropdown list as you did earlier.

if you maintain the states for respective countries a select query will serve your purpose.

like this.

case country.

when 'INDIA'.

CALL FUNCTION VRM_SET_VALUES

....

when 'US'.

ENDCASE.

hope this will help you.

regards

Ramchander Rao.Krish

9 REPLIES 9

Former Member
578

Hi ,

The field should always be declared as a list box in the screen painter first...and then assign a function code to it since the code is trigerred only when the function code is identified.........

Filling the drop down..

(1) if the domain of the field has fixed values assigned to it and the field direcly refers to domain then the drop down list is automatically populated

(2) if the filed is to be populated with custom values then we use a function module

vrm_set_values

Check the program demo_dynpro_dropdown_listbox in se38 for a complete sap standard demo program and code

Hope it helps

Regards

Byju

0 Kudos
578

Hi Byju,

Thanks a lot for your prompt reply but am unable to find any options to declare my element as a list box. So how should i go about it. Kindly guide as i'm totally new to dialog programming.

I also have another qstn. I just used text boxes as of now to design my layout. When activated it shows me an error like

Input/output field "RP50M-SPRTX" not defined

What could be the issue and how can i go about in fixing it?

TIA.

Edited by: SAKKTHISS KUMAAR on Nov 15, 2008 8:55 AM

0 Kudos
578

Hi,

(a) Once we open the screen painter in the change mode..identify the field that needs to be displayed as a check box...double click on that field..a pop up comes..in that there is a field called "dropdown"(3rd or 4th)..select 'list box' ..then enter some text in "Fctcode" like ZDROP..save and activate..

Check the demo program to populate the field with data

(b) Any field that is used on the screen always needs to be defined in the program ...RP50M-SPRTX

Here structure RP50M is not declared in code and screen cannot map the field on the screen to the program whenever it runs

Use another name with same field structure like

data : wa_rp50m type rp50m in the code and use field wa_rp50m-sprtx in the screen .

and do the code accordingly to pass data to and from the field

Hope it helps

Regards

Byju

Former Member
0 Kudos
578

SELECTION-SCREEN BEGIN OF SCREEN 111 AS SUBSCREEN.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 5(11) text-012 FOR FIELD p_step1 MODIF ID st1.

PARAMETER: p_step1 TYPE c AS LISTBOX VISIBLE LENGTH 20

USER-COMMAND step1 OBLIGATORY MODIF ID st1.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 111.

DATA: name1 TYPE vrm_id,

list1 TYPE vrm_values,

value1 LIKE LINE OF list1.

IF list1[] IS INITIAL.

name1 = P_STEP1.

value1-key = 1.

value1-text = your text which you want to display in the list.

APPEND value1 TO list1.

value1-key = 2.

value1-text = your text which you want to display in the list.

APPEND value1 TO list1.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = name1

values = list1

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

ENDIF.

Former Member
0 Kudos
578

Please refer the below thread and change the code as required

0 Kudos
578

Hi Evryone,

Thanks for your courtesy and concern. I have two issues pending now.

1) I have a drop down for a field in my screen. Its a mandatory field and i have many other mandatory fields also. When i select a value from my drop down(mandatory) it gives me a msg Fill in all reqd fields and accepts the value at second time only.

2) Once my 1st drop down is selected i need my another field's drop down to change accordingly. I.E

If i select india as country in my 1st drop down list, then in my 2nd field i should get all states of india as drop down in the second field's list.

Any pointers wil be of great help.

TIA.

0 Kudos
578

Hi,

check these programs...

demo_dropdown_list_box
demo_dynpro_dropdown_listbox

former_member1245113
Active Contributor
0 Kudos
579

HI,

try this out.

once you select country, based on country add the values to the dropdown list as you did earlier.

if you maintain the states for respective countries a select query will serve your purpose.

like this.

case country.

when 'INDIA'.

CALL FUNCTION VRM_SET_VALUES

....

when 'US'.

ENDCASE.

hope this will help you.

regards

Ramchander Rao.Krish

rupali_bhalerao
Explorer
0 Kudos
578

Hi SAKKTHISS KUMAAR ,

u want dropdown list in u r dia;og programming.

the 'screen-painter Attribute' screen of input-output field after text

Dropdown option is their if u want dropdown select that option.

It will give u dropdown arrow in the input-output field.

that means u r dropdown list is selected.

eg.

airline code(in text) -


(i/o field) name is spfli-carrid

dropdown listbox with key

it eill show dropdown for carrid.