Skip to Content
0
Former Member
Dec 03, 2008 at 01:07 PM

data transfer

18 Views

Hi, experts,

I still have problems with the issue:

two views share the data stored in a data structure.

I created this structure as node of component controller and also as node of each of the two views using context mapping to that node in component controller. After the action in View 1 is triggered, the node in view controller will be filled with data (the data should be extracted using get attribute from another node element and transfered to this node using set attribute) and then it will be navigated to view 2.

And I think the data should be automatically stored in the node of component controller and also that of view 2. In view 2 the data will be represented.

But when I try to retrieve the attribute of this data structure in view 2, it failed: the data is not automatically stored in the corresponding node in view 2.

Do I still need to do something to transfer the data in node of view1 to the node of component controller and to node of view 2?

The following code is in view 1(I stored the data in the attribute)

DATA new_ele TYPE REF TO if_wd_context_element.

DATA ls_et_surveylist TYPE wd_this->element_et_surveylist.

DATA ele TYPE REF TO if_wd_context_element.

DATA node type REF TO IF_WD_CONTEXT_NODE.

DATA: guid LIKE ls_et_surveylist-guid,

id LIKE ls_et_surveylist-id,

description LIKE ls_et_surveylist-description,

proc_org_id LIKE ls_et_surveylist-proc_org_id,

category_id LIKE ls_et_surveylist-category_id,

product_id LIKE ls_et_surveylist-product_id,

creator LIKE ls_et_surveylist-creator,

create_dat LIKE ls_et_surveylist-create_dat.

  • get the context element whose linkToAction is triggered.

ele ?= wdevent->get_context_element( name = 'CONTEXT_ELEMENT' ).

  • get the attributes of this context element.

CALL METHOD ele->get_attribute EXPORTING name = 'GUID' IMPORTING value = guid.

CALL METHOD ele->get_attribute EXPORTING name = 'ID' IMPORTING value = id.

CALL METHOD ele->get_attribute EXPORTING name = 'DESCRIPTION' IMPORTING value = description.

CALL METHOD ele->get_attribute EXPORTING name = 'PROC_ORG_ID' IMPORTING value = proc_org_id.

CALL METHOD ele->get_attribute EXPORTING name = 'CATEGORY_ID' IMPORTING value = category_id.

CALL METHOD ele->get_attribute EXPORTING name = 'PRODUCT_ID' IMPORTING value = product_id.

CALL METHOD ele->get_attribute EXPORTING name = 'CREATOR' IMPORTING value = creator.

CALL METHOD ele->get_attribute EXPORTING name = 'CREATE_DAT' IMPORTING value = create_dat.

  • set the attributes of the node to be shared.

node = wd_context->get_child_node( name = 'SURVEY_ELEMENT' ).

new_ele ?= node->create_element( ).

new_ele->SET_ATTRIBUTE( name = 'GUID' value = guid ).

new_ele->SET_ATTRIBUTE( name = 'ID' value = id ).

new_ele->SET_ATTRIBUTE( name = 'DESCRIPTION' value = description ).

new_ele->SET_ATTRIBUTE( name = 'PROC_ORG_ID' value = proc_org_id ).

new_ele->SET_ATTRIBUTE( name = 'CATEGORY_ID' value = category_id ).

new_ele->SET_ATTRIBUTE( name = 'PRODUCT_ID' value = product_id ).

new_ele->SET_ATTRIBUTE( name = 'CREATOR' value = creator ).

new_ele->SET_ATTRIBUTE( name = 'CREATE_DAT' value = create_dat ).

wd_this->fire_survey_detail_plg(

).

Thanks

Fan