Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

IDOC_INPUT_CATS_INSERT - Enhance

Former Member
0 Likes
1,411

Dear All,

I need to enhance the Idoc Inbound  IDOC_INPUT_CATS_INSERT based on my requirement(I'm getting the data from PI Server). For that I found two exit like below,

EXIT_SAPLCATS_006

EXIT_SAPLCATS_003

In EXIT_SAPLCATS_003 I wrote the below code, but it is not changing the value,

TYPES: BEGIN OF ty_catsdb,

         pernr     TYPE catsdb-pernr,

         workdate  TYPE catsdb-workdate,

       END OF ty_catsdb.

DATA lv_date        TYPE catsdb-workdate.

DATA lv_date1       TYPE catsdb-workdate.

DATA lv_date2       TYPE char1.

DATA lc_count        TYPE i.

"Range table for date field

DATA lrs_date       TYPE cacs_s_range_post_date.

DATA lrt_date       TYPE cacs_t_range_post_date.

DATA ls_catsdb      TYPE ty_catsdb.

DATA lt_catsdb      TYPE TABLE OF ty_catsdb.

BREAK-POINT.

IMPORT lv_date2 TO lv_date2 FROM MEMORY ID 'CTAB'.

IMPORT lv_date1 TO lv_date1 FROM MEMORY ID 'CTAB1'.

IMPORT lc_count TO lc_count FROM MEMORY ID 'CTAB2'.

IF lv_date2 IS INITIAL.

   lrs_date-sign    = 'I'.

   lrs_date-option  = 'BT'.

   CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

     EXPORTING

       iv_date             = fields-workdate

     IMPORTING

       ev_month_begin_date = lrs_date-low

       ev_month_end_date   = lrs_date-high.

   APPEND lrs_date TO lrt_date.

   CLEAR: lrs_date.

   SELECT

     pernr

     workdate

     FROM catsdb

     INTO TABLE lt_catsdb

     WHERE pernr    EQ fields-pernr AND

           workdate IN lrt_date.

   IF sy-subrc = 0.

     SORT lt_catsdb BY workdate DESCENDING.

     IF lt_catsdb IS NOT INITIAL.

       READ TABLE lt_catsdb INTO ls_catsdb INDEX 1.

       IF ls_catsdb-workdate > 0.

         lv_date1 = ls_catsdb-workdate + 1.

         MOVE 'X' TO lv_date2.

         EXPORT lv_date2 TO MEMORY ID 'CTAB'.

         EXPORT lv_date1 TO MEMORY ID 'CTAB1'.

       ENDIF.

     ENDIF.

   ELSE.

     MOVE 'X' TO lv_date2.

     EXPORT lv_date2 TO MEMORY ID 'CTAB'.

   ENDIF.

ENDIF.

IF lv_date1 > 0.

   fields-workdate = lv_date1 + lc_count.

*   old_data = 'X'.

   ADD 1 TO lc_count.

   EXPORT lc_count TO MEMORY ID 'CTAB2'.

ELSE.

   fields-workdate = lv_date + lc_count.

*   old_data = 'X'.

   ADD 1 TO lc_count.

   EXPORT lc_count TO MEMORY ID 'CTAB2'.

ENDIF.

In EXIT_SAPLCATS_006 also I wrote the condition based on my requirement.

When I came out from both the exits, It is not affecting anywhere In the above Idoc. Kindly help me out.

I already gone through SCN forms, I could not find the solution for this. So kindly help me.

Regards,

John.

Dear All,

I need to enhance the Idoc Inbound  IDOC_INPUT_CATS_INSERT based on my requirement(I'm getting the data from PI Server). For that I found two exit like below,

EXIT_SAPLCATS_006

EXIT_SAPLCATS_003

In EXIT_SAPLCATS_003 I wrote the below code, but it is not changing the value,

TYPES: BEGIN OF ty_catsdb,

         pernr     TYPE catsdb-pernr,

         workdate  TYPE catsdb-workdate,

       END OF ty_catsdb.

DATA lv_date        TYPE catsdb-workdate.

DATA lv_date1       TYPE catsdb-workdate.

DATA lv_date2       TYPE char1.

DATA lc_count        TYPE i.

"Range table for date field

DATA lrs_date       TYPE cacs_s_range_post_date.

DATA lrt_date       TYPE cacs_t_range_post_date.

DATA ls_catsdb      TYPE ty_catsdb.

DATA lt_catsdb      TYPE TABLE OF ty_catsdb.

BREAK-POINT.

IMPORT lv_date2 TO lv_date2 FROM MEMORY ID 'CTAB'.

IMPORT lv_date1 TO lv_date1 FROM MEMORY ID 'CTAB1'.

IMPORT lc_count TO lc_count FROM MEMORY ID 'CTAB2'.

IF lv_date2 IS INITIAL.

   lrs_date-sign    = 'I'.

   lrs_date-option  = 'BT'.

   CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'

     EXPORTING

       iv_date             = fields-workdate

     IMPORTING

       ev_month_begin_date = lrs_date-low

       ev_month_end_date   = lrs_date-high.

   APPEND lrs_date TO lrt_date.

   CLEAR: lrs_date.

   SELECT

     pernr

     workdate

     FROM catsdb

     INTO TABLE lt_catsdb

     WHERE pernr    EQ fields-pernr AND

           workdate IN lrt_date.

   IF sy-subrc = 0.

     SORT lt_catsdb BY workdate DESCENDING.

     IF lt_catsdb IS NOT INITIAL.

       READ TABLE lt_catsdb INTO ls_catsdb INDEX 1.

       IF ls_catsdb-workdate > 0.

         lv_date1 = ls_catsdb-workdate + 1.

         MOVE 'X' TO lv_date2.

         EXPORT lv_date2 TO MEMORY ID 'CTAB'.

         EXPORT lv_date1 TO MEMORY ID 'CTAB1'.

       ENDIF.

     ENDIF.

   ELSE.

     MOVE 'X' TO lv_date2.

     EXPORT lv_date2 TO MEMORY ID 'CTAB'.

   ENDIF.

ENDIF.

IF lv_date1 > 0.

   fields-workdate = lv_date1 + lc_count.

*   old_data = 'X'.

   ADD 1 TO lc_count.

   EXPORT lc_count TO MEMORY ID 'CTAB2'.

ELSE.

   fields-workdate = lv_date + lc_count.

*   old_data = 'X'.

   ADD 1 TO lc_count.

   EXPORT lc_count TO MEMORY ID 'CTAB2'.

ENDIF.

In EXIT_SAPLCATS_006 also I wrote the condition based on my requirement.

When I came out from both the exits, It is not affecting anywhere In the above Idoc. Kindly help me out.

I already gone through SCN forms, I could not find the solution for this. So kindly help me.

Regards,

John.

7 REPLIES 7
Read only

Former Member
0 Likes
1,307

Dear All,

EXIT_SAPLCATS_006 - Inside this I'm getting more than the Idoc segment data, please help me out, Which exit is suitable to change the date field.

Regards,

John.


Read only

0 Likes
1,307

Dear All,

Any help for the above doubt. My requirement is when the date is came from PI I need to check that date is already exit in CATSDB table if exit I want to replace the next date to Work date else process the same data. Please give your suggestion, for change the date. For that in EXIT_SAPLCATS_003 I wrote the above logic but It not affected any where.

Regards,

John.

Read only

0 Likes
1,307

Dear All,

Any Help ?????

Regards,

John.

Read only

0 Likes
1,307

Hi John,

We would have to modify the Internal table with the data in it not IDOC. When the IDOC data is getting copied to the runtime internal table like XBVBAP, in that internal table we have to change the field value.

Regards,

Read only

0 Likes
1,307

Hi John

I had a look inside the inbound posting FM. It assign the data from idoc to BAPI fields and call the BAPI. As you have already tried above mentioned exit you can put an implicit enhancement at beginging of IDOC_INPUT one and modify the IDOC data contents so that these are passed the way you want them to be

NAbheet

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,307

EXIT_SAPLCATS_003 and 006 purpose are validation of data (single record or whole itab) and not suited to update data. You get better chance with an exit like EXIT_SAPLCATS_002 "CATS: Supplement Recorded Data".


But changing the WORKDATE key field, i'm puzzled by this requirement ?


Regards,

Raymond

Read only

0 Likes
1,307

Raymond Giuseppi very nice... i was not able to find it..John you can use this exit to update the workdate rather than going for implicit stuff which i have mentioned. They should be done when everything fails

Nabbheet