‎2008 Jul 01 4:49 PM
Hallo Experts,
If you can help please.
In my function group I have a subroutine that I need to always perform 1st. I've added the perform to the INCLUDE XXXXXTOP but then the program doesn't want to compile.
Where do I add this PERFORM statement ?
Thank you,
Maré
‎2008 Jul 01 5:02 PM
Hi,
TOP include is used only to define data. You put there definition of your form.
FORM form_name.
...
ENDFORM
By using PERFORM you just invoke it thereafter.
If you need this to be at the very beginning, call it in the beginning of the function module you use.
i.e.
FUNCTION your_function.
*DATA:....
PERFORM form_name
...
ENDFUNCTION*.
then in the program use:
CALL your function...
I hope that will help you.
Regards,
Marcin
‎2008 Jul 01 5:02 PM
Hi,
TOP include is used only to define data. You put there definition of your form.
FORM form_name.
...
ENDFORM
By using PERFORM you just invoke it thereafter.
If you need this to be at the very beginning, call it in the beginning of the function module you use.
i.e.
FUNCTION your_function.
*DATA:....
PERFORM form_name
...
ENDFUNCTION*.
then in the program use:
CALL your function...
I hope that will help you.
Regards,
Marcin
‎2008 Jul 01 5:11 PM
Thanx for the replies.
My problem is that the subroutine will be used in more than one function module therefor I would like to do it only once at the start of the function group ... if possible ?
‎2008 Jul 01 5:22 PM
Hi,
If u define the subroutine in a diff. include then u call call it from all Fms with the following statement.
perform <Subroutine name> in program <Include name> if found.
Regards,
Joy.
‎2008 Jul 01 5:51 PM
Hi,
1) You should define the form in a separate Influde INCLUDE XXXXXF01 rather than in
INCLUDE XXXXXTOP.
2) Call the FORM with PERFORM from each function module that needs the output.
3) If it has to be called only once (because output does not differ) you may define static variables and give back the last results:
FORM get_t006 TABLES e_t006 STRUCTURE t006
USING VALUE(i_dimid) TYPE DIMID .
STATICS: lv_last_dimid type dimid.
STATICS: lt_last_result type standard table of t006.
IF i_dimid = lv_last_dimid.
e_t006[] = lt_last_result[].
RETURN.
ENDIF.
..." select from t006/ ...
have fun,
hp
Edited by: Holger Pakirnus on Jul 1, 2008 6:51 PM
Edited by: Holger Pakirnus on Jul 1, 2008 6:54 PM
‎2008 Jul 01 5:04 PM
Rather than storing the subroutine to top-include store it in a different include.
Note : This new include should be created in the function group.
Regards,
Joy.
‎2008 Jul 01 5:50 PM
hi dont write the perform in the top it doesnt mean that it is available globally...but you can create the external subroutine and you can call them as well....
like in this..
http://help.sap.com/saphelp_erp2004/helpdata/en/9f/db999535c111d1829f0000e829fbfe/frameset.htm
or you can see some standard function modules ...for the coding