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

function module

Former Member
0 Likes
945

hi

friends

I want to learn function module in detail

can anyone send me some file ( sim file, pdf files or ppt files) to learn it from the scrathc.

points will be awarded

Cheers

troy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
889

Hi Troy,

Check for SAP Help they give you the information in much details

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm

Here are few links that will help you.

http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

Exercise 1: Creating a Function module

Use

Function modules are ABAP routines that are administered in a central function library. They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group. A function group is nothing but a container for the function modules. Now create a function group and then a function module, which you can use for the next exercise steps.

Procedure

Create a Function Group:

To open the Object Navigator choose from the SAP Menu Overview ® Object Navigator.

From the Object Selection window select Function group, enter FG_Tutorial as name of your function group, and choose Display.

Since the function group FG_Tutorial does not yet exist, the system asks you whether to create it. Confirm with Yes.

Enter a short description and choose Save.

In the window Create Object Catalog Entry choose Local object.

You created a local function group. Before it can receive function modules, you must activate it.

In the object list, use the right mouse button to select the function group FG_Tutorial you just created and choose Activate.

On the next screen choose Continue.

The function group is now active.

Create Global Data:

Within the function group you can declare global data. All function modules of this function group share this global data.

In the Object Selection window open the directory tree Includes and double-click on LFG_TutorialTOP.

Choose Create « Change ( STRG+F1 ) and enter the following data declarations in the tool area:

TABLES spfli.

DATA spfli_workarea LIKE spfli.

Check ( STRGF2 ) and activate ( STRGF3 ) the include file.

Create a Function Module:

Create a function module that reads data from table SPFLI .

If you are not yet in the Object Navigator, choose from the SAP Menu Overview à Object Navigator and display the function group FG_Tutorial .

In the Object selection window, use the right mouse button to select function group FG_Tutorial , and choose Create à Function module.

Enter as function module name XX_RFC_READ_SPFLI and replace XX with the initials of your name.

Enter a short description and choose Save.

The system lists the function module in the object list in a new directory Function modules, and displays it on the right side in the Function Builder.

Select the Attributes tab and under Processing type choose Remote-enabled module.

Select the Import tab and enter in the appropriate columns the names of the import parameters: carrid with reference type like spfli-carrid and connid with reference type like spfli-connid . For each parameter set the Pass value flag.

Select the Export tab and enter in the appropriate columns the names of the export parameters: ex_spfli with reference type like spfli and sys with reference type like sy-sysid . For each parameter set the Pass value flag.

Select the Exceptions tab and enter the exception invalid_data .

Select the Source code tab.

The system copies the entries you made in the other tabs and creates a source text.

Complete the function module with the actual flight data retrieval.

Compare your function with the model solution.

Save the function module ( STRG+S ). When the note on remote-enabled function modules appears, choose Continue.

Check the function for errors ( STRGF2 ) and then activate it ( STRGF3 ).

Test the Function Module:

Choose Test/Execute ( F8 ) or Function module à Test à Test function module.

As import parameter for CARRID enter LH ; for CONNID enter 400 . Leave the RFC target system line empty.

Choose Execute ( F8 ).

The system displays the export parameters EX_SPFLI and SYS in an additional table.

For a detailed display of the data select the value in line EX_SPFLI.

Result

You created a function module and assigned it to a function group.

Continue With

Exercise 2: Implementing a Local Function Call

If it helps Reward with points..

Regards Rk..

Message was edited by:

Rk Pasupuleti

10 REPLIES 10
Read only

Former Member
Read only

0 Likes
889

i want something with example , where i can learn more fast

troy

Read only

Former Member
0 Likes
890

Hi Troy,

Check for SAP Help they give you the information in much details

http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/frameset.htm

Here are few links that will help you.

http://help.sap.com/saphelp_nw04/helpdata/en/26/64f623fa8911d386e70000e82011b8/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/9f/db98fc35c111d1829f0000e829fbfe/content.htm

Exercise 1: Creating a Function module

Use

