ERP transaction CKMLQS has been designed to display the multilevel valuated quantity structure for one material.
The aim of the multilevel valuated quantity structure is to provide an overview of the actual quantity structure of the multilevel processes, valuated with the actual prices from the actual costing.
I will try explain the steps, how to create BW on HANA custom datasource for mass reporting.
Activities:
Transaction code CKMLQS input screen consist of some input parameters.
Material, Plant, valuation type, Sales Document, WBS Element, Period, Year
Sample input screen,
SE38 program that runs behind CKMLQS transaction is CKML_QSTREE.
Output values of CKMLQS is a hierarchical tree structure form.
Main purpose is to report the values of CKMLQS output values below hierarchy node (for this report demand) PROGRASIF( how much energy, labor and other details consumed, quantity of amortization, quantity of waste material consumed ) for producing product during a period for mass reporting in BW on HANA side.
For the selection input values given above, the output values of hierarchy’s sub node consist of some hierarchy item values.
SE37 custom-based abap function module development,
function zbw_cklmqs_data_ag.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR OPTIONAL
*" REFERENCE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" REFERENCE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE DEFAULT
*" 10000
*" REFERENCE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" REFERENCE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" REFERENCE(I_REMOTE_CALL) TYPE SBIWA_FLAG OPTIONAL
*" TABLES
*" E_T_DATA STRUCTURE ZSTRU_CKLMQS_DATA_AG OPTIONAL
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" Z_T_DATA STRUCTURE ZSTRU_CKLMQS_DATA_AG OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
statics: s_s_if type srsc_s_if_simple,
s_counter_datapakid like sy-tabix,
s_cursor type cursor.
data: from_index type i,
to_index type i,
lv_subrc type sysubrc,
i_lines type i.
ranges:l_r_bdatj for zstru_cklmqs_data_ag-bdatj.
ranges:l_r_curtp for zstru_cklmqs_data_ag-curtp.
ranges:l_r_poper for zstru_cklmqs_data_ag-poper.
ranges:l_r_werks for zstru_cklmqs_data_ag-werks.
ranges:l_r_matnr for zstru_cklmqs_data_ag-matnr.
data:l_r_s_bdatj like line of l_r_bdatj .
data:l_r_s_curtp like line of l_r_curtp.
data:l_r_s_poper like line of l_r_poper .
data:l_r_s_werks like line of l_r_werks .
data:l_r_s_matnr like line of l_r_matnr .
data : ls_mlkey type mlkey.
data : qstree type ref to cl_qstree_ckml.
data : lcl_node type ref to cl_qsnode_material_ckml,
lcl_node1 type ref to cl_qsnode,
lcl_node2 type ref to cl_qsnode,
lcl_value type ckmlqs_fields .
data : begin of lt_ckmlqs occurs 100,
seqnr type i ,
kalnr type ck_kalnr1 ,
matnr type matnr ,
text(30) type c ,
quantity type menge_pos ,
unit type meins ,
bewer type kkb_ml_bewer ,
abwe type kkb_ml_abwe ,
ges type kkb_ml_ges ,
preis type kkb_ml_preis ,
currency type waers ,
ressource type kkek_ress ,
peinh type ck_peinh_1 ,
bdatj type bdatj,
curtp type curtp,
poper type poper,
werks type werks_d,
end of lt_ckmlqs .
data : lv_seqnr type i .
data : begin of lt_inputs occurs 10,
seqnr type i ,
qsnode type ref to cl_qsnode,
end of lt_inputs .
data : st_t001w type t001w .
data:t_marc type standard table of marc.
data:s_marc type marc.
data:l_counter type int2.
data:z_s_data type zstru_cklmqs_data_ag.
data: l_s_select type srsc_s_select.
data:ld_e_offline type int4.
if i_initflag = sbiwa_c_flag_on.
s_s_if-requnr = i_requnr.
s_s_if-dsource = i_dsource.
s_s_if-maxsize = i_maxsize.
else.
if s_counter_datapakid = 0.
append lines of i_t_select to s_s_if-t_select.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'BDATJ'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_bdatj.
append l_r_bdatj.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'CURTP'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_curtp.
append l_r_curtp.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'POPER'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_poper.
append l_r_poper.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'WERKS'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_werks.
append l_r_werks.
endloop.
" loop at s_s_if-t_select into l_s_select
" where fieldnm = 'MATNR'."seçim kriteri adı
" l_s_select-option = 'EQ'.
" l_s_select-sign = 'I'.
" move-corresponding l_s_select to l_r_matnr.
" append l_r_matnr.
" endloop.
l_r_matnr-low = '0002*'.
l_r_matnr-sign = 'I'.
l_r_matnr-option = 'CP'.
append l_r_matnr.
l_r_matnr-low = '0003*'.
l_r_matnr-sign = 'I'.
l_r_matnr-option = 'CP'.
append l_r_matnr.
select single *
from t001w
into st_t001w
where werks in l_r_werks.
select matnr werks
from marc
into corresponding fields of table t_marc
where matnr in l_r_matnr
and werks in l_r_werks.
loop at t_marc into s_marc.
ls_mlkey-matnr = s_marc-matnr.
ls_mlkey-werks = s_marc-werks.
ls_mlkey-bwkey = st_t001w-bwkey.
ls_mlkey-werks_ml_productive = s_marc-werks.
read table l_r_curtp into l_r_s_curtp index 1.
read table l_r_bdatj into l_r_s_bdatj index 1.
read table l_r_poper into l_r_s_poper index 1.
read table l_r_werks into l_r_s_werks index 1.
ls_mlkey-curtp = l_r_s_curtp-low.
ls_mlkey-bdatj = l_r_s_bdatj-low.
ls_mlkey-poper = l_r_s_poper-low.
call method cl_qstree_ckml=>create_docking_tree
exporting
is_mlkey = ls_mlkey
importing
er_qstree = qstree
exceptions
container_already_exists = 1
treecontrol_already_exists = 2
object_create_error = 3
container_create_error = 4
kalnr_notfound = 5
treecontrol_create_error = 6
others = 7.
check sy-subrc = 0.
lcl_node = qstree->mr_rootnode.
read table lcl_node->t_inputs into lcl_node1 index 1.
add 1 to lv_seqnr.
lt_inputs-seqnr = lv_seqnr.
lt_inputs-qsnode = lcl_node.
append lt_inputs.
loop at lt_inputs.
call method lt_inputs-qsnode->expand_inputs.
lcl_node1 = lt_inputs-qsnode.
loop at lcl_node1->t_inputs into lcl_node2.
if sy-tabix = 1.
add 1 to lv_seqnr.
lt_inputs-seqnr = lv_seqnr.
endif.
lt_inputs-qsnode = lcl_node2.
append lt_inputs.
endloop.
endloop.
loop at lt_inputs.
lt_ckmlqs-seqnr = lt_inputs-seqnr .
lt_ckmlqs-kalnr = lt_inputs-qsnode->kalnr .
lt_ckmlqs-text = lt_inputs-qsnode->text .
lt_ckmlqs-quantity = lt_inputs-qsnode->quantity.
lt_ckmlqs-unit = lt_inputs-qsnode->unit .
lt_ckmlqs-matnr = s_marc-matnr.
lt_ckmlqs-werks = s_marc-werks.
clear lcl_value.
read table lt_inputs-qsnode->t_values into lcl_value
with key curtp = l_r_s_curtp-low.
lt_ckmlqs-bewer = lcl_value-bewer .
lt_ckmlqs-abwe = lcl_value-abwe .
lt_ckmlqs-ges = lcl_value-ges .
lt_ckmlqs-preis = lcl_value-preis .
lt_ckmlqs-currency = lcl_value-currency .
lt_ckmlqs-ressource = lcl_value-ressource.
lt_ckmlqs-peinh = lcl_value-peinh .
lt_ckmlqs-bdatj = l_r_s_bdatj-low.
lt_ckmlqs-curtp = l_r_s_curtp-low.
lt_ckmlqs-poper = l_r_s_poper-low.
* lt_ckmlqs-werks = l_r_s_werks-low.
move-corresponding lt_ckmlqs to z_s_data.
append z_s_data to z_t_data.
append lt_ckmlqs.
clear: lt_ckmlqs,z_s_data.
endloop.
clear:lt_inputs,ls_mlkey,qstree,lv_seqnr.
refresh:lt_inputs.
clear:s_marc.
endloop.
export z_t_data to memory id 'ZCKLMQS'.
endif.
import z_t_data from memory id 'ZCKLMQS'.
i_lines = lines( z_t_data ).
from_index = ( s_counter_datapakid * s_s_if-maxsize ) + 1.
to_index = from_index + s_s_if-maxsize - 1.
if i_lines between from_index and to_index.
to_index = i_lines.
endif.
clear z_t_data.
loop at z_t_data from from_index to to_index.
move-corresponding z_t_data to e_t_data.
append e_t_data.
endloop.
lv_subrc = sy-subrc.
s_counter_datapakid = s_counter_datapakid + 1.
if lv_subrc ne 0.
raise no_more_data.
endif.
endif.
endfunction.
I created Z custom BW datasource with function module option, and test the values on some variants on selection screening on RSA3, period and plant , control bilateral BW datasource and CKMLQS transaction.
Both side values are consistent.
When trying to load values of datasource with giving infopackage selection (period and plant ) to BW side datasource load 0 records.
When trying to load BW on HANA datasource on some infopackage selection, datasource tried to load not only table fetch or BOM explode output values , but also datasource tried to load SAPGUI screen elements ( init toolbar control, customer container creation, GUI hierarchical tree control and display events) to BW side and data load fails to 0 records.
Programs run according to one of two options,
BACKGROUND or FOREGROUND.
Triggering BW on HANA nfopackage whether manually or via scheduled process chain, BW on HANA datasource programs always run in BACKGROUND.
Inputting some selection to any ERP transaction program ( e.g: CKMLQS ) SY-BATCH is equal to SPACE and is always run in FOREGROUND.
Debug screenshot any method part of CKMLQS and run foreground,
SY-BATCH = SPACE
When executing a infopackage in BW side, adding necessary SY-BATCH control to skip some ( init toolbar control, customer container creation, GUI tree control and display events) of (call method cl_qstree_ckml) class interface sub methods results a successful data loading to BW on HANA system.
I made abap repair activities (core abap program changes) on (call method cl_qstree_ckml) class interface 3 sub methods codes as shown below.
I commented the original lines and add same code below with a extra line of sy-batch control.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this me->init_toolbar method for not trying to get toolbar elements to BW on HANA side.
me->init_toolbar initializes GUI Toolbar.
Method 1 name: init_all
METHOD init_all.
data: lh_wip_instance type ref to if_ex_ckml_wip.
* Is WIP active ?
clear: m_wipactive, m_showwip.
CALL FUNCTION 'CKMLWIP_BADI_GET_INSTANCE'
IMPORTING
E_BADI_INSTANCE = lh_wip_instance.
call method lh_wip_instance->check_active
IMPORTING
E_ACTIVE = m_wipactive.
if not m_wipactive is initial.
m_showwip = c_on.
endif.
*** Begin of SIT ML: Is SIT active?
clear m_sit_active.
CALL METHOD CL_FCML_SIT_SWITCH_CHECK=>FIN_CO_SIT_RS
RECEIVING
RV_ACTIVE = m_sit_active.
*** End of SIT ML
* Set eventhandler
mr_eventhandler = ir_eventhandler.
* Create root node.
CALL METHOD me->init_rootnode
EXCEPTIONS
kalnr_notfound = 1.
IF sy-subrc = 1.
RAISE kalnr_notfound.
ENDIF.
* Create tree control.
CALL METHOD me->init_treecontrol
EXCEPTIONS
treecontrol_already_exists = 1
treecontrol_create_error = 2.
CASE sy-subrc.
WHEN 1.
RAISE treecontrol_already_exists.
WHEN 2.
RAISE treecontrol_create_error.
ENDCASE.
*{ REPLACE TEDK919846 1
*\* Init toolbar control.
*\ CALL METHOD me->init_toolbar.
*\
*\* Register event handle for node change.
*\ IF NOT mr_eventhandler IS INITIAL.
*\ SET HANDLER mr_eventhandler->on_nodechanged FOR me.
*\ ENDIF.
IF sy-batch = abap_false.
* Init toolbar control.
CALL METHOD me->init_toolbar.
* Register event handle for node change.
IF NOT mr_eventhandler IS INITIAL.
SET HANDLER mr_eventhandler->on_nodechanged FOR me.
ENDIF.
ENDIF.
*} REPLACE
ENDMETHOD.
The other method that I made repair is CALL METHOD er_qstree->init_docking as shown below.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this er_qstree->init_docking method for not trying to load init docking screen design elements to BW side.
er_qstree->init_docking initializes Docking Container.
Method 2 name:create_docking_tree
METHOD create_docking_tree.
* Create QSTREE object.
CREATE OBJECT er_qstree
EXPORTING
i_standalone = c_off
i_showcol = i_showcol
i_showactiv = i_showactiv
i_showproca = i_showproca
i_showheader = i_showheader
is_mlkey = is_mlkey.
IF sy-subrc <> 0.
RAISE object_create_error.
ENDIF.
* Create customer container.
*{ REPLACE TEDK919842 1
*\ CALL METHOD er_qstree->init_docking
*\ EXPORTING
*\ ir_parent = ir_parent
*\ i_repid = i_repid
*\ i_dynnr = i_dynnr
*\ i_side = i_side
*\ i_extension = i_extension
*\ i_ratio = i_ratio
*\ i_style = i_style
*\ EXCEPTIONS
*\ container_already_exists = 1
*\ container_create_error = 2.
IF sy-batch = abap_false.
CALL METHOD er_qstree->init_docking
EXPORTING
ir_parent = ir_parent
i_repid = i_repid
i_dynnr = i_dynnr
i_side = i_side
i_extension = i_extension
i_ratio = i_ratio
i_style = i_style
EXCEPTIONS
container_already_exists = 1
container_create_error = 2.
endif.
*} REPLACE
CASE sy-subrc.
WHEN 1.
RAISE container_already_exists.
WHEN 2.
RAISE container_create_error.
ENDCASE.
* Init all object parts.
CALL METHOD er_qstree->init_all
EXPORTING
ir_eventhandler = ir_eventhandler
EXCEPTIONS
kalnr_notfound = 1
treecontrol_already_exists = 2
treecontrol_create_error = 3.
CASE sy-subrc.
WHEN 1.
RAISE kalnr_notfound.
WHEN 2.
RAISE treecontrol_already_exists.
WHEN 3.
RAISE treecontrol_create_error.
ENDCASE.
ENDMETHOD.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this CREATE OBJECT mr_treecontrol method for not trying to load Initialized Custom Container and ALV Tree to BW on HANA side.
mr_treecontrol method is initializes Custom Container and ALV Tree.
When the infopackage triggered in BW side, SY-BATCH set to TRUE and skip this CALL METHOD mr_treecontrol->set_table_for_first_display method for not trying to load to BW on HANA side.
CALL METHOD mr_treecontrol->set_table_for_first_display method sets table for first Display. Tree design of the screen for outputting values.
Method 3 name:init_treecontrol
METHOD init_treecontrol .
DATA: ls_line TYPE slis_listheader,
ls_runper TYPE ckml_run_period_data,
ls_curtp TYPE CKI_ML_CTY,
lt_curtp TYPE TABLE OF CKI_ML_CTY,
l_hhdr TYPE treev_hhdr,
ls_fcat TYPE lvc_s_fcat,
ls_variant TYPE disvariant,
l_novar(1) TYPE c,
l_noheader(1) TYPE c,
lt_exclude TYPE ui_functions,
l_func TYPE ui_func.
IF m_showheader = c_on.
l_noheader = c_off.
ELSE.
l_noheader = c_on.
ENDIF.
* Create GUI ALV tree control.
IF NOT mr_treecontrol IS INITIAL.
RAISE treecontrol_already_exists.
ENDIF.
*{ REPLACE TEDK919842 1
*\
*\ CREATE OBJECT mr_treecontrol
*\ EXPORTING
*\ parent = mr_container
*\ no_html_header = l_noheader
*\ EXCEPTIONS
*\ others = 8.
IF sy-batch = abap_false.
CREATE OBJECT mr_treecontrol
EXPORTING
parent = mr_container
no_html_header = l_noheader
EXCEPTIONS
others = 8.
ENDIF.
*} REPLACE
IF sy-subrc <> 0.
RAISE treecontrol_create_error.
ENDIF.
* Create hierarchy header
l_hhdr-heading = 'Bewertetes Mengengerüst (mehrstufig)'(h01).
l_hhdr-tooltip = 'Material/Aktivität/Beschaffungsalt.'(i01).
l_hhdr-width = 50.
l_hhdr-width_pix = space.
* Create field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'CKMLQS_FIELDS'
CHANGING
ct_fieldcat = mt_fcat.
* Change field catalog.
LOOP AT mt_fcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'WERT' OR 'CURTP'.
ls_fcat-tech = c_on.
WHEN 'NODE' OR 'ABWE_E' OR 'ABWE_M' OR
'KABWE' OR 'KABWE_E' OR 'KABWE_M' OR
'PABWE' OR 'PABWE_E' OR 'PABWE_M' OR
'PRCTR'.
ls_fcat-no_out = c_on.
ls_fcat-key = c_off.
if ls_fcat-fieldname eq 'NODE'.
ls_fcat-outputlen = '4'.
endif.
WHEN 'RESSOURCE'.
ls_fcat-reptext = 'Ressource'(t01).
ls_fcat-tooltip = 'Technische Beschreibung'(i02).
ENDCASE.
IF m_showcol = c_off.
* Columns are not visible.
ls_fcat-no_out = c_on.
ls_fcat-key = c_off.
ENDIF.
MODIFY mt_fcat FROM ls_fcat.
ENDLOOP.
* Get default variant.
ls_variant-report = sy-repid.
ls_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = ls_variant
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
l_novar = c_on.
ENDIF.
* Create HTML header for tree control.
IF m_showheader = c_on.
IF NOT ms_mlkey-run_id IS INITIAL.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_runper
FROM ckmlrunperiod
WHERE run_id = ms_mlkey-run_id.
ENDIF.
ls_line-typ = 'S'.
IF NOT ls_runper-run_type IS INITIAL.
ls_line-key = text-k06.
ls_line-info = ls_runper-run_type.
CASE ls_runper-appl.
WHEN 'ACRU'.
CONCATENATE ls_line-info text-k07 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'CM'.
CONCATENATE ls_line-info text-k08 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'SIM'.
CONCATENATE ls_line-info text-k09 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'REV'.
CONCATENATE ls_line-info text-k10 INTO ls_line-info
SEPARATED BY ', '.
ENDCASE.
APPEND ls_line TO m_html_header.
ENDIF.
IF NOT ms_mlkey-poper IS INITIAL.
ls_line-key = text-k02.
CONCATENATE ms_mlkey-poper ms_mlkey-bdatj INTO ls_line-info
SEPARATED BY '.'.
APPEND ls_line TO m_html_header.
ENDIF.
if not ms_mlkey-curtp is initial.
if not ms_mlkey-bwkey is initial.
CALL FUNCTION 'GET_BWKEY_CURRENCY_INFO'
EXPORTING
bwkey = ms_mlkey-bwkey
TABLES
t_curtp_for_va = lt_curtp
EXCEPTIONS
OTHERS = 6.
if sy-subrc = 0.
read table lt_curtp
with key curtp = ms_mlkey-curtp
into ls_curtp.
endif.
endif.
ls_line-key = text-k11.
concatenate ls_curtp-text ls_curtp-waers into ls_line-info
separated by space.
APPEND ls_line TO m_html_header.
endif.
endif.
* Hide toolbar function
refresh lt_exclude.
clear l_func.
l_func = cl_alv_tree_base=>mc_fc_calculate.
append l_func to lt_exclude.
* Create empty tree control
*{ REPLACE TEDK919842 2
*\ CALL METHOD mr_treecontrol->set_table_for_first_display
*\ EXPORTING
*\ i_structure_name = 'CKMLQS_FIELDS'
*\ is_hierarchy_header = l_hhdr
*\ i_save = 'A'
*\ i_default = c_on
*\ is_variant = ls_variant
*\ it_list_commentary = m_html_header
*\ it_toolbar_excluding = lt_exclude
*\ CHANGING
*\ it_fieldcatalog = mt_fcat
*\ it_outtab = mt_treeflds.
*\
*\* Insert and expand root node in tree control.
*\ CALL METHOD mr_rootnode->create_alvtree_node
*\ EXPORTING parent_alv_node = space.
*\
*\ CALL METHOD mr_rootnode->expand_inputs.
*\
*\* Register GUI Tree event.
*\ CALL METHOD me->register_treevents.
*\
*\* Send data to frontend.
*\ CALL METHOD mr_treecontrol->frontend_update.
*\
*\* First 2 levels.
*\ IF mr_rootnode->has_children( ) = c_on.
*\ CALL METHOD mr_treecontrol->expand_node
*\ EXPORTING
*\ i_node_key = mr_rootnode->alvtree_node
*\ i_level_count = 2
*\ i_expand_subtree = c_on
*\ EXCEPTIONS
*\ OTHERS = 6.
*\ ENDIF.
*\
*\* Optimize column width biginning from column 2:
*\ IF m_showcol = c_on AND l_novar = c_on.
*\ CALL METHOD mr_treecontrol->column_optimize
*\ EXCEPTIONS
*\ OTHERS = 3.
*\ ENDIF.
IF sy-batch = abap_false.
CALL METHOD mr_treecontrol->set_table_for_first_display
EXPORTING
i_structure_name = 'CKMLQS_FIELDS'
is_hierarchy_header = l_hhdr
i_save = 'A'
i_default = c_on
is_variant = ls_variant
it_list_commentary = m_html_header
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = mt_fcat
it_outtab = mt_treeflds.
* Insert and expand root node in tree control.
CALL METHOD mr_rootnode->create_alvtree_node
EXPORTING parent_alv_node = space.
CALL METHOD mr_rootnode->expand_inputs.
* Register GUI Tree event.
CALL METHOD me->register_treevents.
* Send data to frontend.
CALL METHOD mr_treecontrol->frontend_update.
* First 2 levels.
IF mr_rootnode->has_children( ) = c_on.
CALL METHOD mr_treecontrol->expand_node
EXPORTING
i_node_key = mr_rootnode->alvtree_node
i_level_count = 2
i_expand_subtree = c_on
EXCEPTIONS
OTHERS = 6.
ENDIF.
* Optimize column width biginning from column 2:
IF m_showcol = c_on AND l_novar = c_on.
CALL METHOD mr_treecontrol->column_optimize
EXCEPTIONS
OTHERS = 3.
ENDIF.
else.
CALL METHOD mr_rootnode->expand_inputs.
endif.
*} REPLACE
ENDMETHOD.
After abap repair activities on class interface of
call method cl_qstree_ckml=>create_docking_tree
methods,
METHOD init_all.
METHOD create_docking_tree.
METHOD init_treecontrol .
With the help of giving some infopackage selection range parameters, mass loading of CKMLQS material ledger values successfully loaded to BW on HANA datasource.
PSA mass loading values,
I create custom-based Z function module for BW on HANA datasource backend to load data as a cumulative load, e.g: loading with plant and period value infopackage selection.
After loaded data to BW on HANA side as 0 records, i noticed that when loading data from transaction CKMLQS SAPGUI elements are also passed via program .
I add some condition controls on this standard methods for not trying to load SAPGUI elements to BW side during BW on HANA mass loading .
Code logic for methods for skipping SAPGUI elements when data loaded to BW on HANA (BACKGROUND),
IF sy-batch = ABAP_FALSE. // if program run in FOREGROUND
EXECUTE GUI METHODS.
ENDIF.
After adding controls on this methods, data are mass loaded to BW on HANA datasource successfully.
Both BW on HANA datasource and ERP tcode CKMLQS consume 3 repaired methods.
When user trigger CKMLQS transaction , ( it is a FOREGROUND activity ) methods work same as before method changed.
When BW infopackage triggered for loading data to BW side ( it is a BACKGROUND activity ) program skip the SAPGUI places for not trying to load screen elements(docking, container, screen display) to BW on HANA side.
That’s all steps.
Cihan Ekin
Okumaya devam et...
The aim of the multilevel valuated quantity structure is to provide an overview of the actual quantity structure of the multilevel processes, valuated with the actual prices from the actual costing.
I will try explain the steps, how to create BW on HANA custom datasource for mass reporting.
Activities:
- -Abap function module developments
- -Standard ERP program methods abap repair activities
- -BW on HANA datasource creation and modeling
- -Conclusion
- Abap function module developments
Transaction code CKMLQS input screen consist of some input parameters.
Material, Plant, valuation type, Sales Document, WBS Element, Period, Year
Sample input screen,
SE38 program that runs behind CKMLQS transaction is CKML_QSTREE.
Output values of CKMLQS is a hierarchical tree structure form.
Main purpose is to report the values of CKMLQS output values below hierarchy node (for this report demand) PROGRASIF( how much energy, labor and other details consumed, quantity of amortization, quantity of waste material consumed ) for producing product during a period for mass reporting in BW on HANA side.
For the selection input values given above, the output values of hierarchy’s sub node consist of some hierarchy item values.
SE37 custom-based abap function module development,
function zbw_cklmqs_data_ag.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_REQUNR) TYPE SRSC_S_IF_SIMPLE-REQUNR OPTIONAL
*" REFERENCE(I_DSOURCE) TYPE SRSC_S_IF_SIMPLE-DSOURCE OPTIONAL
*" REFERENCE(I_MAXSIZE) TYPE SRSC_S_IF_SIMPLE-MAXSIZE DEFAULT
*" 10000
*" REFERENCE(I_INITFLAG) TYPE SRSC_S_IF_SIMPLE-INITFLAG OPTIONAL
*" REFERENCE(I_READ_ONLY) TYPE SRSC_S_IF_SIMPLE-READONLY OPTIONAL
*" REFERENCE(I_REMOTE_CALL) TYPE SBIWA_FLAG OPTIONAL
*" TABLES
*" E_T_DATA STRUCTURE ZSTRU_CKLMQS_DATA_AG OPTIONAL
*" I_T_SELECT TYPE SRSC_S_IF_SIMPLE-T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SRSC_S_IF_SIMPLE-T_FIELDS OPTIONAL
*" Z_T_DATA STRUCTURE ZSTRU_CKLMQS_DATA_AG OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
statics: s_s_if type srsc_s_if_simple,
s_counter_datapakid like sy-tabix,
s_cursor type cursor.
data: from_index type i,
to_index type i,
lv_subrc type sysubrc,
i_lines type i.
ranges:l_r_bdatj for zstru_cklmqs_data_ag-bdatj.
ranges:l_r_curtp for zstru_cklmqs_data_ag-curtp.
ranges:l_r_poper for zstru_cklmqs_data_ag-poper.
ranges:l_r_werks for zstru_cklmqs_data_ag-werks.
ranges:l_r_matnr for zstru_cklmqs_data_ag-matnr.
data:l_r_s_bdatj like line of l_r_bdatj .
data:l_r_s_curtp like line of l_r_curtp.
data:l_r_s_poper like line of l_r_poper .
data:l_r_s_werks like line of l_r_werks .
data:l_r_s_matnr like line of l_r_matnr .
data : ls_mlkey type mlkey.
data : qstree type ref to cl_qstree_ckml.
data : lcl_node type ref to cl_qsnode_material_ckml,
lcl_node1 type ref to cl_qsnode,
lcl_node2 type ref to cl_qsnode,
lcl_value type ckmlqs_fields .
data : begin of lt_ckmlqs occurs 100,
seqnr type i ,
kalnr type ck_kalnr1 ,
matnr type matnr ,
text(30) type c ,
quantity type menge_pos ,
unit type meins ,
bewer type kkb_ml_bewer ,
abwe type kkb_ml_abwe ,
ges type kkb_ml_ges ,
preis type kkb_ml_preis ,
currency type waers ,
ressource type kkek_ress ,
peinh type ck_peinh_1 ,
bdatj type bdatj,
curtp type curtp,
poper type poper,
werks type werks_d,
end of lt_ckmlqs .
data : lv_seqnr type i .
data : begin of lt_inputs occurs 10,
seqnr type i ,
qsnode type ref to cl_qsnode,
end of lt_inputs .
data : st_t001w type t001w .
data:t_marc type standard table of marc.
data:s_marc type marc.
data:l_counter type int2.
data:z_s_data type zstru_cklmqs_data_ag.
data: l_s_select type srsc_s_select.
data:ld_e_offline type int4.
if i_initflag = sbiwa_c_flag_on.
s_s_if-requnr = i_requnr.
s_s_if-dsource = i_dsource.
s_s_if-maxsize = i_maxsize.
else.
if s_counter_datapakid = 0.
append lines of i_t_select to s_s_if-t_select.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'BDATJ'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_bdatj.
append l_r_bdatj.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'CURTP'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_curtp.
append l_r_curtp.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'POPER'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_poper.
append l_r_poper.
endloop.
loop at s_s_if-t_select into l_s_select
where fieldnm = 'WERKS'."seçim kriteri adı
l_s_select-option = 'EQ'.
l_s_select-sign = 'I'.
move-corresponding l_s_select to l_r_werks.
append l_r_werks.
endloop.
" loop at s_s_if-t_select into l_s_select
" where fieldnm = 'MATNR'."seçim kriteri adı
" l_s_select-option = 'EQ'.
" l_s_select-sign = 'I'.
" move-corresponding l_s_select to l_r_matnr.
" append l_r_matnr.
" endloop.
l_r_matnr-low = '0002*'.
l_r_matnr-sign = 'I'.
l_r_matnr-option = 'CP'.
append l_r_matnr.
l_r_matnr-low = '0003*'.
l_r_matnr-sign = 'I'.
l_r_matnr-option = 'CP'.
append l_r_matnr.
select single *
from t001w
into st_t001w
where werks in l_r_werks.
select matnr werks
from marc
into corresponding fields of table t_marc
where matnr in l_r_matnr
and werks in l_r_werks.
loop at t_marc into s_marc.
ls_mlkey-matnr = s_marc-matnr.
ls_mlkey-werks = s_marc-werks.
ls_mlkey-bwkey = st_t001w-bwkey.
ls_mlkey-werks_ml_productive = s_marc-werks.
read table l_r_curtp into l_r_s_curtp index 1.
read table l_r_bdatj into l_r_s_bdatj index 1.
read table l_r_poper into l_r_s_poper index 1.
read table l_r_werks into l_r_s_werks index 1.
ls_mlkey-curtp = l_r_s_curtp-low.
ls_mlkey-bdatj = l_r_s_bdatj-low.
ls_mlkey-poper = l_r_s_poper-low.
call method cl_qstree_ckml=>create_docking_tree
exporting
is_mlkey = ls_mlkey
importing
er_qstree = qstree
exceptions
container_already_exists = 1
treecontrol_already_exists = 2
object_create_error = 3
container_create_error = 4
kalnr_notfound = 5
treecontrol_create_error = 6
others = 7.
check sy-subrc = 0.
lcl_node = qstree->mr_rootnode.
read table lcl_node->t_inputs into lcl_node1 index 1.
add 1 to lv_seqnr.
lt_inputs-seqnr = lv_seqnr.
lt_inputs-qsnode = lcl_node.
append lt_inputs.
loop at lt_inputs.
call method lt_inputs-qsnode->expand_inputs.
lcl_node1 = lt_inputs-qsnode.
loop at lcl_node1->t_inputs into lcl_node2.
if sy-tabix = 1.
add 1 to lv_seqnr.
lt_inputs-seqnr = lv_seqnr.
endif.
lt_inputs-qsnode = lcl_node2.
append lt_inputs.
endloop.
endloop.
loop at lt_inputs.
lt_ckmlqs-seqnr = lt_inputs-seqnr .
lt_ckmlqs-kalnr = lt_inputs-qsnode->kalnr .
lt_ckmlqs-text = lt_inputs-qsnode->text .
lt_ckmlqs-quantity = lt_inputs-qsnode->quantity.
lt_ckmlqs-unit = lt_inputs-qsnode->unit .
lt_ckmlqs-matnr = s_marc-matnr.
lt_ckmlqs-werks = s_marc-werks.
clear lcl_value.
read table lt_inputs-qsnode->t_values into lcl_value
with key curtp = l_r_s_curtp-low.
lt_ckmlqs-bewer = lcl_value-bewer .
lt_ckmlqs-abwe = lcl_value-abwe .
lt_ckmlqs-ges = lcl_value-ges .
lt_ckmlqs-preis = lcl_value-preis .
lt_ckmlqs-currency = lcl_value-currency .
lt_ckmlqs-ressource = lcl_value-ressource.
lt_ckmlqs-peinh = lcl_value-peinh .
lt_ckmlqs-bdatj = l_r_s_bdatj-low.
lt_ckmlqs-curtp = l_r_s_curtp-low.
lt_ckmlqs-poper = l_r_s_poper-low.
* lt_ckmlqs-werks = l_r_s_werks-low.
move-corresponding lt_ckmlqs to z_s_data.
append z_s_data to z_t_data.
append lt_ckmlqs.
clear: lt_ckmlqs,z_s_data.
endloop.
clear:lt_inputs,ls_mlkey,qstree,lv_seqnr.
refresh:lt_inputs.
clear:s_marc.
endloop.
export z_t_data to memory id 'ZCKLMQS'.
endif.
import z_t_data from memory id 'ZCKLMQS'.
i_lines = lines( z_t_data ).
from_index = ( s_counter_datapakid * s_s_if-maxsize ) + 1.
to_index = from_index + s_s_if-maxsize - 1.
if i_lines between from_index and to_index.
to_index = i_lines.
endif.
clear z_t_data.
loop at z_t_data from from_index to to_index.
move-corresponding z_t_data to e_t_data.
append e_t_data.
endloop.
lv_subrc = sy-subrc.
s_counter_datapakid = s_counter_datapakid + 1.
if lv_subrc ne 0.
raise no_more_data.
endif.
endif.
endfunction.
- Standard ERP program methods abap repair activities
I created Z custom BW datasource with function module option, and test the values on some variants on selection screening on RSA3, period and plant , control bilateral BW datasource and CKMLQS transaction.
Both side values are consistent.
When trying to load values of datasource with giving infopackage selection (period and plant ) to BW side datasource load 0 records.
When trying to load BW on HANA datasource on some infopackage selection, datasource tried to load not only table fetch or BOM explode output values , but also datasource tried to load SAPGUI screen elements ( init toolbar control, customer container creation, GUI hierarchical tree control and display events) to BW side and data load fails to 0 records.
Programs run according to one of two options,
BACKGROUND or FOREGROUND.
Triggering BW on HANA nfopackage whether manually or via scheduled process chain, BW on HANA datasource programs always run in BACKGROUND.
Inputting some selection to any ERP transaction program ( e.g: CKMLQS ) SY-BATCH is equal to SPACE and is always run in FOREGROUND.
Debug screenshot any method part of CKMLQS and run foreground,
SY-BATCH = SPACE
When executing a infopackage in BW side, adding necessary SY-BATCH control to skip some ( init toolbar control, customer container creation, GUI tree control and display events) of (call method cl_qstree_ckml) class interface sub methods results a successful data loading to BW on HANA system.
I made abap repair activities (core abap program changes) on (call method cl_qstree_ckml) class interface 3 sub methods codes as shown below.
I commented the original lines and add same code below with a extra line of sy-batch control.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this me->init_toolbar method for not trying to get toolbar elements to BW on HANA side.
me->init_toolbar initializes GUI Toolbar.
Method 1 name: init_all
METHOD init_all.
data: lh_wip_instance type ref to if_ex_ckml_wip.
* Is WIP active ?
clear: m_wipactive, m_showwip.
CALL FUNCTION 'CKMLWIP_BADI_GET_INSTANCE'
IMPORTING
E_BADI_INSTANCE = lh_wip_instance.
call method lh_wip_instance->check_active
IMPORTING
E_ACTIVE = m_wipactive.
if not m_wipactive is initial.
m_showwip = c_on.
endif.
*** Begin of SIT ML: Is SIT active?
clear m_sit_active.
CALL METHOD CL_FCML_SIT_SWITCH_CHECK=>FIN_CO_SIT_RS
RECEIVING
RV_ACTIVE = m_sit_active.
*** End of SIT ML
* Set eventhandler
mr_eventhandler = ir_eventhandler.
* Create root node.
CALL METHOD me->init_rootnode
EXCEPTIONS
kalnr_notfound = 1.
IF sy-subrc = 1.
RAISE kalnr_notfound.
ENDIF.
* Create tree control.
CALL METHOD me->init_treecontrol
EXCEPTIONS
treecontrol_already_exists = 1
treecontrol_create_error = 2.
CASE sy-subrc.
WHEN 1.
RAISE treecontrol_already_exists.
WHEN 2.
RAISE treecontrol_create_error.
ENDCASE.
*{ REPLACE TEDK919846 1
*\* Init toolbar control.
*\ CALL METHOD me->init_toolbar.
*\
*\* Register event handle for node change.
*\ IF NOT mr_eventhandler IS INITIAL.
*\ SET HANDLER mr_eventhandler->on_nodechanged FOR me.
*\ ENDIF.
IF sy-batch = abap_false.
* Init toolbar control.
CALL METHOD me->init_toolbar.
* Register event handle for node change.
IF NOT mr_eventhandler IS INITIAL.
SET HANDLER mr_eventhandler->on_nodechanged FOR me.
ENDIF.
ENDIF.
*} REPLACE
ENDMETHOD.
The other method that I made repair is CALL METHOD er_qstree->init_docking as shown below.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this er_qstree->init_docking method for not trying to load init docking screen design elements to BW side.
er_qstree->init_docking initializes Docking Container.
Method 2 name:create_docking_tree
METHOD create_docking_tree.
* Create QSTREE object.
CREATE OBJECT er_qstree
EXPORTING
i_standalone = c_off
i_showcol = i_showcol
i_showactiv = i_showactiv
i_showproca = i_showproca
i_showheader = i_showheader
is_mlkey = is_mlkey.
IF sy-subrc <> 0.
RAISE object_create_error.
ENDIF.
* Create customer container.
*{ REPLACE TEDK919842 1
*\ CALL METHOD er_qstree->init_docking
*\ EXPORTING
*\ ir_parent = ir_parent
*\ i_repid = i_repid
*\ i_dynnr = i_dynnr
*\ i_side = i_side
*\ i_extension = i_extension
*\ i_ratio = i_ratio
*\ i_style = i_style
*\ EXCEPTIONS
*\ container_already_exists = 1
*\ container_create_error = 2.
IF sy-batch = abap_false.
CALL METHOD er_qstree->init_docking
EXPORTING
ir_parent = ir_parent
i_repid = i_repid
i_dynnr = i_dynnr
i_side = i_side
i_extension = i_extension
i_ratio = i_ratio
i_style = i_style
EXCEPTIONS
container_already_exists = 1
container_create_error = 2.
endif.
*} REPLACE
CASE sy-subrc.
WHEN 1.
RAISE container_already_exists.
WHEN 2.
RAISE container_create_error.
ENDCASE.
* Init all object parts.
CALL METHOD er_qstree->init_all
EXPORTING
ir_eventhandler = ir_eventhandler
EXCEPTIONS
kalnr_notfound = 1
treecontrol_already_exists = 2
treecontrol_create_error = 3.
CASE sy-subrc.
WHEN 1.
RAISE kalnr_notfound.
WHEN 2.
RAISE treecontrol_already_exists.
WHEN 3.
RAISE treecontrol_create_error.
ENDCASE.
ENDMETHOD.
When the infopackage triggered in BW on HANA side, SY-BATCH set to TRUE and skip this CREATE OBJECT mr_treecontrol method for not trying to load Initialized Custom Container and ALV Tree to BW on HANA side.
mr_treecontrol method is initializes Custom Container and ALV Tree.
When the infopackage triggered in BW side, SY-BATCH set to TRUE and skip this CALL METHOD mr_treecontrol->set_table_for_first_display method for not trying to load to BW on HANA side.
CALL METHOD mr_treecontrol->set_table_for_first_display method sets table for first Display. Tree design of the screen for outputting values.
Method 3 name:init_treecontrol
METHOD init_treecontrol .
DATA: ls_line TYPE slis_listheader,
ls_runper TYPE ckml_run_period_data,
ls_curtp TYPE CKI_ML_CTY,
lt_curtp TYPE TABLE OF CKI_ML_CTY,
l_hhdr TYPE treev_hhdr,
ls_fcat TYPE lvc_s_fcat,
ls_variant TYPE disvariant,
l_novar(1) TYPE c,
l_noheader(1) TYPE c,
lt_exclude TYPE ui_functions,
l_func TYPE ui_func.
IF m_showheader = c_on.
l_noheader = c_off.
ELSE.
l_noheader = c_on.
ENDIF.
* Create GUI ALV tree control.
IF NOT mr_treecontrol IS INITIAL.
RAISE treecontrol_already_exists.
ENDIF.
*{ REPLACE TEDK919842 1
*\
*\ CREATE OBJECT mr_treecontrol
*\ EXPORTING
*\ parent = mr_container
*\ no_html_header = l_noheader
*\ EXCEPTIONS
*\ others = 8.
IF sy-batch = abap_false.
CREATE OBJECT mr_treecontrol
EXPORTING
parent = mr_container
no_html_header = l_noheader
EXCEPTIONS
others = 8.
ENDIF.
*} REPLACE
IF sy-subrc <> 0.
RAISE treecontrol_create_error.
ENDIF.
* Create hierarchy header
l_hhdr-heading = 'Bewertetes Mengengerüst (mehrstufig)'(h01).
l_hhdr-tooltip = 'Material/Aktivität/Beschaffungsalt.'(i01).
l_hhdr-width = 50.
l_hhdr-width_pix = space.
* Create field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'CKMLQS_FIELDS'
CHANGING
ct_fieldcat = mt_fcat.
* Change field catalog.
LOOP AT mt_fcat INTO ls_fcat.
CASE ls_fcat-fieldname.
WHEN 'WERT' OR 'CURTP'.
ls_fcat-tech = c_on.
WHEN 'NODE' OR 'ABWE_E' OR 'ABWE_M' OR
'KABWE' OR 'KABWE_E' OR 'KABWE_M' OR
'PABWE' OR 'PABWE_E' OR 'PABWE_M' OR
'PRCTR'.
ls_fcat-no_out = c_on.
ls_fcat-key = c_off.
if ls_fcat-fieldname eq 'NODE'.
ls_fcat-outputlen = '4'.
endif.
WHEN 'RESSOURCE'.
ls_fcat-reptext = 'Ressource'(t01).
ls_fcat-tooltip = 'Technische Beschreibung'(i02).
ENDCASE.
IF m_showcol = c_off.
* Columns are not visible.
ls_fcat-no_out = c_on.
ls_fcat-key = c_off.
ENDIF.
MODIFY mt_fcat FROM ls_fcat.
ENDLOOP.
* Get default variant.
ls_variant-report = sy-repid.
ls_variant-username = sy-uname.
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
EXPORTING
i_save = 'A'
CHANGING
cs_variant = ls_variant
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
l_novar = c_on.
ENDIF.
* Create HTML header for tree control.
IF m_showheader = c_on.
IF NOT ms_mlkey-run_id IS INITIAL.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_runper
FROM ckmlrunperiod
WHERE run_id = ms_mlkey-run_id.
ENDIF.
ls_line-typ = 'S'.
IF NOT ls_runper-run_type IS INITIAL.
ls_line-key = text-k06.
ls_line-info = ls_runper-run_type.
CASE ls_runper-appl.
WHEN 'ACRU'.
CONCATENATE ls_line-info text-k07 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'CM'.
CONCATENATE ls_line-info text-k08 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'SIM'.
CONCATENATE ls_line-info text-k09 INTO ls_line-info
SEPARATED BY ', '.
WHEN 'REV'.
CONCATENATE ls_line-info text-k10 INTO ls_line-info
SEPARATED BY ', '.
ENDCASE.
APPEND ls_line TO m_html_header.
ENDIF.
IF NOT ms_mlkey-poper IS INITIAL.
ls_line-key = text-k02.
CONCATENATE ms_mlkey-poper ms_mlkey-bdatj INTO ls_line-info
SEPARATED BY '.'.
APPEND ls_line TO m_html_header.
ENDIF.
if not ms_mlkey-curtp is initial.
if not ms_mlkey-bwkey is initial.
CALL FUNCTION 'GET_BWKEY_CURRENCY_INFO'
EXPORTING
bwkey = ms_mlkey-bwkey
TABLES
t_curtp_for_va = lt_curtp
EXCEPTIONS
OTHERS = 6.
if sy-subrc = 0.
read table lt_curtp
with key curtp = ms_mlkey-curtp
into ls_curtp.
endif.
endif.
ls_line-key = text-k11.
concatenate ls_curtp-text ls_curtp-waers into ls_line-info
separated by space.
APPEND ls_line TO m_html_header.
endif.
endif.
* Hide toolbar function
refresh lt_exclude.
clear l_func.
l_func = cl_alv_tree_base=>mc_fc_calculate.
append l_func to lt_exclude.
* Create empty tree control
*{ REPLACE TEDK919842 2
*\ CALL METHOD mr_treecontrol->set_table_for_first_display
*\ EXPORTING
*\ i_structure_name = 'CKMLQS_FIELDS'
*\ is_hierarchy_header = l_hhdr
*\ i_save = 'A'
*\ i_default = c_on
*\ is_variant = ls_variant
*\ it_list_commentary = m_html_header
*\ it_toolbar_excluding = lt_exclude
*\ CHANGING
*\ it_fieldcatalog = mt_fcat
*\ it_outtab = mt_treeflds.
*\
*\* Insert and expand root node in tree control.
*\ CALL METHOD mr_rootnode->create_alvtree_node
*\ EXPORTING parent_alv_node = space.
*\
*\ CALL METHOD mr_rootnode->expand_inputs.
*\
*\* Register GUI Tree event.
*\ CALL METHOD me->register_treevents.
*\
*\* Send data to frontend.
*\ CALL METHOD mr_treecontrol->frontend_update.
*\
*\* First 2 levels.
*\ IF mr_rootnode->has_children( ) = c_on.
*\ CALL METHOD mr_treecontrol->expand_node
*\ EXPORTING
*\ i_node_key = mr_rootnode->alvtree_node
*\ i_level_count = 2
*\ i_expand_subtree = c_on
*\ EXCEPTIONS
*\ OTHERS = 6.
*\ ENDIF.
*\
*\* Optimize column width biginning from column 2:
*\ IF m_showcol = c_on AND l_novar = c_on.
*\ CALL METHOD mr_treecontrol->column_optimize
*\ EXCEPTIONS
*\ OTHERS = 3.
*\ ENDIF.
IF sy-batch = abap_false.
CALL METHOD mr_treecontrol->set_table_for_first_display
EXPORTING
i_structure_name = 'CKMLQS_FIELDS'
is_hierarchy_header = l_hhdr
i_save = 'A'
i_default = c_on
is_variant = ls_variant
it_list_commentary = m_html_header
it_toolbar_excluding = lt_exclude
CHANGING
it_fieldcatalog = mt_fcat
it_outtab = mt_treeflds.
* Insert and expand root node in tree control.
CALL METHOD mr_rootnode->create_alvtree_node
EXPORTING parent_alv_node = space.
CALL METHOD mr_rootnode->expand_inputs.
* Register GUI Tree event.
CALL METHOD me->register_treevents.
* Send data to frontend.
CALL METHOD mr_treecontrol->frontend_update.
* First 2 levels.
IF mr_rootnode->has_children( ) = c_on.
CALL METHOD mr_treecontrol->expand_node
EXPORTING
i_node_key = mr_rootnode->alvtree_node
i_level_count = 2
i_expand_subtree = c_on
EXCEPTIONS
OTHERS = 6.
ENDIF.
* Optimize column width biginning from column 2:
IF m_showcol = c_on AND l_novar = c_on.
CALL METHOD mr_treecontrol->column_optimize
EXCEPTIONS
OTHERS = 3.
ENDIF.
else.
CALL METHOD mr_rootnode->expand_inputs.
endif.
*} REPLACE
ENDMETHOD.
- BW on HANA datasource creation and modeling
After abap repair activities on class interface of
call method cl_qstree_ckml=>create_docking_tree
methods,
METHOD init_all.
METHOD create_docking_tree.
METHOD init_treecontrol .
With the help of giving some infopackage selection range parameters, mass loading of CKMLQS material ledger values successfully loaded to BW on HANA datasource.
PSA mass loading values,
- Conclusion
I create custom-based Z function module for BW on HANA datasource backend to load data as a cumulative load, e.g: loading with plant and period value infopackage selection.
After loaded data to BW on HANA side as 0 records, i noticed that when loading data from transaction CKMLQS SAPGUI elements are also passed via program .
I add some condition controls on this standard methods for not trying to load SAPGUI elements to BW side during BW on HANA mass loading .
Code logic for methods for skipping SAPGUI elements when data loaded to BW on HANA (BACKGROUND),
IF sy-batch = ABAP_FALSE. // if program run in FOREGROUND
EXECUTE GUI METHODS.
ENDIF.
After adding controls on this methods, data are mass loaded to BW on HANA datasource successfully.
Both BW on HANA datasource and ERP tcode CKMLQS consume 3 repaired methods.
When user trigger CKMLQS transaction , ( it is a FOREGROUND activity ) methods work same as before method changed.
When BW infopackage triggered for loading data to BW side ( it is a BACKGROUND activity ) program skip the SAPGUI places for not trying to load screen elements(docking, container, screen display) to BW on HANA side.
That’s all steps.
Cihan Ekin
Okumaya devam et...