CRM and CX Blogs by SAP
Stay up-to-date on the latest developments and product news about intelligent customer experience and CRM technologies through blog posts from SAP experts.
cancel
Showing results for 
Search instead for 
Did you mean: 
JerryWang
Product and Topic Expert
Product and Topic Expert
1,974
In WebUI we can maintain search parameter for dynamic search:

The value maintained in WebUI could be found from dynamic query service instance in backend via debugging. Double click variable qs:

We need the following FIVE steps to see the selection parameter value.

1. double click SELECTION_PARAM_COL:

2. Double click ENTITY_LIST:

3. These four entities represent the four selection parameters we see in WebUI. Double click one of them:

4. Double click PARAMETER_DATA:



5. double click:

Finally we see the value:

Use ABAP debugger script to directly review variable content without so many double clicks


1. Click Script tab, create a new Script:



2. Choose a name for your script:



Paste the following source code to overwrite automatically generated source code:
*---------------------------------------------------------------------*
* 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.


PRIVATE SECTION.

DATA queryservicename TYPE string.
CONSTANTS querydefaultname TYPE string VALUE 'QUERY_SERVICE'.

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 init.
queryservicename = querydefaultname.
ENDMETHOD. "init

METHOD script.

TYPES:
BEGIN OF ty_selparam,
attrname TYPE string,
sign TYPE string,
option TYPE string,
low TYPE string,
high TYPE string,
END OF ty_selparam.

DATA lt_col_alv TYPE tpda_script_service_source_tab.
DATA ls_col_alv like LINE OF lt_col_alv.
DATA ls_selparam TYPE ty_selparam.
DATA lr_query_service TYPE tpda_quick_vars.
DATA lv_query_service_object_name TYPE tpda_var_name.
DATA lv_selparamcol_object_name TYPE tpda_var_name.
DATA lv_bo_object_name TYPE tpda_var_name.
DATA lv_number_of_selparam TYPE i.
DATA lt_attr TYPE tpda_script_object_attribut_it.
DATA ls_attr TYPE tpda_script_object_attributes.
DATA lt_selparam TYPE STANDARD TABLE OF ty_selparam.
DATA lr_attr TYPE REF TO cl_tpda_script_data_descr.
DATA lr_entity_list TYPE REF TO cl_tpda_script_tabledescr.
DATA lr_obj_descr TYPE REF TO cl_tpda_script_objectdescr.

REFRESH lt_selparam.

TRY.
lv_query_service_object_name = cl_tpda_script_data_descr=>get_variable_info( queryservicename )-varvalue.
lv_selparamcol_object_name = cl_tpda_script_data_descr=>get_variable_info( lv_query_service_object_name && '-SELECTION_PARAM_COL' )-varvalue.
lr_entity_list ?= cl_tpda_script_data_descr=>factory( lv_selparamcol_object_name && '-ENTITY_LIST' ).
lv_number_of_selparam = lr_entity_list->linecnt( ).
DO lv_number_of_selparam TIMES.
lv_bo_object_name = cl_tpda_script_data_descr=>get_variable_info( lv_selparamcol_object_name && '-ENTITY_LIST[' && sy-index && ']-BO')-varvalue.
ls_selparam-attrname = cl_tpda_script_data_descr=>get_simple_value( lv_bo_object_name && '-PARAMETER_DATA->ATTR_NAME' ).
ls_selparam-option = cl_tpda_script_data_descr=>get_simple_value( lv_bo_object_name && '-PARAMETER_DATA->SIGN' ).
ls_selparam-sign = cl_tpda_script_data_descr=>get_simple_value( lv_bo_object_name && '-PARAMETER_DATA->OPTION' ).
ls_selparam-low = cl_tpda_script_data_descr=>get_simple_value( lv_bo_object_name && '-PARAMETER_DATA->LOW' ).
ls_selparam-high = cl_tpda_script_data_descr=>get_simple_value( lv_bo_object_name && '-PARAMETER_DATA->HIGH' ).
APPEND ls_selparam TO lt_selparam.
ENDDO.
REFRESH lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'ATTRNAME'.
APPEND ls_col_alv TO lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'SIGN'.
APPEND ls_col_alv TO lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'OPTION'.
APPEND ls_col_alv TO lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'LOW'.
APPEND ls_col_alv TO lt_col_alv.
ls_col_alv-fieldname = ls_col_alv-content = 'HIGH'.
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 = lt_selparam.

CATCH cx_tpda_varname
cx_tpda_data_descr_invalidated
cx_sy_move_cast_error
cx_tpda_table_wrong_key
cx_tpda_script_no_simple_type
cx_tpda_table_wrong_table_type.
me->raise_error( ).
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_input~get_parameters.

DATA l_input TYPE tpda_transfer_struc.

IF p_parameters_it IS INITIAL.
l_input-id = 'Query Service Variable Name'.
l_input-value = querydefaultname.
APPEND l_input TO p_parameters_it.
ENDIF.

ENDMETHOD. "if_tpda_script_w_input~get_parameters

METHOD if_tpda_script_w_input~set_parameter_values.

DATA l_input TYPE tpda_transfer_struc.

READ TABLE p_parameter_values_it INTO l_input INDEX 1.
queryservicename = l_input-value.

ENDMETHOD. "if_tpda_script_w_input~set_parameter_values

ENDCLASS. "lcl_debugger_script IMPLEMENTATION

Specify the name of your query service variable in line 21. In my example, it is QS.

Start script by clicking button "Start Script":

Now you see all four selection parameter value displayed in ALV.






2 Comments