*the code checks if the difference between the execution start date
*and the execution end date is equal to the value which is maintained
*in the table ZVVF_PP_COR6
*NOTE : The old value in the table ZVVF_PP_COR6 needs to be deleted if
*you intend to have a new date difference.i.e at any point of time there
*should be only one record in the table.
method IF_EX_WORKORDER_CONFIRM~AT_SAVE .
*BREAK-POINT.
DATA : DATE_DIFF TYPE P.
DATA : W_DIFF TYPE P.
DATA : DATE_LOW LIKE SY-DATUM.
DATA : DATE_HIGH LIKE SY-DATUM.
DATA : TIME_LOW LIKE SY-UZEIT.
DATA : TIME_HIGH LIKE SY-UZEIT.
DATE_LOW = IS_CONFIRMATION-ISDD.
TIME_LOW = IS_CONFIRMATION-ISDZ.
DATE_HIGH = IS_CONFIRMATION-IEDD.
TIME_HIGH = IS_CONFIRMATION-IEDZ.
*DIFF = DATE_HIGH - DATE_LOW.
CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
EXPORTING
DATE1 = DATE_LOW
TIME1 = TIME_LOW
DATE2 = DATE_HIGH
TIME2 = TIME_HIGH
IMPORTING
DATEDIFF = DATE_DIFF
* TIMEDIFF =
* EARLIEST =
EXCEPTIONS
INVALID_DATETIME = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SELECT SINGLE DIFF FROM ZVVF_PP_COR6 INTO W_DIFF.
IF DATE_DIFF > W_DIFF.
MESSAGE E000(ZPP1) WITH W_DIFF.
ENDIF.
endmethod.
No comments:
Post a Comment