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
Description:

In Purchasing, you normally use User Exit MM06E005 to update customer fields but in this post, i will show you how to update standard fields of Purchase Order or in Scheduling Agreement. We use small trick to update variables out side the EXIT, in the main program.


 

Step:

You do need to follow these steps below to achieve it:




  1. Create a project to use the User Exit (Tcode CMOD)

  2. Activate the Components

  3. Write the code (in  ZXM06U41)


 

Here i will give you a small example, which will update the Firm Zone field in Scheduling Agreement.


Scenarior:

The system uses “Firm zone” as a key field to determine which item vendor can ship. If delivery date falls  within Firm zone, the line item is treated as firm requirement, and vendor can only create ASN
for line item that marked as “Firm”. The firm zone should be relevant to JIT date range, which is  determined by creation profile.


However, in S/4HANA there is no standard function to link between
firm zone and creation profile. Therefore we need to use User Exit MM06E005 to update. Here i choose EXIT EXIT_SAPMM06E_016 (Export Data to Customer Subscreen for Purchasing Document Item (PBO)) to use.


 

Step by step:

  1. Use Tcode CMOD to create a project.



 


 

2. Activate the components (and create the subscreens)



 

3. Implement the code


We use the below trick to edit value in main program.



ASSIGN ('(SAPMM06E)EKPO') TO <LF_EKPO>.

 

Here is complete code



  DATA:
LS_EKPO TYPE EKPO,
LW_FABHO TYPE FABHO,
LW_FABHO_DIV TYPE P LENGTH 3 DECIMALS 2,
LW_FABHO_ROUND TYPE ETFZ1.

FIELD-SYMBOLS:
<LF_EKPO> TYPE EKPO.

CHECK SY-TCODE = 'ME31'
OR SY-TCODE = 'ME31L'.

ASSIGN ('(SAPMM06E)EKPO') TO <LF_EKPO>.
LS_EKPO = <LF_EKPO>.
*
IF LS_EKPO-ETFZ1 IS INITIAL.
SELECT SINGLE FABHO
INTO LW_FABHO
FROM T163P
WHERE ABUEB = LS_EKPO-ABUEB.

IF SY-SUBRC = 0.
LW_FABHO_DIV = LW_FABHO / 6.
LW_FABHO_ROUND = ROUND( VAL = LW_FABHO_DIV
DEC = 0
MODE = 2 ).
LS_EKPO-ETFZ1 = LW_FABHO +
LW_FABHO_ROUND.
<LF_EKPO> = LS_EKPO.
ENDIF.
ENDIF.

 

Result:

Tcode ME32L, change Scheduling Agreement (additional data)


Before



 

Tcode ME32L


After:


Firmzone value has been changed



 

Hope you see this post is helpful. If you have any question, please leave your comment. Thank you.

 
6 Comments
Labels in this area