‎2013 Apr 27 8:30 PM
HI Guru s
I am practicing FM. I am facing two issue
1) In source code if i use "DATA : ITAB_TABLE....." i get an error ITAB_TABLE is already use.
2) iF i use " DATA : A_TABLE......" i am able to activate it and get 1st o/p screen ,however when i insert the reqd info and click on value i didn't get the reqd info, i have attached all screenshot plz tell me Y i am not getting output......
‎2013 Apr 28 4:13 PM
HI happy,
In export parameter u have declared itab_table right,
that is not a internal table that is work area
u have to define Itab_table in tables Tab.
follow this logic
write the code in source Code.
select * from kna1 into TABLE itab
where kunnr = cust_no and
name1 = name and
land1 = countryname.
output:
after executing u will recieve detail in ti internal table..
Award points if useful
regards,
arun prasath
‎2013 Apr 28 9:44 AM
Hi Happy,
the reason you are getting the first error because you have already declared a variable with same name in the exporting parameter and in the second case it is not populating with data since you have not assigned the value in the a_table back to your exporting parameter itab_table.
hope thats clear.......
thanks and regards,
narayan
‎2013 Apr 28 2:44 PM
Hi Uppa,
Thax for reply Sir will u plz explain how to assigned the value in the a_table.... appreciate ur help
‎2013 Apr 28 3:54 PM
Hi Happy,
While building a function module you need to keep at least the following things in mind:
1) Import parameters: Those variables for which values will be provided at the time of calling the function module.
2) Export parameters: Those variables for which values will be populated and produced as output from the Function Module.
So while defining a new FM, if you have already provided ITAB_TABLE in the export parameter, that means it is already declared. You dont need to re-declare it inside the source code once again.
This is why you were getting the error as: "ITAB_TABLE" is already in use.
In the 2nd case, you declared the table A_TABLE in the source code but you have not given it in the export parameters. FM only shows the export and tables parameters containing outputs after executing.
So here the basic idea is,
Just declare the variable (internal table in your case) inside the export parameter (dont declare it once again in the source code) and then just write the select statement as you did in the source code.
Hope this helps.
‎2013 Apr 28 10:05 AM
Hi Happy,
If you had already declared in one of the parameters in the FM, so no need to declare one more time in the source code.
Thanks.
Pavan
‎2013 Apr 28 4:08 PM
Hi Happy,
You shouldn't declare variables of same name in a Function Module,
Here you are Declaring ITAB_TABLE as Exporting Parameter as well as Local Table, so You should change name of any one
You can solve your second problem of Data not getting filled by doing as below code
DATA : itab_temp LIKE kna1 OCCURS 0 WITH HEADER LINE.
SELECT SINGLE *
FROM kan1
INTO itab_temp
WHERE kunnr = cust_no.
itab_table = itab_temp.
Or you can even Directly use ITAB_TABLE in the select statement, This will Solve your Problem
Thanks and Regards,
Pratheek
‎2013 Apr 28 4:13 PM
HI happy,
In export parameter u have declared itab_table right,
that is not a internal table that is work area
u have to define Itab_table in tables Tab.
follow this logic
write the code in source Code.
select * from kna1 into TABLE itab
where kunnr = cust_no and
name1 = name and
land1 = countryname.
output:
after executing u will recieve detail in ti internal table..
Award points if useful
regards,
arun prasath