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 at selection screen

Former Member
0 Likes
1,201

Hi guys,

I have created report:

TYPE-POOLS: vrm.

DATA: name TYPE vrm_id,

lista TYPE vrm_values,

value LIKE LINE OF lista.

PARAMETERS: SVRHA(10) AS LISTBOX VISIBLE LENGTH 30.

AT SELECTION-SCREEN OUTPUT.

name = 'SVR'.

value-key = '1'.

value-text = 'Text 1'.

APPEND value TO lista.

value-key = '2'.

value-text = 'Text 2''.

APPEND value TO lista.

...3,4,5,6,7,8

value-key = '9'.

value-text = 'Text 9'.

APPEND value TO lista.

value-key = '10'.

value-text = 'Text 10'.

APPEND value TO lista.

value-key = '11'.

value-text = 'Text 11'.

APPEND value TO lista.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = name

values = lista.

START-OF-SELECTION.

IF........

WRITE: / 'Parameter:', SVR.

1. In display list on screen 'Text 10' and 'Text 11' come after 'Text 1', how can I put it in order after

'Text 9' ?

2. How I write conditions in start of selection, using value key or value text ?

Thanks,

Nihad

Edited by: nihad omerbegovic on Apr 13, 2009 3:28 PM

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,178

1) Use a leading zero for values that are 1-9.

value-key = '01'.
value-text = 'Text 1'.
APPEND value TO lista.
value-key = '02'.
value-text = 'Text 2''.
APPEND value TO lista.
...03,04,05,06,07,08
value-key = '09'.
value-text = 'Text 9'.
APPEND value TO lista.

2) the NAME field should hold the value of the parameter called SVRHA.

name = 'SVRHA'.

so when you want to write the value, just write out the SVRHA field.

Write:/ SVRHA.

This will hold the key value of the selected item in the listbox.

Regards,

Rich Heilman

Hi guys,

I have created report:

TYPE-POOLS: vrm.

DATA: name TYPE vrm_id,

lista TYPE vrm_values,

value LIKE LINE OF lista.

PARAMETERS: SVRHA(10) AS LISTBOX VISIBLE LENGTH 30.

AT SELECTION-SCREEN OUTPUT.

name = 'SVR'.

value-key = '1'.

value-text = 'Text 1'.

APPEND value TO lista.

value-key = '2'.

value-text = 'Text 2''.

APPEND value TO lista.

...3,4,5,6,7,8

value-key = '9'.

value-text = 'Text 9'.

APPEND value TO lista.

value-key = '10'.

value-text = 'Text 10'.

APPEND value TO lista.

value-key = '11'.

value-text = 'Text 11'.

APPEND value TO lista.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING id = name

values = lista.

START-OF-SELECTION.

IF........

WRITE: / 'Parameter:', SVR.

1. In display list on screen 'Text 10' and 'Text 11' come after 'Text 1', how can I put it in order after

'Text 9' ?

2. How I write conditions in start of selection, using value key or value text ?

Thanks,

Nihad

Edited by: nihad omerbegovic on Apr 13, 2009 3:28 PM

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,179

1) Use a leading zero for values that are 1-9.

value-key = '01'.
value-text = 'Text 1'.
APPEND value TO lista.
value-key = '02'.
value-text = 'Text 2''.
APPEND value TO lista.
...03,04,05,06,07,08
value-key = '09'.
value-text = 'Text 9'.
APPEND value TO lista.

2) the NAME field should hold the value of the parameter called SVRHA.

name = 'SVRHA'.

so when you want to write the value, just write out the SVRHA field.

Write:/ SVRHA.

This will hold the key value of the selected item in the listbox.

Regards,

Rich Heilman

Read only

0 Likes
1,178

Ok , I missed while typing it shoud be SVRHA not SVR, thanks. What about conditions? Is this ok for example:

data: begin of itab occurs 0,

field type c,

.........

end of itab.

IF SVRHA = '01'.

itab-field = 'Text 1'.

endif.

IF SVRHA = '02'.

itab-field = 'Text 2'.

endif.

etc.

Nihad

Read only

0 Likes
1,178

I would suggest using a CASE statement.

CASE SVRHA.
  when '01'.
     itab-field = 'Text 1'.
  when '02'.
    itab-field = 'Text 2'. 
ENDCASE.

Regards,

Rich Heilman

Read only

0 Likes
1,178

Hi Nihad,

Yes, You can simply check with SVRHA. It will hold the value whichever you selected in the screen.

And also, normally the sequence is defined by KEY value itself. When I try the same thing which you gave in the screen, I could see all the values in proper sequence.

Best Regards

Sitharamaraju

Read only

0 Likes
1,178

Hi guys, I have very strange situation. When I run transaction my listbox have these values:

01 Proba

02 Test

03 Izvodi

04 Kreni

when I enter any other field on screen and press enter I got these values in listbox:

01 Proba

01 Proba

02 Test

02 Test

03 Izvodi

03 Izvodi

04 Kreni

04 Kreni

if I press enter again I got new line of values in listbox and it looks like this:

01 Proba

01 Proba

01 Proba

02 Test

02 Test

02 Test

03 Izvodi

03 Izvodi

03 Izvodi

04 Kreni

04 Kreni

04 Kreni

Each press on enter adds new line in my listbox, What should I do, why is this happening?

Nihad

Read only

0 Likes
1,178

you need to refresh/clear the internal table before you populate the table. Because you are not using any clear it is adding the duplicates.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,178

Hello Nihad,

A bit of magic will do )

CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
      id     = name
      values = lista.

  REFRESH lista. "Ad this line

Try to figure out why this helped )

BR,

Suhas

Read only

0 Likes
1,178

I have done this with help of previous post, it's magic really

Thanks.

Nihad