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

updating wbs element relevant data.

Himayatullah
Active Participant
0 Likes
5,139

HI abapers,

Am new to BAPI concept.I searched in sdn and came to know that BAPI_BUS2054_CHANGE_MULTI can update WBS elements.

can anybody provide a piece of sample code to update wbs header and details like actual start date,controlling area using this bapi.

Thank You.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,608

Hello Himayatullah,,

i think this will help you...

*WBS element details

it_wbs_new-wbs_element = w_wbs_new .

it_wbs_new-wbs_planning_element = 'X'.

it_wbs_new-wbs_account_assignment_element = 'X'.

it_wbs_new-wbs_billing_element = 'X'.

it_wbs_new-wbs_up = w_wbs_old.

IF lv_auart = 'ZDSO'.

it_wbs_new-res_anal_key = 'ZXXXX'.

it_wbs_new-user_field_char20_1 = '30'.

ENDIF.

APPEND it_wbs_new.

*Initialize PS

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

*Create WBS element & set heierarchy

CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'

EXPORTING

i_project_definition = w_project

TABLES

it_wbs_element = it_wbs_new

et_return = it_return2.

READ TABLE it_return2 WITH KEY type = 'S'.

IF sy-subrc EQ 0.

*Precommit the data for WBS element creation

CALL FUNCTION 'BAPI_PS_PRECOMMIT'.

*Commit data for WBS element creation.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

Thanks,

Krishna.

16 REPLIES 16
Read only

Former Member
0 Likes
4,608

Hi,

You can use BAPI_PROJECT_SAVEREPLICA for sending WBS data.

Regards,

Nitin

Read only

0 Likes
4,608

Hi Nitin,

As per the documentation of the BAPI which you have said , "The function module BAPI_PROJECT_SAVEREPLICA is only used internally as part of the ALE business processes for work breakdown structures, delivered by SAP"

My requirement is to update WBS element relevant data like person responsible ,act start date, controlling area etc which are under particular project defination.

Read only

Former Member
0 Likes
4,609

Hello Himayatullah,,

i think this will help you...

*WBS element details

it_wbs_new-wbs_element = w_wbs_new .

it_wbs_new-wbs_planning_element = 'X'.

it_wbs_new-wbs_account_assignment_element = 'X'.

it_wbs_new-wbs_billing_element = 'X'.

it_wbs_new-wbs_up = w_wbs_old.

IF lv_auart = 'ZDSO'.

it_wbs_new-res_anal_key = 'ZXXXX'.

it_wbs_new-user_field_char20_1 = '30'.

ENDIF.

APPEND it_wbs_new.

*Initialize PS

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

*Create WBS element & set heierarchy

CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'

EXPORTING

i_project_definition = w_project

TABLES

it_wbs_element = it_wbs_new

et_return = it_return2.

READ TABLE it_return2 WITH KEY type = 'S'.

IF sy-subrc EQ 0.

*Precommit the data for WBS element creation

CALL FUNCTION 'BAPI_PS_PRECOMMIT'.

*Commit data for WBS element creation.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' .

Thanks,

Krishna.

Read only

0 Likes
4,608

Hi Krishna,

Thanks for ur reply. Am changing the existing WBS elements so am using BAPI_BUS2054_CHANGE_MULTI.

For this,I have checked with test sequence in SE37 like below

Call BAPI_PS_INITIALISATION

THEN BAPI_BUS2054_CHANGE_MULTI

BAPI_PRECOMMIT

BAPI_TRANSACTION_COMMIT

now for BAPI_BUS2054_CHANGE_MULTI I have passed project defination as import and some params in IT_WBS_ELEMENT

and checked the flags for the fields being updated in IT_UPDATE_WBS_ELEMENT (both are tables tab) and executed it.

The return throws an saying that WBS cannot be changed.

Plz help..

Read only

0 Likes
4,608

Hello,

Did you check doing the same (Changing the WBS element) from WBS element change screen..?(Not from FM)

Check the status of WBS element, some times WBS elements can not be changed at some statuses..might be WBS element you are using come under this catagory...

Thanks,

Krishna.

Read only

0 Likes
4,608

Hi Krishna,

I have done that. It is working fine.

Currently what am doing in my program is that - I have retrieved the relevant details of a wbs element using "BAPI_BUS2054_GETDATA". Once I got the details , now am trying to overwrite them with the information user want to change.

Say for example : for person responsible field -00000000

Now am updating it with - 10000005.

and then passing the updated internal table to "BAPI_BUS2054_CHANGE_MULTI"...it returns

Object wbs element 001 could not be changed

no update flags or extensions were set for wbs element.

plz help in this issue.

Thanks and Regards

Himayat

Read only

