Skip to Content
-1
May 31, 2020 at 09:58 AM

Validation Message in TMG

117 Views Last edit May 31, 2020 at 09:59 AM 2 rev

Hello,

I have created one ztable and i want to apply validation message on 'DATE' Field in TMG that the date should be day after today. (i.e ztable-tripdat eq ( sy-datum + 1 ) ).

I have written below code , But it neither accepting any date. always giving error message on any date. Also have an another issue after pressing "ENTER" it gets save in table and if press on "SAVE" icon , then and then gives error message.Please check my code once.

FORM ZVALIDATE_ENTRY.
*  DATA: TRIPDAT TYPE ZTOM_ZDAILY2-TRIPDAT.
DATA lwa_row TYPE ZTOM_ZDAILY2.
  LOOP AT total.
    clear lwa_row.
    if <vim_total_struc> is ASSIGNED.
      MOVE-CORRESPONDING <vim_total_struc> to lwa_row.
    endif.

   if <action> NE 'N' and <action> is NOT INITIAL." and <action> NE 'U'.
      if  + lwa_row-tripdat NE ( sy-datum + 1 ).
        MESSAGE 'Enter Correct Date' TYPE 'S' DISPLAY LIKE 'E'.
        vim_abort_saving = 'X'.
        exit.
      endif.
    endif.
  ENDLOOP.
ENDFORM.