Learning SAP Basic — How to Write a Function Module

In this post I am going to write a about a basic function Module. If you are functional or technical you need to know what a function module is and its basic.

Let us write a small function module  with two input and the output is addition on these two number.

T-code to create/change/display a function module SE37. Look at the following screen.

Let us write a function module name z_test_fm. Type in the name and click create. This will ask you where to add this function moudle(under which group) and the description. See the following screen.

Click on save button this will take you to the function module editor where you have to give input and output. Input is Import parameters and Output is Export Parameters, Changing and Tables are input as well as output. you can take the table values and process and change the values and send them out.

Look at the following screen for input and the output values.

 

 

Exception is when you raise a exception this will return a error code to the calling program. the error code can be the value of the raised exception so that you know how to handle. Look at the following screen shot for exception.

 

Now let us see how to code for this example. Get two numbers and add the number and give output.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s