0 Likes
4,608

Hi ,

BAPI_BUS2054_change_MULTI is returning Sucess(individual checks are successful)

and now the BAPI BAPI_PS_PRECOMMIT is returning an error message that -

1) Final check of the project defination and the WBS elements : error

2)make an entry in all required

any idea on this?

Read only

0 Likes
4,608

First you call below bapi to get the details of the project WBS element wise:

BAPI_BUS2054_GETDATA

Then You call below BAPIS

BAPI_PS_INITIALISATION

BAPI_BUS2054_CHANGE_MULTI ->Pass data from BAPI_BUS2054_GETDATA

BAPI_PRECOMMIT

BAPI_TRANSACTION_COMMIT

Thanks and Regards,

Chandra

Read only

0 Likes
4,608

Hi chandra,

Am doing like the way u mentioned only.....

BAPI_PS_INITIALIZATION

Then BAPI_BUS2054_GETDATA - It is returning all the required data of wbs element.

Then BAPI_BUS2054_CHANGE_MULTI- It is returning individual checks are successful.

Then BAPI_PS_PRECOMMIT-it returns the errors which I mentioned in the previous post.

Read only

0 Likes
4,608

Any help on this?

thanks and regards

Himayat.

Read only

0 Likes
4,608

Hi experts,

Am able to update wbs elements relevant data at level 5 only . How to update the same at one level higher i. e level 4.

Please let me know.

Best Regards

Himayat

Edited by: Himayatullah on Feb 24, 2010 10:42 AM

Read only

0 Likes
4,608

How did you solve this problem? I am following the given below approach, and I am receiving the same error.

Error : 1.) Object WBS Element DS-11-1000-0058.01 could not be changed

2.) No update flags or extensions were set for WBS Element DS-11-1000-0058.01


  gwa_bapi_bus2054_upd-wbs_element = 'X'.
  gwa_bapi_bus2054_upd-description  = 'X'.
  gwa_bapi_bus2054_upd-responsible_no = 'X'.
  gwa_bapi_bus2054_upd-applicant_no = 'X'.
  gwa_bapi_bus2054_upd-company_code = 'X'.
  gwa_bapi_bus2054_upd-business_area  = 'X'.
  gwa_bapi_bus2054_upd-profit_ctr  = 'X'.
  gwa_bapi_bus2054_upd-proj_type = 'X'.
  gwa_bapi_bus2054_upd-wbs_planning_element = 'X'.
  gwa_bapi_bus2054_upd-wbs_account_assignment_element = 'X'.
(I have marked all fields with 'X')
  APPEND gwa_bapi_bus2054_upd TO git_bapi_bus2054_upd.

  CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

  CALL FUNCTION 'BAPI_BUS2054_CHANGE_MULTI'
    EXPORTING
      i_project_definition  = p_prj
    TABLES
      it_wbs_element        = git_wbs_element_chg (manually populated)
      it_update_wbs_element = git_bapi_bus2054_upd
      et_return             = et_return.

  READ TABLE et_return INTO ev_ret WITH KEY type = 'E'.
  IF sy-subrc NE '0'.
    CALL FUNCTION 'BAPI_PS_PRECOMMIT'
      TABLES
        et_return = et_return2.
    WAIT UP TO 3 SECONDS.
    CLEAR ev_ret.
    READ TABLE et_return2 INTO ev_ret WITH KEY type = 'E'.
    IF sy-subrc NE '0'.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
      WAIT UP TO 3 SECONDS.
    ENDIF.
  ENDIF.

I don't know what I am doing wrong. Please help!

Read only

0 Likes
4,608

I solved the issue occurred with BAPI_BUS2054_CHANGE_MULTI.

But now, BAPI_PS_PRECOMMIT is throwing an error.

Error # 1 : Final check of the project definition and the WBS elements: Error

Error # 2 : Fill in all required entry fields

Read only

0 Likes
4,608

Hi Dev,

Can you please share how you solved the errors in WBS change bapi.

Read only

0 Likes
4,608

Hi Kiran,

I just faced the same issue with BAPI_BUS2054_CHANGE_MULTI

I fixed it playing with conversion exits, use this  CONVERSION_EXIT_ABPSN_INPUT to load the data to BAPI's WBS ELEMENT field.

About the issue with BAPI_PS_PRECOMMIT you just need to be sure that all mandatory fields are filled in for T-Code CJ20N.

These 2 errors are just data issues.

-----------------------------------------------------

Error # 1 : Final check of the project definition and the WBS elements: Error

Error # 2 : Fill in all required entry fields

-----------------------------------------------------

I hope this information helps.

Regards,

Ricardo

Read only

0 Likes
4,608

This message was moderated.