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

Error while creating Function Model in Sap Abap.

mahmood_hammood
Participant
0 Likes
6,464

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
Read only

mahmood_hammood
Participant
0 Likes
6,287

sorry, function-pool not function-ball

Read only

RAHEEL_BABAR
Active Contributor
0 Likes
6,287

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
Read only

0 Likes
6,287

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 !!!

Read only

matt
Active Contributor
6,287

You use SE37 to create a FM. Not SE38.

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,287

Typo: it's function MODULE.

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,287

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

Read only

0 Likes
5,967

this worked for me, thanks ðŸ™‚

Read only

mahmood_hammood
Participant
0 Likes
6,287

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

Read only

matt
Active Contributor
0 Likes
6,287

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.

Read only

Sandra_Rossi
Active Contributor
0 Likes
6,287

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

Read only

mahmood_hammood
Participant
0 Likes
6,287

I became the answer, thank you all