‎2008 Jul 16 8:24 AM
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...
‎2008 Jul 16 8:25 AM
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
‎2008 Jul 16 8:32 AM
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.
‎2008 Jul 16 8:34 AM
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
‎2008 Jul 16 8:26 AM
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.
‎2008 Jul 16 8:27 AM
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_dataand it will gernerrate the routine, add the code. and activate the whole function module and Function group.
‎2008 Jul 16 8:28 AM
‎2008 Jul 16 8:33 AM
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.