cancel
Showing results for 
Search instead for 
Did you mean: 

LSMW - Creation Project/WBS with BAPI or Idoc

0 Kudos

Hi SDN,

is there anybody who was succesful in creating Projects and WBS structures with BAPI or Idoc?

I tried it with BAPI and the follwing parameters

Business Object  BUS2054
Method           SAVEREPLICA
Message Type     PROJECT
Basic Type       PROJECT01

This ends with an error that SAVEREPLICA is not allowed in this context. I should use CREATE, but CREATE can not be entered in the parameters.

I tried Idoc with the follwing parameters

Message Type     PROJECT
Basic Type       PROJECT01
Enhancement

X Allow Structure Assignment for EDIDC40

This finaly terminates with the same error as the BAPI.

I would really like to use a standard SAP tool to migrate Projects/WBS-Structures. Was anybody succesful in this and can give a short documentation to the SDN community?

Best regards

Stefan

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi ,

is there anything wrong with my solution? You still didn't react to any of my postings in this thread. I would highly appreciate it, if you could at least state why you still think that this Topic is "Not answered".

Kind regards,

Pascal

Rachel_Tang
Advisor
Advisor
0 Kudos

Really good post, I also learn what I can't learn from SAP directly.

mohammed_fathelbab
Participant
0 Kudos

Hi

Although it gets me a wrong message, however after change the Method it is working and WBS created . one more help, i need to make WBS as child of main one. For example :

K.15023.01.01 under K.15023.01 as K.15023.01. the superior.

K.15023.01.02 under K.15023.01 as K.15023.01. the superior.

Can we achieve this? what will be the Method file like?

Really appreciate your help

Former Member
0 Kudos

Yes we can 🙂

You need to generate one more file. The WBS-Hierarchie.csv. One of my previous posts describes how to map it in your lsmw.

I suppose you didn't delete your Project and just want to add 2 more wbs elements as children of the existing ones.

In this case your method.csv will look the following way:

A bit more difficult to understand is the WBS-Hiearchy.csv. The file should like like this:

This will set the new wbs elements as children of K15023.01. It is very important to keep this table consistent, which means for every wbs element you mention in one of the coloums UP, DOWN, RIGHT, LEFT you need a seperate row.

Hope this helps.

Kind Regards,

Pascal

mohammed_fathelbab
Participant
0 Kudos

Dear Pascal,

Thank you for your reply. I will follow your steps and give you feedback.

mohammed_fathelbab
Participant
0 Kudos

Hi

I have followed your steps. i have an error that the hierarchy is not consistent.

Please have a look on the file. I am creating new Project with its WBSs.

Project :

WBS :

Structure :

Method :

Please guide me if there is something wrong.

BR,

Mohamed

Former Member
0 Kudos

Hi Mohamed,

the wbs hierarchy is fairly difficult to check for errors. Especially, if it gets big (>500 elements). I made a formula which translates the structure from my legacy system  into consistent wbs-hierarchy tables, but I'm sorry this won't work for anything else but my purpose.

In your case I can see the problem. Delete the project K.13032 and try to load it with this hierarchy:

I can only suggest to visualize your hierarchy by structure graphics (e.g. tree Diagramm or something similiar).  This will help you a lot.

Kind regards,

Pascal

mohammed_fathelbab
Participant
0 Kudos

Hi Pascal,

It is worked . your solution is absolutely Correct. I have created new Project with its WBSs and Hierarchy level too. Appreciate your help and guidance.

Thank you very much .

BR,

Mohamed

Former Member
0 Kudos

You're welcome!

I'm happy it worked out so well for you 🙂

Kind regards,

Pascal

mohammed_fathelbab
Participant
0 Kudos

Hi Pascal Erhart,

It is a really wonderful topic. I have followed your steps and all works fine except the IDoc generation. what i am facing now is that i got the Same Message that you displayed before. see below :

I have prepared three files one for project, one for WBS and one for Method.

please see below the files that i have prepared.

Project def :

WBS :

Method :


I put the field Iden (LIDEN) to link the three files together.

Can you please help me what is wrong that cause the above message.


BR,

Mohamed

Former Member
0 Kudos

