Skip to Content
Technical Articles
Author's profile photo Niveditha Reddy AMMIREDDY

How to update the CATSDB Table if the Hours and Amount values are Zero.


This Blog is about to update the CATSDB Table if the Hours and Amount values are Zero or no need to update the Amount/Hours Fields in CATSDB Table. Before doing that I will explain, in which cases does this requirement may needed.

Generally, we can update CATSDB Data using CAT2 Transaction and also using FM’s BAPI_CATIMESHEETMGR_CHANGE(for updating) and BAPI_CATIMESHEETMGR_INSERT(for creating).. etc.

But my requirement is, I need to update the Table without Hours and Amount. On this case, the above techniques are not helped to reach the requirement. So, I achieved this requirement using below example code to update the CATSDB Table without and Hours and Amount.

Step 1: Firstly, we need to get the latest counter value from the CATSDB Table.

Step 2: After fetching the value, we need to increment the counter value(because counter value is must while updating the record).

Step 3: Then, map the required filed to catsdb work area and update the table using below code.

DATA: ls_catsdb  TYPE catsdb,
      lv_counter TYPE catscounte,
      ls_cats    TYPE catsdb_ext,
      lt_cats    TYPE TABLE OF catsdb_ext,
      lt_msg     TYPE TABLE OF mesg.

**__ Fetch the latest Counter value from CATSDB
SELECT counter
  INTO lv_counter FROM catsdb

**__ Increment the Counter Value
lv_counter = lv_counter + 1.
ls_catsdb-counter = lv_counter.
ls_catsdb-awart = 'AV00'.
ls_catsdb-pernr = '1001516'.
ls_catsdb-workdate = '20210621'.

**__ Insert the Record
MODIFY catsdb FROM ls_catsdb.

IF sy-subrc EQ 0.
  WRITE:/ ls_catsdb-pernr, 'SUCESS'.


Run the Report.

After Run the Report, Record has been updated in CATSDB Table.

Note – In the above Code, I have used Hard coding to update the records.. instead of Hard coding we can update using dynamic value using input values.

The summary of this blog is to update the CATSDB Table without hours and Amount values using above code.

Hope this blog might help you…

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.