SAP SRM Transaction complete a PO

Introduction about SAP SRM Transaction complete a PO

This blog talks about SAP SRM Transaction complete a PO and handling old / Pos which may no longer be needed and have to be transaction completed.This is a step before actually archiving the POs and contracts. So basically the business should first be transaction completing them if there is no more GR and Invoice expected and letter archiving them as needed. The details mentioned here are related to mass transaction complete and change the status of the PO/ Contracts from backend via an ABAP report in SAP SRM Transaction complete a PO.

This, however, is possible to do via front-end by just clicking on the complete button.

                   Click on Complete to transaction complete a POSAP SRM Transaction complete a PO                           

The reason for doing transaction completed can be many from an operational perspective

  1. You need to ensure no one is using those POs as they are already Grd and invoiced
  2. Lets consider an example where these POs are linked to the contract. The contract value was 10000 USD and PO value was of 1000 USD. The remaining contract amount available after the PO is ordered is 9000 USD. However if the PO was actually on Grd for 500 USD it should return back the 500 USD balance amount. This happens when we transaction complete the PO. So the amount left to use in contract after the PO is transaction is complete would be 9500 USD. This is a best practice to ensure you make use of contracts efficiently.
  3. The program I created can be made as a batch job to see if a PO has not been updated for last 1 year or the requester/recipient is no longer available and no one else has been identified to take its ownership and is lying with the admin team it should just be transaction completed.
  4. It helps a lot in reporting making the reports look better as well as ensure you are able to forecast the expected invoice and balance amount in a much better way
  5. The reason for doing this via a program code is also the reason that these are Old Pos and if you try to transaction complete them from the backend they will have errors in terms of WBS being locked, users who have left the org and these checks needs to be fixed before you can actually Transaction complete it from the portal. If however we do as a batch program it skips those checks and is easier to close off these POs without wasting time on trying to fix the data errors

    In sum up:

Now that we discussed transaction completed there may be a case where you need to make changes in a PO which was either manually transaction completed incorrectly or was incorrectly updated by the batch job or was put on hold for sometime but is needed again. So to handle such a case I also created another program to update the table entries to change the status of the PO from being transaction completed to change back to ordered status.

Find details about how the solution was implemented

Transaction completed status is I1023
Call Function Module BBP_PD_PO_GETDETAIL. To read the details of the PO

Ensure you read the version correctly if the PO has been ordered multiple times there will be change version of the. Check if a change version exists if yes then use GUID for change version of PO

IF SY-SUBRC EQ 0.
p_guid = ls_version-guid.
ELSe.
p_guid = ls_header-GUID .
ENDIF.

Call the below function module again with the p_guid of the latest version you found above

'BBP_PROCDOC_GETDETAIL'
IF sy-subrc eq 0 . " lv_object_type EQ /sapsrm/if_pdo_obj_types_c=>GC_PDO_PO.
READ TABLE lt_status1 TRANSPORTING NO FIELDS
WITH KEY stat = /sapsrm/if_pdo_status_c=>GC_PDO_ORDERED
inact = ' '.
IF sy-subrc NE 0.
lv_not_ordered = 'X' .
ENDIF.

READ TABLE lt_status1 TRANSPORTING NO FIELDS
WITH KEY stat = /sapsrm/if_pdo_status_c=>GC_PDO_CLOSED
inact = ' '.
IF sy-subrc EQ 0.
lv_tc = 'X' .
ENDIF.
ENDIF.

Ensure the Po is not Awaiting approval or the transaction has been completed ready

if lv_not_ordered is not initial or   lv_tc is not INITIAL.
*      MESSAGE i047(bbp_pd) WITH text-001. "Transaction completed only for status ordered
ls_po_error = ls_po.
APPEND ls_po_error to lt_po_error.
CONTINUE.
ENDIF.

If the PO is in the right status of Ordered proceed with the change of status and Dont forget to call Commit FM. Also note in SRM you need to update the Final_entry and Final_inv indicator which will update the delivery completion indicator in the ECC system

'BBP_PROCDOC_STATUS_CHANGE_DIRE'
select * from bbp_pdigp INTO table lt_pdigp  for ALL ENTRIES IN lt_guid_pdigp
where guid = lt_guid_pdigp-guid.
UPDATE bbp_pdigp
SET Final_inv = 'X'
final_entry = 'X'
WHERE guid = ls_pdigp-guid.





CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

You may also want to use the class /sapsrm/cl_pdo_bo_po and method /sapsrm/if_pdo_bo_po~complete_po to be able to complete the PO

