on 04-03-2014 7:03 AM
Hi All,
we have requirement to add two custom column to standared WD DPR_TABLE and the view in front end is recurisive tree structure.( we have following requirments.
1. inital value for the two fields need to retrieve from the database tables. we are able to retrieve the data through function module but not able to set the value to attrinute since it is in tree structure (one parent node, one or more child node, child node can have one or more subnode)
2. If user change the value or update the value for the fields, values needs to be updated in database. How to find the index value for the updated fieds.
Please help me and share your ideas. Let me know if you need any information
Thanks & Regards,
Meena Ganesan
Hi Ravi,
I have written below code in loadchildren event , got abap dump access via null point reference.
data
lv_FORECAST_START type CGPL_FORECAST_START.
DATA lo_nd_tree_nodes TYPE REF TO if_wd_context_node.
DATA lo_el_tree_nodes TYPE REF TO if_wd_context_element.
DATA ls_tree_nodes TYPE wd_this->Element_tree_nodes.
DATA lv_guid TYPE wd_this->Element_tree_nodes-guid.
DATA lt_ET_TREE type TABLE OF BAPI_TS_TREE.
DATA WA_ET_TREE TYPE BAPI_TS_TREE.
DATA lv_index type i VALUE 0.
DATA wa_detail type BAPI_TS_PROJECT_DEF_DETAIL.
DATA lv_zz_forecasted_finish TYPE wd_this->Element_tree_nodes-zz_forecasted_finish.
DATA lv_zz_forecasted_start TYPE wd_this->Element_tree_nodes-zz_forecasted_start.
** navigate from <CONTEXT> to <TREE_NODES> via lead selection
lo_nd_tree_nodes = wd_context->get_child_node( name = wd_this->wdctx_tree_nodes ).
* @TODO handle non existant child
* IF lo_nd_tree_nodes IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_tree_nodes = lo_nd_tree_nodes->get_element( ).
* alternative access via index
* lo_el_tree_nodes = lo_nd_tree_nodes->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_tree_nodes IS INITIAL.
ENDIF.
* get single attribute
lo_el_tree_nodes->get_attribute(
EXPORTING
name = `GUID`
IMPORTING
value = lv_guid ).
data lt_ES_PROJECT_DEF_DETAIL type BAPI_TS_PROJECT_DEF_DETAIL.
CALL FUNCTION 'BAPI_BUS2172_GET_DETAIL'
EXPORTING
PROJECT_DEFINITION_GUID = lv_guid
IMPORTING
ES_PROJECT_DEFINITION_DETAIL = lt_ES_PROJECT_DEF_DETAIL
* ES_EXTENSION_OUT =
* TABLES
* ET_NAME =
* ET_DESCRIPTION =
* ET_STATUS =
* ET_AUTHORIZATION =
* RETURN =
.
* navigate from <CONTEXT> to <TREE_NODES> via lead selection
lo_nd_tree_nodes = wd_context->get_child_node( name = wd_this->wdctx_tree_nodes ).
* @TODO handle non existant child
* IF lo_nd_tree_nodes IS INITIAL.
* ENDIF.
* get element via lead selection
lo_el_tree_nodes = lo_nd_tree_nodes->get_element( ).
* alternative access via index
* lo_el_tree_nodes = lo_nd_tree_nodes->get_element( index = 1 ).
* @TODO handle not set lead selection
IF lo_el_tree_nodes IS INITIAL.
ENDIF.
** @TODO fill attribute
* lv_zz_forecasted_start = lt_ES_PROJECT_DEF_DETAIL-FORECASTED_START.
** set single attribute
lo_el_tree_nodes->set_attribute(
name = `ZZ_FORECASTED_START`
value = lt_ES_PROJECT_DEF_DETAIL-FORECASTED_START ).
CALL FUNCTION 'BAPI_BUS2172_GET_TREE'
EXPORTING
PROJECT_DEFINITION_GUID = lv_guid
TABLES
ET_TREE = lt_ET_TREE
* RETURN =
.
loop at lt_ET_TREE into WA_ET_TREE.
lv_index = lv_index + 1.
if WA_ET_TREE-OBJECT_TYPE = 'PPO'.
data lt_ES_PHASE_DETAIL type BAPI_TS_PHASE_DETAIL.
CALL FUNCTION 'BAPI_BUS2173_GET_DETAIL'
EXPORTING
PHASE_GUID = WA_ET_TREE-GUID
IMPORTING
ES_PHASE_DETAIL = lt_ES_PHASE_DETAIL
* ES_EXTENSION_OUT =
* TABLES
* ET_NAME =
* ET_DESCRIPTION =
* ET_STATUS =
* ET_AUTHORIZATION =
* ET_SUPERIOR_OBJECT =
* RETURN =
.
* navigate from <CONTEXT> to <TREE_NODES> via lead selection
lo_nd_tree_nodes = wd_context->get_child_node( name = wd_this->wdctx_tree_nodes ).
* @TODO handle non existant child
* IF lo_nd_tree_nodes IS INITIAL.
* ENDIF.
* get element via lead selection
* lo_el_tree_nodes = lo_nd_tree_nodes->get_element( ).
* alternative access via index
lo_el_tree_nodes = lo_nd_tree_nodes->get_element( lv_index ).
* @TODO handle not set lead selection
IF lo_el_tree_nodes IS INITIAL.
ENDIF.
* @TODO fill attribute
lv_zz_forecasted_start = lt_ES_PHASE_DETAIL-FORECASTED_START.
* set single attribute
* lo_el_tree_nodes->set_attribute(
* name = `ZZ_FORECASTED_START`
* value = lv_zz_forecasted_start ).
* data lt_ES_TASK_DETAIL type BAPI_TS_TASK_DETAIL.
*
* CALL FUNCTION 'BAPI_BUS2173_GET_TREE'
* EXPORTING
* PHASE_GUID = WA_ET_TREE-GUID
* IMPORTING
* ET_TREE = lt_ES_TASK_DETAIL
** RETURN =
.
ELSEIF WA_ET_TREE-OBJECT_TYPE = 'TTO'.
data lt_ES_TASK_DETAIL type BAPI_TS_TASK_DETAIL.
CALL FUNCTION 'BAPI_BUS2175_GET_DETAIL'
EXPORTING
TASK_GUID = WA_ET_TREE-GUID
IMPORTING
ES_TASK_DETAIL = lt_ES_TASK_DETAIL
* ES_EXTENSION_OUT =
* TABLES
* ET_NAME =
* ET_DESCRIPTION =
* ET_STATUS =
* ET_AUTHORIZATION =
* ET_SUPERIOR_OBJECT =
* ET_PREDECESSOR_TASK =
* ET_SUCCESSOR_TASK =
* ET_ROLEASSIGNMENTS =
* RETURN =
.
* navigate from <CONTEXT> to <TREE_NODES> via lead selection
lo_nd_tree_nodes = wd_context->get_child_node( name = wd_this->wdctx_tree_nodes ).
* @TODO handle non existant child
* IF lo_nd_tree_nodes IS INITIAL.
* ENDIF.
* get element via lead selection
* lo_el_tree_nodes = lo_nd_tree_nodes->get_element( ).
* alternative access via index
lo_el_tree_nodes = lo_nd_tree_nodes->get_element( index = lv_index ).
* @TODO handle not set lead selection
IF lo_el_tree_nodes IS INITIAL.
ENDIF.
* @TODO fill attribute
lv_zz_forecasted_start = lt_ES_TASK_DETAIL-FORECASTED_START.
** set single attribute
lo_el_tree_nodes->set_attribute(
name = `ZZ_FORECASTED_START`
value = lv_zz_forecasted_st
Please could you tell me where iam wrong
Thanks & Regards,
Meena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Meena,
Can you explain the node strucutre of your context ?
What i have understood is you have Treen_nodes as node.
Tree_Nodes node has GUID attribute and ZZ_FORECASTED_START attribute right. ?
how is your tree strucuture defined and on which loadchilderen have you written code? Where exactly you are getting dump??
Hi Ravi,
Thanks for your reply. I have added two custom column to standard component. My requirment is need to retrieve the data from the data but not able to set the values for this two attributes, because it is in recurisive tree structure. Please let me know how to set values for the attributes which are in tree structure.
Thanks & regards,
Meena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Meena,
To set the values in the recursive structure node first you need to get selected parent element of the node and that parent node reference you have to use it while setting values to the child element.
In the Onloadchildren event handler method of the tree node type you will get selected element.
Regards,
Ravikiran.K
Hi Meena,
To add custom fields to the standard webdynpro component you have to use Enhancement concept.
Regards,
Ravikiran.K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.