Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

There are essential four condtions, which influence the items in time sheet

  1. The customizing of the CATS Data Entry Profiles must be set correctly.
  2. The Link between the personal numer (Cat2) and Business Partner (cProject) must be maintained correctly. (note 954860)
  3. The business partner must be assigned to a role or task within the used time period
  4. The  involved cProject objects (role or task) must have a accounting assignment. (P.S: Please DO NOT mix up the terms 'object link with a controlling object' and 'accounting assignment'. )

As the program does not know, what the user expects. If there no items should be displayed,  it display nothing. No warning or error will be occured for such case.  The following check report should give you a quick answer, why there is no items is displayed in the time sheet.  The report will be improved continously, if feedback is given.

Hope, it can give you some helps at reason search (big grin)

Thanks and regards,

Zhenbo  

*&---------------------------------------------------------------------*
*& Report Z_CAT2_CPRO_ANALYSE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT Z_CAT2_CPRO_ANALYSE.

Parameters:
Variant like TCATST-VARIANT,
InpDate like CATSFIELDS-INPUTDATE,
Persnr like CATSFIELDS-PERNR.

CONSTANTS: yx TYPE c VALUE 'X'.

Tables: TCATST, TCATS.
data: CATSFIELDS like CATSFIELDS.
DATA: pernr_list LIKE pernr_list_structure OCCURS 0 WITH HEADER LINE.
DATA: SUBRC like sy-subrc.
DATA: days_on_screen LIKE sy-tabix. "
CONSTANTS: BEGIN OF pertype,
daily(1) VALUE '1',
weekly(1) VALUE '2',
halfmonthly(1) VALUE '3',
monthly(1) VALUE '4',
END OF pertype.
CONSTANTS: days_of_a_week LIKE sy-tabix VALUE 7.
CONSTANTS: arbgb LIKE mesg-arbgb VALUE 'LR'.
CONSTANTS: const_1 LIKE sy-tabix VALUE '1'.
CONSTANTS: const_16 LIKE sy-tabix VALUE '16'.

DATA: dateleft LIKE catsfields-dateleft.
DATA: dateright LIKE catsfields-dateright.
DATA: begdate LIKE catsfields-dateleft.
DATA: begweek LIKE catsfields-catsweek.

DATA: lv_pernr LIKE catsdb-pernr.
DATA: icatsw LIKE catsw OCCURS 0 WITH HEADER LINE.
DATA: lt_icatsw LIKE icatsw OCCURS 0 WITH HEADER LINE.
DATA: wa_icatsw LIKE LINE OF icatsw.

TCATST-Variant = variant.
CATSFIELDS-INPUTDATE = INPDATE.
lv_pernr = persnr.

SELECT SINGLE * FROM TCATST WHERE VARIANT = TCATST-VARIANT
AND LANGU = SY-LANGU.

if sy-subrc is initial.
SELECT SINGLE * FROM TCATST WHERE VARIANT = TCATST-VARIANT.
endif.
if not sy-subrc is initial.
write: / ' Variant', TCATST-VARIANT, 'not valid' .
exit.
endif.

SELECT SINGLE * FROM TCATS WHERE VARIANT = TCATST-VARIANT.

IF tcats-workcpro IS INITIAL.
write: / ' Variant', TCATST-VARIANT, 'does not tick the flag workcpro' .
write: / ' Todo : run CAC1, select variant ', TCATST-VARIANT, ', tick the flag: From ProjectAssignment'.
exit.
endif.

IF tcats-worklist IS INITIAL.
write: / ' Variant', TCATST-VARIANT, 'does not tick the flag worklist' .
write: / ' Todo : run CAC1, select variant', TCATST-VARIANT, ', tick the flag: with_worklist'.
exit.
endif.

if tcats-hrcostasg EQ 'A'.
write: / ' Variant', TCATST-VARIANT, ' for cProject is costing of receiver not allowed' .
write: / ' Todo : run CAC1, select variant', TCATST-VARIANT, ', change the option: Cost accounting variant '.
exit.
endif.

* CALL TRANSACTION 'CAT2' and skip first screen.
* check the date
begdate = catsfields-inputdate.
Perform set_week(SAPLCATS) USING begdate begweek.

PERFORM get_boundaries USING begdate dateleft dateright begweek
days_on_screen.

* calculate left border
DO tcats-perleft TIMES.
PERFORM scroll_in_time USING begdate dateleft dateright begweek
space yx.
ENDDO.
catsfields-dateleft = dateleft.

begdate = catsfields-inputdate.
PERFORM set_week(SAPLCATS) USING begdate begweek.
PERFORM get_boundaries USING begdate dateleft dateright begweek
days_on_screen.
* calculate right border
DO tcats-perright TIMES.
PERFORM scroll_in_time USING begdate dateleft dateright begweek
yx space.
ENDDO.
catsfields-dateright = dateright.

* Data defenition
DATA: lv_bpguid TYPE bu_partner_guid,
lt_receivers LIKE bdi_logsys OCCURS 0 WITH HEADER LINE,
lt_worklist LIKE caba_cpr_communication OCCURS 0,
lt_filters LIKE bdi_fobj OCCURS 0 WITH HEADER LINE,
lv_line TYPE i,
lv_index LIKE sy-tabix.

