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

upload project hierarachy master data

Former Member
0 Likes
1,154

hi can any one provide me a sample code for uploading Project definition, WBS element, Networks and network activities using BAPI_PROJECT_MAINTAIN.UR help will be appreciated.

Thanks,

Aditya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
804

The FM;BAPI_PROJECT_MAINTAIN is a very well documented one.Go to se37 and give the name of the fm.

Say display and click on the Function Module Documentation.

It is very exhaustive.

In case you don't find it,

here it is:

<b>FU BAPI_PROJECT_MAINTAIN

____________________________________________________

Text

Edit project including networks

Functionality

With the Maintain BAPI of the WorkBreakdownStruct business object you can edit the objects of a project definition. You can also use all the functions of the Maintain BAPI of the Network business object.

For more information, see Network.Maintain. With WorkBreakdownStruct.Maintain it is possible to edit the project definition, its WBS elements and their hierarchical relationships. The BAPI encapsulates a complete transaction in itself. As a result, several operations on project elements can be processed by only one call. The R/3 Project System determines in which order the operations are to be executed on the objects. The caller can choose the operations in any order.

As a result, processing is very speedy and effective. However, this transaction concept does not include the use and combination of other SAP BAPIs in the same LUW.

Procedure

The WorkBreakdownStruct business object is a facade of the project definition for WBS elements and their hierarchy.

To edit a project object, enter a command for an object type. In addition, enter the object key and a reference to its attributes.

In the table of the IMethodProject parameter enter the object type, the command and the object key. As a reference enter the index of the object data table of the relevant object type. In the object data table enter the information about the object. If necessary, use an update structure for the object. When entering the object type and method in the IMethodProject table remember that the entries are case-sensitive.

To finish the transaction and store the data in the R/3 database, enter the Save command. If you only want to test whether the changes can be carried out, do not use the save command.

In general, you cannot change the keys of objects.

The return parameter Return indicates whether errors occurred during processing. After the call you find the error messages created during processing in the EmessageTable table.

Commands of the Object Types

For the description of the object types Network, NetworkActivity, NetworkActivityElement, ActivityMilestone, and NetworkRelation, see Network.Maintain.

Object type: Project definition

The Maintain BAPI must always refer to one project definition. Therefore, always enter the structure of a project definition in the IProjectDefinition parameter. Use the project definition as a key. The reference to the data part is always 1. Always enter the project definition in upper case.

Command: Create

Enter the project definition and the project profile. The project profile must exist in the R/3 Project System.

Example - Create a Project Definition in the R/3 Project System

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Create

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Training project

PROJECT_PROFILE = PPRO001

Command: Update

Use this command to change a project definition that already exists in the R/3 Project System. If you enter an update structure you can change individual fields without having to specify the other fields.

Example - Changing the description of a project definition (Only the description is changed.)

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Update

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Training project

IProjectDefinitionUp

PROJECT_DEFINITION =

DESCRIPTION = X

Command: Lock (from R/3 Release 4.6A)

Use this command to lock a project definition. The "Master data locked" system status is set for the project definition.

LS>Example - Locking the project definition PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Lock

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Command: Unlock (from R/3 Release 4.6A)

Use this command to unlock the project definition. The "Master data locked" system status is removed from the project definition.

Example - Unlocking the project defintion PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Unlock

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Command: Release (from R/3 Release 4.5A)

Releasing a project. The system status "released" is set for the project definition and all WBS elements.

Example - Releasing the project definition PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Release

OBJECTKEY = PD-TRAINING

REFNUMBER =

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Object type: WBS element

You can edit all WBS elements of a project definition. The name and key of the WBS element are identical.

Enter the WBS element in uppercase.

Command: Create

Example - Creating a WBS element for the project definition. Creating three WBS elements TRAINING, TRAINING.1 and TRAINING.2 for project definition PD-TRAINING

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Create

OBJECTKEY = TRAINING

REFNUMBER = 000001

OBJECTTYPE = WBS-Element

METHOD = Create

OBJECTKEY = TRAINING.1

REFNUMBER = 000002

OBJECTTYPE = WBS element

METHOD = Create

OBJECTKEY = TRAINING.2

REFNUMBER = 000003

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Whole project

Index = 2

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Preparation

Index = 3

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Execution

Command: Update