Hi Mohammed,

the message simply says that there already is a WBS-Element with the ID K13023.01.

Check the project builder transaction CJ20N for project K13023.01 and see if there is a WBS-Element named K13023.01. It seems to me, that you already successfully created your project and wbs elements via LSMW.

I couldn't find any errors in your description. Please let me know if this helped.

Kind regards,

Pascal

mohammed_fathelbab
Participant
0 Kudos

Hi Pascal,

I have opened the project from CJ20N as i was created it before and update it from LSMW.

However, nothing created and the project is empty. See below :

I don't know what will be the cause for the error.

Waiting your feedback.

BR,

Mohamed

Former Member
0 Kudos

Hi Mohamed,

did you also search cj20 for this wbs element?

Former Member
0 Kudos

I overlooked this one....sorry.

In your method.csv:

Row# 3: the second wbs element should have the REFNUM 000002

mohammed_fathelbab
Participant
0 Kudos

Hi Pascal,

Changed it and still the same error

Former Member
0 Kudos

Hi Stefan,

I had the same problem as you did in 2013. Your Blog inspired me to find a solution for this problem. I too have create rather complex projects with networks, wbs elements an network activities.

The problem, as you already mentioned, is that for the function group bus2054, there is no method "CREATE". In order to use LSMW, for full creation and/or updating projects you will have to add this method.

I don't understand why creating projects using the LSMW is not suggested. To me, it's the only way to create projects, networks, wbs-elements and networkactivities in a single run. Using ABAB and/or 3 different BAPIs is not necessary if the LSMW project is done correctly.

If you are interested in how exactly my LSMW project looks, i would be happy to show you.

Right now, I'm importing 150 projects with approx. 5000 wbs elements and 10000 networkactivities into our DEV. After maintaining the source files, the LSMW does the rest quite easily.

Kind regards,

Pascal

0 Kudos

Hi Pascal,

If you are interested in how exactly my LSMW project looks, i would be happy to show you.

That sounds great! Could you publish the documentation in this discussion. I guess it will be helpful to the community.

Best regards

Stefan

Former Member
0 Kudos

Hi Stefan,

I'll do my best in order to describe this matter in an easy way. Supposively, there will be a lot of questions.

First of all:

You will need the "MAINTAIN" method for the business object "bus2054". Because I do not have a "developer key", this method was provided by our IT-Department. They told me, that it is not a very difficult matter. It is done with transaction "BDBG" and, as far as i remember, it's about creating or editing ALE-structure. You will need to edit the "BAPI_PROJECT_MAINTAIN" respectively the business object "BUS2054".

Once you have added to MAINTAIN - method you can start to configure the LSMW-project.

1.) Create a new LSMW-project and make sure that IDoc Inbound processing is activated:

2.) Maintain the object attributes in the following way:

3.) The source-structures:

4.) Source Fields:

Make sure to have a source field for every field in the corresponding BAPI-Table. This will allow you to ensure, that all possible fields in the tables of the BAPI_PROJECT_MAINTAIN will be filled by your source fields. Adjusting the values in the source fields is the most convenient way to adjust the behaviour of the interface. I created the source fields by simply copying the tables from se37.

The screenhot shows the source fields for the project definition:

Be sure to check this Button:

This will show you the key values for the tables. There must(!) be a field named "PROJECT_DEFINITION" in each and every single Table. Project number is the key for all other tables including the METHOD table (this is because all other Tables are in the substructure of the Project_Definition Table)

Having done so, you will later be able to import multiple projects at once.

4.) The structure relations:

I suppose this mapping is clear without further explaination.

5.) Field Mapping:

Having defined a source field for every element in the bapi-tables the mapping is very easy. Just map the Field from the source table to the field from the BAPI - table.

No special rule. Just "Move" the fields. Although one could customize the "Method" table with ABAP, i found it easier to create the Method Table from my source system as this table is fairly easy to understand.

5.) The step "Maintain fixed values..." (LSMW step 6) can be skipped.

6.) There are six source files for my LSMW project:

I_PROJECT_DEFINITION.csv

WBS_HIERARCHY.csv

WBS_ELEMENTS.csv

