Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Set/Get Parameter

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

Former Member
0 Kudos

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

Rashid_Javed
Contributor
0 Kudos

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

RJv

former_member183804
Active Contributor
0 Kudos

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