cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creation of C project from xRPM item and automatic creation of proj in PS

Former Member
0 Likes
464

Hi all,

My requirement is to create a cproject from xRPM, once the status of the item is "Approved" and a BAdI is there(RPM_PROJ_CUST_WF) which will trigger, when the status is changed to "Approved".

My problem is how to create a cproject from xRPM item, any FM or BAPI available? If cproject is created, then automatically a project needs to be created in PS (ECC).

Also how to create a project in PS from cproject, any config? Please help in this regard. How I can proceed?. I need to make any config. for acheiving the same?

Regards,

V Kumar

Edited by: V Kumar on Sep 18, 2009 3:06 PM

Edited by: V Kumar on Sep 18, 2009 3:09 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

hi

i do not know any BADI to create, but i can tell u a way to create a cproject from xRPM

to create a cproject from xrpm, you need to

1.create a project template in cProjects.

2. map this cproject template to the Map xRPM Item Type to cProjects Project Template

IMG path

SPRO>SAP xApp Resource and Portfolio Management (SAP xRPM) > Global Customizing >Portfolio-Independent Settings > Map Item Type to cProjects Project Type or Project Templates

3. then create a portfolio item type in xRPM using thjs cProject template

thanks

maniraj

Former Member
0 Likes

Hi Experts,

I am new to cFolder and cProject .As I have studied your question and answer I am willing to know in which scenario we can use this Where first Item is required to be defined in xRPM and then project will be created automatically in cProject and then behalf of cProject , Project will be created in ECC.

Regards

Rama S.Sharma

Answers (4)

Answers (4)

former_member209919
Active Contributor
0 Likes

Hi V Kumar,

We have the same requirement as you , we need the cproject is created when item is released, we are looking for or a BADI or working with initiatives.

Regards,

Sara

Former Member
0 Likes

Hi,

Please use the BAdI-RPM_PROJ_CUST_FIELDS and method: CUST_PROJ_ON_COMMIT_CHANGES. Also you can compare the item status (old & new value) with the importing parameters of this method.

After that, get the cproject template using FM- /RPM/CPRO_TEMPLATE_GETLIST or get the template GUID using table- /RPM/CPIT_MAP because if you use FM, it will give authorisation issues for some users. Prequisite is to configure the item type to corresponding cProject template in SPRO.

Then call FM- DFM_DO_CREATE_PROCESSING for creating project in cProject.

Regards,

V Kumar

Former Member
0 Likes

This message was moderated.

Former Member
0 Likes

Hi,

I don't know how to create PS upon approval of item but I have done auto creation of cProject upon approval of item. Use FM

DFM_DO_CREATE_PROCESSING.

Here is sample code for this. In this code you have to create a cProject from a template.

FUNCTION Z_RPM_ITEM_CPROJECT_LINK2.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(I_ITEM_GUID) TYPE /RPM/TV_GUID OPTIONAL

*" VALUE(I_BUCKET_ID) TYPE /RPM/TV_BUCKET_ID OPTIONAL

*" EXPORTING

*" VALUE(EV_RC) TYPE I

*"----


  • Data declaration

Data:

lt_rpm_messages TYPE /rpm/tt_messages,

ls_source_context TYPE inm_object_context,

ls_operation_context TYPE inm_operation_context,

IT_TARGET_TEMPLATES TYPE INM_TT_GROUP_TEMPLATE_ASSOC,

ls_target_templates TYPE INM_TS_GROUP_TEMPLATE_ASSOC,

lt_triggering_objects TYPE inm_tt_object_context,

ls_triggering_object TYPE inm_object_context,

lt_params TYPE inm_of_tt_field_names_values,

ls_params TYPE inm_of_ts_field_name_value,

lv_object_id TYPE INM_OF_TV_OBJECT_KEY,

lv_templateId TYPE INM_OF_TV_OBJECT_KEY,

lv_parent_guid TYPE /RPM/TV_GUID,

lv_portfolio_guid TYPE /RPM/TV_GUID,

lv_parent_guid1 TYPE INM_OF_TV_FIELD_VALUE,

lv_portfolio_guid1 TYPE INM_OF_TV_FIELD_VALUE,

ET_Messages TYPE INM_OF_TT_MESSAGES,

ls_ilink_db TYPE /rpm/item_il.

Data: lv_cproject_template TYPE ZTEMPLATE1-CPROJECT_TEMP,

lv_cproject_template2 TYPE DPR_TV_PROJECT_ID,

lv_temp_guid TYPE DPR_TV_ENTITY_GUID,

lv_log_sys TYPE string.

lv_object_id = I_ITEM_GUID.

  • Get the cproject template guid

