Skip to Content
Mar 15, 2012 at 01:12 PM

Reading context using method chaining in 7.02


In 7.02, method chaining in ABAP is allowed, which means that we can write less code and use fewer temporary variables. In a web dynpro view method, is there a method for reading the contents of a context node into a structure using just one line of code? I tried this:

ls_old_material = wd_context->get_child_node( name = wd_this->wdctx_old_material )->get_static_attributes( )

This does not work because get_attributes() does not have a returning parameter.

So I have to do it this way:

lo_el_old_material = wd_context->get_child_node( name = wd_this->wdctx_old_material )->get_element( ).
lo_el_old_material->get_static_attributes( IMPORTING static_attributes = ls_old_material ).

Any tips on how to squeeze this into on line?