cancel
Showing results for 
Search instead for 
Did you mean: 

OVS Help in Select Options-Text to be Shown and Code to be captured

Former Member
0 Kudos

Hello Experts,

I am using Select options in web dynpro abap.

On a particular View container i have added a selection field using ADD_SELECTION_FIELD which has an OVS help to it.

The selection field is of type CODE.

And on click of a button i am reading the select option fields using GET_RANGE_TABLE_OF_SEL_FIELD and assigining this to a

field symbol which inturn is being set to an attribute.

My requirement is to show the TEXT to the user and send the CODE to the method which is called

when the button is clicked and a table is populated.

Normally we can keep two attributes one for TEXT and the other for CODE but for Select options i am not very sure how this can be achieved.

Because in select options we are reading the values present on the select option field and there may be multiple values.

Please guide me through this.

Thanks in Advance,

Shravan

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi.,

Check this article : [How to Create OVS for Select Options|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/707f0d73-94f0-2d10-97a2-a3776e2118d8?quicklink=index&overridelayout=true]

hope this helps u.,

Thanks & Regards,

Kiran

Former Member
0 Kudos

Hi Kiran,

Thanks for your reply.

I have gone through this earlier.

But this doesnt explain hoe to show the user TEXT in the input field of select options and

send the CODE to the method.

This is what my requirement is.....

Thanks & Regards

Shravan

Former Member
0 Kudos

Hello all,

Could anyone please help me through this.....

Thanks

Shravan

Former Member
0 Kudos

Hi,

This will work if your text is always unique. I havent tried this, but you can try out:

1. Create a input field of Type Text field, rather than code

2. Create OVS based on text of values

3. Look up code for text and pass it to your method

What if more than one code has same text?

Nitesh

saravanan_narayanan
Active Contributor
0 Kudos

Hello Shravan,

This can be easily achieved if you convert the selection field to dropdown.

Create a valueset containing the list of valid values and then pass this to the ADD_SELECTION_FIELD method



"Creating valueset
DATA lt_valueset TYPE wdy_key_value_table.
DATA ls_valueset LIKE LINE OF lt_valueset.

  ls_valueset-key = 'EN'.
  ls_valueset-value = 'English'.
  APPEND ls_valueset TO lt_valueset.

"Creating selection field as Dropdown

lr_helper->add_selection_field( i_id = <ID>
                                                   it_result = lt_range
                                                   i_as_dropdown = abap_true
                                                  it_value_set = lt_valueset ).

BR, Saravanan

Former Member
0 Kudos

Hi Saravanan,

Looks like Dropdown can be achieved but my actual requirement is OVS.

For OVS can you help me achieving this...

Thanks & Regards,

Shravan

Former Member
0 Kudos

Hello Nitesh,

Thanks for your reply.

point 1 and 2 are clear.

What do you actually mean in Point 3.

Thanks

Shravan