
Hi Experts,
I had been to a project requirement in which I had to update Project's questionnaire in programmatic fashion. We were getting data to update project questionnaire from a third party and the questionnaire was to be updated in a proxy call.
I am new to PPM/RPM and I did not know how to achieve this, however, after some research work and guidance from my lead we could achieve it.
Creating this document to help you with a very little knowledge/experience I have gained during the discussed client requirement.
Approach
Updating project questionnaire can be done in the PPM screen (FPM based) also, with user interaction. We did the same and traced it using ST12.
In the trace we determined that there is a method call of an instance happens which takes care of entire update. We mimicked the standard way in our custom class and called the custom class' method in the proxy interface's method.
Technical Solution
First we had to lock the said project to perform an update. To lock it we used /rpm/cl_lock_manager=>enqueue_object
CALL METHOD /rpm/cl_lock_manager=>enqueue_object
EXPORTING
iv_lock_mode = 'E' " Lock mode
iv_object_external_id = <32 char project ID> " Business Object External ID
iv_application_type = 'RPM' " Application in Project Planning, it may differ in your case
IMPORTING
et_msg = lt_msg " Table Type for Messages
.
We had put the break-point in MODIFY method of /RPM/CL_SERVICES class as it is the method which gets called to perform the changes, we observed the contents of CT_MODIFICATION (changing parameter) and mimicked the same when we called this method in our program after locking the project.
DATA(lr_rpm_service) = /RPM/CL_SERVICES=>get_instance( ).
* Pass the new values
CALL METHOD lr_rpm_service->modify
EXPORTING
is_context = ls_context " Portfolio Hierarchy
IMPORTING
et_msg = lt_msg " Table Type for Messages
CHANGING
ct_modification = lt_modifications " Initiative Modifications
.
ls_context we can fill with the help of certain tables which I will talk now--
* Get project details from Operational item persisted data table /RPM/ITEM_D
SELECT * UP TO 1 ROWS INTO ls_project
FROM /rpm/item_d
WHERE external_id =<proj numb>.
ENDSELECT.
* Get questionnaire header data from table /RPM/QNNR
SELECT * UP TO 1 ROWS INTO gs_qnnr_head
FROM /rpm/qnnr
WHERE object_guid = ls_project-guid.
ENDSELECT.
* Get custom object type
SELECT * UP TO 1 ROWS INTO ls_cust_obj_type
FROM /rpm/obj_cus_fld
WHERE field_name = ls_qnnr_head-attribute_id.
ENDSELECT.
* Fill returning structure
ls_context-object_guid = ls_project-guid.
ls_context-object_id = ls_qnnr_head-attribute_id.
ls_context-object_type = 'QNR'.
ls_context-parent_guid = ls_project-parent_guid.
ls_context-parent_type = ls_cust_obj_type-obj_type.
ls_context-portfolio_guid = ls_project-portfolio_guid.
After call of the method MODIFY with the correct parameters (you need to observe the parameters in debug mode and then program them and pass them ), we will call method DO_ACTION of the same class
CALL METHOD lr_rpm_service->do_action
EXPORTING
is_context = ls_context " Portfolio Hierarchy
in_bo_node_name = lv_string1 "Dummy
in_action_name = /rpm/cl_ui_co=>action_save
in_parameters = ls_dpara "Dummy
IMPORTING
et_msg = lt_msg " Table Type for Messages
ev_rc = lv_rc
.
Unlock the project after entire processing-
/rpm/cl_lock_manager=>dequeue_object(
EXPORTING
iv_lock_mode = 'E' " Lock mode
iv_object_external_id = ls_project-external_id " Business Object External ID
).
I hope this document helps people in any way to get closer to their client's similar requirements.
Thanks & Regards
Mohit Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.