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

BAPI_CATIMESHEETMGR_CHANGE problem

Former Member
0 Likes
1,204

Hi all,

I need to change some cats records but I have error with BAPI_CATIMESHEETMGR_CHANGE :

L'enregistrement de données pour le numéro 000000000033 ne peut être traité

The data record for the n° 000000000033 can't be performed

All works fine until the CHANGE bapi.

Here is the sample code I use for my test :

CONSTANTS :
  c_cats_profile   LIKE bapicats6-profile VALUE 'ZCATS'.

  DATA:
    it_employee TYPE STANDARD TABLE OF bapihrselemployee,
    ws_employee LIKE LINE OF it_employee.

  DATA:
    it_cats_in TYPE STANDARD TABLE OF bapicats1,
    ws_cats_in LIKE LINE OF it_cats_in.

  DATA:
    it_cats_out TYPE STANDARD TABLE OF bapicats2,
    ws_cats_out LIKE LINE OF it_cats_out,

    it_cats_mod TYPE STANDARD TABLE OF bapicats3,
    ws_cats_mod LIKE LINE OF it_cats_mod.

data: it_pernr type table of pa0002-pernr,
      wa_pernr like line of it_pernr.


data: return type table of BAPIRET2.



SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t1.
PARAMETERS: p_date TYPE sy-datum DEFAULT '20090105',
            p_trig(3) TYPE c DEFAULT 'OCH'.
SELECTION-SCREEN END OF BLOCK b1.




START-OF-SELECTION.



select pernr into table it_pernr from PA0002 where inits = p_trig.

loop at it_pernr into wa_pernr.
CLEAR ws_employee.
ws_employee-sign = 'I'.
ws_employee-option = 'EQ'.
ws_employee-low = wa_pernr.
APPEND ws_employee TO it_employee.
endloop.


CALL FUNCTION 'BAPI_CATIMESHEETRECORD_GETLIST'
  EXPORTING
    fromdate              = p_date
    todate                = p_date
*   GET_LONGTEXT          =
*   TEXT_FORMAT_EXP       =
  tables
    sel_employee          = it_employee
    catsrecords_out       = it_cats_out
*   EXTENSIONOUT          =
    return                = return
*   LONGTEXT              =
          .








loop at it_cats_out into ws_cats_out.
MOVE-CORRESPONDING ws_cats_out TO ws_cats_mod.
        ws_cats_mod-catshours = 4.
append ws_cats_mod to it_cats_mod.
endloop.




    CALL FUNCTION 'BAPI_CATIMESHEETMGR_CHANGE'
*      EXPORTING
*        profile               = c_cats_profile
*        testrun               = p_test
*     RELEASE_DATA          =
*     AGENT                 =
*     TEXT_FORMAT_IMP       =
      TABLES
        catsrecords_in        = it_cats_mod
*     EXTENSIONIN           =
*     CATSRECORDS_OUT       =
*     EXTENSIONOUT          =
*     WORKFLOW_TEXT         =
        return                = return
*     LONGTEXT              =
              .

              if sy-subrc <> 0.

              endif.

I have read that if the bapi has 1error, none of the record are inserted/modified but I dont know what is the error 😕

Regards,

Antoine

3 REPLIES 3
Read only

erp_superman
Explorer
0 Likes
765

When I've done this, I found the errors in the bapiret2 table.  You named the table 'return'.  In addition, it seems that sy-subrc 0 is returned even if there are errors reported in bapiret2.  You might try checking sy-msgno <> 0 as well.  Worked for me.

Hope this helps someone!

Read only

Former Member
0 Likes
765

Hi Shwaps,

Just going through he documentation i found 3 points.

1.This function is only supported if you use the Professional Services Order Processing and Personnel Planning (PRS_ERP_CPILS_1) business function in your system.

2.When posting begins, all numeric fields not in use must be set to initial. You do this by filling all characters of the relevant fields with '0'.

3.Always schedule data to be posted as often as possible and include only a small number of records in each posting.

Hope it helps.

Regards,

Kannan

Read only

RaymondGiuseppi
Active Contributor
0 Likes
765

Never check BAPI success with a sy-subrc value, a BAPI must neither return an error, always use the returned parameter RETURN (table or structure) look for message type 'E', if none you can COMMIT WORK else correct error, raise error or fill a log.

Hint: Also look at often forgotten fields of BAPIRET2 as PARAMETER, ROW and FIELD.

Regards,
Raymond