Skip to Content
Technical Articles
Author's profile photo Kriti Sugandha

PPM: Automate the Creation of Initiative version

This is a beginner level article intended for consultants to gain technical insight on the process of automatic creation of initiative versions in Portfolio and Project Management (PPM).

Problem Statement:

In the PPM workspace, we want to create a new initiative version (Snapshot) whenever decision point value is changed

 

Required background Knowledge:

Version:

We create versions of a portfolio item (item) or of a portfolio initiative (initiative) to document the status of an item at a certain point in time (snapshot) or to simulate changes (simulation).

Version Creation:

We can create a version of a given portfolio item or portfolio initiative. The versions of the object are then displayed in the embedded dashboard of versions in the Miscellaneous view of the Item Details screen or Initiative Details screen, under Versions.

Features

If we create a version of an initiative, the system not only creates a version of the initiative but also versions of all assigned items, which are then assigned to the initiative version. The version type of items will be the same as the version type of initiative.

Version Type

Snapshot

If we choose the snapshot version type, the version details will correspond to the item details or initiative details as they were at the time you created the snapshot. We cannot change the version object afterwards.

Simulation

If we choose the simulation version type, the version details will correspond to the item details or initiative details as they were at the time you created the simulation. To execute simulations, we can change the version object.

 

For more details, please visit the Official product documentation

Solution:

In order to achieve the above requirement, the below BADI needs to be implemented. This is the BADI that gets called whenever a decision point is changed and saved.

BADI    /RPM/DECISION_POINT
Method of implementing class        /RPM/IF_EX_DECISION_POINT~PREPARE_TO_SAVE

 

Creation of initiative version:

 

To create an initiative version below FM is used.

Function Module    /RPM/INIS_VERS_CREATE

For this FM, the parameter IV_VERSION_TYPE is sent as ‘01’, if a snapshot version creation is requested. The same parameter is sent as ‘02’ if a simulation version is to be created.

Please note that the FM is called using the addition “STARTING NEW TASK”. With this ABAP statement, we are telling the SAP system to process function module call in parallel.

 

METHOD /rpm/if_ex_decision_point~prepare_to_save.

    IF mv_create_s = abap_false. "Validation: the trigger is any change at the status of the initiative. This is a static variable to ensure, version is created only once. 
      IF is_attributes_new-status <> is_attributes_old-status
        AND NOT is_attributes_new-status IS INITIAL
        AND NOT is_attributes_old-status IS INITIAL.  

          mv_create_s = abap_true.

***     Get GUID from DB table; this is different from the one coming in importing parameters
          SELECT guid
            FROM inm_initiative
            INTO TABLE @DATA(lt_guid)
            WHERE item_guid = @is_attributes_new-item_guid.

          IF sy-subrc = 0 AND lt_guid IS NOT INITIAL.
            DATA: lv_name  TYPE /rpm/tv_version_name,
                  lt_guids TYPE /rpm/tt_guid.

            lt_guids = CORRESPONDING #( lt_guid MAPPING guid = guid ).

**      populate version name

*           Converts date from 20020901 to 01.09.2002 and time to HH:MM:SS
            DATA: lv_time_f(10),  "field to store time
                  lv_date_f(10).  "field to store output date
            WRITE sy-datum TO lv_date_f DD/MM/YYYY.
            DATA(lv_time) = sy-uzeit.
            CONCATENATE lv_time(2) ':' lv_time(2) ':' lv_time+4(2) INTO lv_time_f.

            CONCATENATE lv_date_f lv_time_f INTO lv_name SEPARATED BY space.

***calling in new task so that /RPM/SAVE_CHANGES is not called multiple times.
            CALL FUNCTION '/RPM/INIS_VERS_CREATE'
              STARTING NEW TASK 'ZPPM_TEST'
              DESTINATION IN GROUP DEFAULT
              EXPORTING
                it_initiative_guids = lt_guids
                iv_version_type     = '01'	"01: snapshot, 02: simulation
                iv_vers_hdr_name    = lv_name.
          ENDIF.
        
      ENDIF. "Validation: the trigger is any change at the status of the initiative
    ENDIF. "Validation: the trigger is any change at the status of the initiative

  ENDMETHOD.

 

I hope you had a good read and were able to get a basic know-how of the process of automating version creation for initiatives.

Please don’t hesitate to comment below if you have any questions, doubts or feedback.

Thank You!

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.