Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

SM30 Events: Refresh Maintenance Screen after DB Update

$
0
0

Hello All,

 

Before posting my query I have already gone through the other posts form SCN related to the same. Since I could not get the exact answer I'm posting this question.

 

My scenario is simple as explained below:

 

1. Created a Custom DB Table.

2. Created a Maintenance View.

3. I wanted to update a Timestamp Field ( This is a display field only ) automatically after the User changes a particular record ( Other  Non-Key Fields Data).

4. I have created an Event AFTER_SAVE and have written the code to update the Timestamp Field.

5. I have placed the Routine AFTER_SAVE in the 01 Event.

6. Now, my problem is -->

 

After the User changes Records in the Maintenance View, the changed data (Other Non-Key Fields) is available on the screen after SAVE.

But, the Timestamp value which I'm filling in the Routine "AFTER_SAVE" is not getting changed / refreshed.

 

The User after closes the session and upon reopening the Maintenance View the updated Timestamp value is being displayed.

i.e. My routine is updating the DB value but not reflecting the change immediately on the Maintenance screen.

 

Here is my code -->

 

 

*&**********************************************************************
 *& Form:        AFTER_SAVE
 *& Description: Change the  Timestamp valueafter User's Change
 *&**********************************************************************
 FORM after_save.   DATA: f_index LIKE sy-tabix. "Index to note the lines found   TYPES BEGIN OF total_s.           INCLUDE STRUCTURE ZTAB.           INCLUDE STRUCTURE vimtbflags.   TYPES END OF total_s.   FIELD-SYMBOLS: <fs_total> TYPE total_s.   DATA itab TYPE total_s.   DATA: ls_total TYPE total.   LOOP AT total ASSIGNING <fs_total> CASTING.     IF <fs_total>-vim_action = 'U'.       READ TABLE extract WITH KEY <vim_xtotal_key>.       IF sy-subrc EQ 0.         f_index = sy-tabix.       ELSE.         CLEAR f_index.       ENDIF.
 * Modify the Time_Stamp field with the current Timestamp value       GET TIME STAMP FIELD <fs_total>-time_stamp.       itab = <fs_total>.       CHECK f_index GT 0.       extract = total.       MODIFY extract INDEX f_index.     ENDIF.     " IF <action> = 'U'.   ENDLOOP.  " LOOP AT total ASSIGNING <fs_total> CASTING.
ENDFORM. " Form AFTER_SAVE. 

How Should I refresh the Screen ?

 

I tried to write the following code in the Event 02:

 

*&**********************************************************************
 *& Form:        REFRESH_SCREEN
 *& Description: Refresh the Screen of the SM30 maintenance after
 *&              DB gets updated fom the AFTER_SAVE Routine
 *&**********************************************************************
 FORM refresh_screen.
 extract[] = total[].
ENDFORM. " Form AFTER_SAVE.

The above code is changing the Timestamp value for all the records.

But, I need the value to be changed for only those records for which the User has changed the Non-Key Fields Data.

 

Any help on achieving this in one event only ?

 

Regards,

Deepu.K


Viewing all articles
Browse latest Browse all 8332

Trending Articles