* Get receiver for RFC
CALL FUNCTION 'ALE_ASYNC_BAPI_GET_RECEIVER'
EXPORTING
object = 'TSCPRCONNE'
method = 'TransferCPR'
TABLES
* RECEIVER_INPUT =
receivers = lt_receivers
filterobject_values = lt_filters
EXCEPTIONS
error_in_filterobjects = 1
error_in_ale_customizing = 2
OTHERS = 3.

IF lt_receivers[] IS INITIAL.
write: / ' NO RFC FOR ALE Found, only O.K, if the cProject is ',
'installed in the same system ' .
* Get buiseness partner via persinal number
CALL FUNCTION 'BP_CENTRALPERSON_GET'
EXPORTING
iv_employee_id = lv_pernr
IMPORTING
* EV_PERSON_ID =
ev_bu_partner_guid = lv_bpguid
EXCEPTIONS
no_central_person = 1
no_business_partner = 2
no_id = 3
OTHERS = 4.
IF sy-subrc <> 0.
write: / ' Can not find the business partner accordingly for person number',
lv_pernr.

EXIT.
ENDIF.

TRY.
* Get worklist for cProjects
CALL FUNCTION 'DPR_API_CATS_WORKLIST' "#EC *
EXPORTING
bu_partner_guid = lv_bpguid
beg_date = catsfields-dateleft
end_date = catsfields-dateright
language = sy-langu
TABLES
et_worklist = lt_worklist.
CATCH cx_sy_dyn_call_illegal_func.
* DO nothing
ENDTRY.

if lt_worklist[] is initial.
write: / ' Do not find any records (Staffing) for the business partner',
lv_bpguid.
write: / ' Between time periode', catsfields-dateleft, ' -->',
catsfields-dateright.
write: / ' Please staff the buiness partner to a role at first'.

endif.

ELSEIF NOT lt_receivers[] IS INITIAL.
DESCRIBE TABLE lt_receivers LINES lv_line.
* Only one reciver

READ TABLE lt_receivers INDEX lv_line.

  IF lv_line GT 1.
   write: / ' More than one ALE receiver found.',
            'Please check ALE/BAPI distribution model'.
   exit.
  ENDIF.

* Get buiseness partner via persinal number
CALL FUNCTION 'BP_CENTRALPERSON_GET' DESTINATION lt_receivers
EXPORTING
iv_employee_id = lv_pernr
IMPORTING
* EV_PERSON_ID =
ev_bu_partner_guid = lv_bpguid
EXCEPTIONS
no_central_person = 1
no_business_partner = 2
no_id = 3
OTHERS = 4.
IF sy-subrc <> 0.
write: / ' Can not find the business partner accordingly for person number',
lv_pernr, ' in cProject system ', lt_receivers.
ENDIF.

* Get worklist for cProjects
CALL FUNCTION 'DPR_API_CATS_WORKLIST' DESTINATION lt_receivers
EXPORTING
bu_partner_guid = lv_bpguid
beg_date = catsfields-dateleft
end_date = catsfields-dateright
language = sy-langu
TABLES
et_worklist = lt_worklist.

if lt_worklist[] is initial.

write: / ' Do not find any records (Staffing) for the business partner',
lv_bpguid.
write: / ' Between time periode', catsfields-dateleft, ' -->',
catsfields-dateright.
write: / ' Please staff the buiness partner to a role or task at first'.
endif.

ENDIF.

PERFORM map_inbound(SAPLCATS) TABLES: lt_worklist
lt_icatsw.

Data: lv_amount like sy-tabix.

describe table lt_icatsw lines lv_amount.
write: / lv_amount, ' items selected in worklist'.
clear lv_amount.

* Get CO-receiver for accounting manager scenario
LOOP AT lt_icatsw.
wa_icatsw = lt_icatsw.
lv_index = sy-tabix.
CALL FUNCTION 'GET_CO_RECEIVERS'
CHANGING
c_icatsw = lt_icatsw.
IF wa_icatsw = lt_icatsw.
* no accounting information found -> ommit
lv_amount = lv_amount + 1.
* write: / ' no accouting object found, => removed from worklist'.
ELSE.
wa_icatsw = lt_icatsw.
APPEND wa_icatsw TO icatsw.
ENDIF.
ENDLOOP.

if not lv_amount is initial.
write: / lv_amount, ' items removed from worklist', ' because of no accouting object found '.
endif.

include LCATSF40.
include LCATSF03.
include LCATSF5S.
include LCATSF67.

 

 

Back

  • No labels

4 Comments

  1. Guest

    Zhenbo, Igor,

    this program is great! I had the problem that the worklist was not filled when switching from an ALE-based cPro-CATS integration scenario to ERP internal scenario. Thanks to the program, I quickly realized that the still existing ALE-connection was the reason for this. I guess, your program saved me some hours.

    Thanks,

    Hansjörg

  2. Hi Hansjörg,

    Thanks for feedback, nice to know that.

    Kind regards from ST.Leon-Rot

    Zhenbo  

  3. Former Member

    Hi Zhenbo,

    System: PPM 6 SP2

    Our developer says,

    "This is a custom report which needs to be created and activated, can

    only work only in the system where PPM and ECC/CATS are installed in

    same box. SZ0 (PPM) and SE2 (ECC / CATS) are in different boxes. So I

    cannot activate it here."

     Please advise.

    Thanks,

    Arjun Shenoy

     

     

  4. Zhenbo - well done! Helps me to get forward. Thanks