on 06-02-2011 12:24 PM
Hai All,
I have calculated total amount in an alv table and I want to assign that total value to an attribute in context.
lv_aggr_rule will hold the total amount is of below type..
lv_aggr_rule type ref to cl_salv_wd_aggr_rule
Claimed amount is my attribute of type PAD_AMT7S..
I have to set this value lv_aggr_rule to the attribute Claimed amount using set attribute.
Is it possible??? Am getting type conflict error
lv_aggr_rule can be converted into the respective data type.
How can i convet this data type????
Pls help.
Thanks in Advance,
Nalla.B
Hi,
declare another variable in type of PAD_AMT7S,
data : lv_variablename type pad_amt7s.
and write query like move v_aggr_rule to lv_variablename.
and pass lv_variable name in set attribute pass
Regards,
Srinivasan.R
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It is not possible to set a class reference to any attribute which is of amount type.
lv_aggr_rule is refering to a class cl_salv_wd_aggr_rule.
All you can get from this class is the aggregation type by using its methods.
Maybe you can let us know the code you have written to get the total amount and also the details of the data type PAD_AMT7S.
Regards
Dolly
Hai Dolly,
I have used this coding to calculate the total value in ALV table.
" Total calculation
data: lr_comp_alv type ref to if_wd_component_usage,
lr_comp_if_alv type ref to iwci_salv_wd_table,
lr_config type ref to cl_salv_wd_config_table.
data: lv_totalamount type PAD_AMT7S.
"data lr_config type ref to cl_salv_wd_config_table.
"data: lr_column_settings type ref to if_salv_wd_column_settings,
" data: lr_column type ref to cl_salv_wd_column.
data: lr_column_header type ref to cl_salv_wd_column_header.
data : lt_column type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref.
data: lr_field_amnt type ref to cl_salv_wd_field.
data: lv_aggr_rule type ref to cl_salv_wd_aggr_rule.
data: wv_aggr_rule type p decimals 2.
"PAD_AMT7S
data: lr_sort_rule type ref to cl_salv_wd_sort_rule.
data fs_bill_detail like line of lt_bill_detail.
*... ALV Component Usage
lr_comp_alv = wd_this->wd_cpuse_alv( ).
if lr_comp_alv->has_active_component( ) is initial.
lr_comp_alv->create_component( ).
endif.
lr_comp_if_alv = wd_this->wd_cpifc_alv( ).
*... Configure ALV
lr_config = lr_comp_if_alv->get_model( ).
call method lr_config->if_salv_wd_table_settings~set_selection_mode
exporting
value = cl_wd_table=>e_selection_mode-multi_no_lead.
To get the dropdowns displayed you need to set the table to editable by using below statement
lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).
"display columns in correct order
lr_column_settings ?= lr_config.
lt_column = lr_column_settings->get_columns( ).
loop at lt_column into ls_column.
case ls_column-id.
when 'AMOUNT'.
aggregate field
call method lr_config->if_salv_wd_field_settings~get_field
exporting
fieldname = 'AMOUNT'
receiving
value = lr_field_amnt .
create aggregate rule as total
call method lr_field_amnt->if_salv_wd_aggr~create_aggr_rule
exporting
aggregation_type = if_salv_wd_c_aggregation=>aggrtype_total
receiving
value = lv_aggr_rule.
endcase.
endloop.
This is what i did to assign that vale to my context attribute.
lo_el_context->set_attribute(
name = `CLAIMED_AMNT` " attribute name in context
value = lv_aggr_rule).
I also tried with some assigning this lv_aggr_rule to some other variable. and assigned this to the value in set attribute.
Pls give some suggestions...
Thanks in Advance,
Nalla.B
Hi ,
I tried working on it.As per my finding, aggregations are for the summary lines.You cannot assign the aggregated value to some other field.
lv_aggr_rule is refering to a class cl_salv_wd_aggr_rule and there are no methods in the class cl_salv_wd_aggr_rule by which we can get the desired value.
And above all, you cannot copy a class reference into any variable of type amount.
A class reference can be copied to a variable of the type reference only.
Regards,
Dolly
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.