Skip to Content
0
Former Member
Aug 26, 2011 at 01:21 PM

2 Project Systems issues

21 Views

Hi,

I'm working on a project and having a couple of problems.

1. I wrote a program to upload a file from Kronos of employee activity and load into PS. That works. However, I would like to also be able to confirm the activity. I thought I was doing this correctly, the BAPI returns no errors, I do a BAPI_TRANSACTION_COMMIT, yet when I go to CJ20N and do the pull-down EDIT >ACTIVITY >CONFIRM, it still shows that the user needs to manually confirm. Here's the code:

  • Maintain the activity.

CLEAR: LT_METHOD_PROJECT.

LT_METHOD_PROJECT-REFNUMBER = '000001'.

LT_METHOD_PROJECT-OBJECTTYPE = 'NETWORKACTIVITY'.

LT_METHOD_PROJECT-METHOD = 'UPDATE'.

CONCATENATE LT_ACT-NETWORK ' ' LT_ACT-ACTIVITY INTO LT_METHOD_PROJECT-OBJECTKEY.

APPEND LT_METHOD_PROJECT.

CLEAR: LT_METHOD_PROJECT.

LT_METHOD_PROJECT-METHOD = 'SAVE'.

APPEND LT_METHOD_PROJECT.

CLEAR: LT_ACTIVITY_ELEMENT.

LT_ACTIVITY_ELEMENT-NETWORK = LT_ACT-NETWORK.

LT_ACTIVITY_ELEMENT-ACTIVITY = LT_ACT-ACTIVITY.

LT_ACTIVITY_ELEMENT-WORK_ACTIVITY = WA_UPLOAD-ARBEI.

APPEND LT_ACTIVITY_ELEMENT.

CLEAR: LT_ACTIVITY_ELEMENT_UPDATE.

LT_ACTIVITY_ELEMENT_UPDATE-NETWORK = 'X'.

LT_ACTIVITY_ELEMENT_UPDATE-ACTIVITY = 'X'.

LT_ACTIVITY_ELEMENT_UPDATE-WORK_ACTIVITY = 'X'.

APPEND LT_ACTIVITY_ELEMENT_UPDATE.

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

CALL FUNCTION 'BAPI_NETWORK_MAINTAIN'

IMPORTING

RETURN = ls_return

TABLES

I_METHOD_PROJECT = LT_METHOD_PROJECT

E_MESSAGE_TABLE = LT_MESSAGE_TABLE

I_ACTIVITY_ELEMENT = LT_ACTIVITY_ELEMENT

I_ACTIVITY_ELEMENT_UPDATE = LT_ACTIVITY_ELEMENT_UPDATE.

IF ls_return IS INITIAL.

REFRESH: E_MESSAGE_TABLE, I_CONFIRMATIONS, return.

CLEAR: NUMBER.

NUMBER = LT_ACT-NETWORK.

I_CONFIRMATIONS-ACTIVITY = LT_ACT-ACTIVITY.

I_CONFIRMATIONS-PERS_NO = HOLD_PERNR_SAP.

I_CONFIRMATIONS-ACT_TYPE = HOLD_PERNR.

I_CONFIRMATIONS-ACT_WORK = WA_UPLOAD-ARBEI.

APPEND I_CONFIRMATIONS.

CALL FUNCTION 'BAPI_NETWORK_CONF_ADD'

EXPORTING

NUMBER = NUMBER

IMPORTING

RETURN = return

TABLES

I_CONFIRMATIONS = I_CONFIRMATIONS

E_MESSAGE_TABLE = E_MESSAGE_TABLE.

READ TABLE E_MESSAGE_TABLE INDEX 1.

IF E_MESSAGE_TABLE-TYPE = 'I'

AND E_MESSAGE_TABLE-MESSAGE_ID = 'RU'

AND E_MESSAGE_TABLE-MESSAGE_NUMBER = '105'.

CALL FUNCTION 'BAPI_PS_PRECOMMIT'

TABLES

ET_RETURN = return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

RETURN = return.

PERFORM WRITE_REPORT USING WA_UPLOAD-PROJECT_DEFINITION

WA_UPLOAD-PERNR

WA_UPLOAD-ARBEI

'Successfully inserted'.

endif.

endif.

2. I'm creating an ALV report which shows activity by period. The column on the left is essentially the secondary cost element. It joins several tables (COKA, PRPS, PROJ, CSKS, CSU), but the amounts come from COSS. I think these amounts are correct. The user wants a drill-down to see the detail. From what I've seen, I thought that I could get the detail of activity by reading COBK inner join COEP (on akokrs = bkokrs and abelnr = bbelnr) inner join AFRU (on arefbn = crueck and aaworg = crmzhl). What I'm returning however, is nothing like what I want.

Can some tell me how to retrieve the activity (in dollars) by period? I don't want to show the hours (which is in AFRU). I need the costed activity.

Thanks for your help