cancel
Showing results for 
Search instead for 
Did you mean: 

Context Problem.

Former Member
0 Kudos

Hi All,

I am using 3 function modules in my application.

I created views, for reading data from database and another for updating values in database. For Viewing View (Project_View Function Module), For Updating view (Project_Edit Function Module). When user cliecks UPDATE button on Viewing page(Table DATA), it passes viewing values to Updating view.

i.e. wdContext.Arch_Project_Edit_InputElement().SetTitle(wdContext.Arch_Project_ViewElement().getTitle).

It passing values from Viewing view to Updating View.

When i press UPDATE button on Updating View its updating my database. For only one record.

<u><b>MY QUATION HERE:</b></u>

When i click back button in Updating view and go back to update view. And if i select another record, Previous values are appearing in Update View.

Any idea ?. Sample code would be helpful.

Thanks and Regards

Ravi Golla

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Coding must be in WdModifyView() not in wdInit();

Former Member
0 Kudos

Ravi,

I can suggest better place: inbound plug handler.

If it works, then use this way while wdDoModifyView is called on every rendering.

VS

Former Member
0 Kudos

Ravi,

Please try a small test: for the Update view on "Properties" of view editor change Lifecylce property value from "framework_controlled" (it's a default) to "when_visible".

Typically this solves (without coding) majority of problems when view is not reinitialized correctly. Btw, in this case remove invalide() or bind() calls suggested by Abhijeet.

Valery Silaev

SaM Solutions

http://www.sam-solutions.net

Former Member
0 Kudos

Hi Valery,

I see your posts, thanks for your replies. my view is not refereshing with new values. what do you suggest. And i have another quation. I have a problem with dropdown boxes too. i want to set blank as first value in my dropdown box. SAP has provided with blank but i am using model node. i read about cardinalities and setLeadSelection. but my problem has not been solved. I think you can solve these two problems.

Thank you

Regards

Ravi Golla

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

If i understood correctly, then you have table in edit view, here you select the record and say update so it takes you to update view, here after clicking on UPdate button it updates values in database, i.e rfc getting executed.

and when again you go back to edit view previous values are seen right?, if this is your problem then this is because after updating values to database you gotta execute rfc which brings data to WD, so this updated data will be seen.

If your problem is , after going into update view the previously updated values are still seen , then invalidate() the context node in update view. Remember invalidate(), refresh all the data i.e. deletes. So this context should just be used in Update view , if it is used elsewhere then that data will be lost.

let me know if you have some other problem

regards

Former Member
0 Kudos

Hi Abhijeet,

We have tried to use invalidate() method in wdExit(); but it clears all my data. it does not appear anything in that view. Can you suggest me where to write this code.

Thanks

Ravi

abhijeet_mukkawar
Active Contributor
0 Kudos

Ravi,

I hope the context you are using in UpdateVIew has nothing to take with other context i.e, it is not being used anywhere else.

so on the action of BACK button in UpdateView write;

wdContext.node<UpdateNode>.invalidate()

regards

Former Member
0 Kudos

Hi Abhijeet,

I have put the code in action button. but it deleted all previous data and not showing any new data? fields are become read only! any other i idea you think.

thanks and Redards

Ravi

abhijeet_mukkawar
Active Contributor
0 Kudos

Hi,

check the cardinality of node in UpdateView it should be 1.n, or 1.1 (if at time you are updating only one item)

regards

Former Member
0 Kudos

Hi Abhijeet,

It is model node and cardinality o..n.

My Quation is : why it context is not clearing and only updating one record. when click another record still old record appears in context. i used invalidate() in wdDoExit() and and it Action Method too. but it is clearing all previous data and not appearing any new data even i click new record?. if you have any other idea than invalidate()?

Thank you

Regards

Ravi Golla

abhijeet_mukkawar
Active Contributor
0 Kudos

Ravi,

oho so it is a model node!!!

One thing you can do is,

when you create element of model node of Updateview, instead of using

addElement(); use bind();

i hope this element addition you are using in when you click on the row in firstview

. bind() replaces the entire existing collection of element so when you will do this ,before navigating to second view the newly added element will become the only element and then only this element is displayed.

About why it is updating only one record, so for that you may required to add all the elements you want to update.(then here before you execute rfc with updated values all the records are need to be kept in node and here bind() should not be used , instead addElement())

let me know if you have problem

regards