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

Creating WBS Elements using BAPI

Former Member
0 Likes
3,413

Hi,

I'm trying to create a new WBS Elements which is a copy of an existing one. To do this, I'm using the BAPI "BAPI_PROJECT_GETINFO" to gather the WBS Element which will be copied. Then, I populate the internal tables used for the BAPI "BAPI_PROJECT_MAINTAIN" and the following message is returned from the BAPI:

MESSAGE_ID CN

MESSAGE_NUMBER 189

MESSAGE_TYPE E

MESSAGE_TEXT A reference object cannot be entered for the

method 'Update'.

I have read the documentation from the BAPI and followed its intrunctions but the problem persists.

I'm using the method create for the object type WBS-ELEMENT and WBS-HIERARCHY and I have populated the project definition internal table with the project code.

I don't understand why this error is happening because I'm using the method create and not update.

Any suggestion is welcome.

Regards,

Leonardo Stroebel

6 REPLIES 6
Read only

Former Member
0 Likes
1,961

Hi People,

I've found the problem for the message returned by BAPI. I had to remove the entries in field refnumber and objectkey from the method for the hierarchy.

But now, I have another message:

MESSAGE_ID CJ

MESSAGE_NUMBER 727

MESSAGE_TYPE E

MESSAGE_TEXT Field WBS_ELEMENT/WBS element: Changing the contents of the field is not permitted.

I have debugged the function module and there is a checking PRPS table fields process which causes this message. The field that is being checked and cause this message is POSID.

It seems that the function module tries to modify an existing WBS element, but as I wrote before, I'm following the documentation to create a new one.

Any comments or ideas are welcome.

Regards,

Leonardo Stroebel

Read only

0 Likes
1,961

Hi,

Instead of using "BAPI_PROJECT_MAINTAIN", use following solution. We are using this solution and it is working pretty good.

************************************************************

************************************************************

If the WBS element is already created and you want to create one more with same data, first get the WBS related information using BAPI_PROJECT_GETINFO as you are doing currently.

I am using different sets of BAPIs to create project, create / change WBS element.

I use function module from Function group CJ2001 ( Project related BAPIs ), CJ2054 ( WBS related BAPIs ) and PS_BAPI ( pre/post processing BAPIs ). There are specific order in which you need to execute these BAPIs.

For example if you want to create / change the WBS element, the BAPIs sequence is:

<b>1. BAPI_PS_INITIALIZATION

2. BAPI_BUS2054_CREATE_MULTI ( to create WBS )

or

2. BAPI_BUS2054_CHANGE_MULTI ( to change WBS )

3. BAPI_PS_PRECOMMIT

4. BAPI_TRANSACTION_COMMIT</b>

Check the documentation of BAPI "BAPI_BUS2054_CREATE_MULTI " to see how these function modules work.

Let me know if you need further information.

Regards,

RS

Read only

0 Likes
1,961

Hello RS,

Thank you for your reply. The problem was solved applying note 775428. Now it's working as expected.

Regarding to your solution, I'm working with the 4.6C R/3 version and there is no function group called CJ2001 and CJ2054 and no function modules specified by you.

Thanks again.

Regards,

Leonardo Stroebel

Read only

0 Likes
1,961

Hi,

Glad that you solved your problem.

But i am also working in 4.6C and i have all the Function group and FM i mentioned before. This is weird.

Anyways, let me know if you have any other issues.

Please mark the question as "answered" and close the thread if you do not have any more issues.

Regards,

RS

Read only

0 Likes
1,961

Hi RS,

We are using 4.7 version.

And please find the below error message.

The following syntax error occurred in the program SAPLCJ2054 :

""LS_BAPI_TE_PRPS" and "EXTENSIONIN+30(960)" are not mutually convertib"

Error in ABAP application program.

Thanks,

Abhishek

Read only

0 Likes
1,961

Hi,

We not have any issues in 4.6C.

Can you tell me in which include and on which line this systax occur is coming?

Regards,

RS