Application Development 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: 

Error while creating Function Model in Sap Abap.

mahmood_hammood
Participant
0 Kudos
2,026

Hi,

I try to create simple function model but I have this error which says " the statement "function" is not allowed in the current environment. However, the similar statement "function-ball" is allowed"

11 REPLIES 11

mahmood_hammood
Participant
0 Kudos
1,849

sorry, function-pool not function-ball

RAHEEL_BABAR
Active Contributor
0 Kudos
1,849

Hi Shakir,

To resolve the error, you can create a function pool by following these steps:

  1. Open the ABAP Editor (SE38) and create a new program.
  2. In the "Attributes" tab of the program, set the "Type" to "Function pool".
  3. Save and activate the program.
  4. In the editor, use the "FUNCTION" statement to define your function module.

Here's an example of how to define a simple function module in a function pool:

FUNCTION ZMH_FM_AGETEST.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  TABLES
*"      ET_EMPLOYEES STRUCTURE  ZMH_SOPRAA
*"  IMPORTING
*"     MIN_AGE TYPE I
*"----------------------------------------------------------------------
  SELECT *
    FROM zmh_sopraa
    INTO TABLE et_employees
    WHERE age GT min_age.
ENDFUNCTION.
Note that in the correct syntax, you need to define the input/output parameters of the function module in the local interface section. Additionally, the table parameter ET_EMPLOYEES should be defined using the keyword TABLES.
Regards

0 Kudos
1,849

Hi Babar,

I have already function group "function pool" created and when I have created the function module , I put it in the function group , which I have created.

And with SE38 when I set the "Type" to "Function pool" is not allowed !!!

matt
Active Contributor
1,849

You use SE37 to create a FM. Not SE38.

Sandra_Rossi
Active Contributor
0 Kudos
1,849

Typo: it's function MODULE.

Sandra_Rossi
Active Contributor
0 Kudos
1,849

Activate all the includes of the function group at the same time.

0 Kudos
1,529

this worked for me, thanks 🙂

mahmood_hammood
Participant
0 Kudos
1,849

sorry I did not understand the first comment, and the second comment how I made it ? maybe you have a blog

matt
Active Contributor
0 Kudos
1,849

Go to SE37. Enter the name you want for your function module. Click on "CREATE".

In Eclipse, go to File->New and choose function module.

Sandra_Rossi
Active Contributor
0 Kudos
1,849

Typo: it's function MODULE, not function MODEL.

mahmood_hammood
Participant
0 Kudos
1,849

I became the answer, thank you all