Use this command to change a WBS element that already exists in the R/3 Project System. If you enter an update structure, you can change individual fields without having to specify the other fields.

Example - Changing the description of the WBS element TRAINING.1 for the project definition PD TRAINING

IMethodProject

OBJECTTYPE = WBS element

METHOD = Update

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Preparation and documentation

IWbsElementTableUpdate

Index = 1

WBS_ELEMENT =

PROJECT_DEFINITION =

DESCRIPTION = X

Command: Delete

Use this command to delete a WBS element that already exists in the R/3 Project System. The WBS element receives the "Deletion flag" system status and is not deleted physically. You cannot create a new WBS element with the same key.

Example - Deleting the WBS element TRAINING.2 for the project PD

TRAINING

IMethodProject

OBJECTTYPE = WBS element

METHOD = Delete

OBJECTKEY = TRAINING.2

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

Command: Lock (from R/3 Release 4.6A)

Use this command to lock a WBS element. The "Master data lock" system status is set for the WBS element.

Example - Locking the WBS element TRAINING.1

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Lock

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Command: Unlock (from R/3 Release 4.6A)

Use this command to unlock a WBS element. The "Master data lock" system status is removed from a WBS element.

Example - Unlocking the WBS element TRAINING.1

IMethodProjectIMethodProject

OBJECTTYPE = WBS-Element

METHOD = Unlock

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Command: Release (ab R/3 Release 4.5A)

Releasing a WBS element. The system status "Released" is set for the WBS element and all lower-level WBS elements.

Example - Releasing the WBS element TRAINING.1

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Release

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Object type: WBS milestone (from R/3 Release 4.6A)

The key for the object WBS milestone is the milestone number.

Command: Create

Use this command to create a new WBS milestone for a network. It is not necessary to enter a number for the milestone. The system gives the milestone a number when it is created. The system returns the milestone in the message table as an information message.

If however, an external number is entered in the method table, both the external and the new milestone number are returned in an information a message in the message table. A WBS element always has to be entered.

Example - Creating a new WBS milestone for a WBS element TRAINING.2

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Create

OBJECTKEY =

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

Index = 1

MILESTONE_NUMBER =

WBS_ELEMENT = TRAINING.2

Command: Update

Use this command to change a WBS element that already exists in the Project System. It is always necessary to enter the project definition, if you do not explicitly change the project definition. Use the update structure as for WBS elements.

Example - Changing an existing WBS milestone with the number 000000002098 assigned to WBS element TRAINING.2.

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Update

OBJECTKEY = 000000002098

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

Index = 1

MILESTONE_NUMBER = 000000002098

DESCRIPTION = Milestone description changed

WBS_ELEMENT = TRAINING.2

IWbsMilestoneTableUp

MILESTONE_NUMBER =

DESCRIPTION = X

WBS_ELEMENT =

Command: Delete

Use this command to delete a WBS milestone that already exists in the R/3 Project System. The milestone is deleted physically. It is always necessary to enter the project definition, if you do not explicitly change the project definition.

Example - Deleting a WBS element with the number 000000002098 assigned to WBS element TRAINING.2.

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Delete

OBJECTKEY = 000000002098

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

MILESTONE_NUMBER = 000000002098

WBS_ELEMENT = TRAINING.2

Object type: WBS hierarchy

The WBS hierarchy object type defines the hierarchy of the WBS elements. A project definition always has exactly one hierarchy. If the position of a WBS element changes, the whole hierarchy has to be rebuilt. Therefore, the WBS hierarchy object type has only one command: Create. Every WBS element receives exactly one entry in the table parameter IWbsHierarchieTable with which it defines its position.

Command: Create

Use this command to create or change a WBS element hierarchy for a project definition. Enter the WBS hierarchy object type and the Create command in the table of the IMethodProject parameter. The command refers to all entries in the table of the IWbsHierarchieTable parameter that contains the data for the data for the hierarchy. Each entry in the IWbsHierarchieTable refers to a WBS element that describes its position relative to the other WBS elements.

Example - Positioning WBS elements TRAINING , TRAINING.1 and TRAINING.2 . (WBS elements TRAINING.1 and TRAINING.2 are subordinate to WBS element TRAINING. WBS element TRAINING1 is positioned on the left of TRAINING.2.)

IMethodProject

OBJECTTYPE = WBS Hierarchy

METHOD = Create

OBJECTKEY =

