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: 

Using subroutines in a Function Module

Former Member
0 Kudos

Hi folks,

Can i use perform statemetns in the source code of a function module...If i am using so...it showing an error message...Thanks...

7 REPLIES 7

Former Member
0 Kudos

Hi,

Yes, you can use perform statements in a function module.

If you told us what the error message is there's a better chance we can help you.

Regards,

Nick

0 Kudos

Hi,

It showung syntactical error saying 'incorrect nesting: before the statement 'form', the structure introduced by 'function' should be concluded with 'end function' .

Also, i amusing both perform and form in the same function module..is it correct way....

Thanks.

0 Kudos

Hi,

You shouldn't put the definition of the subroutine inside the function (i.e. before the ENDFUNCTION command).

You can do one of two things;

Move the subroutine to after the ENDFUNCTION (untidy, but it works)

or

Create an include program in the function group and put the subroutine in there (better approach).

Regards,

Nick

Former Member
0 Kudos

hiii

we can defenitly use perform statement in FM..check with the code of your subroutine and check for passing parameters inside subroutine...

regards

twinkal.

former_member188685
Active Contributor
0 Kudos

What is the error you are getting..

FUNCTION zsflight.

  DATA:t_table TYPE table of sflight.

  SELECT * FROM sflight INTO TABLE i_sflight 
        WHERE carrid EQ p_carrid
                    AND connid EQ p_connid.

perform get_data.


ENDFUNCTION.

Double click on the get_data it propose the includes to create the routine, just choose one ex..LXXXXXXXF01

*----------------------------------------------------------------------*
***INCLUDE LZTEST1F01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  get_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form get_data .

endform.                    " get_data

and it will gernerrate the routine, add the code. and activate the whole function module and Function group.

Former Member
0 Kudos

Whats the error message...?

Cheers,

Tatvagna.

Former Member
0 Kudos

Hi Shyam.

I would like to suggest,

Yes, we can use Subroutines in function module.

I also would like to suggest few references, it is quite the same as your issue,

[SDN - Reference for Error while writing perform statement in Function module|;

[SDN - Reference for Syntax error in Perfrom statemement while using function module|;

Hope that's usefull.

Good Luck & Regards.

Harsh Dave.