cancel
Showing results for 
Search instead for 
Did you mean: 

WD - dump after clicking on screen - Binding

former_member246634
Active Participant
0 Kudos

Hi Experts,

On my screen I have two containers displaying ALV with the same data: one (older) has TABLE type, the other (new) is ViewContainerUIElement.

My initial goal was to replace the old container with the new one, but since it's not working fine I can see what happens with both of them.

I have created a method SET_TABLE_CONFIG, which is called in another method MODIFY_SCR:


method SET_TABLE_CONFIG .

*"------------------------------------------------------------------------------------

*"  LOCAL CONSTANTS

*"------------------------------------------------------------------------------------

   CONSTANTS:

*   GENERAL

   cs_alv_width          TYPE string                     VALUE '990',                              " ALV width

   cs_alv_enabled        TYPE abap_bool                  VALUE abap_true,                         " ALV enabled

   cs_alv_read_only      TYPE abap_bool                  VALUE abap_false,                          " ALV read only

   cs_alv_selection_mode TYPE wdy_uie_library_enum_type  VALUE cl_wd_table=>e_selection_mode-none, " ALV Selection mode

*   STANDARD FUNCTIONS

   cs_std_func_insert_row      TYPE abap_bool  VALUE abap_false,

   cs_std_func_delete_row      TYPE abap_bool  VALUE abap_false,

   cs_std_func_check_available TYPE abap_bool  VALUE abap_false,

*   EDIT OPTIONS CONFIGURATION

   cs_data_check             TYPE salv_wd_constant VALUE if_salv_wd_c_table_settings=>data_check_on_cell_event,

   cs_edit_mode              TYPE salv_wd_constant VALUE if_salv_wd_c_table_settings=>edit_mode_standard,

   cs_refresh_on_data_check  TYPE salv_wd_constant VALUE if_salv_wd_c_table_settings=>refresh_and_apply_services,

   cell_action_event_enabled TYPE abap_bool        VALUE abap_true.

*"------------------------------------------------------------------------------------

*"  LOCAL DATA TYPES

*"------------------------------------------------------------------------------------

   DATA:

         lo_cmp_usage              TYPE REF TO if_wd_component_usage,

         lo_cmp_usage2             TYPE REF TO if_wd_component_usage,

         lo_cmp_usage3             TYPE REF TO if_wd_component_usage,

         lo_alv_cpifc              TYPE REF TO iwci_salv_wd_table,

         lo_alv_cpifc2             TYPE REF TO iwci_salv_wd_table,

         lo_alv_cpifc3             TYPE REF TO iwci_salv_wd_table,

         lo_alv_config_table       TYPE REF TO cl_salv_wd_config_table,

         lo_alv_config_table2      TYPE REF TO cl_salv_wd_config_table,

         lo_alv_config_table3      TYPE REF TO cl_salv_wd_config_table,

         lr_table_settings         TYPE REF TO if_salv_wd_table_settings,

         lr_table_settings2        TYPE REF TO if_salv_wd_table_settings,

         lr_table_settings3        TYPE REF TO if_salv_wd_table_settings,

         lr_column_settings        TYPE REF TO if_salv_wd_column_settings,

         lr_column_settings2       TYPE REF TO if_salv_wd_column_settings,

         lr_column_settings3       TYPE REF TO if_salv_wd_column_settings,

         lr_functions_settings     TYPE REF TO if_salv_wd_function_settings,

         lr_functions_settings2    TYPE REF TO if_salv_wd_function_settings,

         lr_functions_settings3    TYPE REF TO if_salv_wd_function_settings,

         lr_std_function_settings  TYPE REF TO if_salv_wd_std_functions,

         lr_std_function_settings2 TYPE REF TO if_salv_wd_std_functions,

         lr_std_function_settings3 TYPE REF TO if_salv_wd_std_functions,

         lr_mass_edit_settings     TYPE REF TO if_salv_wd_mass_edit_settings,

         lr_mass_edit_settings2    TYPE REF TO if_salv_wd_mass_edit_settings,

         lr_mass_edit_settings3    TYPE REF TO if_salv_wd_mass_edit_settings,

         lr_buttonui               TYPE REF TO cl_salv_wd_fe_button,

         lo_button1                TYPE REF TO cl_salv_wd_function,

         lt_attr                   TYPE zzwf_scr_attr_t,

         ls_attr                   LIKE LINE OF lt_attr,

         visible                   TYPE abap_bool.

   DATA: lr_field TYPE REF TO cl_salv_wd_field.

   DATA: v_pernr              TYPE pa0105-pernr,

         lines TYPE i.

   DATA: lo_alv_header         TYPE REF TO cl_salv_wd_header,

         lv_text               TYPE string.