REFNUMBER =

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER = I

ProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsHierarchieTable

WBS_ELEMENT = TRAINING

PROJECT_DEFINITION = PD-TRAINING

UP =

DOWN = TRAINING.1

LEFT =

RIGHT =

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

UP = TRAINING

DOWN =

LEFT =

RIGHT = TRAINING.2

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

UP = TRAINING

DOWN =

LEFT = TRAINING.1

RIGHT =

Further Information

For more information, see the SAP Library under PS Project System -> Structures -> EPS Interface

Parameters

I_PROJECT_DEFINITION

I_PROJECT_DEFINITION_UPD

RETURN

I_METHOD_PROJECT

I_WBS_ELEMENT_TABLE_UPDATE

I_WBS_ELEMENT_TABLE

I_WBS_MILESTONE_TABLE

I_WBS_MILESTONE_TABLE_UPDATE

I_WBS_HIERARCHIE_TABLE

I_NETWORK

I_NETWORK_UPDATE

I_ACTIVITY

I_ACTIVITY_UPDATE

I_RELATION

I_RELATION_UPDATE

E_MESSAGE_TABLE

I_ACTIVITY_ELEMENT

I_ACTIVITY_ELEMENT_UPDATE

I_ACTIVITY_MILESTONE

I_ACTIVITY_MILESTONE_UPDATE

Exceptions

Function Group

2054</b>

hi can any one provide me a sample code for uploading Project definition, WBS element, Networks and network activities using BAPI_PROJECT_MAINTAIN.UR help will be appreciated.

Thanks,

Aditya

4 REPLIES 4
Read only

Former Member
0 Likes
805

The FM;BAPI_PROJECT_MAINTAIN is a very well documented one.Go to se37 and give the name of the fm.

Say display and click on the Function Module Documentation.

It is very exhaustive.

In case you don't find it,

here it is:

<b>FU BAPI_PROJECT_MAINTAIN

____________________________________________________

Text

Edit project including networks

Functionality

With the Maintain BAPI of the WorkBreakdownStruct business object you can edit the objects of a project definition. You can also use all the functions of the Maintain BAPI of the Network business object.

For more information, see Network.Maintain. With WorkBreakdownStruct.Maintain it is possible to edit the project definition, its WBS elements and their hierarchical relationships. The BAPI encapsulates a complete transaction in itself. As a result, several operations on project elements can be processed by only one call. The R/3 Project System determines in which order the operations are to be executed on the objects. The caller can choose the operations in any order.

As a result, processing is very speedy and effective. However, this transaction concept does not include the use and combination of other SAP BAPIs in the same LUW.

Procedure

The WorkBreakdownStruct business object is a facade of the project definition for WBS elements and their hierarchy.

To edit a project object, enter a command for an object type. In addition, enter the object key and a reference to its attributes.

In the table of the IMethodProject parameter enter the object type, the command and the object key. As a reference enter the index of the object data table of the relevant object type. In the object data table enter the information about the object. If necessary, use an update structure for the object. When entering the object type and method in the IMethodProject table remember that the entries are case-sensitive.

To finish the transaction and store the data in the R/3 database, enter the Save command. If you only want to test whether the changes can be carried out, do not use the save command.

In general, you cannot change the keys of objects.

The return parameter Return indicates whether errors occurred during processing. After the call you find the error messages created during processing in the EmessageTable table.

Commands of the Object Types

For the description of the object types Network, NetworkActivity, NetworkActivityElement, ActivityMilestone, and NetworkRelation, see Network.Maintain.

Object type: Project definition

The Maintain BAPI must always refer to one project definition. Therefore, always enter the structure of a project definition in the IProjectDefinition parameter. Use the project definition as a key. The reference to the data part is always 1. Always enter the project definition in upper case.

Command: Create

Enter the project definition and the project profile. The project profile must exist in the R/3 Project System.

Example - Create a Project Definition in the R/3 Project System

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Create

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Training project

PROJECT_PROFILE = PPRO001

Command: Update

Use this command to change a project definition that already exists in the R/3 Project System. If you enter an update structure you can change individual fields without having to specify the other fields.

Example - Changing the description of a project definition (Only the description is changed.)

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Update

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Training project

IProjectDefinitionUp

PROJECT_DEFINITION =

DESCRIPTION = X

