Searching for method in cProjectthat is creating and updating PSP-elements
I cannot find the save button in the source code of cProjects. Can someone tell me where to find it?
More concrete I am searching the code that creates/updates the PSP-elements. In this place I would like to add some code to set some customer fields and the account element flag. Is there a BADI that I could use for this?
Your code logic seems OK. As you set a space for parameter WBS_ACCOUNT_ASSIGNMENT, it's normal the checkbox is not flagged.
To do so, you have to get the data from your object instance (let's say lr_project), find the value of your specific field for account assignment, then set 'X' as the passed value (instead of ' ').
For customer fields defined in an extension table, it's not available in standard. The only way is to build a custom interface: the idea could be to send the additional data to your ERP system through a custom function call, then update the WBS data in the ERP system asynchronously (for performance purpose). It's quite tricky to handle as you have to cope with the standard lock of WBS-E locks. On our side, we updated the Short ID like this: we send a table with WBS + Short ID, call in background a custom FM in SAP ERP, then update the WBS-E. We also set a short delay before the update to avoid the standard lock.