10-20-2006 9:04 PM
Hello Friends!
I have the follow situation:
I need to pass a value from main program to a Z function as parameter.
I am using SET parameter but the value is not being loading in memory to use GET. These are the statements:
Main Program
data: material like mara-matnr.
set parameter id material field matnr.
Function
data: material like mara-matnr.
get parameter id material field lista_tecnica-matnr.
PS.: I cannot pass by import option because it's a recursive funtion.
Thanks for your help!
Michel Khouri
10-20-2006 9:07 PM
How about using EMPORT/IMPORT. In order to use parameters IDS, they must be created separatly, you can achieve what you want by simply using the EMPORT/IMPORT statement, make sure that the field that will be exporting and importing is defined exactly the same on both ends with the same field name.
*Main Program
data: material like mara-matnr.
<b> export material = material to memory id 'ZMATERIAL'.</b>
*Function
data: material like mara-matnr.
<b>import material = material from memory id 'ZMATERIAL'.</b>
Regards,
Rich Heilman
Message was edited by: Rich Heilman
10-20-2006 9:07 PM
How about using EMPORT/IMPORT. In order to use parameters IDS, they must be created separatly, you can achieve what you want by simply using the EMPORT/IMPORT statement, make sure that the field that will be exporting and importing is defined exactly the same on both ends with the same field name.
*Main Program
data: material like mara-matnr.
<b> export material = material to memory id 'ZMATERIAL'.</b>
*Function
data: material like mara-matnr.
<b>import material = material from memory id 'ZMATERIAL'.</b>
Regards,
Rich Heilman
Message was edited by: Rich Heilman
10-20-2006 9:08 PM
Hi,
Use Export and Import...
DATA: V_TEST TYPE MATNR VALUE 'ABC'.
EXPORT V_TEST TO MEMORY ID 'TEST'.
IMPORT V_TEST FROM MEMORY ID 'TEST'.
Thanks,
Naren
10-21-2006 7:26 AM
With reference to your code
data: material like mara-matnr.
set parameter id material field matnr.
You cannot use just any word for parameter Id. You have to use the parameters ids defined for the respective data element. These are defined in table TPARA.
Assuming that in the above example you want to want material number, your above mentioned code should change like this
data: material like mara-matnr.
set parameter id 'MAT' field matnr.
To know what parameter id can be used, you can check the relevant dataelement in SE11. Put the data element name directly in the relevant field such as MATNR or you can go through table for example display table MARA, than double click on the data element for MATNR and the result screen will show the parameter ID attached with that data element.
Cheers
10-21-2006 6:40 PM
Hello Michel,
function modules are reentrant, there is no given limitation implied by their signature. Therefore I wonder if any of the mentioned techniques is required.
If you want to pass the same value in a recursive call, just use the argument, if you like to have a different value just use a local variable for the next invocation.
Your code will become more readable and the functionality more performant.
Regards
Klaus