Command: Lock (from R/3 Release 4.6A)

Use this command to lock a project definition. The "Master data locked" system status is set for the project definition.

LS>Example - Locking the project definition PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Lock

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Command: Unlock (from R/3 Release 4.6A)

Use this command to unlock the project definition. The "Master data locked" system status is removed from the project definition.

Example - Unlocking the project defintion PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Unlock

OBJECTKEY = PD-TRAINING

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Command: Release (from R/3 Release 4.5A)

Releasing a project. The system status "released" is set for the project definition and all WBS elements.

Example - Releasing the project definition PD-TRAINING

IMethodProject

OBJECTTYPE = ProjectDefinition

METHOD = Release

OBJECTKEY = PD-TRAINING

REFNUMBER =

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

Object type: WBS element

You can edit all WBS elements of a project definition. The name and key of the WBS element are identical.

Enter the WBS element in uppercase.

Command: Create

Example - Creating a WBS element for the project definition. Creating three WBS elements TRAINING, TRAINING.1 and TRAINING.2 for project definition PD-TRAINING

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Create

OBJECTKEY = TRAINING

REFNUMBER = 000001

OBJECTTYPE = WBS-Element

METHOD = Create

OBJECTKEY = TRAINING.1

REFNUMBER = 000002

OBJECTTYPE = WBS element

METHOD = Create

OBJECTKEY = TRAINING.2

REFNUMBER = 000003

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Whole project

Index = 2

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Preparation

Index = 3

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Execution

Command: Update

Use this command to change a WBS element that already exists in the R/3 Project System. If you enter an update structure, you can change individual fields without having to specify the other fields.

Example - Changing the description of the WBS element TRAINING.1 for the project definition PD TRAINING

IMethodProject

OBJECTTYPE = WBS element

METHOD = Update

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

DESCRIPTION = Preparation and documentation

IWbsElementTableUpdate

Index = 1

WBS_ELEMENT =

PROJECT_DEFINITION =

DESCRIPTION = X

Command: Delete

Use this command to delete a WBS element that already exists in the R/3 Project System. The WBS element receives the "Deletion flag" system status and is not deleted physically. You cannot create a new WBS element with the same key.

Example - Deleting the WBS element TRAINING.2 for the project PD

TRAINING

IMethodProject

OBJECTTYPE = WBS element

METHOD = Delete

OBJECTKEY = TRAINING.2

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

Command: Lock (from R/3 Release 4.6A)

Use this command to lock a WBS element. The "Master data lock" system status is set for the WBS element.

Example - Locking the WBS element TRAINING.1

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Lock

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Command: Unlock (from R/3 Release 4.6A)

Use this command to unlock a WBS element. The "Master data lock" system status is removed from a WBS element.

Example - Unlocking the WBS element TRAINING.1

IMethodProjectIMethodProject

OBJECTTYPE = WBS-Element

METHOD = Unlock

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Command: Release (ab R/3 Release 4.5A)

Releasing a WBS element. The system status "Released" is set for the WBS element and all lower-level WBS elements.

Example - Releasing the WBS element TRAINING.1

IMethodProject

OBJECTTYPE = WBS-Element

METHOD = Release

OBJECTKEY = TRAINING.1

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsElementTable

Index = 1

WBS_ELEMENT = TRAINING.1

Object type: WBS milestone (from R/3 Release 4.6A)

The key for the object WBS milestone is the milestone number.

Command: Create

Use this command to create a new WBS milestone for a network. It is not necessary to enter a number for the milestone. The system gives the milestone a number when it is created. The system returns the milestone in the message table as an information message.

If however, an external number is entered in the method table, both the external and the new milestone number are returned in an information a message in the message table. A WBS element always has to be entered.

Example - Creating a new WBS milestone for a WBS element TRAINING.2

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Create

OBJECTKEY =

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

Index = 1

MILESTONE_NUMBER =

WBS_ELEMENT = TRAINING.2

Command: Update

Use this command to change a WBS element that already exists in the Project System. It is always necessary to enter the project definition, if you do not explicitly change the project definition. Use the update structure as for WBS elements.

Example - Changing an existing WBS milestone with the number 000000002098 assigned to WBS element TRAINING.2.

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Update

OBJECTKEY = 000000002098

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

Index = 1

MILESTONE_NUMBER = 000000002098

DESCRIPTION = Milestone description changed

