04-11-2006 2:13 PM
Hi Friends,
I am new to create FM.
I have a FM in which i am passing one import parameter(ex: a table name).
In this sorce code i am using one more FM to retrieve data from table.
So i got data in itab.So in the main FM i want to create a tables parameter.in which result will be diaplayed .Can any body tell me How to decalre that?
Thanks in Advance
04-11-2006 2:16 PM
Yes, first create a structure in SE11 which will be used as the structure type in your TABLES parameters. Next go to your function module, click the tables tab, enter a name for the parameter and make it the type of the structure that you just created. Now in the function module code, you will need to move the data from the itab to the parameter table that you just defined.
Regards,
RIch Heilman
04-11-2006 2:18 PM
Hi Kumar,
Go to se37 and after you create the Function group and then a Function module, Go to tables tab.
Give a name to your table's parameter. sat t_itab.
give like /type in type spec.
Give the structure name of your internal table.
If it is a custom structure, you should create a Z structure in se11 and then use it here.
Then you can use the data in the t_itab in your siurce code, or fill the table as per your requirement.
Regards,
ravi
04-11-2006 2:18 PM
Jak,
This might help you.
Assume ITAB1 is DECLARED in the TABLES parameters of the Main function. And inside that you have another ITAB2, which you are passing to retrieve data into the table.
You can just say ITAB1 = ITAB2 as long as they are of the same type.
If you are asking how to create TABLES parameter, then when you display the function module, In the parameters section, you will have a tab for TABLES, declare the name over there referring to a strcuture or table in the data dictionary. You have a TABLE parameter.
Regards,
Ravi
Note : Please mark the helpful answers
04-11-2006 2:29 PM
04-11-2006 3:14 PM
Hi Ravi Kumar,
In The FM i am getting data in ITAB.
I declared ITAB IN global data as
DATA: ITAB LIKE TAB512 OCCURS 0.
and in the tables parameter of FM i delclared like this:
PARAMETER TYPESPEC REFERENCE TYPE
DAT LIKE TAB512
BUT WHEN I EXICUTE FM DAT DOES'T HAVE ANY ENTRIES.
CAN U TELL ME WHERE IS THE PROBLEM?
THANKS IN ADVANCE.
04-11-2006 3:30 PM
Hi Jak,
In the source code, did you assign the content in the itab to the internal table in the FM tables parameter?
t_tab512[] = itab. "t_tab512 is the table declared in the tables tab of the Fm.
REgards,
Ravi
04-11-2006 3:33 PM
Hi,
Doesn't sound like what you are doing is right?
Can you send me the screen shots of the parameters? My mail address is in the business card.
You need to have a strcuture in the dictionary of the same type of table which you want to return - same columns etc.
And you don't need a global table ITAB, you should be able to access the parameter.
Regards,
Ravi
04-11-2006 2:20 PM
For example:
You want to get all the line item data(VBAP) for a given Sales Order No (VBELN)
Main FM1:
importing VBELN
tables itab1 like vbap
Source Code of Main FM
call function FM2
exporting VBELN
tables itab2 like vbap.
FM2:
importing VBELN
tables itab2 like vbap.
Source Code of FM2:
Select * from vbap
into table itab2 where vbeln = vbeln.
04-11-2006 2:21 PM
Hi,
in your FM create that under table parameter option.
and pass it to your fm.
Check the SAP help to hel p to create the FM .
http://help.sap.com/saphelp_nw04/helpdata/en/d1/801e9a454211d189710000e8322d00/frameset.htm
Regards
vijay