Function Module Exit - SAPCODES PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10
At a glance
Powered by AI
The document discusses how to use a function module exit to default the sold-to party value when creating a sales order in transaction VA01 in SAP.

A function module exit can be used to default a value by enhancing an existing function module and writing code in the function module exit to set the default value.

The steps shown are: 1) Find the package and function module using SMOD and SE93 2) Create an enhancement project 3) Double click the function module and include 4) Write code to set the default value 5) Activate the project

6/6/2019 Function Module Exit – SAPCODES

SAPCODES

ABAP OO-ABAP ENHANCEMENTS RFC & BAPI ALE-IDOC USEFUL PROGRAMS WEBDYNPRO

FPM WORKFLOW HANA ODATA-UI5 BASIS JOBS POSTS

FUNCTION MODULE EXIT


 November 20, 2015  Leave a comment
Search … 

 Scenario: Defaulting the SOLD-TO-PARTY value while creating the sales order
in VA01 transaction by using FUNCTION MODULE EXIT.
RECENT POSTS

Step1. Go to Tx- SE93 and provide Tcode- VA01 & hit display button and get the UI5 App Table with

package name. JSON Data Model-2


UI5 App Table with
JSON Data Model
UI5 APP- Simple Form
with JSON Data Model
Prepaid & Postpaid
Payment Group in Hybris
Billing
CI Partner Settlement
CRM – Partner Product
Settlement Rule
CRM
Standard/Revenue Sharing
Product
CRM Product Hierarchy
& Category
Step2. Go to Tcode- SMOD.

Enter your email address

Follow

Step3. Hit F4 Button.

BLOG STATS

1,141,877 hits

RECENT COMMENTS

UI5 App Table


with J… on UI5
App Table with
JSON Data M…
Phani on oData
service which
consumes R…

https://sapcodes.com/2015/11/20/function-module-exit/ 1/11
6/6/2019 Function Module Exit – SAPCODES

Step4. Provide the above package name & continue. Anonymous on


Using Standard
Text in Adobe
F…

This site is maintained by


Siva Prasad . This site
sapcodes.com is not
a liated with SAP SE.

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

Step7.  Click on Display button.

https://sapcodes.com/2015/11/20/function-module-exit/ 2/11
6/6/2019 Function Module Exit – SAPCODES

Step8. Click on Components button.

Step9. Click on the Function module.

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

https://sapcodes.com/2015/11/20/function-module-exit/ 3/11
6/6/2019 Function Module Exit – SAPCODES

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

Step12. Provide details and hit Enter key.

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

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

https://sapcodes.com/2015/11/20/function-module-exit/ 4/11
6/6/2019 Function Module Exit – SAPCODES

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.

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

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

Step18. Double click on the Function module name.

https://sapcodes.com/2015/11/20/function-module-exit/ 5/11
6/6/2019 Function Module Exit – SAPCODES

Step19. Double click on the Include name.

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

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

https://sapcodes.com/2015/11/20/function-module-exit/ 6/11
6/6/2019 Function Module Exit – SAPCODES

Step22. Put the debug point and go back.

Step23. Activate the Project.

Step24. The implementation turns green.

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

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

https://sapcodes.com/2015/11/20/function-module-exit/ 7/11
6/6/2019 Function Module Exit – SAPCODES

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.

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

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

https://sapcodes.com/2015/11/20/function-module-exit/ 8/11
6/6/2019 Function Module Exit – SAPCODES

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

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

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

Step33. In the Debugging also we can see.

https://sapcodes.com/2015/11/20/function-module-exit/ 9/11
6/6/2019 Function Module Exit – SAPCODES

Advertisements

REPORT THIS AD

REPORT THIS AD

Rate this:

            Rate

  
Related

https://sapcodes.com/2015/11/20/function-module-exit/ 10/11

You might also like