WBS_ELEMENT = TRAINING.2

IWbsMilestoneTableUp

MILESTONE_NUMBER =

DESCRIPTION = X

WBS_ELEMENT =

Command: Delete

Use this command to delete a WBS milestone that already exists in the R/3 Project System. The milestone is deleted physically. It is always necessary to enter the project definition, if you do not explicitly change the project definition.

Example - Deleting a WBS element with the number 000000002098 assigned to WBS element TRAINING.2.

IMethodProject

OBJECTTYPE = WBS milestone

METHOD = Delete

OBJECTKEY = 000000002098

REFNUMBER = 000001

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER =

IWbsMilestoneTable

MILESTONE_NUMBER = 000000002098

WBS_ELEMENT = TRAINING.2

Object type: WBS hierarchy

The WBS hierarchy object type defines the hierarchy of the WBS elements. A project definition always has exactly one hierarchy. If the position of a WBS element changes, the whole hierarchy has to be rebuilt. Therefore, the WBS hierarchy object type has only one command: Create. Every WBS element receives exactly one entry in the table parameter IWbsHierarchieTable with which it defines its position.

Command: Create

Use this command to create or change a WBS element hierarchy for a project definition. Enter the WBS hierarchy object type and the Create command in the table of the IMethodProject parameter. The command refers to all entries in the table of the IWbsHierarchieTable parameter that contains the data for the data for the hierarchy. Each entry in the IWbsHierarchieTable refers to a WBS element that describes its position relative to the other WBS elements.

Example - Positioning WBS elements TRAINING , TRAINING.1 and TRAINING.2 . (WBS elements TRAINING.1 and TRAINING.2 are subordinate to WBS element TRAINING. WBS element TRAINING1 is positioned on the left of TRAINING.2.)

IMethodProject

OBJECTTYPE = WBS Hierarchy

METHOD = Create

OBJECTKEY =

REFNUMBER =

OBJECTTYPE =

METHOD = Save

OBJECTKEY =

REFNUMBER = I

ProjectDefinition

PROJECT_DEFINITION = PD-TRAINING

IWbsHierarchieTable

WBS_ELEMENT = TRAINING

PROJECT_DEFINITION = PD-TRAINING

UP =

DOWN = TRAINING.1

LEFT =

RIGHT =

WBS_ELEMENT = TRAINING.1

PROJECT_DEFINITION = PD-TRAINING

UP = TRAINING

DOWN =

LEFT =

RIGHT = TRAINING.2

WBS_ELEMENT = TRAINING.2

PROJECT_DEFINITION = PD-TRAINING

UP = TRAINING

DOWN =

LEFT = TRAINING.1

RIGHT =

Further Information

For more information, see the SAP Library under PS Project System -> Structures -> EPS Interface

Parameters

I_PROJECT_DEFINITION

I_PROJECT_DEFINITION_UPD

RETURN

I_METHOD_PROJECT

I_WBS_ELEMENT_TABLE_UPDATE

I_WBS_ELEMENT_TABLE

I_WBS_MILESTONE_TABLE

I_WBS_MILESTONE_TABLE_UPDATE

I_WBS_HIERARCHIE_TABLE

I_NETWORK

I_NETWORK_UPDATE

I_ACTIVITY

I_ACTIVITY_UPDATE

I_RELATION

I_RELATION_UPDATE

E_MESSAGE_TABLE

I_ACTIVITY_ELEMENT

I_ACTIVITY_ELEMENT_UPDATE

I_ACTIVITY_MILESTONE

I_ACTIVITY_MILESTONE_UPDATE

Exceptions

Function Group

2054</b>

Read only

0 Likes
804

i want a sample code for that. i want to create project definition, wbs, wbs hierarchy,network, nwetwork activities at one run.

Message was edited by: Aditya Balijepalli

Read only

0 Likes
804

Refer this thread:

Regards,

ravi

Read only

Former Member
0 Likes
804

Hi,

This is a program we created for uploading networks. You can use it as a base.

REPORT z_dlps002_network_act_load.

TYPES: BEGIN OF gty_bus2002,

i_number TYPE bapi_network_list-network.

INCLUDE STRUCTURE bapi_bus2002_act_new.

TYPES: END OF gty_bus2002.

DATA: gtab_bus2002 TYPE TABLE OF gty_bus2002 WITH HEADER LINE,

