Skip to Content

Create wbs element with long text

Hello guys,

at the moment I'm trying to create a custom report which can create wbs elements from an excel file. Therefor I want to add some basic data of wbs element, set user status and set longtext for wbs element. My problem now is that I want to the whole thing in one commit. Unfortunately the status and the longtext have to created in separated tasks. At the moment it looks like:

(1) BAPI_PS_INITIALIZATION for WBS element initialization
(2) BAPI_BUS2054_CREATE_MULTI for WBS element creation
(3) BAPI_BUS2054_SET_STATUS for setting status of WBS
(4) BAPI_PS_PRECOMMIT do the precommit
(5) BAPI_TRANSACTION_COMMIT do the commit
(6) SAVE_TEXT and COMMIT_TEXT to add the long text

My problem is now the steps 5 and 6. I only want to create the wbs element, when both work, wbs creation and long text creation. So normally I have to do the comit (5) in step 6 instead. But when switching that, I cannot create the text because the OBJNR for longtext is not created yet. In the way it is now, it works, but I have no chance to undo the creation when the longtext creation fails.

Any solutions for that?

Regards

Michael

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Feb 10 at 01:00 PM

    Hi,

    Have you tried this in the case of a failure of step 6?

    How about various rollback techniques?

    Another option is to have a ghost WBS that you will delete at the end (or have it so it is used for those purposes only) that you can test the SAVE_TEXT on it, as a kind of a simulation, and if it fails not to go through steps 5 and 6. There are problems with this way that you need to manage - not sure how your system is customized and what constraints you put on WBS in your organization, consult the authority at your workplace.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 10 at 01:13 PM

    Why does the long text have to be in the same commit? Many SAP documents save texts in the V2 (secondary) update, so unless you have a very specific reason, I don't see an issue with your sequence. Perhaps it would be easier to adjust any follow dependencies.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 12 at 08:01 AM

    You could wrap the SAVE /COMMIT_TEXT in a RFC FM (or use RFC_SAVE_TEXT) and call this FM in BACKGROUND TASK/UNIT before the commit, so it will be executed after the update and only if successful?

    Add comment
    10|10000 characters needed characters exceeded