Function modules are ABAP routines that are administered in a central function library. They apply across applications and are available throughout the system. You must assign function modules to a function pool that is called a function group. A function group is nothing but a container for the function modules. Now create a function group and then a function module, which you can use for the next exercise steps.

Procedure

Create a Function Group:

To open the Object Navigator choose from the SAP Menu Overview ® Object Navigator.

From the Object Selection window select Function group, enter FG_Tutorial as name of your function group, and choose Display.

Since the function group FG_Tutorial does not yet exist, the system asks you whether to create it. Confirm with Yes.

Enter a short description and choose Save.

In the window Create Object Catalog Entry choose Local object.

You created a local function group. Before it can receive function modules, you must activate it.

In the object list, use the right mouse button to select the function group FG_Tutorial you just created and choose Activate.

On the next screen choose Continue.

The function group is now active.

Create Global Data:

Within the function group you can declare global data. All function modules of this function group share this global data.

In the Object Selection window open the directory tree Includes and double-click on LFG_TutorialTOP.

Choose Create « Change ( STRG+F1 ) and enter the following data declarations in the tool area:

TABLES spfli.

DATA spfli_workarea LIKE spfli.

Check ( STRGF2 ) and activate ( STRGF3 ) the include file.

Create a Function Module:

Create a function module that reads data from table SPFLI .

If you are not yet in the Object Navigator, choose from the SAP Menu Overview à Object Navigator and display the function group FG_Tutorial .

In the Object selection window, use the right mouse button to select function group FG_Tutorial , and choose Create à Function module.

Enter as function module name XX_RFC_READ_SPFLI and replace XX with the initials of your name.

Enter a short description and choose Save.

The system lists the function module in the object list in a new directory Function modules, and displays it on the right side in the Function Builder.

Select the Attributes tab and under Processing type choose Remote-enabled module.

Select the Import tab and enter in the appropriate columns the names of the import parameters: carrid with reference type like spfli-carrid and connid with reference type like spfli-connid . For each parameter set the Pass value flag.

Select the Export tab and enter in the appropriate columns the names of the export parameters: ex_spfli with reference type like spfli and sys with reference type like sy-sysid . For each parameter set the Pass value flag.

Select the Exceptions tab and enter the exception invalid_data .

Select the Source code tab.

The system copies the entries you made in the other tabs and creates a source text.

Complete the function module with the actual flight data retrieval.

Compare your function with the model solution.

Save the function module ( STRG+S ). When the note on remote-enabled function modules appears, choose Continue.

Check the function for errors ( STRGF2 ) and then activate it ( STRGF3 ).

Test the Function Module:

Choose Test/Execute ( F8 ) or Function module à Test à Test function module.

As import parameter for CARRID enter LH ; for CONNID enter 400 . Leave the RFC target system line empty.

Choose Execute ( F8 ).

The system displays the export parameters EX_SPFLI and SYS in an additional table.

For a detailed display of the data select the value in line EX_SPFLI.

Result

You created a function module and assigned it to a function group.

Continue With

Exercise 2: Implementing a Local Function Call

If it helps Reward with points..

Regards Rk..

Message was edited by:

Rk Pasupuleti

Read only

Former Member
0 Likes
889

Hi....

Go through the following link from SAP HELP...

http://help.sap.com/saphelp_470/helpdata/en/d1/801ee8454211d189710000e8322d00/frameset.htm

Reward if it helps u....

Kimi

Read only

Former Member
0 Likes
889

SEND ME UR MAIL ID I'LL SEND U SOME WORD FILES ON FMs

REGARDS,

BHARAT.

Read only

0 Likes
889

you can get it from my profile

Read only

Former Member
0 Likes
889

Hi...

Then u go through Documentation Examples while reading help..

Transaction <b> ABAPDOCU</b>

this may help u....

Regards

Kimi

Read only

Former Member
0 Likes
889

any more help i want ppt presentation if possible

rajforsap@gotalk.net.au

Read only

0 Likes
889

i've sent 2 examples with screen shots to ur mail id.

check it.

regards,

bharat.

Read only

Former Member
0 Likes
889

Thanks all