Hello Experts,
We have a requirement to retract information from BPC to ECC, We are on BPC 10 sp17 patch 2. When implementing BADI to retract information to ECC works fine except when the currency has more than 2 decimal places.
Before the information is sent to ECC we run the std currency conversion, then the amount should be round.
To solve the requirement, we implemented BADI Write back according this guide:
After the implementation,
We replace the code for the code that sivakiran uppala suggest in the next post:
BADI for rounding decimal values in bpc 10
We set in the dimension for Account (CTAS_GTOS in our case) the property ROUND with the value = 2.
And alredy set the filters in the BADI:
We expect the currency converted to USD to round but the amounts won't,
What am I doing wrong.
Thank you in advance for the comments.
Regards.
P.S. The code We are using is next:
METHOD if_ujr_wb_pre_process~pre_process.
DATA: lv_environment_id TYPE uj_appset_id VALUE'NISSAN_PLANNING',
lv_application_id TYPE uj_appl_id VALUE'CARFLOW',
lt_dim_list TYPE uja_t_dim_list,
lo_appl_mgr TYPEREFTO if_uja_application_manager,
lo_query TYPEREFTO if_ujo_query,
lr_data TYPEREFTOdata,
a_account TYPEREFTOdata,
* a_time TYPE REF TO data,
* a_category TYPE REF TO data,
* a_signeddata TYPE REF TO data,
lt_message TYPE uj0_t_message,
ls_application TYPE uja_s_application,
ls_dimensions TYPE uja_s_dimension,
wa_account TYPE char32,
wa_time TYPE char32,
wa_category TYPE char32,
wa_signeddata TYPE p,
l_returnval type p,
wa_keyfigure TYPE p.
* ls_dimension type ujr_s_dim_handler.
DATA : iref TYPEREFTO cx_ujo_read,
temp TYPE string.
FIELD-SYMBOLS: <lt_query_result> TYPESTANDARDTABLE,
<ls_query> TYPEany,
* <fs_val> TYPE any,
<fs_val1> TYPEany,
<fs_val2> TYPEany,
<fs_val3> TYPEany,
* <fs_val4> TYPE any,
* <fs_val5> TYPE any,
* <fs_val6> TYPE any,
<ls_record> TYPEany,
<l_keyfigure> TYPEany.
*
*CREATE DATA a_account like line of ls_dimensions.
* assign ls_dimensions->* to <fs_val1>.
** CREATE DATA a_time like line of ls_dimensions.
* assign ls_dimensions->* to <fs_val2>.
** CREATE DATA a_category like line of ls_dimensions.
* assign ls_dimensions->* to <fs_val3>.
** CREATE DATA a_igneddata like line of ls_dimensions.
* assign ls_dimensions->* to <fs_val6>.
lo_appl_mgr = cl_uja_bpc_admin_factory=>get_application_manager(
i_appset_id = lv_environment_id
i_application_id = lv_application_id ).
CLEAR ls_application.
lo_appl_mgr->get(
EXPORTING
if_with_measures = abap_false " BPC: Generic indicator
if_summary = abap_false " BPC: Generic indicator
IMPORTING
es_application = ls_application ). " Applications table type
REFRESH lt_dim_list.
LOOPAT ls_application-dimensions INTO ls_dimensions.
APPEND ls_dimensions-dimension TO lt_dim_list.
ENDLOOP.
lo_appl_mgr->create_data_ref(
EXPORTING
i_data_type = 'T'
it_dim_name = lt_dim_list
if_tech_name = abap_false
if_signeddata = abap_true
IMPORTING
er_data = lr_data ).
ASSIGN lr_data->* TO<lt_query_result>.
lo_query = cl_ujo_query_factory=>get_query_adapter(
i_appset_id = lv_environment_id
i_appl_id = lv_application_id
).
lo_query->run_rsdri_query(
EXPORTING
it_dim_name = lt_dim_list " BPC: Dimension List
if_check_security = abap_false " BPC: Generic indicator
IMPORTING
et_data = <lt_query_result>
et_message = lt_message " BPC: Messages
).
LOOPAT<lt_query_result> ASSIGNING<ls_query> .
ASSIGNCOMPONENT'ACCOUNT'OFSTRUCTURE<ls_query>
TO<fs_val1>.
wa_account = <fs_val1>.
ASSIGNCOMPONENT'TIME'OFSTRUCTURE<ls_query>
TO<fs_val2>.
wa_time = <fs_val2>.
ASSIGNCOMPONENT'CATEGORY'OFSTRUCTURE<ls_query>
TO<fs_val3>.
IF wa_account EQ'WS_QTY' .
*
* ASSIGN COMPONENT 'SIGNEDDATA' OF STRUCTURE <ls_query>
* TO <fs_val6>.
* wa_signeddata = <fs_val6>.
CREATEDATA lr_data LIKELINEOF ct_array.
ASSIGN lr_data->* TO<ls_record>.
* ASSIGN COMPONENT ls_entity-dimension OF STRUCTURE <ls_record> TO <l_entity>.
ASSIGNCOMPONENT ujr0_c_keyfigure OFSTRUCTURE<ls_record> TO<l_keyfigure>.
LOOPAT ct_array INTO<ls_record>.
CLEAR wa_keyfigure.
wa_keyfigure = <l_keyfigure>.
***************************************************************************************************************
*clear:<fs_val6>.
CALLFUNCTION'ROUND'
EXPORTING
decimals = 0
* sign = l_sign
input = wa_keyfigure
* input = l_wholenum
IMPORTING
output = l_returnval
EXCEPTIONS
input_invalid = 1
overflow = 2
type_invalid = 3
OTHERS = 4.
<l_keyfigure> = l_returnval.
modify ct_array from<ls_record> .
endloop.
endif.
endloop.
*IF sy-subrc <> 0.
* Implement suitable error handling here
*ENDIF.
ENDMETHOD.