Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Create value Attribute


I have a requirement to calculate some values and display them in web ui.

I enhanced component BT_CUSTOMER_I and displayed fields which I am using for calculation and enhanced view CustomerI.

In order to calculate fields i created value attribute CALCVALUE under context node BTCUSTOMERI.

When I created the attribute CALCVALUE system automatically added methods:





I displayed the attribute in customer configuration.

In web ui I am getting exception for automatically generated code in GET_CALCVALUE


dref = current->get_property( 'CALCVALUE' )."#EC NOTEXT

CATCH cx_sy_ref_is_initial.



If I comment that part everything looks fine...

Can anyone tell me where should I set value for the attribute and how to do that?

Were I should do the calculation?

I tried in view class in DO_INIT_CONTEXT but I am getting null exception...

Thank you in advance


Hi Tanja,

I answered a similar question in below thread, it should resolve your query as well:

[New field Within Contact Search Result List|New field Within Contact Search Result List]

Basically, you need to populate the fields otherwise you will get exception or it will be displayed as not bound.

As your current bol entity that is BTCustomerI does not hold that attribute - it will give exception in the GET_<attr> code.

1. Either you need to do append structure to its corresponding structure : CRMST_CUSTOMERI_BTIL, then write code anywhere such as in DO_INIT_CONTEXT or DO_PREPARE_OUTPUT

you can set value in any method of IMPL class as suitable by calling code similar to below:

lr_entity ?=  typed_context->BTCUSTOMERI->collection_wrapper->get_current( ).
 lr_entity->set_property( iv_attr_name = '<name>' 
                                          value = ... ).

2. OR, simpler way (but not good on performance) -- in GET method where you are getting exception - let the code remain commented - write your logic here directly to read value you want, do calculations as required and then finally write:

VALUE = lv_calculated_value.

A little better way would be do all calculations in IMPL class method, then put value in new IMPL class attribute that you can create. then in get method put value:

VALUE = owner->class_attr_name.

IF this doesn't work - create static attribute in IMPL class, populate value in DO_INIT_CONTEXT, then write code in GET method:

VALUE = classname=>attr_name.

I hope it resolves the query.



0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question