‎2008 Feb 09 4:45 AM
Hi,
I want to create a Function Module...
In my FM...
First, In Import insert value -
Parameter Name--Type--Associate Type
KUNNR--
Second, In Export insert values -
Parameter Name--Type Spec.--Associate Type
NAME1--
KNA1-NAME1
LAND1--
KNA1-LAND1
Now, I want that data should come respectively KUNNR...
When i insert KUNNR value, it show the NAME1 & LAND1 values according to KUNNR....
What should I do....
Here i use an Internal Table (in Tables) or not....
And, in Source Code....what i write....
Plz Explain.....
‎2008 Feb 09 5:16 AM
Hi,
U need not use the "Tables" to strore the NAME1 and LAND1 values. KUNNR is the only key field in KNA1 table. So it will return only one record for a KUNNR.
So u can declare the NAME1 and LAND1 in EXPORT parameter.
KUNNR in Import parameter.
select single NAME1 LAND1 from KNA1 into (NAME1, LAND1) where kunnr = KUNNR.
Now, u will have the output in NAME1 and in LAND1.
Kindly reward points if useful
Cheers,
Shanthi.
Edited by: shanthi ps on Feb 9, 2008 6:18 AM
‎2008 Feb 09 4:55 AM
Hi,
if u want land1 and name1 depending on kunnr then
import parameters
kunnr
export parameters
land1
name1
tables
itab like kna1
source code
select land1 name1 from kna1 into table itab where kunnr = p_kunnr.
Regards
‎2008 Feb 09 5:02 AM
Hi,
Go to source code of that funciton module.
write the below code in that.
select kunnr name1 land1 from kna1 into table itab where kunnr in s_kunnr.
********************************************************
then you call that function module in your program.
see the program is like this,
tables : kna1.
select-optiions : s_kunnr for kna1-kunnr.
types : begin of t_kunnr,
kunnr type kunnr,
name1 type name1,
land1 type land1,
end of t_kunnr.
data : wa_kunnr type t_kunnr,
itab type table of t_kunnr.
call function 'function module name'
exporting
kunnr = s_kunnr
importing
name1 = name1
land1 = land1
tables
t_outtab = itab,
regards,
swami
‎2008 Feb 09 5:16 AM
Hi,
U need not use the "Tables" to strore the NAME1 and LAND1 values. KUNNR is the only key field in KNA1 table. So it will return only one record for a KUNNR.
So u can declare the NAME1 and LAND1 in EXPORT parameter.
KUNNR in Import parameter.
select single NAME1 LAND1 from KNA1 into (NAME1, LAND1) where kunnr = KUNNR.
Now, u will have the output in NAME1 and in LAND1.
Kindly reward points if useful
Cheers,
Shanthi.
Edited by: shanthi ps on Feb 9, 2008 6:18 AM
‎2008 Feb 09 5:21 AM
for a customer number kunnr if they are more names name1 then will ur select statement work?
select single NAME1 LAND1 from KNA1 into (NAME1, LAND1) where kunnr = KUNNR.