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

List box question

Former Member
0 Likes
1,277

Hi Guys,

I have filled in my List box on Selection screen with few countries wich is not dynamic.

My question is I want to select data document type based on the country which the users selects on Selection screen.

Here is my code for list box:

sel-screen.

SELECTION-SCREEN COMMENT 1(20) text-001 FOR FIELD p_cntry.

at ss output.

wa_param = 'P_CNTRY'.

wa_value-key = '1'.

wa_value-text = 'GERMANY'.

APPEND wa_value TO wa_values.

wa_value-key = '2'.

wa_value-text = 'SPAIN'.

APPEND wa_value TO wa_values.

wa_value-key = '3'.

wa_value-text = 'ITALY'.

APPEND wa_value TO wa_values.

wa_value-key = '4'.

wa_value-text = 'DENMARK'.

APPEND wa_value TO wa_values.

wa_value-key = '5'.

wa_value-text = 'UK'.

APPEND wa_value TO wa_values.

SORT wa_values BY text.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = wa_param

values = wa_values.

Now I want to select data based on the country selected in my below select query.

start of selection.

SELECT

zoffrcont

doc_type

zoffrcontd

zpro_eff_date

zodeacqe

zprofile_id

zodeacqm

zodeacql

FROM zlimlgt_linkage

INTO TABLE i_link_maintain

WHERE doc_type = p_cntry " Here I will select the doctype based on select country in parameter.

AND zpro_eff_date >= sy-datum.

Below are the doc_type codes for the countries:

Germany = DECO01

Denmark = DKCO01

Spain = ESCO01

Italy = ITCO01

UK = GBCO01

Please help me out.

Thanks and Regards,

Kumar.

Hi Guys,

I have filled in my List box on Selection screen with few countries wich is not dynamic.

My question is I want to select data document type based on the country which the users selects on Selection screen.

Here is my code for list box:

sel-screen.

SELECTION-SCREEN COMMENT 1(20) text-001 FOR FIELD p_cntry.

at ss output.

wa_param = 'P_CNTRY'.

wa_value-key = '1'.

wa_value-text = 'GERMANY'.

APPEND wa_value TO wa_values.

wa_value-key = '2'.

wa_value-text = 'SPAIN'.

APPEND wa_value TO wa_values.

wa_value-key = '3'.

wa_value-text = 'ITALY'.

APPEND wa_value TO wa_values.

wa_value-key = '4'.

wa_value-text = 'DENMARK'.

APPEND wa_value TO wa_values.

wa_value-key = '5'.

wa_value-text = 'UK'.

APPEND wa_value TO wa_values.

SORT wa_values BY text.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = wa_param

values = wa_values.

Now I want to select data based on the country selected in my below select query.

start of selection.

SELECT

zoffrcont

doc_type

zoffrcontd

zpro_eff_date

zodeacqe

zprofile_id

zodeacqm

zodeacql

FROM zlimlgt_linkage

INTO TABLE i_link_maintain

WHERE doc_type = p_cntry " Here I will select the doctype based on select country in parameter.

AND zpro_eff_date >= sy-datum.

Below are the doc_type codes for the countries:

Germany = DECO01

Denmark = DKCO01

Spain = ESCO01

Italy = ITCO01

UK = GBCO01

Please help me out.

Thanks and Regards,

Kumar.

9 REPLIES 9
Read only

Former Member
0 Likes
1,247

Hi,

Instead of using the numbers 1 to 5 as the key values in the listbox, why not use the actual DOC_TYPE codes?

The listbox will still have meaning from the description (although you might want to consider mixed case, much easier to read) and the value in the key will match the table you're reading from.

Regards,

Nick

Read only

0 Likes
1,247

if i am not in mistake, you have to put the values DECO01 etc in the key of the LIST BOX, and declare this field like zlimlgt_linkage-doc_type, so you will have this value in the parameter when the user select in the list box.

Regards,

Javier Carrillo

Read only

Former Member
0 Likes
1,247

Hi,

Just had another idea. Assuming field zlimlgt_linkage-doc_type is defined with a value list or check table (it must be, right) then you don't need to fill the drop down manually, just use;


PARAMETERS: p_cntry like zlimlgt_linkage-doc_type AS LISTBOX VISIBLE LENGTH 20.

Then you don't need to hardcode anything.

Regards,

Nick

Read only

Former Member
0 Likes
1,247

Hi Nick,

the endusers want to know which country they want to get the data. There is no field in the tables which displays the countries.

Hope you would understand the query.

Cheers,

Kumar.

Read only

0 Likes
1,247

There is no check table assign to it zlimlgt_linkage.

I am giving an option for the enduser to select the country by name, hence I have hardcoded it.

How I want to know how to select the actual doc_type when the user selects the country in the selection.

I hope you are understanding my query.

Cheers,

Kumar.

Read only

0 Likes
1,247

Hi,

I thought I understood the query, but I don't understand your reply.

You have a table, zlimlgt_linkage which has a field doc_type, which can contain values DECO01, DKCO01, ESCO01 etc and each doc_type relates to a country. You want the user to select the name of the country from a listbox and then the program selects data from zlimlgt_linkage based on the doc_type associated with this country. That's as I understand your query.

Currently, you are building a listbox with the country names and a key of numbers 1 to 5. My suggestion (and that of Javier as well) is not to build your listbox with a key of numbers 1 to 5, but to use the actual doc_type values as the key. Then when the user selects a country you won't have a number between 1 and 5 in p_cntry, you'll have the doc_type that you want to select from table zlimlgt_linkage.

I can't comment on the table design, but the would be much more flexible if doc_type had a check table or value list defined.

Regards,

Nick

Read only

0 Likes
1,247

I have managed to code it.

Nevertheless, thanks for your replies.

Cheers,

Kumar.

Read only

Former Member
0 Likes
1,247

Solved myself.

Read only

0 Likes
1,247

Hi,

How did you solve it? If neither of my two suggestions were suitable, what was the answer?

Regards,

Nick