‎2006 Jul 04 1:59 PM
hi friends,
iam declaring company code as import parameter in function module. later on iam calling that fuction module in report. but i declared company code as select-options. it is giving error. if iam declaring company code as a parameter then it is working.
pls, let me know how to declare it as select-options.
chandu
‎2006 Jul 04 2:01 PM
Use below code
Select bukrs from t001 into i_t001 where bukrs in s_bukrs (ur select option.
check sy-dbcnt gt 0.
Loop at i_t001.
call function 'UR FUNCTION'
exporting
bukrs = i_t001-bukrs
Endloop.
‎2006 Jul 04 2:03 PM
Defining as a select-option, you are giving the user the opportunity to enter mulitple company codes and ranges or even excluding. Do you want to fire this function module for all company codes which are valid for the select-option? If so, then you need to get all of the company codes in the SO, and loop thru that table.
data: it001 type table of t001 with header line.
select-options: s_bukrs for it001-bukrs.
select * into table it001 from t001
where bukrs in s_bukrs.
loop at it001.
* Call your function module with
* the company code in this table.
* IT001-bukrs.
endloop.Regards,
Rich Heilman
‎2006 Jul 04 2:04 PM
do like this:
data: begin of it_t001 occurs 0,
bukrs type bukrs,
end of it_t001.
select bukrs
from t001
into it_t001
where bukrs in s_bukrs.
loop at it_t001.
call function '<func mod name>'
exporting <comp code> = it_t001-bukrs.
endloop.
Regards,
Ravi
‎2006 Jul 04 2:05 PM
Hi chandra,
1. in the FM,
pass the parameter in
TABLES (not IMPORT)
2. and make it like this.
<b>BUKRS LIKE RNG_BUKRS</b>
(In TABLES Tab of se37)
<b>NOTE:
RNG_BUKRS is nothing but a RANGE for BUKRS,
which is nothing but copy of
select-option for bukrs field.</b>
3. then while calling the FM,
pass the select-option (eg. MYBUKRS)
using TABLES (and not EXPORTING)
4. In this way, in your FM,
u shall be able to fire query
IN BUKRS
(similar to select-option)
regards,
amit m.
‎2006 Jul 04 2:08 PM
1. Select company code entries into ITAB.
2. change FM's signature as
import to tables for company code.
3. Pass the table to FM
4. Change the logic in FM to handle for multiple company codes.
Regds
Manohar
‎2006 Jul 04 2:21 PM
Hi chandra,
Instead of using IMPORT use TABLES in the FM created by you.
IMPORT is used when only one value has to be passed.
Since you are using select-option, there will be n number of entries
You will need to use a LOOP in your FM and change the code accordingly.
Regards,
Sameena