I_NETWORKS.csv

NETWORK_ACTIVITIES.csv

I_METHOD.csv

The I_Method.csv contains the roadmap for the project. In other words, what is to do. This files only contains meta-data, but needs to be 100% consistent. If you don't know what kind of methods and objecttypes exists, i will be glad to help. Here's a screenshot from a project without network or network-activities.

The most problematic file to me was the WBS_HIERARCHY. This hierarchy needs to be correct and complete. It needed a lot of thinking to create a correct file. Another problem is, that if you encounter errors with this table, the BAPI_Message Table won't tell you where the error is. Sometimes, this can be a bothering. But if the logic you used to create the WBS_Hierarchy is consistent, there will be no problems.

7.) Once the files have been specified, they can be loaded into the system and converted.

8.) IDoc generation  and processing is nothing special and can just be done by clicking through the steps.

9.) Debugging: Of course, things won't go well the first time you try. If they do, congrats!

But if not: I suggest to debug with transaction "we19".  LSMW won't tell you exactly why things didn't go the way you wanted them to go. You will need the entries in the E_Message_Table from the BAPI_PROJECT_MAINTAIN. Here's how i debug:

- Start WE19

- Choose your IDoc

- Choose "Inbound function module" in debugging mode:

Function Module is "BAPI_IDOC_INPUT1", however, this may differ in your company.

- Set a break point at the function module "BAPI_PROJECT_MAINTAIN":

Now you can execute the IDoc. It will stop at the BAPI_PROJECT_MAINTAIN. Next step is to set another Breakpoint, so that you can read the messages returned by the BAPI:

Continue the execution by hitting the F8 key once more. Now, we have the information from the E_MESSAGE_TABLE available:

- Switch to the "Tables" View

- Type E_MESSAGE_TABLE in the field "Table"

Sometimes, looking for the reasons why things didn't work is a game of patience, but after the reason is found, things become a lot clearer 😉

I hope this guide is of any use for you. I was quite in a hurry when writing it..

Please excuse grammar and/or spelling mistakes.

Feel free to ask any questions about this LSMW project.

Kind regards,

Pascal

Former Member
0 Kudos

Hi Pascal,

Thank you for your post. I am facing the same problem right now, however I'm not able to create the MAINTAIN option for de BUS2054 object in transaction BDBG.

Do you know what the exact input parameters were when you or your IT administrator created this extra feature, especially the function modules? I filled in these parameters, but no it doesn't work, and I'm also not able to change it anymore. Do you know a possible solution?

Thanks in advance!

Regards Christiaan Boon

meesha_belani
Explorer
0 Kudos

Pascal

Excellent post!

Have a few questions :

1.I need to just create new wbs elements under one project on same level (level 2) In that case do I need the project definition structure and file ?

2. How is the WBS hierarchy data to be filled ? Could you elaborate using my project as an example?

My project hierarchy looks like this :

P1000     (Project definition already exists)

     I-P1000-00  (Level 1 already exists)

          I-P1000-01 (Level 2 WBS , needs to be created)

3. Also , how shoud the method.csv be populated ? in your screen shot what is the object key ?it will help if you can show how to find the data to populate the method.csv

Appreciate your help !

Thanks

Meesha

Former Member
0 Kudos

Hi there,

it has been a while since I checked this place the last time. Sorry for keeping you unanswered!

I found a couple screenshots, hope it helps. The SAP system language is German, but I'm confident you will be able to deduce or translate the necessary content.

1. Create a new ALE-Interface for BAPI in Transaction "BDBG":

2. Configure:

3. Release:

You will need a developers key to release. I'm afraid that i cannot help any further in creating new ALE for BAPI. Hopefully it's enough Information for you.

Kind regards,

Pascal

Former Member
0 Kudos

Hi Meesha,

thanks for the compliment 🙂

ad 1)

If all the wbs elements you want to create are on the same hierarchy level, things become a lot easier.

Using the BAPI_PROJECT_MAINTAIN you will always need to specify the "I_PROJECT_DEFINITION" table. Just fill in the project-ID in which you want to create your wbs elements.You won't need any other fields in this table.

ad 2)

