Anda di halaman 1dari 15

Function Module Exit

Scenario: Defaulting the SOLD-TO-PARTY value while creating the sales order in VA01 transaction by
using FUNCTION MODULE EXIT.
--------------------------------------------------------------------------------------------------------Step1. Go to Tx- SE93 and provide Tcode- VA01 & hit display button and get the package name.

[http://4.bp.blogspot.com/-36hcVSgbVHs/U70WX4n7KLI/AAAAAAAAKPA/RnnfYcVsZpo/s1600/1.JPG]

Step2. Go to Tcode- SMOD.

[http://1.bp.blogspot.com/-0m9DRhZZLU8/U70W5DNHbbI/AAAAAAAAKSI/1UQXxe1LIqw/s1600/1.JPG]

Step3. Hit F4 Button.

[http://4.bp.blogspot.com/-4ONuH5Q0IBk/U70XBPjTY3I/AAAAAAAAKSQ/IGlqf8nFKzI/s1600/2.JPG]

Step4. Provide the above package name & continue.

[http://1.bp.blogspot.com/-qlQsDwe2d4Q/U70WbWyw4gI/AAAAAAAAKQY/Ynd8WV2UUto/s1600/2.JPG]

Step6. From the list of Enhancements available in the Package, for our case lets choose the underlined one( double
click on the decided enhancement).

[http://1.bp.blogspot.com/-LSD9Kw_A1Dw/U70WeICbkTI/AAAAAAAAKRQ/1VgXisb_MJE/s1600/3.JPG]

Step7. Click on Display button.

[http://1.bp.blogspot.com/-C18b_MHNgGk/U70WeTLxjRI/AAAAAAAAKRU/Cx5eDCwZ200/s1600/4.JPG]

Step8. Click on Components button.

[http://1.bp.blogspot.com/-SgFiXSxYpNU/U70WesdLaVI/AAAAAAAAKRc/l7DVGSoGJ_0/s1600/5.JPG]

Step9. Click on the Function module.

[http://2.bp.blogspot.com/-KQG1EcnRGJA/U70WfGqSRzI/AAAAAAAAKRw/-F3HIvDpWHc/s1600/6.JPG]

Step10. These function module interface parameters are available to determine the sold-to-party and can be
assigned to the Exporting parameter e_kunnr.

[http://4.bp.blogspot.com/-qh5hDwMBWAA/U70WJ7gnI/AAAAAAAAKR0/lYQZUIDDy3Y/s1600/7.JPG]

Step11. Go to Tx- VA01 to create a sales order.

[http://2.bp.blogspot.com/-0JGHEJRaahY/U70WfZEZDJI/AAAAAAAAKRo/tTY4IBIfpHw/s1600/8.JPG]

Step12. Provide details and hit Enter key.

[http://2.bp.blogspot.com/-mMM5Y_ZcvOM/U70WgEbEZEI/AAAAAAAAKR8/nGla9IV6lZI/s1600/9.JPG]

Step13. No SOLD-TO-PARTY field is defaulted.

[http://4.bp.blogspot.com/-SjT8hc5tZ4w/U70WYD8ud9I/AAAAAAAAKPc/pdDcCXp9yB8/s1600/10.JPG]

Step14. Open KNVV table entreis. Here we can see customer- 0000099994 .

[http://1.bp.blogspot.com/-VDFXNZavbko/U70WYNnw9nI/AAAAAAAAKPQ/IUEsOonOzeM/s1600/11.JPG]

Step15. Let's create a project to default the SOLD-TO-PARTY value. Go to Tx- CMOD & provide a Project name
and click on Create button.

[http://4.bp.blogspot.com/-NK9UdYGaXhE/U70WYn7dn2I/AAAAAAAAKPw/IpeWGl_WcyI/s1600/12.JPG]

Step16. Provide the short text and click on the Enhancement assignment button.

[http://1.bp.blogspot.com/-h-b4GlxPuM0/U70WYwQBb8I/AAAAAAAAKPk/SiydbNWtefE/s1600/13.JPG]

Step17. Provide the enhancement name decided from SMOD transaction and hit enter button. At last click on
Components button.

[http://2.bp.blogspot.com/-XXxKpM3IUrU/U70WZHS_ZWI/AAAAAAAAKPo/g5VqtRlJWXw/s1600/14.JPG]

Step18. Double click on the Function module name.

[http://2.bp.blogspot.com/-OQWlNA0M9Rw/U70WZqNuF6I/AAAAAAAAKSA/ae3IF_MDQ10/s1600/15.JPG]

Step19. Double click on the Include name.

[http://4.bp.blogspot.com/-SLvHG2Vs5a4/U70WZ6X8NsI/AAAAAAAAKP8/YZKKQx-n7Rk/s1600/16.JPG]

Step20. Hit the Enter key from the keyboard. From the appeared pop up click on Yes button.

[http://1.bp.blogspot.com/-HNskU-CVQFc/U70WaQgYcLI/AAAAAAAAKSE/kMPvyXtIoWQ/s1600/17.JPG]

Step21. Provide the below code. Here just we have hard coded the sold-to--party vale. But the value of the soldto-party can be decided dynamically from the importing parameters of the function module.

[http://2.bp.blogspot.com/-y3QhofnvKaQ/U70Wa6O2alI/AAAAAAAAKQM/YP-zIC7rmDQ/s1600/18.JPG]

Step22. Put the debug point and go back.

[http://2.bp.blogspot.com/-ylwl87UqbFs/U70Wdrkh6sI/AAAAAAAAKR4/CcwURNMyKaY/s1600/25.JPG]

Step23. Activate the Project.

[http://2.bp.blogspot.com/-kSf9XXiazjk/U70WbI7xUII/AAAAAAAAKQQ/5mTzQ5Gv7Kk/s1600/19.JPG]

Step24. The implementation turns green.

[http://2.bp.blogspot.com/-uuy7xKR6x_E/U70Wb6dzCxI/AAAAAAAAKQg/gPk461sO-dI/s1600/20.JPG]

Step25. Now again run - Tx- VA01 and provide the values & hit enter.

[http://3.bp.blogspot.com/-wl3s-oaEgNY/U70WcBJ_yzI/AAAAAAAAKQ4/__OYl7iFTPw/s1600/21.JPG]

Step26. The debug point reached and we can see the function modules importing parameters. Double click on the
parameter : I_TVTA.

[http://4.bp.blogspot.com/-cubACfznELc/U70Wc2vOw1I/AAAAAAAAKQw/G5qvDIYYRTg/s1600/23.JPG]

Step27. The structure I_TVTA contains the below values which can be used to dynamically decide any sold-to-party
depending on the business requirement. Click on F8.

[http://4.bp.blogspot.com/-QEvyelZjc6w/U70WdfVq2nI/AAAAAAAAKRA/3SJBDz_cngs/s1600/24.JPG]

Step28. Here the Sold-to-Party field is defaulted.

[http://3.bp.blogspot.com/-kDEK0yVDJiI/U70WcZAkrzI/AAAAAAAAKQo/cj5roqLLjT4/s1600/22.JPG]

Step29. Let's find where this function module exit is called in the standard VA01 transaction. From Tx- SE93 get the
program name for the Tx- VA01.

[http://3.bp.blogspot.com/-qVUbJ8GxEpI/U73u7W53nfI/AAAAAAAAKVs/043HP9fiuUE/s1600/27.JPG]

Step30. Open the Program in Tx- SE38 and click on the find button.

[http://3.bp.blogspot.com/-BuxcBwl0oSw/U73u77cPyeI/AAAAAAAAKWA/t7dwu5w6SOs/s1600/28.JPG]

Step31. Search for the Key Word 'call customer-function' and select main program radio button.

[http://2.bp.blogspot.com/-lPsXMLyUZbE/U73u9ckn6II/AAAAAAAAKWI/9o6mWOjukDA/s1600/29.JPG]

Step32. Here we can see ' call customer-function '002' -> our function module also ends with 002 , which calls the
function module 'EXIT_SAPMV45A_002' .

[http://2.bp.blogspot.com/-Qp3fQCRVBTQ/U73u-FM5SHI/AAAAAAAAKWQ/K-rSj7q8Opk/s1600/30.JPG]

Step33. In the Debugging also we can see.

[http://4.bp.blogspot.com/-LukSEs9umj0/U73u7jRDnWI/AAAAAAAAKV8/E-DvT8ZVQ5M/s1600/26.JPG]

------------------------------------------------------------------------------------------------------Posted 9th July 2014 by S Prasad


1

View comments