‎2009 Oct 19 7:01 AM
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
‎2009 Oct 19 7:06 AM
Hi,
You can create your own Z function module, and then use this FM instead of queries.
Hope this helps you.
Regards,
Tarun
‎2009 Oct 19 7:16 AM
‎2009 Oct 19 7:23 AM
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
‎2009 Oct 19 8:17 AM
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.
‎2009 Oct 19 8:25 AM
‎2009 Oct 19 8:59 AM
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
‎2009 Oct 19 10:22 AM
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 !!!!!
‎2009 Oct 19 1:20 PM
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