cancel
Showing results for 
Search instead for 
Did you mean: 

caluculated field using aet.

Former Member
0 Kudos

Hi ,

using caluculated field ,can i add all the items (column) and display the result?

Thanks,

Anitha

Accepted Solutions (1)

Accepted Solutions (1)

AnupDDesai
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Can you refer to link

Hopet this helps.

Regards,

Anup

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Anitha

Yes using calculated field you can, but the best approach is (Assuming that) result is not going to be stored in database, and it will be calculated during runtime for this create one value node which holds the result value and fill this result value with all the colums sum and display result on screen.

Thanks & Regards

Raj

Former Member
0 Kudos

Thaks anup and raj ,

@anup :

in a table view i have the coloumn sales ,i need to sum up these items and auto populate in a custom field total sales.

I should redefine do_prpare_output.

data: sum type crmt_currency.

sum = 0.

what is lr_partner ?= and lr_points...

what exactly these are refering.

Please explain the concept.

@raj ,

when i define a field as caluculated ,it asks for the xepression ,

so how should i define in the field,

the column name sale ?

i should add the items of the column sale.

.

Former Member
0 Kudos

Hi Anitha,

The below code can be used for calculating the total.

lr_entity = lr_iterator->get_first( ).

while lr_entity is bound.
 
v_sum = lr_entity->get_property_as_string( 'Attribute NAME' ).

v_total = v_total + v_sum.

clear v_sum.

clear lr_entity( ).

lr_entity = lr_iterator->get_next( ).

endwhile.

Take v_total and populate your custom field using SET_PROPERTY.

Regards,

Lakshmi.Y

Former Member
0 Kudos

In do_prepare_output_method.

Please write the following code.


data: 
lr_entity    type ref to cl_crm_bol_entity,
coll_wrapper type ref to cl_bsp_wd_collection_wrapper,

total_sales type String,
sales       type string.

coll_wrapper ?= me->typed_context->yourtablenode->get_collection_wrapper( ).
lr_entity = coll_wrapper->get_first( ).

while lr_entity is bound.

sales = lr_enity->get_property_as_string( 'SALES' ).
total_sales = total_sales + sales.
clear sales.

lr_entity = coll_wrapper->get_next( ).

endwhile.

clear lr_entity.
* set total_sales to cutom field 
lr_entity = me->typed_context->Yournodename->collection_wrapper->get_current( ).
lr_entity->set_peroperty(
   iv_attr_name = 'TOTAL_SALES' 
   iv_value = total_sales ).