cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic version creation - ERROR: Item version XXXX does not exists

0 Kudos

Hi PPM Experts,

System: PPM 6.0

Requirement:

Item and project version(snapshot) has to be generated automatically whenever the user change the item decision point status.

Solution:

Implemented the BADI /RPM/DECISION_POINT=>PREPARE_TO_SAVE

Calling static class to generate version:   /rpm/cl_item_d_api=>create_items_version

Problem:

Item version is generated successfully but project version is not. It throw's errors as below.

"Item version XXXX does not exists."

"Snapshot version could not be created"

code:

CALL FUNCTION 'NUMBER_GET_NEXT'

                        EXPORTING

                          nr_range_nr             = lv_number_range

                          object                  = ' DPR_VRSN'

                        IMPORTING

                          number                  = lv_hdr_verid

                        EXCEPTIONS

                          interval_not_found      = 1

                          number_range_not_intern = 2

                          object_not_found        = 3

                          quantity_is_0           = 4

                          quantity_is_not_1       = 5

                          interval_overflow       = 6

                          buffer_overflow         = 7

                          OTHERS                  = 8.


/rpm/cl_item_d_api=>create_items_version(

                               EXPORTING

                                 it_item_guids           = lt_itemguid

                                 iv_version_type         = lc_snapst

                                 iv_vers_hdr_name        = lv_hdr_verid

                                 iv_cp_version_name      = lv_hdr_verid

                                 iv_vers_hdr_description = lv_verdes

                                  ).

The version has to generate for an item along with the project.

Kindly help me to resolve this issue.

Accepted Solutions (1)

Accepted Solutions (1)

judith_gabriel
Contributor
0 Kudos

Dear Udaya,

you can use BAPI_BUS2172_SIMULATION_CREATE or BAPI_BUS2172_SNAPSHOT_CREATE to create the simulation/snapshot for the assigned project.

In class /RPM/CL_ITEM_D_API, method GET_CPROJECT_VERS the available projectversion-IDs
are determined.

Best regards,
Judith

0 Kudos

Hi Judith,

Thanks for the reply.

The method /rpm/cl_item_d_api=>create_items_version in turns calling the BAPI_BUS2172_SNAPSHOT_CREATE.

Also the version has to be generated for item along with the project.

judith_gabriel
Contributor
0 Kudos

Dear Udaya,

the following coding parts should be reached to create version of item and project:

/RPM/CL_ITEM_D_API
CREATE_ITEM_VERSION

The parameter lv_create_cpro_vers_checked must be set to X otherwise the project-version
isn´t created.

/RPM/VERSION_HEADER              
COMPONENTCONTROLLER
ON_UPDATE                     

IF lv_create_cpro_vers_checked IS NOT INITIAL.

/RPM/CL_ITEM_D_API
ACTION_CP_VERSION_CREATE

88 * create cProjects project version to item version
89   TRY.
90       IF sy-subrc IS INITIAL.
91         CALL METHOD me->create_cp_version
92           EXPORTING
93             iv_original_item_guid_h = ls_key-original_guid_h
94             iv_item_version_guid_d  = ls_key-version_guid_d
95             iv_version_name         = ls_key-cp_version_name
96             iv_version_type         = ls_key-version_type
97             ir_item_guid            = lr_item_vers_d
98           IMPORTING
99             ev_cp_version_guid      = lv_cp_version_guid.

At the following coding the corresponding BAPIs are called:

/RPM/CL_ITEM_D_API
CREATE_CP_VERSION

117 * create cproject version
118   lv_cp_version = iv_version_name.
119   CASE  iv_version_type .
120     WHEN '01'.     " Snap Shot
121       CALL FUNCTION 'BAPI_BUS2172_SNAPSHOT_CREATE'
122         EXPORTING
123           project_definition_guid = lv_project_guid
124           iv_version              = lv_cp_version
125         TABLES
126           return                  = lt_return.
127     WHEN '02'.     " Simulation
128       CALL FUNCTION 'BAPI_BUS2172_SIMULATION_CREATE'
129         EXPORTING
130           project_definition_guid = lv_project_guid
131           iv_version              = lv_cp_version
132         TABLES
133           return                  = lt_return.

Are you reaching the breakpoint 'BAPI_BUS2172* when making the changes in the decision point?

Best regards,
Judith

0 Kudos

Judith,

Thanks a lot. It works!

Still I am using the same static class /rpm/cl_item_d_api=>create_items_version by passing the cproject version.

Code:

/rpm/cl_item_d_api=>create_items_version(

                                EXPORTING

                                  it_item_guids           = lt_itemguid

                                  iv_version_type         = lc_snapst

                                  iv_vers_hdr_name        = lv_hdr_verid

                                  iv_cp_version_name      = lv_cproj_ver

                                  iv_vers_hdr_description = lv_verdes

                                   ).

lv_cproj_ver is the exporting parameter of /RPM/CL_ITEM_D_API=>GET_CPROJECT_VERS

0 Kudos

Hi Judith,

I am hitting another issue. When I call first time /RPM/CL_ITEM_D_API=>GET_CPROJECT_VERS by passing the Item GUID, the project version is populated in the exporting parameter. So that item version is created with project.

When I cal the same method /RPM/CL_ITEM_D_API=>GET_CPROJECT_VERS  second time, exporting parameter is empty for the particular item GUID.

Please help to get the project version all the times.

Thanks.

Uday

Answers (0)