cancel
Showing results for 
Search instead for 
Did you mean: 

Update contract /PO using BBP_PD_UPDATE FMs

former_member184741
Active Contributor
0 Kudos

Hi Experts,

I am using BBP_PD_PO_UPDATE and BBP_PD_CTR_UPDATE to change existing lines / add new lines to contracts and POs. We have activated process controlled workflow for both documents. For POs there is a approval workflow and for contracts it automatic workflow by system. The FMs work absolutely fine. When I use these FMs to change / add new items I am seeing a change version created in BBP_PD and change version is in awaiting approval. But the problem is I don't see any WF instance or workitem related to the WF. If I do simillar changes using webui I see WF instance for change version  in BBP_PD. So it is cleat that there is nothing wrong with WF setup. There is some issue with the way updating / Saving is happening using these FMs.

The call stack i am following is

- BBP_PD_CTR_UPDATE with i_park = 'X' and i_save = 'X'

- BBP_PD_CTR_SAVE

- COMMIT WORK AND WAIT

same call stack as above is followed for POs as well with PO related FMs

thanks,

sankar.

Accepted Solutions (1)

Accepted Solutions (1)

konstantin_anikeev
Active Contributor
0 Kudos

Alternative, you can try to use class /SAPSRM/CL_WF_PROCESS_MANAGER to start worklfow manually.

former_member184741
Active Contributor
0 Kudos

Hi,

Thanks for the reply.

Initially I thought of using OO aproach, but could not find any document / material on how to use it. Can you give me some pointers? Also how to use class /SAPSRM/CL_WF_PROCESS_MANAGER to start WF manually. I have change version guid with me.

thanks,

sankar.

konstantin_anikeev
Active Contributor
0 Kudos

Hi sankar,

Have you tried START_PROCESS method?

Regards

Konstantin

former_member184741
Active Contributor
0 Kudos

hi,

I am getting dump saying The ASSERT condition was violated. The code where it is failing is

lo_process = /sapsrm/cl_wf_process_manager=>get_process_by_document( iv_document_guid ).

   ASSERT lo_process IS BOUND.


i debugged a bit and found that system is checking  table /SAPSRM/D_WF_000 for the document guid. in my case there is not entry in this table for the change version document guid.


I am having a crazy idea. tell me if this works. when calling pd_po_update i can say i_park = 'X' and i_save = '' ' and then call bbp_pd_po_save. This will create a version with HELD status. Now I will use the new GUID and use OO approch of ordering the PO ( I am not sure how to do that, but i am thinking exploring /SAPSRM/CL_PDO_BO_PO_ADV class ). what do you say?


thanks

former_member184741
Active Contributor
0 Kudos

Hi

As i mentioned i am creating changeversion in HELD status and trying to order it using OO approach. to make sure that this is possible techncially i tried ordering a HELD PO crated by PD_PO_UPDATE FM and it was succesful, workflow triggered with no issue. So techncially this can be achieved i think. I tried below code with no success

CALL METHOD /sapsrm/cl_pdo_bo_po_adv=>get_po_adv_instance

       EXPORTING

         iv_header_guid  = 'header guid of change veriosn'

         iv_mode         = 'EDIT'

         iv_wiid         = ' '

         iv_process_type = 'ECPO'

         iv_user_id      = 'user id'

       RECEIVING

         ro_instance     = lo_po_instance.


CALL METHOD lo_po_instance->/sapsrm/if_pdo_bo_po~order

       CHANGING

         co_message_handler = lo_message_handler.


This code gives an exception saying PDO layer error.

any clues? I will also debug it further

thanks

former_member184741
Active Contributor
0 Kudos

I have figured out the solution. Created a blog as well

Answers (1)

Answers (1)

konstantin_anikeev
Active Contributor
0 Kudos

Hi Sankar,

SAP moved some WF logic to *ADV classes. You should use new OO approach to have it working the right way

Regards

Konstantin