select single CPROJECT_TEMP into lv_cproject_template

from ZTEMPLATE1

where EXTERNAL_ID = I_BUCKET_ID.

lv_cproject_template2 = lv_cproject_template.

select single GUID into lv_temp_guid

from DPR_PROJECT

where PROJECT_ID = lv_cproject_template2.

lv_templateId = lv_temp_guid.

  • Get Parent & Portfolio guid

Select single PORTFOLIO_GUID PARENT_GUID into

(lv_portfolio_guid, lv_parent_guid)

from /rpm/item_d

where guid = i_item_guid.

lv_portfolio_guid1 = lv_portfolio_guid.

lv_parent_guid1 = lv_parent_guid.

  • Get logistic system

concatenate SY-SYSID 'CLNT' SY-MANDT into lv_log_sys.

condense lv_log_sys.

  • Assigning more data

ls_source_context-OBJECT_ID = lv_object_id.

*ls_source_context-LOGSYS = 'DY1CLNT200'.

ls_source_context-LOGSYS = lv_log_sys.

ls_source_context-GROUPING = 'PPO'.

ls_source_context-OBJECT_LINK_TYPE = '0INMITEM'.

ls_source_context-CREATE_TEMPLATE_TYPE = '1'.

ls_source_context-TEMPLATE_ID = lv_templateId.

ls_source_context-TARGET_OBJECT_GROUPING = 'PDCP'.

ls_operation_context-OPERATION = 'C'.

ls_target_templates-GROUPING = 'PDCP'.

*ls_target_templates-LOGSYS = 'DY1CLNT200'.

ls_target_templates-LOGSYS = lv_log_sys.

ls_target_templates-TEMPLATE_ID = lv_templateId.

ls_target_templates-TYPE = '1'.

append ls_target_templates to IT_TARGET_TEMPLATES.

ls_params-EXT_FIELD_NAME = 'PARENT_GUID'.

ls_params-EXT_FIELD_VALUE = lv_parent_guid1.

append ls_params to lt_params.

ls_params-EXT_FIELD_NAME = 'PORTFOLIO_GUID'.

ls_params-EXT_FIELD_VALUE = lv_portfolio_guid1.

append ls_params to lt_params.

  • Calling FM to create cproject & linking to item

CALL FUNCTION 'DFM_DO_CREATE_PROCESSING'

EXPORTING

IS_SOURCE_OBJECT_CONTEXT = ls_source_context

IS_OPERATION_CONTEXT = ls_operation_context

IT_TARGET_TEMPLATES = it_target_templates

IT_PARAMS = lt_params

IT_TRIGGERING_OBJECTS = lt_triggering_objects

IMPORTING

ET_MESSAGES = ET_Messages

EV_RC = EV_RC.

      • commit changes

ENDFUNCTION.

Please let me know if you find a way to create PS from xRPM or cProject.

Regards

Mohinder

Former Member
0 Likes

Hi,

I don't know how to create PS upon approval of item but I have done auto creation of cProject upon approval of item. Use FM

DFM_DO_CREATE_PROCESSING.

Here is sample code for this. In this code you have to create a cProject from a template.


FUNCTION Z_RPM_ITEM_CPROJECT_LINK2.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_ITEM_GUID) TYPE  /RPM/TV_GUID OPTIONAL
*"     VALUE(I_BUCKET_ID) TYPE  /RPM/TV_BUCKET_ID OPTIONAL
*"  EXPORTING
*"     VALUE(EV_RC) TYPE  I
*"----------------------------------------------------------------------
* Data declaration

Data:

      lt_rpm_messages        TYPE /rpm/tt_messages,

      ls_source_context      TYPE inm_object_context,
      ls_operation_context   TYPE inm_operation_context,
      IT_TARGET_TEMPLATES TYPE  INM_TT_GROUP_TEMPLATE_ASSOC,
      ls_target_templates TYPE INM_TS_GROUP_TEMPLATE_ASSOC,
      lt_triggering_objects  TYPE inm_tt_object_context,
      ls_triggering_object   TYPE inm_object_context,
      lt_params              TYPE inm_of_tt_field_names_values,
      ls_params              TYPE inm_of_ts_field_name_value,
      lv_object_id           TYPE  INM_OF_TV_OBJECT_KEY,
      lv_templateId           TYPE  INM_OF_TV_OBJECT_KEY,
      lv_parent_guid        TYPE  /RPM/TV_GUID,
      lv_portfolio_guid      TYPE  /RPM/TV_GUID,
      lv_parent_guid1        TYPE  INM_OF_TV_FIELD_VALUE,
      lv_portfolio_guid1      TYPE  INM_OF_TV_FIELD_VALUE,
      ET_Messages    TYPE INM_OF_TT_MESSAGES,
      ls_ilink_db      TYPE /rpm/item_il.

