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_PROJECT_MAINTAIN - problems when updating project's dates

mario_maisto
Participant
0 Likes
2,710

Hey there!

I was wondering maybe someone could help me with an issue when trying to update project information (i.e updating dates).
For doing that, I am using the BAPI BAPI_PROJECT_MAINTAIN.

For example, when trying to update the start and end date of a wbs element, I am populating these rows in the bapi's tables:

  • I_PROJECT_DEFINITION  and  I_PROJECT_DEFINITION _UPD (insert the project definiton and the corresponding X in the update table)
  • I_WBS_ELEMENT_TABLE  and  I_WBS_ELEMENT_TABLE_UPD
    • with data of:

     and

  • I_METHOD_PROJECT
    • with data of:

But, the E_MESSAGE_TABLE returns me an error alongside with some warning and information messages, like:


     Error: "Field /Time Stamp: Changing the contents of the field is not permitted"

     Information: "TTR_INIT"

However, when I go to the Project Builder (cj20n), I can see that the dates have been successfully updated.. Still - the returned error message concerns me - does anyone have any explanation for these errors and knows how to resolve this?

Thank you ,
Mario

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,084

Hi Mario,

you can use below BAPI in sequence.

BAPI_PS_INITIALIZATION

BAPI_BUS2054_CHANGE_MULTI

BAPI_PS_PRECOMMIT

BAPI_TRANSACTION_COMMIT

Please read the FM Documentation.

Regards,

Praphul

4 REPLIES 4
Read only

Former Member
0 Likes
2,085

Hi Mario,

you can use below BAPI in sequence.

BAPI_PS_INITIALIZATION

BAPI_BUS2054_CHANGE_MULTI

BAPI_PS_PRECOMMIT

BAPI_TRANSACTION_COMMIT

Please read the FM Documentation.

Regards,

Praphul

Read only

0 Likes
2,084

Hello,

thank you for your answer - I tried your solution, and when trying to change the dates with BAPI_BUS2054_CHANGE_MULTI, I get an error of "Enter an allowed object class.".

The code I tried it with is as follows:


I_PROJ = 'Z/003'

WA_IT_WBS_ELEMENT-WBS_ELEMENT = 'Z/003-12'.
WA_IT_WBS_ELEMENT-WBS_BASIC_START_DATE = '20160803'.
WA_IT_WBS_ELEMENT-WBS_BASIC_FINISH_DATE = '20160826'.
APPEND WA_IT_WBS_ELEMENT TO IT_WBS_ELEMENT.
WA_IT_UPDATE_WBS_ELEMENT-WBS_ELEMENT = 'Z/003-12'.
WA_IT_UPDATE_WBS_ELEMENT-WBS_BASIC_FINISH_DATE = 'X'.
WA_IT_UPDATE_WBS_ELEMENT-WBS_BASIC_FINISH_DATE = 'X'.
APPEND WA_IT_UPDATE_WBS_ELEMENT TO IT_UPDATE_WBS_ELEMENT.

CALL FUNCTION 'BAPI_PS_INITIALIZATION'
            .

  CALL FUNCTION 'BAPI_BUS2054_CHANGE_MULTI'
    EXPORTING

      I_PROJECT_DEFINITION        = I_PROJ
    TABLES
      IT_WBS_ELEMENT              = IT_WBS_ELEMENT
      IT_UPDATE_WBS_ELEMENT       = IT_UPDATE_WBS_ELEMENT
     ET_RETURN                   = ET_RETURN    <<<<<<<< RETURNS THE ERROR MESSAGE
**     EXTENSIONIN                 =
**     EXTENSIONOUT                =
*            .
  CALL FUNCTION 'BAPI_PS_PRECOMMIT'
   TABLES
     ET_RETURN       = ET_RETURN
*            .
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
**   EXPORTING
**     WAIT          =
   IMPORTING
     RETURN        = ET_RETURN

Still - I think the same thing could also be done in the BAPI_PROJECT_MAINTAIN, as it supports changing the milestones and network as well (also need to change those too). Furthermore - I get the same error "Field /Time Stamp: Changing the contents of the field is not permitted" when trying to update the wbs description, but when checking the project with cj20n I can see that the description has been actually changed successfully.

Heres a snapshot of the returned messages when trying to update the dates/description with BAPI_PROJECT_MAINTAIN:

Any ideas what i am doing wrong?

Read only

0 Likes
2,084

hi mario,

i think you have missed some parameters in the above function module,


data : ls_extensionin TYPE bapiparex,

          lt_extensionin TYPE STANDARD TABLE OF bapiparex.


CLEAR ls_extensionin.


ls_extensionin-structure = 'BAPI_TE_WBS_ELEMENT'.   " Extension Structure


ls_extensionin-valuepart1 = ls_te_wbs_element.

APPEND ls_extensionin TO lt_extensionin.


pass this  lt_extensionin to extensionin(parameter) of above FM...



regards,

vinay....

Read only

0 Likes
2,084

Hello Vinay,
thanks for you answer! I ran into some similar problems with your suggested BAPI.. Nevertheless - my primary wish was to use the BAPI_PROJECT_MAINTAIN, as is should allow me to change every project detail. I followed the BAPI's documentation and used the exact same fields as was in the sample of the documentation - still I get the error message.