07-24-2007 8:54 PM
Hi,
I have to write a FM out of tables FAGLFLEXA BSEG BKPF...What will be the import and export parameters for this FM and how can i code...I am not sure if this possible actually the query is if we can write this FM by joining these tables through common field..
Does it make sense..
Cheers:
Jim
07-24-2007 9:01 PM
Hi Jim,
Whats the purpose of a FM in your case? I am not clear with your question. Do you want to write a FM which will select data from the above tables or do you want to write a FM to maintain( inster, modify, Update ) data in the above tables?
If you want to onlys select data from the above tables then you can do it using a Join in the FM source code. If you want to update the table then writing a FM is not a good idea as they are std tables and shoould not be used for direct updates.
Cheers
VJ
07-24-2007 9:01 PM
Hi Jim,
Whats the purpose of a FM in your case? I am not clear with your question. Do you want to write a FM which will select data from the above tables or do you want to write a FM to maintain( inster, modify, Update ) data in the above tables?
If you want to onlys select data from the above tables then you can do it using a Join in the FM source code. If you want to update the table then writing a FM is not a good idea as they are std tables and shoould not be used for direct updates.
Cheers
VJ
07-24-2007 9:03 PM
HI Vijay,
Thnx for the reply..
I want to write a FM that will select data from these tables...its like view of all these three tables...what will be the coding like and what will be the import and export parameters...
please help ...
07-24-2007 9:08 PM
Hi Jim,
Since you only need to select the data then you can use a inner join. An example of how to using inner join is given below.
SELECT b~matnr b~mtvfp b~werks
b~dismm b~beskz b~plifz b~disgr
c~pstat c~mtart c~brgew c~normt z~mtpos
INTO CORRESPONDING FIELDS OF TABLE t_materials
FROM marc AS b
INNER JOIN mara AS c
ON a~matnr = c~matnr
INNER JOIN mvke AS z
ON a~matnr = b~matnr
FOR ALL ENTRIES IN t_materials2
WHERE b~matnr EQ t_materials2-matnr
AND b~werks EQ t_materials2-werks
AND b~stawn IN s_stawn
AND b~disgr IN s_disgr
AND b~mmsta EQ '03'
AND c~mtart IN s_mtart
AND z~vkorg EQ p_vkorg
AND z~vtweg EQ p_vtweg
AND z~mtpos IN s_mtpos.
The IMPORT parameter should be those fields based on which you would like to restrcit your selection. The EXPORT paramaters can be empty if you are going to fetch multiple records so you can use TABLES paramters instead.
Cheers
VJ
07-24-2007 9:08 PM
I would suggest you creating a view...
Or do you already have a specification, which tells you what the output should be and what input data you have?
In that case, you perhaps want to create a ddic type of the output (either structure for a single value or a table type for a table) as well as ddic types for the input values.
Christian
07-24-2007 9:11 PM