cancel
Showing results for 
Search instead for 
Did you mean: 

Context change log--- bind table

Former Member
0 Kudos

Hello Friends,

I tried to record the change log what I find is it works fine if I have a attribute/node in context of controller change direclty in view ( via mapping ) but If i have a node in context of controller which is changed via bind_table.... it does not record the changes ? is it true for you all or am I doing something wrong ?

Regards,

Accepted Solutions (0)

Answers (2)

Answers (2)

uday_gubbala2
Active Contributor
0 Kudos

Hi Shah,

Please try go through Rahul's replies in this [thread|;.

Regards,

Uday

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This is the note in online help:

The table records solely changes made by the user; changes to context elements that were made in the programs (for example, dynamic programming) are not listed.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/47/a8e5d273b12fe2e10000000a42189d/frameset.htm

Former Member
0 Kudos

Hello Friends,

I am trying to get the NEW_VALUE of str wdr_context_change......... but when i try to assign I got exception ( cant convet type 'I' to D ) ?

Anyone pls let me know how I can get the NEW_VALUE assigned to my field ?

Thanks and regards,

lt_change = lo_componentcontroller->get_change_log( ).

LOOP AT lt_change INTO ls_change.

CASE ls_change-node_name.

WHEN 'IMP_NOTIFHEADER'.

  • IF ls_change-attriute_name eq 'DESENDDATE'.

  • ls_imp_notifheader_old-DESENDDATE = ls_change-new_value.

  • ENDIF.

*

ASSIGN COMPONENT ls_change-ATTRIBUTE_NAME OF STRUCTURE ls_imp_notifheader_old TO <comp>.

  • move ls_change-NEW_VALUE to <comp>.

<comp> = ls_change-NEW_VALUE.

Last line of code, result in exception.,............

Edited by: Shah H on Jul 23, 2009 6:41 PM

Former Member
0 Kudos

Hi, Check standard component DEMO_CONTEXT_CHANGES. Regards, RAdhika.

Former Member
0 Kudos

I am getting following: Conversion of type l to type D not supported

uday_gubbala2
Active Contributor
0 Kudos

Hi Shah,

You are getting that error because you are trying to assign 2 incompatible data types to each other. Just make the following changes to your code.

Instead of using ls_change type wdr_context_change try make use of a field symbol instead. The advantage of following this approach is that you would be able to cast it to a string as how shown below:

data: lv_str type string.

field-symbols: <change> type wdr_context_change,
	       <new> type <data>.

Now loop through wdr_context_change_list like earlier & when it comes to the assignment say as :

assign <change>-new_value->* to <new>.

lv_str = cl_wdr_conversion_utils=>to_string( value = <new> ).

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Shah,

You would have got to know about this coding if you had gone through the method ONACTIONGET_CHANGES of the component DEMO_CONTEXT_CHANGES. I had earlier posted a link to 1 SDN thread & asked to go through Rahul's postings in there. He too was referring to the same standard component for reference. You can try go through that particular method & apply the similar logic even in your component.

Regards,

Uday

Former Member
0 Kudos

Hello All,

Okay, let me explain a bit why I need all this, might be there is a better way to do so.....

I have a view, which has TabStrip.... around 5... so each of the TABStrip has some inputfields which are mapped via controller.... when user enter some data in few inputfields in lest say TAB1 and jump to TAB2, I want to show him the msg that unsave data will be lost and he has optoin to go back in tab1 or remains now in tab2... if he goes in tab1, i want to read the new_value form change context and mapped to the inputfield ( as by return to tab1 already refresh the new value entered )

for that I need to bind the field of my mapped node with the value which is in "<change>-attribute_name"... this is a bit tricky, can any one pls suggest how I can do so ?

LOOP AT lt_change ASSIGNING <ls_change>.

CASE <ls_change>-node_name.

WHEN 'IMP_NOTIFHEADER'.

ASSIGN COMPONENT <ls_change>-ATTRIBUTE_NAME OF STRUCTURE ls_imp_notifheader_old TO <comp>.

assign <ls_change>-new_value->* to <new>.

lv_new_value = cl_wdr_conversion_utils=>to_string( value = <new> ).

<comp> = lv_new_value .

actually it should be as:

ls_imp_notifheader_old-<ls_change>-ATTRIBUTE_NAME = <ls_change>-new_value.

append ls_imp_notifheader_old to lt_imp_notifheader_old.

Any suggestoin any idea ??

uday_gubbala2
Active Contributor
0 Kudos

Hi Shah,

I am not clear about 1 thing. Suppose you are having number of input fields in TAB1 & the user navigates to 2nd tab without pressing on save. Up on seeing the warning message he would navigate back to the 1st tab & since he is within the same view all the data entered by him earlier within those input fields will remain intact. You don't have to worry about using the context change log and all. Right? Are you explicitly refreshing the contents of a tab when you navigate to the other tab coz or else the tab should retain all its earlier contents?

Regards,

Uday

Former Member
0 Kudos

You are right, let me explain in other way...

When have few tabs, first tab shows the list where one user can mark something ( lets say notification ) when user select one notification and goes in Tab2, the corresponding data will be shown in tab2 ( so tab 2 shows the details ) now when user changes something here in tab2 and goes in tab3 and comes agan in tab2 ( data will be shown to the user from backend and it overwrites not saved data....

So either I have to restrict him from going to backend when user comes in TAB1 after not saving data... maybe I can check for change-table and if there is something in change table then restrict program not to retrive again the data