Skip to Content
0

Set Default value for a pick list

Jan 12 at 10:43 AM

70

avatar image
Former Member

Hi all , In WEB UI screen I have a a drop down list which have values as below keys

1 very high

3 high

5 medium

7 low

9 "blank line"

Attribute name is " PRIORITY" and is an attribute of BTADMINH.

currently when page loads the default value is Low, and i would like to change it to medium.

Your help will be much appreciated

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
avatar image
Former Member Jan 19 at 09:54 AM
0

Solution:

Courtesy :Ricky J

DATA: lr_entity TYPE REF TO cl_crm_bol_entity,

lr_priority TYPE REF TO cl_crm_bol_entity.

lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
lr_priority ?= lr_entity->get_related_entity( iv_relation_name = 'BTHeaderActivityExt' ).
lr_priority->set_property( iv_attr_name = 'PRIORITY' iv_value = 5 ).
Share
10 |10000 characters needed characters left characters exceeded
Varun Agarwal
Jan 12 at 11:32 AM
1

Hi Ligin,

Please follow the steps mentioned in https://blogs.sap.com/2015/04/22/default-values-in-ui-search/

Best Regards,

Varun Agarwal

Show 6 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Varun,

Thanks for the Reply.

In my case it not a Selection screen. its a main view where you enter details and save.

I wrote the below code in Do_Prepare_output.

lr_entity_s TYPE REF TO cl_crm_bol_entity,

lr_entity ?= me->typed_context->btadminh->collection_wrapper->if_bol_bo_col~get_current( ).
lr_entity->set_property( iv_attr_name = 'priority' iv_value = 5 ).

But it throws an error saying "

  • Entry parameter of method CL_CRM_BOL_ENTITY->SET_PROPERTY contains value PRIORITY, which is not allowed.

Any Clue?..

0

Hi Ligin,

Make sure that attribute name is in upper case.

DATA: lr_entity TYPE REF TO cl_crm_bol_entity.

lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
lr_entity->set_property( iv_attr_name = 'PRIORITY' iv_value = 5 ).

-Ricky.

0
Former Member

Hi Ricky,

I tried the Uppercase too. Still same error.

Ligin

0

Ligin,

If possible, can you please paste your code here?

-Ricky

0

Hi Ligin,

My bad.. the field PRIORITY will be a relation for BTAdminH. Try the below code.. it will work.

DATA: lr_entity TYPE REF TO cl_crm_bol_entity,
lr_priority TYPE REF TO cl_crm_bol_entity.

lr_entity ?= me->typed_context->btadminh->collection_wrapper->get_current( ).
lr_priority ?= lr_entity->get_related_entity( iv_relation_name = 'BTHeaderActivityExt' ).
lr_priority->set_property( iv_attr_name = 'PRIORITY' iv_value = 5 ).

-Ricky.

1
Former Member

Thank you very Much Ricky,

This worked Perfectly..

Regards | Ligin.

0