*"------------------------------------------------------------------------------------

*"  MAIN

*"------------------------------------------------------------------------------------

   IF lines( wd_this->gt_docs ) > 100.

     LINES = 100.

   ELSE.

     LINES = lines( wd_this->gt_docs ).

   ENDIF.

   wd_this->gr_model->wd_getdata( IMPORTING fto_scr_attr = lt_attr ).

   READ TABLE lt_attr INTO ls_attr WITH KEY strnm = 'ZZWF_LT_ITEM' fvsbl = abap_true stpnr = wd_this->gs_basic-curst.

   IF sy-subrc NE 0.

     visible = abap_false.

   ELSE.

     visible = abap_true.

   ENDIF.

   lo_cmp_usage =   wd_this->wd_cpuse_zwf_lt_item( ).

   IF lo_cmp_usage->has_active_component( ) IS INITIAL.

     lo_cmp_usage->create_component( ).

   ENDIF.

   lo_alv_cpifc = wd_this->wd_cpifc_zwf_lt_item( ).

   lo_alv_config_table       = lo_alv_cpifc->get_model( ).

   lr_table_settings        ?= lo_alv_config_table.

   lr_column_settings       ?= lo_alv_config_table.

   lr_functions_settings    ?= lo_alv_config_table.

   lr_mass_edit_settings    ?= lo_alv_config_table.

   lr_std_function_settings ?= lo_alv_config_table.

*    ---------------------------------------------------------------------------------

*     General

*    ---------------------------------------------------------------------------------

   lr_table_settings->set_read_only( cs_alv_read_only ).

   lr_table_settings->set_enabled( cs_alv_enabled ).

   CALL METHOD lr_table_settings->create_header

   RECEIVING

   VALUE = lo_alv_header.

   lv_text = 'List of assets'.

   lo_alv_header->set_text( lv_text ).

   CASE visible.

   WHEN abap_true.

     lr_table_settings->set_visible( cl_wd_uielement=>e_visible-visible ).

   WHEN OTHERS.

     lr_table_settings->set_visible( cl_wd_uielement=>e_visible-none ).

   ENDCASE.

   lr_table_settings->set_width( cs_alv_width ).

*    lines = 2.

   lr_table_settings->set_visible_row_count( LINES ).

   lr_table_settings->set_selection_mode( cs_alv_selection_mode ).

*    ---------------------------------------------------------------------------------

*     Toolbar Standard Functions

*    ---------------------------------------------------------------------------------

*  lr_std_function_settings->set_edit_delete_row_allowed( cs_std_func_delete_row ).

*  lr_std_function_settings->set_edit_check_available( cs_std_func_check_available ).

   lr_std_function_settings->set_edit_insert_row_allowed( cs_std_func_insert_row ).

   lr_std_function_settings->set_edit_append_row_allowed( cs_std_func_insert_row ).

   lr_std_function_settings->set_edit_delete_row_allowed( cs_std_func_delete_row ).

   lr_std_function_settings->set_edit_check_available( cs_std_func_check_available ).

*    ---------------------------------------------------------------------------------

*     Edit Options Configuration

*    ---------------------------------------------------------------------------------

   lr_table_settings->set_data_check( cs_data_check ).

   lr_table_settings->set_edit_mode( cs_edit_mode ).

   lr_table_settings->set_refresh_on_data_check( cs_refresh_on_data_check ).

   lr_table_settings->set_cell_action_event_enabled( abap_false )."cell_action_event_enabled ).

endmethod.

MODIFY_SCR:


DATA:

     lr_nd_context   TYPE REF TO if_wd_context_node,

     lr_el_context   TYPE REF TO if_wd_context_element.

   DATA:

     lt_elements     TYPE wdr_context_element_set,

     lt_strnm        TYPE zzwf_scr_attr_t,

     lt_attr         TYPE zzwf_scr_attr_t,

     lt_attrprop     TYPE wdr_context_properties_tab.

   DATA:

     ls_strnm        LIKE LINE OF lt_strnm,

     ls_attr         LIKE LINE OF lt_attr,

     ls_attrprop     LIKE LINE OF lt_attrprop.

   DATA:

     lv_attrname     TYPE string,

     lv_name         TYPE string.

   me->set_table_config( ).

   wd_this->gr_model->wd_getdata(

     IMPORTING

       fto_scr_attr = lt_attr ).

   lt_strnm[] = lt_attr[].

   DELETE ADJACENT DUPLICATES FROM lt_strnm COMPARING strnm.

   LOOP AT lt_strnm INTO ls_strnm.

     CLEAR lt_attrprop[].

     IF ls_strnm-strnm = 'ZZWF_LT_ITEM' OR ls_strnm-strnm = 'ZWF_LT_ITEM'..

       lv_name = 'LT_DOCS'.

     ELSEIF ls_strnm-strnm = 'ZZWF_LT_HEADER'.

       lv_name = 'LS_HEADER'.

     ELSEIF ls_strnm-strnm = 'ZWF_LT_ITEM'.

       lv_name = 'LT_DOCS'.

     ELSE.

       CONTINUE.

     ENDIF.

     DATA: lo_alv_cpifc          TYPE REF TO iwci_salv_wd_table.

     DATA: lo_alv_config_table   TYPE REF TO cl_salv_wd_config_table,

           lr_column_settings    TYPE REF TO if_salv_wd_column_settings,

           lr_columns            TYPE salv_wd_t_column_ref,

           wa_cols               TYPE salv_wd_s_column_ref,

           lr_input_field        TYPE REF TO cl_salv_wd_uie_input_field.

     IF lv_name = 'LT_DOCS'.

       lo_alv_cpifc = wd_this->wd_cpifc_zwf_lt_item( ).

       lo_alv_config_table  = lo_alv_cpifc->get_model( ).

       lr_column_settings   ?= lo_alv_config_table.

       lr_columns           = lr_column_settings->get_columns( ).

       LOOP AT lr_columns INTO wa_cols.

         CREATE OBJECT lr_input_field

         EXPORTING

           value_fieldname = wa_cols-ID.

         DATA: lv_read_only_pos      TYPE abap_bool,

               lv_visible_pos        TYPE wdy_uie_library_enum_type,

               lv_required_pos       TYPE wdy_uie_library_enum_type,

               lr_checkbox        TYPE REF TO cl_salv_wd_uie_checkbox.

*        wa_cols-r_column->set_cell_design_fieldname( 'CELL_DESIGN' ).

*        wa_cols-r_column->set_cell_design( cl_wd_table_column=>e_cell_design-goodvalue_light ).

         FIELD-SYMBOLS <ls_scr_attr_cfg> LIKE LINE OF lt_attr.

         READ TABLE lt_attr ASSIGNING <ls_scr_attr_cfg> WITH KEY strnm = ls_strnm-strnm fldnm = wa_cols-ID.

         IF sy-subrc = 0.

           CLEAR: lv_read_only_pos, lv_visible_pos, lv_required_pos.

           IF <ls_scr_attr_cfg>-fvsbl = 'X'.   " widoczne/niewidoczne

             lv_visible_pos = cl_wd_abstr_table_column=>e_visible-visible.

           ELSE.

             lv_visible_pos = cl_wd_abstr_table_column=>e_visible-none.

           ENDIF.

           IF <ls_scr_attr_cfg>-fedit = 'X'.   " edytowalne

             lv_read_only_pos = abap_false.

           ELSE.

             lv_read_only_pos = abap_true.

           ENDIF.

           IF <ls_scr_attr_cfg>-frequ = 'X'.

             lv_required_pos = cl_wd_abstract_input_field=>e_state-required.

           ELSE.

             lv_required_pos = cl_wd_abstract_input_field=>e_state-normal.

           ENDIF.

         ELSE.

           lv_visible_pos   = cl_wd_abstr_table_column=>e_visible-none.

           lv_required_pos  = cl_wd_abstract_input_field=>e_state-normal.

           lv_read_only_pos = abap_true.

         ENDIF.

         lr_input_field->set_read_only( lv_read_only_pos ).

         wa_cols-r_column->set_visible( lv_visible_pos ).

         lr_input_field->set_state( lv_required_pos ).

       ENDLOOP.