gtab_bus2002_new TYPE TABLE OF bapi_bus2002_act_new WITH HEADER

LINE.

DATA: gtab_bapiret2 TYPE TABLE OF bapiret2 WITH HEADER LINE,

gw_exit_flag(1).

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

  • Local file

PARAMETERS: p_lcl_fn TYPE rlgrap-filename.

SELECTION-SCREEN END OF BLOCK b1.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS: p_1 RADIOBUTTON GROUP sel2, "YYYYMMDD

p_2 RADIOBUTTON GROUP sel2, "YYYYDDMM

p_3 RADIOBUTTON GROUP sel2, "DD.MM.YYYY

p_4 RADIOBUTTON GROUP sel2, "MM/DD/YYYY

p_5 RADIOBUTTON GROUP sel2, "MM-DD-YYYY

p_6 RADIOBUTTON GROUP sel2, "YYYY.MM.DD

p_7 RADIOBUTTON GROUP sel2, "YYYY/MM/DD

p_8 RADIOBUTTON GROUP sel2. "YYYY-MM-DD

SELECTION-SCREEN END OF BLOCK b2.

*-- AT SELECTION-SCREEN -


*

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_lcl_fn.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

def_filename = p_lcl_fn

  • DEF_PATH = ' '

mask = ',. ,..'

  • MODE = ' '

  • TITLE = ' '

IMPORTING

filename = p_lcl_fn

  • RC =

EXCEPTIONS

inv_winsys = 0

no_batch = 0

selection_cancel = 0

selection_error = 0

OTHERS = 0.

*START OF SELECTION

START-OF-SELECTION.

PERFORM upload_file.

CHECK NOT gtab_bus2002[] IS INITIAL.

LOOP AT gtab_bus2002.

CLEAR gtab_bus2002_new. REFRESH gtab_bus2002_new.

MOVE-CORRESPONDING gtab_bus2002 TO gtab_bus2002_new.

APPEND gtab_bus2002_new.

  • AT END OF i_number.

CLEAR gw_exit_flag.

  • CALL FUNCTION BAPI_PS_INITIALIZATION

CALL FUNCTION 'BAPI_PS_INITIALIZATION'.

  • CALL FUNCTION BAPI_BUS2002_CREATE_MULTI

CALL FUNCTION 'BAPI_BUS2002_ACT_CREATE_MULTI'

EXPORTING

i_number = gtab_bus2002-i_number

TABLES

it_activity = gtab_bus2002_new

et_return = gtab_bapiret2.

REFRESH gtab_bus2002_new.

CLEAR gtab_bus2002_new.

PERFORM write_message USING 'ZBAPI_BUS2002_CREATE_MULTI'.

CHECK gw_exit_flag NE 'X'.

  • CALL FUNCTION BAPI_PS_PRECOMMIT

CALL FUNCTION 'BAPI_PS_PRECOMMIT'

TABLES

et_return = gtab_bapiret2.

PERFORM write_message USING 'BAPI_PS_PRECOMMIT'.

CHECK gw_exit_flag NE 'X'.

  • CALL FUNCTION BAPI_TRANSACTION_COMMIT

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

IMPORTING

return = gtab_bapiret2.

PERFORM write_message USING 'BAPI_TRANSACTION_COMMIT'.

WAIT UP TO 2 SECONDS .

CHECK gw_exit_flag NE 'X'.

  • ENDAT.

ENDLOOP.

----


  • FORM WRITE_MESSGAGES *

----


FORM write_message USING header.

SKIP.

WRITE: / 'Messages from', header.

LOOP AT gtab_bapiret2.

WRITE: / gtab_bapiret2-type,

4 gtab_bapiret2-message.

IF gtab_bapiret2-type = 'E'.

gw_exit_flag = 'X'.

ENDIF.

ENDLOOP.

REFRESH gtab_bapiret2.

ENDFORM.

&----


*& Form upload_file

&----


FORM upload_file.

  • Read from local file

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

filename = p_lcl_fn

filetype = 'DAT'

TABLES

data_tab = gtab_bus2002

EXCEPTIONS

conversion_error = 1

file_open_error = 2

file_read_error = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_filetransfer = 8

customer_error = 9

OTHERS = 10.

IF sy-subrc <> 0.

  • Error message

ENDIF.

ENDFORM. " upload_file