cancel
Showing results for 
Search instead for 
Did you mean: 

bapi_wbs_element_update

Former Member
0 Kudos

I have created a program that uses bapi_wbs_element_update to create WBS elements from a spreadsheet.  This program has been running for several years.  But it has never successfully loaded the profit center.  This has to be entered manually afterwards.

I am attempting to load the profit center again, having recently patched the system to Ecc6 Ehp6.  As soon as I uncomment the code for the profit centre it fails to create a WBS.  I suspect that it may be because the Profit Center defaults from the Project, which we do not necessarily want.

I have not found any suitable SAP notes. Any ideas?

*Set Values for Internal Tables


  st_bapi_wbs_element_update-wbs_element                    = 'X'.

  st_bapi_wbs_element_update-project_definition             = 'X'.

  st_bapi_wbs_element_update-description                    = 'X'.

  st_bapi_wbs_element_update-user_field_char20_1            = 'X'.

  st_bapi_wbs_element_update-user_field_char20_2            = 'X'.

  st_bapi_wbs_element_update-user_field_char10_1            = 'X'.

  st_bapi_wbs_element_update-profit_ctr                     = 'X'.

  st_bapi_wbs_element_update-calendar                       = 'X'.

  st_bapi_wbs_element_update-plant                          = 'X'.

  st_bapi_wbs_element_update-wbs_planning_element           = 'X'.

  st_bapi_wbs_element_update-wbs_account_assignment_element = 'X'.

  st_bapi_wbs_element_update-wbs_billing_element            = 'X'.

  st_bapi_wbs_element_update-objectclass                    = 'X'.

*  st_bapi_wbs_element_update-responsible_no                 = 'X'.

*  st_bapi_wbs_element_update-applicant_no                   = 'X'.

  APPEND st_bapi_wbs_element_update.

  st_bapi_wbs_element-wbs_element                    = t_newrec-wbs_id.

st_bapi_wbs_element-project_definition             = t_newrec-proj_id.

  st_bapi_wbs_element-description                    = t_newrec-wbs_desc.

  st_bapi_wbs_element-user_field_char20_1            = t_newrec-client.       " Client

  st_bapi_wbs_element-user_field_char20_2            = t_newrec-busunit.      " Business Unit

  st_bapi_wbs_element-user_field_char10_1            = t_newrec-opptype.      " Opportunity type

  st_bapi_wbs_element-user_field_char10_2            = t_newrec-subtype.      " Sub type

  st_bapi_wbs_element-user_field_date1               = t_newrec-course_start. " Course Start

  st_bapi_wbs_element-user_field_date2               = t_newrec-course_end.   " Course End

  st_bapi_wbs_element-wbs_planning_element           = 'X'.

  st_bapi_wbs_element-wbs_account_assignment_element = 'X'.

  st_bapi_wbs_element-wbs_billing_element            = 'X'.

  st_bapi_wbs_element-plant                          = l_plant.

  st_bapi_wbs_element-calendar                       = '78'.

  st_bapi_wbs_element-objectclass                    = 'PA'.                  " Profit analysis

  st_bapi_wbs_element-responsible_no                 = t_newrec-proj_mgr.     " project manager

  st_bapi_wbs_element-applicant_no                   = t_newrec-trainer.      " course instructor

  st_bapi_wbs_element-profit_ctr                     = t_newrec-profitcentre. " ???? error

  APPEND st_bapi_wbs_element.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I have amended the code to add the profit centre to the activity.  The result is that the WBS is added The Network is added but the activity fails.  The trapped message is that the profit centre is not valid for the date.  Yet the profit centre is valid, has not been altered since

it was set up, and can be added in a dialog CJ20N.  See attached error listing.

So what combination of fields causes this to error in a BAPI but not in a dialog?

Brendan_Ward
Advisor
Advisor
0 Kudos

Hi Nigel,

Try it with the leading zeroes for the profit center included in the BAPI.

Best Regards,

Brendan