on 2015 Jun 03 6:59 AM
I’m facing a huge difficulty with a requirement where i need to look up data in the OWNERSHIP model to determine the POWN value and based on that value, split totals per entity in the consolidation model into DEBIT or CREDIT then i need to record the values to a dimension member in BPC Database.
Is it possible to do a LOK UP/READ INTCO values from the ownership model into the CONS model ? if so , How?
Request clarification before answering.
Hi Harry,
You can read another model's data in UJ_CUSTOM_LOGIC BADI.
There is a method to read transaction data 'run_rsdri_query'.
While creating the object to call the method specify the environament & model who's data you want to read:
lo_query = cl_ujo_query_factory=>get_query_adapter(
i_appset_id = lv_environment_id "Environment ID
i_appl_id = lv_application_id "Model ID
).
Please find same code below to read transaction data:
_________________________________________________________________________________
_________________________________________________________________________________
DATA: lv_environment_id TYPE uj_appset_id VALUE 'TESTENV',
lv_application_id TYPE uj_appl_id VALUE 'TESTMODEL',
lt_dim_list TYPE uja_t_dim_list,
lo_appl_mgr TYPE REF TO if_uja_application_manager,
lo_query TYPE REF TO if_ujo_query,
lr_data TYPE REF TO data,
lt_message TYPE uj0_t_message,
ls_application type UJA_S_APPLICATION,
ls_dimensions type UJA_s_DIMENSION.
FIELD-SYMBOLS: <lt_query_result> TYPE STANDARD TABLE.
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.
loop at ls_application-dimensions into ls_dimensions.
append ls_dimensions-dimension to lt_dim_list.
endloop.
* Get Model Structure
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 ).
Regards,
Mihir
ASSIGN lr_data->* TO <lt_query_result>.
TRY.
lo_query = cl_ujo_query_factory=>get_query_adapter(
i_appset_id = lv_environment_id
i_appl_id = lv_application_id
).
*Read Transaction Data
lo_query->run_rsdri_query(
EXPORTING
it_dim_name = lt_dim_list " BPC: Dimension List
* it_range = " BPC: Selection condition
if_check_security = ABAP_FALSE " BPC: Generic indicator
* i_packagesize = " BPC: Size of Returned Data Package
* i_call_badi = ABAP_TRUE
* if_db_aggregate = ABAP_TRUE " BPC: Generic indicator
IMPORTING
et_data = <lt_query_result>
* e_end_of_data = " BPC: Last Data Package Yes/No
* e_split_occurred = " Result may not be completely aggregated
et_message = lt_message " BPC: Messages
* e_stats_guid = " BPC: Statistics Session
* e_cell_filted =
* CHANGING
* c_first_call = " BPC: First Call Yes/No
).
* CATCH cx_ujo_read. " Exception of common read
CATCH cx_ujo_read. " Exception of common read
ENDTRY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harry,
Absolutely unclear... What badi you are talking about??
Vadim
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vadim,
I would like to use a BADI : UJ_CUSTOM_LOGIC to look-Up OWNERSHIP data into the CONS Model and perform some calculations on this data within the CONS Model and post final vlues to a dimension member..
Example with the sample code below :
*Structure based on CONS model.
TYPES:
BEGIN OF ty_ctdata,
account TYPE C LENGTH 32,
auditid TYPE C LENGTH 32,
category TYPE C LENGTH 32,
currency TYPE C LENGTH 32,
entity TYPE C LENGTH 32,
flow TYPE C LENGTH 32,
interco TYPE C LENGTH 32,
measures TYPE C LENGTH 32,
scope TYPE C LENGTH 32,
time TYPE C LENGTH 32
signeddata type /XXX/oisdata ,
END OF ty_ctdata.
DATA :
it_ctd_int type standard table of ty_ctdata,
it_ctd_INT[] = ct_data[].
SELECT *FROM /CPMB/OWNMOD (**OWNSERSHIP**)
INTO CORRESPONDING FIELDS OF TABLE IT_OWNER
WHERE ENTITY = 'XX_XX'
SORT it_ctd_int BY ENTITY.
l_first = 0.
LOOP AT it_ctd_int ASSIGNING <ls_rec>.
IF l_lasttime <> <ls_rec>-time.
l_first = 0.
ENDIF.
Regards
Harry
Hi Andy,
Why can't we use SELECT* in BPC BAdI?
The CODE in the link doesnt provide an option to read from external models.
e.g. Reference POWN values from the the ownership model using INTERCO as key between CONS model and OWNSERSHIP model.
How will you select * the ownership underlining tables into the BADI and move the data into a single internal table before writing to C_T_DATA?
Regards
Harry
May be also this document: How To Migrate BPC 7.x BADIs to BPC 10 | SCN
Vadim
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 7 | |
| 6 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.