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

How to use BAPI_PROJECT_MAINTAIN?

Former Member
0 Likes
9,244

Hi,

Please let me know how to use the BAPI, BAPI_PROJECT_MAINTAIN for maintaining project details in Project Systems(PS) module.

Especially, I am not getting how to populate the table I_METHOD_PROJECT in the tables parameter.

It will be more useful if you can explain with code.

Hi,

Please let me know how to use the BAPI, BAPI_PROJECT_MAINTAIN for maintaining project details in Project Systems(PS) module.

Especially, I am not getting how to populate the table I_METHOD_PROJECT in the tables parameter.

It will be more useful if you can explain with code.

4 REPLIES 4
Read only

Former Member
0 Likes
5,234

move p_it_activity-wbs_element to h_objkey.

move p_za to i_project_definition-project_definition.

append i_project_definition.

move '1' to it_method_project-refnumber.

move 'WBS ELEMENT' to it_method_project-objecttype.

move 'UPDATE' to it_method_project-method.

move h_objkey to it_method_project-objectkey.

append it_method_project.

clear it_method_project. clear h_objkey.

move p_it_activity-network to h_objkey.

move p_it_activity-activity to h_objkey+12.

move: '1' to it_method_project-refnumber,

'NetworkActivity' to it_method_project-objecttype,

'Update' to it_method_project-method,

h_objkey to it_method_project-objectkey.

append it_method_project.

clear it_method_project.

move 'SAVE' to it_method_project-method.

append it_method_project.

it_wbs_element_table_update-user_field_key = 'X'.

it_wbs_element_table_update-user_field_char20_1 = 'X'.

it_wbs_element_table_update-wbs_billing_element = 'X'.

append it_wbs_element_table_update.

it_wbs_element_table-user_field_key = 'Z000003'.

it_wbs_element_table-user_field_char20_1 = p_example.

append it_wbs_element_table.

it_network-network = p_it_activity-network.

append it_network.

it_activity-network = p_it_activity-network.

it_activity-activity = p_it_activity-activity.

it_activity-control_key = p_h_best_code.

it_activity-user_field_key = 'Z000003'.

it_activity-user_field_char20_1 = p_example.

append it_activity.

it_activity_update-control_key = 'X'.

it_activity_update-user_field_key = 'X'.

it_activity_update-user_field_char20_1 = 'X'.

append it_activity_update.

call function 'BAPI_PROJECT_MAINTAIN'

exporting

i_project_definition = i_project_definition

i_project_definition_upd = i_project_definition_upd

tables

i_method_project = it_method_project

i_wbs_element_table_update = it_wbs_element_table_update

i_wbs_element_table = it_wbs_element_table

i_network = it_network

i_activity = it_activity

i_activity_update = it_activity_update

e_message_table = it_message_table.

Read only

0 Likes
5,234

Hi,

Thank you for your reply. It is very useful.

Can you please let me know how to create a WBS element within another WBS element.

I know that we have to use "WBS-Hierarchy" in the I_METHOD... table in the tables parameter but I don't know how to use it and how to populate I_WBS_HIERARCHY....table parameter.

Please explain with example code.

It's very urgent!

Read only

Former Member
0 Likes
5,234

Hi,

You can go through This Link.

[http://www.jt77.com/plant-maintenance/quality-management-18596.html]

Regards

Sandipan

Read only

Former Member
0 Likes
5,234

HI,

Here is the example code

-


-


DATA: lv_seqno(6) TYPE n VALUE '000001',

lc_seqno(6) TYPE n VALUE '000000'.

Structures and Internal tables used in the BAPI

DATA : gs_project_definition LIKE bapi_project_definition,

gs_project_definition_upd LIKE bapi_project_definition_up.

DATA : gt_method_project LIKE bapi_method_project

OCCURS 0 WITH HEADER LINE,

gt_wbs_element_table_update LIKE bapi_wbs_element_update

OCCURS 0 WITH HEADER LINE,

gt_wbs_element_table LIKE bapi_wbs_element

OCCURS 0 WITH HEADER LINE,

gt_wbs_hierarchie_table LIKE bapi_wbs_hierarchie

OCCURS 0 WITH HEADER LINE,

gt_return LIKE bapireturn1

OCCURS 0 WITH HEADER LINE,

gt_return1 LIKE bapiret2

OCCURS 0 WITH HEADER LINE,

gt_message_table LIKE bapi_meth_message

OCCURS 0 WITH HEADER LINE.

Populate Project definition

gs_project_definition-project_definition = 'PD-TRAINING'.

gs_project_definition-description = 'Training project'.

gs_project_definition-project_profile = 'PPRO001'.

Populate Project dafinition update table

gs_project_definition_upd-project_definition = space.

Populate project method update

gt_method_project-refnumber = lv_seqno.

gt_method_project-objecttype = 'WBS-ELEMENT'.

gt_method_project-method = 'CREATE'.

gt_method_project-objectkey = 'TRAINING'.

APPEND gt_method_project.

lv_seqno = lv_seqno + 1.

gt_method_project-refnumber = lv_seqno.

gt_method_project-objecttype = 'WBS-ELEMENT'.

gt_method_project-method = 'CREATE'.

gt_method_project-objectkey = 'TRAINING.1'.

APPEND gt_method_project.

lv_seqno = lv_seqno + 1.

gt_method_project-refnumber = lv_seqno.

gt_method_project-objecttype = 'WBS-ELEMENT'.

gt_method_project-method = 'CREATE'.

gt_method_project-objectkey = 'TRAINING.2'.

APPEND gt_method_project.

gt_method_project-refnumber = lc_seqno.

gt_method_project-objecttype = space.

gt_method_project-method = 'SAVE'.

gt_method_project-objectkey = space.

Populate WBS element

gt_wbs_element_table-wbs_element = 'TRAINING'.

gt_wbs_element_table-project_definition = 'PD-TRAINING'.

gt_wbs_element_table-description = 'Whole Project'.

gt_wbs_element_table-wbs_element = 'TRAINING.1'.

gt_wbs_element_table-project_definition = 'PD-TRAINING'.

gt_wbs_element_table-description = 'Preparation'.

gt_wbs_element_table-wbs_element = 'TRAINING.2'.

gt_wbs_element_table-project_definition = 'PD-TRAINING'.

gt_wbs_element_table-description = 'Execution'.

Update the I_WBS_ELEMENT_TABLE_UPDATE table for the BAPI

This is done 3 times because there are 3 WBS elements

created for the Studio Project

DO 3 TIMES.

gt_wbs_element_table_update-wbs_element = 'I'.

APPEND gt_wbs_element_table_update.

ENDDO.

CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'

EXPORTING

i_project_definition = gs_project_definition

i_project_definition_upd = gs_project_definition_upd

IMPORTING

return = gt_return

TABLES

i_method_project = gt_method_project

i_wbs_element_table_update = gt_wbs_element_table_update

i_wbs_element_table = gt_wbs_element_table

i_wbs_hierarchie_table = gt_wbs_hierarchie_table

e_message_table = gt_message_table.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = gt_RETURN1.

-


-


Regards

Kiran Sure