DATA:
lo_collection TYPE REF TO if_bol_entity_col,
lv_view_name TYPE crmt_view_name,
lv_query_name TYPE crmt_ext_obj_name,
ls_parameter TYPE genilt_query_parameters,
lt_query_parameter TYPE genilt_selection_parameter_tab,
ls_query_parameter LIKE LINE OF lt_query_parameter.
ls_query_parameter-attr_name = 'OBJECT_ID'.
ls_query_parameter-low = iv_oppt_id.
ls_query_parameter-option = 'EQ'.
ls_query_parameter-sign = 'I'.
APPEND ls_query_parameter TO lt_query_parameter.
ls_query_parameter-attr_name = 'PROCESS_TYPE'.
ls_query_parameter-low = iv_process_type.
ls_query_parameter-option = 'EQ'.
ls_query_parameter-sign = 'I'.
APPEND ls_query_parameter TO lt_query_parameter.
so_core = cl_crm_bol_core=>get_instance( ).
so_core->load_component_set( 'BT' ).
lv_query_name = 'BTQ1Order'.
DATA(lo_result) = so_core->dquery(
iv_query_name = lv_query_name
is_query_parameters = ls_parameter
it_selection_parameters = lt_query_parameter
iv_view_name = lv_view_name ).
CHECK lo_result->size( ) = 1.
DATA(lo_order_result) = lo_result->get_first( ).
DATA(lo_bt_order) = lo_order_result->get_related_entity( 'BTADVS1Ord' ).
CHECK lo_bt_order IS NOT INITIAL.
DATA(lo_header) = lo_bt_order->get_related_entity( 'BTOrderHeader' ).
CHECK lo_header IS NOT INITIAL.
DATA(lo_items) = lo_header->get_related_entities( iv_relation_name = 'BTHeaderItemsExt' ).
CHECK lo_items->size( ) = 1.
DATA(lo_item) = lo_items->get_first( ).
DATA(lo_admini) = lo_item->get_related_entity( 'BTItemsFirstLevel' ).
CHECK lo_admini IS NOT INITIAL.
DATA(lo_product) = lo_admini->get_related_entity( 'BTItemProductExt' ).
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script DEFINITION INHERITING FROM cl_tpda_script_class_super .
PUBLIC SECTION.
METHODS: prologue REDEFINITION,
init REDEFINITION,
script REDEFINITION,
end REDEFINITION.
INTERFACES: if_tpda_script_w_input,
if_tpda_script_w_output.
PRIVATE SECTION.
DATA: entity_name TYPE string.
DATA: value TYPE string.
DATA: output TYPE tpda_transfer_it_unsorted.
DATA: bol_object_name TYPE crmt_ext_obj_name.
METHODS get_attribute
IMPORTING io_oref_descr TYPE REF TO cl_tpda_script_orefdescr
iv_attribute_name TYPE string
RETURNING VALUE(ro_descr) TYPE REF TO cl_tpda_script_data_descr.
ENDCLASS. "lcl_debugger_script DEFINITION
*---------------------------------------------------------------------*
* CLASS lcl_debugger_script IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
CLASS lcl_debugger_script IMPLEMENTATION.
METHOD prologue.
*** generate abap_source (source handler for ABAP)
super->prologue( ).
ENDMETHOD. "prolog
METHOD if_tpda_script_w_input~get_parameters.
DATA lt_input TYPE tpda_transfer_it.
DATA ls_input TYPE tpda_transfer_struc.
ls_input-id = 'ENTITY'.
APPEND ls_input TO lt_input.
p_parameters_it = lt_input.
ENDMETHOD. "if_tpda_script_w_input~get_parameters
METHOD if_tpda_script_w_input~set_parameter_values.
* Tabelle mit Inputparameter und Wert
DATA lt_input TYPE tpda_transfer_it.
DATA ls_input TYPE tpda_transfer_struc.
lt_input = p_parameter_values_it.
LOOP AT lt_input INTO ls_input.
IF ls_input-id = 'ENTITY'.
entity_name = ls_input-value.
ENDIF.
ENDLOOP.
ENDMETHOD. "if_tpda_script_w_input~set_parameter_values
METHOD init.
*** insert your initialization code here
ENDMETHOD. "init
METHOD script.
DATA lr_data_descr TYPE REF TO cl_tpda_script_data_descr.
DATA lr_struct_descr TYPE REF TO cl_tpda_script_structdescr.
DATA lr_cx TYPE REF TO cx_root.
DATA ls_quick TYPE tpda_scr_quick_info.
DATA lv_name TYPE string.
DATA lt_struct TYPE tpda_scr_struct_comp_it.
DATA ls_struct TYPE tpda_scr_struct_comp.
DATA ls_output TYPE tpda_transfer_struc.
DATA lr_symbsimple TYPE REF TO tpda_sys_symbsimple.
DATA ls_varinfo TYPE tpda_quick_vars.
FIELD-SYMBOLS: <lv_value> TYPE any.
TRY.
CLEAR output.
* BREAK-POINT.
ls_varinfo = cl_tpda_script_data_descr=>get_variable_info( 'LO_PRODUCT' ).
* get object type name
IF ls_varinfo-varvalue = 'OBJECT'.
* class instance passed directly
lv_name = entity_name && '-CONTAINER_PROXY->DATA_REF->OBJECT_NAME'.
ELSE.
* variable of class instance passed
lv_name = ls_varinfo-varvalue && '-CONTAINER_PROXY->DATA_REF->OBJECT_NAME'.
ENDIF.
ls_quick = cl_tpda_script_data_descr=>get_quick_info( lv_name ).
ASSIGN ls_quick-quickdata TO <lv_value>.
lr_symbsimple ?= <lv_value>.
bol_object_name = lr_symbsimple->valstring.
* get content
IF ls_varinfo-varvalue = 'OBJECT'.
lv_name = entity_name && '-CONTAINER_PROXY->DATA_REF->ATTRIBUTE_REF->*'.
ELSE.
lv_name = ls_varinfo-varvalue && '-CONTAINER_PROXY->DATA_REF->ATTRIBUTE_REF->*'.
ENDIF.
lr_data_descr = cl_tpda_script_data_descr=>factory( lv_name ).
lr_struct_descr ?= lr_data_descr.
lr_struct_descr->components(
IMPORTING
* p_components_it =
p_components_full_it = lt_struct
).
LOOP AT lt_struct INTO ls_struct.
ls_output-id = ls_struct-compname.
TRY.
ASSIGN ls_struct-symbquick-quickdata TO <lv_value>.
lr_symbsimple ?= <lv_value>.
ls_output-value = lr_symbsimple->valstring.
CATCH cx_root INTO lr_cx.
ls_output-value = lr_cx->get_text( ).
ENDTRY.
APPEND ls_output TO output.
ENDLOOP.
DATA lt_col_alv TYPE tpda_script_service_source_tab.
DATA ls_col_alv LIKE LINE OF lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'ID'.
APPEND ls_col_alv TO lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'VALUE'.
APPEND ls_col_alv TO lt_col_alv.
CALL METHOD cl_tpda_script_data_display=>data_display
EXPORTING
p_list_header = 'Query Selection Parameters'
p_column_it = lt_col_alv
p_popup = 'X'
CHANGING
p_data_it = output.
* BREAK-POINT.
CATCH cx_root INTO lr_cx.
BREAK-POINT. "#EC NOBREAK
value = lr_cx->get_text( ).
ENDTRY.
ENDMETHOD. "script
METHOD end.
*** insert your code which shall be executed at the end of the scripting (before trace is saved)
*** here
ENDMETHOD. "end
METHOD if_tpda_script_w_output~get_parameter_values.
DATA lt_param TYPE tpda_transfer_it_unsorted.
DATA ls_param TYPE tpda_transfer_struc.
ls_param-id = 'VARIABLE'.
ls_param-value = entity_name.
APPEND ls_param TO lt_param.
ls_param-id = 'OBJECT_NAME'.
ls_param-value = bol_object_name.
APPEND ls_param TO lt_param.
APPEND INITIAL LINE TO lt_param.
APPEND LINES OF output TO lt_param.
p_parameter_values_it = lt_param.
ENDMETHOD. "if_tpda_script_w_output~get_parameter_values
METHOD get_attribute.
DATA lr_oref_descr TYPE REF TO cl_tpda_script_orefdescr.
DATA lr_object_descr TYPE REF TO cl_tpda_script_objectdescr.
DATA ls_varinfo TYPE tpda_quick_vars.
DATA lv_longname TYPE string.
DATA lt_attributes TYPE tpda_script_object_attribut_it.
lr_oref_descr = io_oref_descr.
lr_object_descr = lr_oref_descr->get_object_handle( ).
lt_attributes = lr_object_descr->attributes( ).
ro_descr = lr_object_descr->get_attribut_handle( lv_longname ).
ENDMETHOD. "get_oref_attribute
ENDCLASS. "lcl_debugger_script IMPLEMENTATION
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
6 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 |