Application Development 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: 

Example code for BAPI_NETWORK_MAINTAIN

Former Member
0 Kudos

Hi All,

I need to create a network, network activity and its components using BAPI (BAPI_NETWORK_MAINTAIN).

Can any one tell me out to find the mandatory tables and its parameters.

if possible with example code.

One More question, when i am creating a network, Which network number do i need to pass as objectkey in IMETHOD table ?

Same number i need to pass in INETWORK table also?

Do i need to use some existing number or the number will be assigned by system?

When the BAPI ends with error, i can see error messages in message table.

if BAPI is success, does it give any messages like success message.

Thanks,

Swapna.

5 REPLIES 5

Former Member
0 Kudos

Hi

Check the documentation of the BAPI in SE37. After you enter the BAPI in display mode.. Click on "Function Module Documentation" .

The documentation contains complete sample code and how to pass the values.

Regards,

Vishwa.

Former Member
0 Kudos

Hi,,

See the example

                        • create network ***********

if not network is initial.

MOVE '000001' TO itnetmethod-refnumber.

MOVE 'NETWORK' TO itnetmethod-objecttype.

MOVE 'CREATE' TO itnetmethod-method.

MOVE network TO itnetmethod-objectkey.

APPEND itnetmethod.

MOVE '000000' TO itnetmethod-refnumber.

MOVE ' ' TO itnetmethod-objecttype.

MOVE 'SAVE' TO itnetmethod-method.

MOVE ' ' TO itnetmethod-objectkey.

APPEND itnetmethod.

MOVE network TO itnetwork-network.

MOVE network_type TO itnetwork-network_type.

MOVE vplant TO itnetwork-plant.

MOVE 'NEW NETWORK' TO itnetwork-short_text.

MOVE wbs_element TO itnetwork-wbs_element.

MOVE '001' TO itnetwork-mrp_controller.

MOVE project_definition TO itnetwork-project_definition.

MOVE profile TO itnetwork-profile.

APPEND itnetwork.

REFRESH itemsg.

CALL FUNCTION 'BAPI_NETWORK_MAINTAIN'

  • IMPORTING

  • RETURN =

TABLES

i_method_project = itnetmethod

i_network = itnetwork

  • I_NETWORK_UPDATE =

  • I_ACTIVITY =

  • I_ACTIVITY_UPDATE =

  • I_RELATION =

  • I_RELATION_UPDATE =

e_message_table = itemsg.

  • I_ACTIVITY_ELEMENT =

  • I_ACTIVITY_ELEMENT_UPDATE =

  • I_ACTIVITY_MILESTONE =

  • I_ACTIVITY_MILESTONE_UPDATE =

IF sy-subrc = 0.

ENDIF.

LOOP AT itemsg.

MOVE : itemsg-method to network_create_error-method,

itemsg-object_type to network_create_error-OBJECT_TYPE,

itemsg-internal_object_id to

network_create_error-INTERNAL_OBJECT_ID,

itemsg-external_object_id to

network_create_error-EXTERNAL_OBJECT_ID,

itemsg-message_id to network_create_error-MESSAGE_ID,

itemsg-message_number to

network_create_error-MESSAGE_NUMBER,

itemsg-message_type to network_create_error-MESSAGE_TYPE,

itemsg-message_text to network_create_error-MESSAGE_TEXT.

append network_create_error.

clear itemsg.

endloop.

COMMIT WORK .

WAIT UP TO 1 SECONDS.

endif. "if not network is initial

Regards

Mudit

former_member206439
Contributor
0 Kudos

Hi

i_method_project-objecttype = 'NETWORKACTIVITY' . 
i_method_project-method = 'UPDATE'. 
i_method_project-objectkey = v-objkey. 
i_method_project-refnumber = '000001' . 
APPEND i_method_project. 
i_method_project-objecttype = ' ' . 
i_method_project-method = 'SAVE'. 
i_method_project-objectkey = ' '. 
i_method_project-refnumber = ' ' . 
APPEND i_method_project. 
i_activity-network = v-objkey. 
i_activity-activity = i-vornr. 
i_activity-work_activity = i-ismnw . 
APPEND i_activity. 
i_activity_update-network = v-objkey. 
i_activity_update-activity = i-vornr. 
i_activity_update-work_activity = 'X'. 
APPEND i_activity_update. 
i_network-network = v-objkey. 
APPEND i_network. 

* Network activity updating 
CALL FUNCTION 'BAPI_NETWORK_MAINTAIN' 
IMPORTING 
return = bapireturn1 
TABLES 
i_method_project = i_method_project 
i_network = i_network 
i_activity = i_activity 
e_message = e_message.

Former Member
0 Kudos

Hi all,

How to use 'SAVE' mehtod in creation of network.

Is this method 'SAVE' in IMETHOD table parameters is mandatory for creation of network using BAPI BAPI_NETWORK_MAINTAIN

If the BAPI is success, What will be the output?

Please help!

Thannks,

Swapna P

Former Member
0 Kudos

Hello,

I am trying to user BAPI_NETWORK_MAINTAIN function module to create create a nework. However I cannot get past these errors.

The statuses could not be created while creating network "MS41-T000002" (Message ID CN #194)

WBS elem. cntrl. area "FP00" is not same as network cntrl. area (Message ID CN #068)

I can create the Network and activities through CN21 transaction using the same data that I am passing to BAPI_NETWORK_MAINTAIN function module.

Any insight would be greatly appreciated.

Thanks

Tushar Shelar