Skip to Content
Author's profile photo apeksha choudhary

Update Purchase requisition based on external operation of production order

During our recent ECC implementation, business requested that Service Material value (populated in user field : AFVGD-USR00) should be auto populated into a purchase requisition for an external operation.

The Purchase Requisition (PR) is created as soon as a Production order lines having Operation control keys relevant for external processing such as ‘EXTL’ or ‘EXTP’ is saved. In Standard SAP, PR is created with Operation text as a Material Description and it does not carry Material code in the PR material Code field. But to provide better visibility to buyer and supplier, business requested a PR to be created from Production order with external operations should address the following.

Purchase Requisition should be

  • Auto populated Material code in PR with material code maintained in the “Service Matl” field in the Operation details screen for the external Operation number in Production Order(ref the screen Shot)


  • Item long text: material text both short and long copied from the material master, engineering revision level to copy from basic data 1 of the material master.

The business also requested some pre-validations when performing auto population of material code.

For e.g.:

1. The service material code should begin with ‘SM_’. 

2. Material should be available in MARA table.

3. Material and plant combination should exist in MARC table.

The validation errors should be visible on the operation details screen of the production order.

It took me some time to debug the end to end transaction to find out appropriate enhancement points to achieve different business requirements. I am listing down the enhancements used in table below.

I hope this is useful for others attempting to map similar requirements during automatic PR created\changed when Production Order is created\changed. 

Enhancement Details:


Enhancement Type

Enhancement Name


1 User – Exit EXIT_SAPLCOVG_001
  • We used this exit to collect all modified external operations records.
  • This exit is triggered only when an external operation is modified.
  • However there were few scenarios in which this exit is not triggered at all and hence we have also implemented EXIT_SAPLCOZF_001.

E.g. when there is no change to external operation or when an external operation is deleted etc.

  • Populate external operation data obtained in this exit into a global internal table using custom method.
2 Spot

Enhancement spot – ES_SAPLCOZF


  • This enhancement spot is triggered when an external operation is deleted.
  • Export deleted external operation record (AFVGD_IMP) and respective deletion flag (DELKNZ_BANF) using ABAP memory id.
3 User – Exit EXIT_SAPLCOZF_001
  • This exit is triggered for each external operation once.
  • We used this exit to collect external operations records which cannot be fetched using exit EXIT_SAPLCOVG_001.
  • However this exit is not triggered when an existing external operation record is modified. So in that case exit EXIT_SAPLCOVG_001 will be useful.
  • Also import deleted external operations using ABAP memory id. (This data is exported by 2nd enhancement).
  • Populate external operation data obtained in this exit into a global internal table using custom method.
4 Badi


Method – AT_SAVE

  • This method is used for adding any custom validation on external operation fields.
  • By pass the validation for deleted external operation with the help of deletion flag.
  • Fetch all the external operation from global internal table populated using above 2 exits.
  • Appropriate error message can be displayed using this Badi method.
  • If all the external operations are valid then export the external operation internal table using ABAP memory id for further processing. 
5 Spot

Enhancement spot – ES_SAPLEBNE


  • This enhancement spot is triggered before execution of standard FM ‘ME_UPDATE_REQUISITION’ used for updating PR data.
  • Import valid external operation table using ABAP memory id.
  • Modify purchase requisition table XEBAN using external operation data.
  • In our business scenario we modified PR item material number and short description using external operation fields.
6 Badi


Method – IN_UPDATE

  • At this point, the PR is already created and hence this method can be used to populate various long texts available in PR.
  • In our business scenario, we used this method to update PR item long text based on external operation records.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Parag Parikh
      Parag Parikh

      Interesting requirement. I agree, it does provide better visibility to user.

      Author's profile photo Nabheet Madan
      Nabheet Madan


      First of all thanks for writing about it in detail. From the way if i look at your solution it looks like you have implemented so many exits, which to me does not look valid. It looks like you have used various exits just because you were not having some data available or it as not triggered for that process. If you will closely check their are function modules which SAP standard tcode is also using to fetch change/new etc data as they are assigned globally you could have used the same or we have other ways to access global data also.

      I would have tried to do it at one enhancement only or max two one for collecting and exporting data if it not available at the other place.

      Having so many enhancement for copying some field value only to me it does not look like the best possible solution