cancel
Showing results for 
Search instead for 
Did you mean: 

set_attribute_property method - strange dump

former_member246634
Active Participant
0 Kudos

Hi Experts,

I've got a strange problem. I have two programs with almost identical code - one works fine and one gets dump. Those programs show ALV tables, I can choose some positions (by checking checkbox (XMARK field in structure) and then go to the other screen and do some stuff. I have this dump after I press "Back" button from the second screen and go back to the ALV table. Here's the code:

This code works fine every time:


    lr_nd_context = wd_context->get_child_node( name = `LT_DATA`).

     lr_nd_context->bind_table( wd_this->gt_data ).

     DATA lo_el_res TYPE REF TO if_wd_context_element.

     FIELD-SYMBOLS <data> LIKE LINE OF wd_this->gt_data.

     LOOP AT wd_this->gt_data ASSIGNING <data> WHERE cell_design = cl_wd_table_column=>e_cell_design-subtotal.

       lo_el_res = lr_nd_context->get_element( INDEX = sy-tabix ).

       lo_el_res->set_attribute_property(

       attribute_name `XMARK`

       PROPERTY = " Property 3 - Read Only

       VALUE = 'X' ).

     ENDLOOP.

lr_nd_context is not initial, in loop lo_el_res is also not initial

And this code gets dump:


lr_ot = wd_context->get_child_node( name = `GT_RESULTS`).

   lr_ot->bind_table( lt_dane ).

   DATA lo_el_res TYPE REF TO if_wd_context_element.

   LOOP AT lt_dane ASSIGNING <res> WHERE cell_design = cl_wd_table_column=>e_cell_design-subtotal.

     lo_el_res = lr_ot->get_element( index = sy-tabix ).

     lo_el_res->set_attribute_property(

     attribute_name `XMARK`

     property = " Property 3 - Read Only

     value = 'X' ).

   ENDLOOP.

lr_ot is not initial, however lo_el_res IS initial after get_element( ) method.

Did anyone face that problem or knows possible solutions?

I'll be grateful for all answers

Bartłomiej

Accepted Solutions (1)

Accepted Solutions (1)

former_member246634
Active Participant
0 Kudos

Problem solved.

Solution: pass sy-tabix to some variable, e.g. lv_index, then use it in get_element method:

GET_ELEMENT( INDEX = lv_index)

Answers (1)

Answers (1)

Former Member
0 Kudos

In the second case, did you check if lt_dane has a line in the sy-tabix position? If someone copied the code from the original one, maybe there is something missing in the MODIFYVIEW method.

What is the dump message?

former_member246634
Active Participant
0 Kudos

Dump message was: "Access via 'NULL' object reference not possible."

lo_el_res was null after get_element method.

If condition in loop wasn't fulfilled then we wouldn't go inside the loop, right?