*    ELSE.

       lr_nd_context = wd_context->get_child_node( lv_name ).

       lt_elements = lr_nd_context->get_elements( ).

       LOOP AT lt_elements INTO lr_el_context.

         LOOP AT lt_attr INTO ls_attr WHERE strnm = ls_strnm-strnm.

           lv_attrname = ls_attr-fldnm.

           CLEAR ls_attrprop.

           ls_attrprop-attribute_name  = lv_attrname.

           ls_attrprop-required        = abap_false.

           ls_attrprop-read_only       = abap_false.

           ls_attrprop-visible         = abap_true.

           ls_attrprop-enabled         = abap_true.

           IF ls_attr-fvsbl IS INITIAL.

             ls_attrprop-required        = abap_false.

             ls_attrprop-read_only       = abap_false.

             ls_attrprop-visible         = abap_false.

             ls_attrprop-enabled         = abap_false.

           ELSEIF ls_attr-fedit IS INITIAL.

             ls_attrprop-required        = abap_false.

             ls_attrprop-read_only       = abap_true.

             ls_attrprop-visible         = abap_true.

             ls_attrprop-enabled         = abap_true.

           ELSEIF ls_attr-frequ IS NOT INITIAL.

             ls_attrprop-required        = abap_true.

             ls_attrprop-read_only       = abap_false.

             ls_attrprop-visible         = abap_true.

             ls_attrprop-enabled         = abap_true.

           ENDIF.

           APPEND ls_attrprop TO lt_attrprop.

         ENDLOOP.

         CALL METHOD lr_el_context->set_attribute_props_for_elem

           EXPORTING

             properties = lt_attrprop.

       ENDLOOP.

     ENDIF.

   ENDLOOP.

This is what happens after starting an application:

1. Both ALV's are displayed, but the in new one (ViewContainerUIElement) there aren't editable fields (but there should be).

2. After pressing on column header of the new container I get a dump:


The exception 'CX_WDR_ADAPTER_EXCEPTION' was raised, but it was not caught

anywhere along

the call hierarchy.

Since exceptions represent error situations and this error was not

adequately responded to, the running ABAP program

'CX_WDR_ADAPTER_EXCEPTION======CP' has to be

terminated.

An exception occurred which is explained in detail below.

The exception, which is assigned to class 'CX_WDR_ADAPTER_EXCEPTION', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

Error in TABLE "CONT_DOCS" of view "ZWD_LT_PROCESS.ZWD_LT_CREATE": Context

binding of property ? cannot be resolved: Wybór potencjalnej szansy nie jest

ustawiony w węźle kontekstu ZWD_LT_CREATE.1.LT_DOCS

The occurrence of the exception is closely related to the occurrence of

a previous exception "CX_WD_CONTEXT", which was raised in the program

"CL_WDR_CONTEXT_NODE===========CP",

specifically in line 11 of the (include) program

"CL_WDR_CONTEXT_NODE===========CM00V".

An exception occurred which is explained in detail below.

The exception, which is assigned to class 'CX_WDR_ADAPTER_EXCEPTION', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

Error in TOOLBAR_BUTTON "DUP_BWASL" of view "ZWD_LT_PROCESS.ZWD_LT_CREATE":

Context binding of property ENABLED cannot be resolved: Wybór potencjalnej

szansy nie jest ustawiony w węźle kontekstu ZWD_LT_CREATE.1.LT_DOCS

The occurrence of the exception is closely related to the occurrence of

a previous exception "CX_WD_CONTEXT", which was raised in the program

"CL_WDR_CONTEXT_NODE===========CP",

specifically in line 11 of the (include) program

"CL_WDR_CONTEXT_NODE===========CM00V".

The thing is I have no idea why it has a problem with button properties binding. Everything was fine before I added ViewContainerUIElement and SET_TABLE_CONFIG method and now I have no idea what to do.

I'd be very thankful for any help

Bartłomiej

Accepted Solutions (1)

Accepted Solutions (1)

former_member246634
Active Participant
0 Kudos

I've found solution for this dump myself. All I had to do was to delete standard container:

After that sorting works fine (before after clicking on header I got that dump).

No my problem is that none of the fields are editable, but some should be.

I'd be grateful for aby help

Bartłomiej

former_member246634
Active Participant
0 Kudos

According to this thread:

I have solved my problems.

Answers (1)

Answers (1)

former_member246634
Active Participant
0 Kudos

Did anyone have the same problem?