cancel
Showing results for 
Search instead for 
Did you mean: 

Data Transfer between Views

Former Member
0 Kudos

Hi, experts,

I want two views to 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 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.

As I am quite new to Web Dynpro, I am not sure whether I have done the right thing or not. If not, how is the right way to do it?

If I am right, now I have the runtime error message as following:

"you attempted to move one data object to another.

this is not possible here because the conversion of a data object of type "c" to type "l" is not supported. "

The error occures at the point of get_attribute of lead element (type ref to IF_WD_CONTEXT_ELEMENT.)

I did not see any conversion from "c" to "i" in my code.

Where can be the errors?

Thanks

Fan

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

Okay. I will close this thread.

Former Member
0 Kudos

Hi, to both,

I have solved the problem. I changed the way of declaration of specific types of attributes and used the following declaration for attribute of the node:

DATA ls_et_surveylist TYPE wd_this->element_et_surveylist.

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.

I appreciate your help:-)

Best Regards

Fan

Former Member
0 Kudos

Hi, Renald

I have debugged the code. There is no error. The error that I mentioned above is runtime error.

I am quite sure that the data structure is consistant.

I will keep finding the reason.

Thank you for your help:-)

Best regards

Fan

Former Member
0 Kudos

Hello Fan ,

For which attribute you get the runtime error . Can you please provide the long text of runtime error .

Regards

Vivek

RenaldWittwer
Contributor
0 Kudos

Hi Fan,

did you debug the code? At which statement breaks the programm?

Did you double check if the fields in the table have the same type as in the context?

Best regards

Renald

Former Member
0 Kudos

Hi, Renald

Sorry. Not SURVEY_ITEM but SURVEY_ELEMENT.

Best Regards

Fan

Former Member
0 Kudos

Hi, Renald,

In view 1 there is a table and one column of this table is linkToAction.

When the action is triggered, I should at first identify the row which is related to linkToAction and store the data of this row into a data structure SURVEY_ITEM and transfer the data to view 2 for further processing.

That is why I can not use wizard to read attributes, because they are the attributes of a context element, not a context node or attribute.

Best Regards

Fan

RenaldWittwer
Contributor
0 Kudos

Hi Fan,

I do not understand, why do you use wdevent-> to get the attribute? I thought you want to read it from the context?

You should use the webdynpro wizard to get data from the context.

Actually you don't need to read the attributes, if you bind the input field with the context elements of the controller.

Best regrads

Renald

Former Member
0 Kudos

Hi, Renald,

Thanks a lot for your prompt reply.

I did try the re-mapping. The error remains.

Here is my code:

method ONACTIONONDETAIL .

DATA ele TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA node type REF TO IF_WD_CONTEXT_NODE.

DATA: guid TYPE REF TO UXP_GUID,

id TYPE REF TO UXP_ID,

description TYPE REF TO UXP_DESCRIPTION,

proc_org_id TYPE REF TO BBP_PROC_ORG,

category_id TYPE REF TO COMT_CATEGORY_ID,

product_id TYPE REF TO COMT_PRODUCT_ID,

creator TYPE REF TO UNAME,

create_dat TYPE REF TO SYDATUM.

  • 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' ).

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

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

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

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

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

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

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

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

wd_this->fire_survey_detail_plg(

).

ENDMETHOD.

Is there anything wrong?

Best regards

Fan

RenaldWittwer
Contributor
0 Kudos

Hi Fan,

actually you did it the right way.

Did you changed the structure after the mapping? In this case you have to do the mapping again. This could one reason for this problem.

Best regards

Renald