The wbs hierarchy in your case will only consist of your new elements + (very important) the wbs element which is superior to the new ones (I-P1000-00)

I added a couple wbs elements to your example. It should look like this:

The table must be 100% consistent. This means every wbs element you mention in the columns UP, DOWN, LEFT, or RIGHT also have to be a seperate row in this table.

Example: The wbs element I-P1000-00 (which already exists) is mentioned in column UP of every other row. As a consequence wbs element I-P1000-00 needs a row in this table for itself. Every related wbs element will need its own row.

In your case all the new wbs elements will have the I-P1000-00 in column "UP". LEFT and RIGHT specifies the order (not the hierarchy). If not necessary, you can leave these 2 columns empty.

ad 3)

The "method.csv" explained:

REFNUM:

Counter for physical objects (only Project definitions, wbs elements, Networks, Network acitivites) of one type.

In your case: only WBS-ELEMENT will get this ID. Start with 000001

OBJECTTYPE:

Defines the type of object. There are WBS_HIERARCHY, WBS-ELEMENT, NETWORK, NETWORK-ACTIVITY, PROJECTDEFINITION

You will only need WBS_HIERARCHY and WBS-ELEMENT

METHOD:

Defines what you want to do with the objects you defined

There are CREATE, UPDATE, DELETE  and SAVE as far as I know

OBJECTKEY:

Primary Key of the object

Your "method.csv":

Hope this helps.

Kind regards,

Pascal

Former Member
0 Kudos

You will need to run the BAPI's in a specific sequence to create PS Objects.  There is not a single BAPI to create an entire project.

1.  Create Project Definitions with BUS2001

2.  Create WBS Elements with BUS2054

3.  Create Networks with BUS2002

SAVEREPLICA is for copying an existing project.

0 Kudos

Hi Ken,

could you explain how to use these steps in the transaction LSMW?

Best regards

Stefan

Former Member
0 Kudos

You can use those BAPIs in an ABAP program to load your projects.  The developers I have worked with have always said to stay away from LSMW for loading PS objects.

0 Kudos

Hi Ken,

the the common answer from developer is the same I also got,

  1. but in LSMW it is possible to select the parameters "as standard" as described above. Therefore it should work. Otherwise I would like to see not possible selections for projects and WBS elements at all.
  2. For me it is hard to accept that we use standard software and develop equal interfaces again and again all around the world

That's the reason that I am still going for a standard soloution i.e. in LSMW without programming.

Best regards

Stefan

Former Member
0 Kudos

Hi Stefan,

Were you able to create Project/WBS using LSMW?

Regards,

Kalyani

former_member213204
Participant
0 Kudos

Hi Stefan,

We too had the problem with BAPI's.

We used SHDB recording for the WBS and it worked.

Regards,

Revanth

0 Kudos

not yet - I will try it again later - when I have some time

0 Kudos

Hi Revanth,

that something I did in the past. (1. Create project, 2. create wbs below the project unstructured, 3. sort the project by the editing mask). This works for unified projects and wbs elements. But not in the compex setup I face now.

Best regards

Stefan

Rachel_Tang
Advisor
Advisor
0 Kudos

The BAPI should be tested in a sequence, like:

BAPI_PS_INITIALIZATION

BAPI_BUS2054_*

BAPI_PS_PRECOMMIT

BAPI_TRANSACTION_COMMIT

You test it with a single test sequence in SE37 to see if it can work, then you can call the same sequence in your own program to create project/WBS-element in batch.

0 Kudos

Hi Rachel,

could you explain how to use these steps in the transaction LSMW?

Best regards

Stefan

Rachel_Tang
Advisor
Advisor
0 Kudos

Hi Stephen,

It is not suggested to use LSMW to load project objects in standard SAP system. Actually the use of BAPIs is much more convenience. As I mentioned earlier, you should first test the BAPIs with single test in SE37 under certain sequence and try to develop your own program and involve those BAPIs with such sequence. One thing you need to be awared is that when you create WBS-elements with BAPIs, you need to create them level by level but can't create the whole struction at one time, because the lower level can't find correct position in the structure when the higher level is still in creation phase.

Regards,

Rachel