Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

check_changed_data

Former Member
0 Likes
1,691

save_ok = ok_code.

  CLEAR ok_code.

  CASE save_ok.

    WHEN 'EXIT' OR 'BACK'.

      PERFORM exit_program.

    WHEN '&DATA_SAVE'.

      CALL METHOD grid1->check_changed_data

      IMPORTING

      e_valid = l_valid.

      IF l_valid = 'X'.

        PERFORM call_transaction.

      ENDIF.

    WHEN OTHERS.

*     do nothing

  ENDCASE.

here check_changed_data is returning always X to l_valid. 😞  how do i manipulate the code such that l_valid is blank initially and gets changed to X only if i change the value of an eidtable field in alv display???

6 REPLIES 6
Read only

Former Member
0 Likes
1,513

Need more explanations

Read only

0 Likes
1,513

initially the value of l_valid will be initial , later after executing the check_changed_data, the value is changing to X even though no change has been made to ALV display. why is it changing to X ??

Read only

0 Likes
1,513

Hi

The method check_changed_data returns X if no error occur, this method triggers the event DATA_CHANGED where all controls should be done.

In this event if an error occurs the error message can be triggered by the parameters ER_DATA_CHANGED, in this case the method check_changed_data will return the SPACE for I_VALID.

So if you don't use the event ER_DATA_CHANGED, I_VALID will always be equal to X: you don't have to use this method to check if a modification has been done, but just only to trigger the event for the control.

Max

Read only

0 Likes
1,513

... if you create your own handler you can check

if er_data_changed->mt_mod_cells is initial, that means no data have been changed.

Regards,

Clemens

Read only

phillip_manning2
Explorer
0 Likes
1,513

CHECK_CHANGED_DATA, although it has the word CHECK in it, is not a boolean method but a functional method.

You call this to ensure all the changes waiting on the SAPGUI are flushed through to the SAP Backend. I.e. if a user has typed in a cell, but not hit enter yet, CHECK_CHANGED_DATA will bring the change through.

In my programs for editable ALVs, I always keep an original copy of the data (for undo functionality).

So, after you call this method, just compare the origirinal ITAB with the current ITAB and you will know if a change has occurred.

Cheers,

Phil

Read only

Former Member
0 Likes
1,513

Hi Karthik,

Please check whether your system field SY-DATAR is getting populted, If yes

manipulate your code according to that.

SY-DATAR returns  whether the user enters something on the screen.

Regards,

Arun