Customer Enhancements for CATS
You can use this SAP enhancement to validate any data already recorded. The validation is performed for the entire time sheet. When you save data or you change the current data entry period by scrolling, the validation is called automatically. You can also call the validation via a function key.
Example: You do not want a user to record more than 8 hours per day. The transfer structure used for the data records is the table CHECK_TABLE. This table contains all the account assignment fields that are relevant to you. The two variables "DATEFROM" and "DATETO" contain the time limits of the time sheet to be validated.
If you want to return messages to the standard program, you will also need to use internal table I_MESSAGES. In this example, error message "001" is issued with message class "ZZ", message type "E" and parameter "XYZ". Making entries in table I_MESSAGES is equivalent to using the
command "MESSAGE E001(ZZ) WITH 'XYZ'". However, to ensure all that all the program flows can run, fill the internal table I_MESSAGES rather than use this command. Example: DATA: OLD_WORKDATE LIKE CATSDB-WORKDATE.
DATA: CATSHOURS LIKE CATSDB-CATSHOURS. REFRESH I_MESSAGES. SORT CHECK_TABLE BY WORKDATE. CLEAR OLD_WORKDATE. LOOP AT CHECK_TABLE WHERE WORKDATE BETWEEN DATEFROM AND DATETO. IF OLD_WORKDATE NE CHECK_TABLE-WORKDATE.
OLD_WORKDATE = CHECK_TABLE-WORKDATE. CLEAR CATSHOURS. CATSHOURS = CATSHOURS + CHECK_TABLE-CATSHOURS. ELSE. CATSHOURS = CATSHOURS + CHECK_TABLE-CATSHOURS. ENDIF. IF CATSHOURS GT 8.
I_MESSAGES-MSGTY = 'E'. I_MESSAGES-MSGID = 'ZZ'. I_MESSAGES-MSGNO = '001'. I_MESSAGES-MSGV1 = 'XYZ'. APPEND I_MESSAGES. ENDIF. ENDLOOP.
Function/Program:- EXIT_SAPLCATS_006: CATS: Validate Entire Time Sheet
|