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

ALV issue: method DATA_CHANGED called twice

yes_sapteam
Participant
0 Likes
893

Hi.

I have implemented my own F4 for my ALV and now I get a problem since my DATA_CHANGED method is called BEFORE I change the cell content AND AFTER and this causes problems in my logic.

There is a demo program in SLIS ("BCALV_EDIT_03") but they use the default F4 that comes from the DDIC.

Another issue is that their MT_GOOD_CELLS always have the last cell that was changed, while my MT_GOOD_CELLS have all the cell I changed from previous visits to DATA_CHNAGED.

For example I change the value of FieldA and I visit the MY_DATA_CHANGED method and MT_GOOD_CELLS have 1 record with data on FieldA.

Than I change FieldB and when I visit MY_DATA_CHANGED method the MT_GOOD_CELLS have 2 record: 1 with data on FieldA and 1 with data on FieldB.

Any help will be appreciated.

ayal.

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
513

Hello Ayal

Sample report <b>BCALV_TEST_GRID_F4_HELP</b> explains most of the F4 help options in ALV lists. You can choose to check values before and after the F4 event.

If your event handler method for event DATA_CHANGED should be triggered only AFTER calling the F4 help then I guess you should have the following coding in your method:

* We are in the F4 event
  IF ( e_onf4 = 'X' ).
 
*   Event: after the F4 help value has been selected
    IF ( e_onf4_after = 'X' ).
*    valide values selected by F4 help
     ...
   ELSE.
     RETURN.  " leave method my_data_changed
   ENDIF.

  ENDIF.

Regards

Uwe

Read only

0 Likes
513

Hi Uwe.

Thanx for the reply but my problem is that if I compare my program behaviour to the demo program "BCALV_EDIT_03" I see that their DATA_CHANGED method is only visited when the Enter is pressed and <i>only after</i> a value was changed.

I copied this demo program code to the letter and still my method is visited twice !!

I have some Java experiance and I don't understand why this event should ever be called twice. I think that there should be an event of

before_data_changed

and another

after_data_changed

, but that's me.

Another issue I have is that my

mt_good_cells

have all the fields I touched while it should only have the last field.

thanx

ayal.