cancel
Showing results for 
Search instead for 
Did you mean: 

Web Dynpro ABAP - Context @ Runtime

Former Member
0 Kudos

hi,

I want to transfer attribute values of context node in view controller to the attribure of context in component controller at runtime (without creating context mapping at design time).

Is it possible ? If yes, let me know how to implement this.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

Yes, it's possible, you can do the following:


  DATA: lr_view_context TYPE REF TO if_wd_context_node,
        lr_comp_control TYPE REF TO if_wd_component,
        lr_cont_context TYPE REF TO cl_wdr_controller,
        lr_context      TYPE REF TO if_wd_context_node,
        lv_carrid       TYPE sflight-carrid.

  lr_view_context = wd_context->get_child_node( name = wd_this->wdctx_bapisblist ).
  IF lr_view_context IS NOT BOUND.
    RETURN.
  ENDIF.
  lr_view_context->get_attribute( EXPORTING name = `CARRID` IMPORTING value = lv_carrid ).

  lr_comp_control = wd_comp_controller->wd_get_api( ).

  TRY.
      lr_cont_context ?= lr_comp_control->get_context( ).
    CATCH cx_sy_move_cast_error.
      RETURN.
  ENDTRY.
  lr_context = lr_cont_context->if_wd_context~root_node.

  lr_context->set_attribute( name = `CARRID` value = lv_carrid ).

In this example, the component controller has only attributes.

Regards.

Former Member
0 Kudos

Thx David

Your stuff is realy helpfull.

Thx again, take care, bye

Answers (0)