Data:  lv_cproject_template  TYPE  ZTEMPLATE1-CPROJECT_TEMP,
       lv_cproject_template2  TYPE  DPR_TV_PROJECT_ID,
       lv_temp_guid  TYPE  DPR_TV_ENTITY_GUID,
       lv_log_sys  TYPE  string.


lv_object_id = I_ITEM_GUID.

* Get the cproject template guid

select single CPROJECT_TEMP into lv_cproject_template
from ZTEMPLATE1
where EXTERNAL_ID = I_BUCKET_ID.

lv_cproject_template2 = lv_cproject_template.

select single GUID into lv_temp_guid
from DPR_PROJECT
where  PROJECT_ID = lv_cproject_template2.

 lv_templateId = lv_temp_guid.

* Get Parent & Portfolio guid

Select single PORTFOLIO_GUID PARENT_GUID into
(lv_portfolio_guid, lv_parent_guid)
from /rpm/item_d
where guid = i_item_guid.

lv_portfolio_guid1 = lv_portfolio_guid.
lv_parent_guid1 = lv_parent_guid.

* Get logistic system

concatenate SY-SYSID 'CLNT' SY-MANDT into lv_log_sys.
condense lv_log_sys.

* Assigning more data

ls_source_context-OBJECT_ID = lv_object_id.
*ls_source_context-LOGSYS = 'DY1CLNT200'.
ls_source_context-LOGSYS = lv_log_sys.
ls_source_context-GROUPING = 'PPO'.
ls_source_context-OBJECT_LINK_TYPE = '0INMITEM'.
ls_source_context-CREATE_TEMPLATE_TYPE = '1'.
ls_source_context-TEMPLATE_ID = lv_templateId.
ls_source_context-TARGET_OBJECT_GROUPING = 'PDCP'.


ls_operation_context-OPERATION = 'C'.

ls_target_templates-GROUPING = 'PDCP'.
*ls_target_templates-LOGSYS = 'DY1CLNT200'.
ls_target_templates-LOGSYS = lv_log_sys.
ls_target_templates-TEMPLATE_ID = lv_templateId.
ls_target_templates-TYPE = '1'.
append ls_target_templates to IT_TARGET_TEMPLATES.

ls_params-EXT_FIELD_NAME = 'PARENT_GUID'.
ls_params-EXT_FIELD_VALUE = lv_parent_guid1.
append ls_params to lt_params.

ls_params-EXT_FIELD_NAME = 'PORTFOLIO_GUID'.
ls_params-EXT_FIELD_VALUE = lv_portfolio_guid1.
append ls_params to lt_params.

* Calling FM to create cproject & linking to item
CALL FUNCTION 'DFM_DO_CREATE_PROCESSING'
  EXPORTING
    IS_SOURCE_OBJECT_CONTEXT = ls_source_context
    IS_OPERATION_CONTEXT     = ls_operation_context
    IT_TARGET_TEMPLATES      = it_target_templates
    IT_PARAMS                = lt_params
    IT_TRIGGERING_OBJECTS    = lt_triggering_objects
  IMPORTING
    ET_MESSAGES              = ET_Messages
    EV_RC                    = EV_RC.

*** commit changes


ENDFUNCTION.

Please let me know if you find a way to create PS from xRPM or cProject.

Regards

Mohinder

Edited by: Mohinder Kumar Arora on Sep 29, 2009 11:38 PM

Former Member
0 Likes

Thanks and sorry for the late reply Mohinder and Maniraj

I am able to get the template id using FM- /RPM/CPRO_TEMPLATE_GETLIST (based on item type and item GUID). The problem is after calling the FM- DFM_DO_CREATE_PROCESSING, there is nor message and ev_rc (return code) is 0 but, i am not able to see the project created in cProjects (Table -DPR_PROJECT).

In the is_source_object_context (importing para for FM), i am passing the object link type as '0INMITEM' and grouping as 'PDCP'. I am not sure whether is it correct or where can i see this object link type and grouping.

Also i am not passing the it_target_templates to the FM. If i pass the values to it_target_templates, the FM ends with message "The application object was not found and Project template to be used does not exist."

Please help, where i am going wrong?

Regards,

V Kumar

Edited by: V Kumar on Oct 10, 2009 3:18 PM

Former Member
0 Likes

hi,

I hope u have CPR template in system and same assigned to Item type at RPM side.

Pramod