Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Need for creating Function Module any example

Former Member
0 Likes
1,679

Hi all,

Can any body please say why we need to create Function Modules in real time, Please say me any situation where we need to create Function Modules

Thanks in Advance

Ranjith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,405

Basically the need to create Function module arises when you wish to write a code to do a functionality which can be reused in other programs...

example...

You wish to read data from a customer control table you can create a function module for the same to read the table and do the necessary processing depending on the input parameters.

Message was edited by: Anurag Bankley

7 REPLIES 7
Read only

Former Member
0 Likes
1,406

Basically the need to create Function module arises when you wish to write a code to do a functionality which can be reused in other programs...

example...

You wish to read data from a customer control table you can create a function module for the same to read the table and do the necessary processing depending on the input parameters.

Message was edited by: Anurag Bankley

Read only

0 Likes
1,405

Hi Anurag

Thanks for your reply Can you please tell me what is customer Control Table, and explain it more briefly

Thanks in advance

Ranjith

Read only

0 Likes
1,405

Please do not confuse it with customer master..We have written a function module to read a control table created by us eg ZLL_GEN_CTRL, where we define certain parameters and corresponding arguments.

ZLL_GEN_CTRL.

Ctrl Argument.

EMAILTO_MPC XYZ@test.com

EMAILCC_MPC ABC@test.com,DEF@test.com

We use the same in many programs so to make it standard and easy to fetch the data...we have created a fm.

call function 'Get_control_data'

exporting

ctrl = 'EMAILCC_MPC'

delimeter = ','

importing

arg = larg

tables

dtab = itab.

In the function module we return the result of the select statement and in dtab we split the argument on the delimeter and update the internal table with the data as individual row.

Regards

anurag

Hope the above is clear and please assign points for helpful answers !!

Read only

0 Likes
1,405

Hi anurag,

Thank you very much for your good answer, please be in touch mail me my id is vrkranjit@gmail.com

Ranjith

Read only

Former Member
0 Likes
1,405

hi Ranjith,

If there exists no Function Moudle which meets your requirement you put your logic in to that and create .. sometimes few report programs needs to be converted to FM based on the requirement ..

Regards,

Santosh

Read only

Former Member
0 Likes
1,405

Hi,

1. Goto SE37.

2. Follow the path

Goto --> Function Group --> Create Group

3. Then enter a function name Z***** and click create.

The following link gives you more information about the functions and groups and others:

http://cma.zdnet.com/book/abap/ch19/ch19.htm

If you are looking for ENHANCEMENT kind of a thing then follow the following path:

1. Log onto R/3

2. TCODE: SMOD

3. Enhancement RSAP0001.

4. Double click on the one you are looking for i.e. Transaction / Master Data.

5. In the Function Module Double click on the INCLUDE.

Regards,

Ram

Pls reward points if helpful

Read only

Former Member
0 Likes
1,405

Function modules are blocks of code that can be reused in other programs.

When you know that a for a specific set of inputs, you will have to follow the same procedure to get you a diferent output, and this procedure is very generic in nature, then you can go for writing a function module.

eg: a function module to send mails.

a function module to create sales orders etc.

2) If there is a certain part of the code which has to be triggered in an update task, or an external system wants to communicate with the r/3 system, you will have to create RFCs which are also one type of function modules.

Regards,

ravi