This is the same class and method which is called when you click on Complete PO from the portal side. .  This was not part of my business requirement so really i dont use this logic. There is however a lot of buffer data it calls from the portal execution and hence you may need to copy the actual code and the FM instead of calling the class directly.

Somewhere inside the class it also checks for Value and Qty of invoice. This was not part of my business requirement so really i dont use this logic. 

->/sapsrm/if_pdo_bo_po~get_flwondoc_totval
** if sy-subrc = 0.
** lv_conf_val = ls_actval-val_cf_e.
** lv_conf_qty = ls_actval-quan_cf_e.
** lv_inv_val = ls_actval-val_iv_e.
** lv_inv_qty = ls_actval-quan_iv_e.

When you do transaction complete it will be nice to do a check to ensure

  • Once delivery is complete Flag is tick for the PO
  • User is not able to do any more GR for the PO
  • Status on the portal has changed to Transaction completed

Reverse transaction Completing on SAP SRM Transaction complete a PO

Now, coming to the next part is to make changes to reverse the already existing Transaction completed POs and make its status as Ordered again. Pass GUID to get the status

CALL FUNCTION CRM_STATUS_READ_MULTI
TABLES
objnr_tab = lt_obj
status = lt_status.

* remove status which are not in scope based on Global parameter values
DELETE lt_status WHERE stat NOT IN lr_stat. i,e check transaction completed status exists and delete all the others

CALL FUNCTION CRM_STATUS_UPDATE
EXPORTING
no_workflows = X
TABLES
jest_ins = lt_jest_ins not filled
jest_upd = lt_jest_upd filled with the status you need
jsto_ins = lt_jsto_ins not filled
jsto_upd = lt_jsto_upd not filled
obj_del = lt_obj_del. not filled

COMMIT WORK AND WAIT.

Ensure you get the status update again to ensure that the work is complete successfully/.

CALL FUNCTION CRM_STATUS_BUFFER_REFRESH.

* get a status update for all objects AFTER the reset
REFRESH: lt_jcds, lt_status.
CALL FUNCTION CRM_STATUS_READ_MULTI
EXPORTING
only_active = X
get_change_documents = X
TABLES
objnr_tab = pt_obj
status = lt_status
jcds_tab = lt_jcds.

With this now the PO would again open up and you can place an order and create a change version or be able to do GR for the PO.

Thats it on this blog.

Hope I have been able to help those using SRM and trying to handle the transaction completion status of the POs.

I also took some help from the below links for SAP SRM Transaction complete a PO

https://wiki.scn.sap.com/wiki/display/SRM/Clarification+on+Complete+Button+Functionality+%28Transaction+Completed+Status%29+in+PO

Thanks for taking time to read my blog and please let me know if you have some comments or other ways on how you have handled a similar scenario

Read the blog post on SAP site by following the link below

https://blogs.sap.com/2017/06/28/transaction-completed-pos-contracts/                                                           For more information and services:https://peritossolutions.com/services/sap-consulting-services/

Pl spare some time to look at the book published on Amazon Store.
This book comprises of 115 top consulting scenarios which you should know when you start to work in any procurement module but specifically in SRM Module in SAP.I have added these easy to understand in the one-page format which makes it easy to refer back, Keep as a side note and should be a guide for you to help you in handling most of the scenarios in SRM

 

As per what happens in any consulting environment the issues you actually get from your client may not be included in here but after you have read through this guide, it would give you a very good base in the terms of helping you to experiment and try things out in the system directly to come closer to a resolution. These are prepared based on my notes from hundreds of meetings, being part of multiple projects, brainstorming with my colleagues and lastly to be able to provide ongoing support to my clients to manage their procurement landscape. Please note that this book focuses on building basic concepts for both Technical as well as functional people, so I recommended you go through all the pages to have a good understanding of the SRM system.  If you have basic ABAP knowledge, it will be easy if not, it can be a good learning which you can also apply to other SAP modules.   

To Conclude about SAP SRM Transaction complete a PO

Although this book is geared more towards SRM as a product but having worked in other modules as well, it includes some general SAP concepts which help you to apply the same knowledge in multiple other modules like MM, PM, HR and other areas. SRM has a tight integration with all the above modules, and hence it is important to have a good understanding so you can work effectively in a collaborative environment with other team members by knowing how the other module work rather than just passing the buck.

Link to buy the book as below

https://www.amazon.com/dp/B07GR3XG5Va

Get In Touch If You Have A Business Query