Application Development and Automation 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: 
Read only

Replacing the select query with function module

Former Member
0 Likes
2,679

hi all,

I am new to abap and i got a requirement to have a details of sales order and customer master. So i have written a select query for that but now they are asking me to replace the select query with function module.

here is the select queries,

(1) SELECT vbeln vkorg vtweg spart kunnr

FROM vbak

INTO TABLE t_vbak

WHERE vbeln IN s_order

AND kunnr IN s_kunnr

AND vkorg IN s_sorg

AND vtweg IN s_dc

AND spart IN s_div.

(2) SELECT kunnr vkorg vtweg spart

FROM knvv

INTO TABLE t_knvv

WHERE kunnr IN s_kunnr

AND vkorg IN s_sorg

AND vtweg IN s_dc

AND spart IN s_div.

here the s_sorg, s_dc, s_div, s_kunnr all are select options and the mandatory select option is "Sales Organization(vkorg)" so in selection screen i may enter the sales order number and customer number, if i dont enter those then according to the sales organization i need to get the output.

can anyone tell me the function module for this??? or select query is the correct option for this task........

and also can anyone explain me how to search the function module for any of the requirement ........ so that i can search the function module independently......... it will be a great help if u explain me............

Thanks,

Kalai

8 REPLIES 8
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,585

Hi,

You can create your own Z function module, and then use this FM instead of queries.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
1,585

hi tarun,

i should not use zfunction module.........

Read only

Former Member
0 Likes
1,585

Hi Kalai,

I think u shud create a Z FM for ur requirement.

You can create ur own function module for your requirement.

Goto SE37 -> give a FM name with 'Z'.

In the Exporting parameters of the FM give the names of ur internal table..

In the Importing parameters, give ur select-options data.

Use ur logic of selecting the fields as u wanted..

So in ur code u can call this FM with the Importing parameters and the Exporting parameters.

U can google to find the list of FM.

http://sapbrainsonline.com/REFERENCES/FunctionModules/SAP_function_modules_list.html

regards,

Surya

Edited by: Surya PK on Oct 19, 2009 8:23 AM

Read only

0 Likes
1,585

hi,

can anyone tell me how should i search for function module not for this requirement im asking generally so that i can independently search.

Read only

0 Likes
1,585

This message was moderated.

Read only

matt
Active Contributor
0 Likes
1,585

Go to se37. Click on the binoculars symbol. Use * as a wildcard, search by function module name and description. Note - there may not be a function module that meets your requirements. If that is the case, and you are not allowed to write your own function module, tell your employer that it is impossible to meet their requirements.

matt

Read only

0 Likes
1,585

Hi matt,

Thanks for you valuable tips.........

Is this the only way to find the function module or else is there any other way to find a function module im asking generically !!!!!

Read only

0 Likes
1,585

Hello,

A generic way to find function modules that use table XYZ:

- transaction SE11; enter the table name XYZ

- display

- click on table name XYZ & press 'where-used' button

- restrict the search to 'function modules'

- eyeball the list to find a function module that performs selections (eg GET_..)

That's a very hard way to go about it though. It's unlikely you will find exactly what you want.

It's often easier to write your own class method or a function module.

hth

Paul Bakker

Hanabi Technology