1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
method ONACTIONGET_TOTAL . DATA V_SUM TYPE I. DATA lo_nd_node TYPE REF TO if_wd_context_node. DATA lo_el_node TYPE REF TO if_wd_context_element. DATA ls_node TYPE wd_this->element_node. DATA lv_lv_a TYPE wd_this->element_node-lv_a. * navigate from <CONTEXT> to <NODE> via lead selection lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ). * @TODO handle non existant child * IF lo_nd_node IS INITIAL. * ENDIF. * get element via lead selection lo_el_node = lo_nd_node->get_element( ). * @TODO handle not set lead selection IF lo_el_node IS INITIAL. ENDIF. * get single attribute lo_el_node->get_attribute( EXPORTING name = `LV_A` IMPORTING value = lv_lv_a ). DATA lv_lv_b TYPE wd_this->element_node-lv_b. * get single attribute lo_el_node->get_attribute( EXPORTING name = `LV_B` IMPORTING value = lv_lv_b ). DATA lv_lv_c TYPE wd_this->element_node-lv_c. * get single attribute lo_el_node->get_attribute( EXPORTING name = `LV_C` IMPORTING value = lv_lv_c ). V_SUM = lv_lv_a + lv_lv_b + lv_lv_c. CALL METHOD lo_nd_node->set_attribute EXPORTING * index = USE_LEAD_SELECTION value = V_SUM name = 'LV_D' . wd_this->fire_main_out_plg( ). endmethod. |