2009 Jan 09 10:33 AM
Hi Gurus,
Could you please help me in creating a function module that picks records from the table based on certain selection criteria.For eg, If contract number(a primary field) is an import parameter and I want the Function module to export all the records with contract number starting with 1 or may be ending with 303.How could I query this??
Thanks,
Ashwini
2009 Jan 09 10:42 AM
An FM so flexible will cost a lot of ur efforts.. however you could do like this..
Hope you have only one field to be queried say Contract..the:
have 2 fields
1. Contract
2. Where --- say u pass BG for begginning BT for between and EN for End
Then inur query based on the where field concat CONTRACT and % either at beginning or end or both
In ur query write as
SELECT.....
WHERE contract LIKE wa_contract
Hope i understood ur problem correctly
2009 Jan 09 10:47 AM
u can create function module with se37 ,
write ur select query like
select fields1... from table table1
where contractno like '1%'
2009 Jan 09 10:51 AM
hi,
you need to create a function group and then create a function module ..
put the select query in its source code
thanks
2009 Jan 09 10:55 AM
Try using the existing function module RFC_READ_TABLE for this purpose. It is well documented.
Thomas
2009 Jan 09 11:11 AM
Hello,
Creation of Function Module
Goto TCode SE37
Click on the Menu Goto->Create Function Group
Create Z (ZPTP) function group and Activate Function Group even if the error occurs
Create Function module Namely Z (ZTEST) assign to the function group (ZPTP)
Go to the Import parameters (EBLEN TYPE EKKO-EBELN)
Go to the Tables ( itab type ekpo)
Goto the Source code
tables ekpo.
Select * from ekpo into table itab
where ebeln eq ebeln.
Activate the function module and run the function
regards
suresh nair