System Field SY-DATAR [SAP]

SAP ECC 6.0 [SAP_BASIS 700]

The goal is to understand whether the user enters something on the screen, so I can do a check for necessity of confirmation message.

System field SY-DATAR (Selection for Screen Field Input) exactly does the same thing. If there is a input by user, SY-DATAR = X.

SY-DATAR: Set to X at time of PAI if at least one screen input field was changed by the user or other data transfer, otherwise empty.

So a code can be developed like that:

IF gt_data_old[] = gt_data_new[] and
SY-DATAR = gc_false.

* No changes found
SET SCREEN 0.
LEAVE SCREEN.

ELSE.

CALL FUNCTION ‘POPUP_TO_CONFIRM_LOSS_OF_DATA’
EXPORTING
textline1 = ‘Do you really want to leave?’
tite1          = ‘Confirmation’
IMPORTING
answer      = gv_answer.

ENDIF.

References:

Tags: , , , ,

Leave a Reply