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: 

Data from Custom table - Case Statement in a function module

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

FM is globally used.

Perfrom can be used within the program.

Prefer to use 'perform' for modularization with in the report