Method IS_MODIFIED
Use
The system should only save data on the maintenance screen if the user has actually changed the data. The process control in function group BRF_MAINTENANCE asks the instance of the current maintenance class by calling its method IS_MODIFIED.
Sample source text:
Only the main parts of the source text are mentioned below. The intention is just to show an example of the behavior.
METHOD if_maintenance_brf~is_modified .
CALL METHOD super->if_maintenance_brf~is_modified
IMPORTING
ev_modified = ev_modified.
CALL METHOD cl_aux_brf=>check_table_difference
EXPORTING
it_old = mt_brf144_old
it_cur = mt_brf144_cur
iv_tabname = 'TBRF144'
IMPORTING
ev_is_different = ev_modified.
IF ev_modified = mc_true.
APPEND 'TBRF144' TO mt_changed_tables.
ENDIF.
ENDMETHOD.
Description:
To start with, the IS_MODIFIED method of the superclass is called. This call is obligatory.
In the IS_MODIFIED method, the relevant CUR tables and CUR structures are compared with the corresponding OLD tables and OLD structures. So that you do not have to program this anew each time, class CL_AUX_BRF offers two static service methods that perform this comparison for both internal tables and structures.
In this example, the comparison is made for the internal tables MT_BRF144_OLD and MT_BRF144_CUR.
The following applies for this comparison:
-
If the CUR status and the OLD status differ, the output variable EV_MODIFIED is set to TRUE.
You must save.
-
If the CUR status and the OLD status are the same, the output variable EV_MODIFIED is set to FALSE.
There is no need to save.
-
If the CUR status and the OLD status differ, the name of the table to which one or multiple data records must be written is determined. The name of the table is added to the internal member table MT_CHANGED_TABLES via an append.
-
If you use the comparison method CHECK_STRUCTURE_DIFFERENCE for structures (and CHECK_TABLE_DIFFERENCE for tables) as here in the sample source text, the key fields are skipped in the comparison.
-
You can explicitly specify which fields should be compared, or explicitly specify which fields should be excluded from the comparison.
This behavior is used in the basis classes in particular.