Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

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:


















































Sequence



Enhancement Type



Enhancement Name



Purpose


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

Point - \PR:SAPLCOZF\EX:SAPLCOZF_OLC_002\EI


  • 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

WORKORDER_UPDATE

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

Point - \PR:SAPLEBNE\EX:LEBNEF08_01\EI


  • 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

WORKORDER_UPDATE

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.




2 Comments