‎2009 May 13 12:22 AM
Hi All,
I need to a get the data from a custom table within a case statement.This code is in a function module.
Function 'ZXXXX'.
Perform get_data.
Endfunction.
Form get_data.
case customer id.
when 'AA'.
Get data from the custom table.
endcase.
endform.
What is the most efficient/modularized way to get the data from the custom table? Using another perform or a calling another function module...
Any ideas appreciated.
Thanks
Meghna
‎2009 May 13 5:42 AM
hi,
to extract the data u can use both the techniques.
but its always good to go for funtion module as it will provide a true modularization approach
FM are usually created in Function groups which are themselves stored in the repository !!!
so u can use the function module in another program.
usually subroutines are tied with the programs where they are being created, howevere it is still possible to use them in another programs, but SAP recommends not to do so. so with this u wont get adv of modular approach.
another diff is that the subroutines remains in the internal session of the programs so do the FM but when u call the FM the entire Function group gets loaded in the internal session of that program.
so along with that FM u can use all the FM of tat group !!!
Hope this will help you!!!
Thanks & Regards,
Punit Raval
‎2009 May 13 5:03 AM
hai meghna,
if u want to get the data from custom tables usign case statments u cna normally do it in fucntion moudle only, just write the case statement and based on it fetch data from tables, no need to use perform statements , as u have to use subroutines only if they are called from different fucntion modules in the group i mean reusable , as ur doign normally no need to make the code complicated
regards
afzal
‎2009 May 13 5:42 AM
hi,
to extract the data u can use both the techniques.
but its always good to go for funtion module as it will provide a true modularization approach
FM are usually created in Function groups which are themselves stored in the repository !!!
so u can use the function module in another program.
usually subroutines are tied with the programs where they are being created, howevere it is still possible to use them in another programs, but SAP recommends not to do so. so with this u wont get adv of modular approach.
another diff is that the subroutines remains in the internal session of the programs so do the FM but when u call the FM the entire Function group gets loaded in the internal session of that program.
so along with that FM u can use all the FM of tat group !!!
Hope this will help you!!!
Thanks & Regards,
Punit Raval
‎2009 May 13 5:49 AM
Hi,
FM is globally used.
Perfrom can be used within the program.
Prefer to use 'perform' for modularization with in the report