‎2005 Nov 08 11:18 AM
Hi,
My program is calling a function module.
Is there any way that i can access a variable of program
in function module without passing it in?
Regards,
Ankur
‎2005 Nov 08 11:31 AM
Hi Ankur,
you can use the export to memory and/or the set parameter statements to pass values to memory before calling the fm. In the fm you need to make sure the value will be read from memory using import from memory and/or get parameter statements.
regards
Siggi
‎2005 Nov 08 11:31 AM
Hi Ankur,
you can use the export to memory and/or the set parameter statements to pass values to memory before calling the fm. In the fm you need to make sure the value will be read from memory using import from memory and/or get parameter statements.
regards
Siggi
‎2005 Nov 08 11:33 AM
Hi Siggi,
Actually its a standard program and it is regarding implementing a user exit.
Thanks & Regards,
Ankur
‎2005 Nov 08 11:32 AM
Hi,
You can do a global assign if the variable is a global variable in your program i.e. declared in TOP include or at the top in a report program
For example,
FIELD-SYMBOLS: <fs_value> TYPE ANY.
ASSIGN ('(<your program name>)<your variable name>')
TO <fs_value>.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni
‎2005 Nov 08 11:35 AM
hi Ankur,
Try using memory id.
1. EXPORT obj1 ... objn TO MEMORY.
2. EXPORT obj1 ... objn TO DATABASE dbtab(ar) ID key.
3. EXPORT obj1 ... objn TO DATASET dsn(ar) ID key.
4. EXPORT obj1 ... objn TO SHARED BUFFER dbtab(ar) ID key.
EXPORT obj1 ... objn TO MEMORY.
Additions:
1. ... FROM g (for each field to be exported)
2. ... ID key
Exports the objects obj1 ... objn as a data cluster to ABAP/4
memory.
If you call a transaction, report or dialog module (with CALL
TRANSACTION, SUBMIT or CALL DIALOG), the contents of ABAP/4
memory are retained, even across several levels. The called
transaction can then retrieve the data from there using IMPORT
... FROM MEMORY. Each new EXPORT ... TO MEMORY statement
overwrites any old data in ABAP/4 memory - no data is appended.
If the processing leaves the deepest level of the call chain,
the ABAP/4 memory is released.
Regards,
Sailaja.
Dont forget to reward points, if answers helps you.
‎2005 Nov 08 11:36 AM
Look at this weblog.
/people/brad.williams/blog/2005/04/25/userexits--how-do-i-access-inaccessible-data
Svetlin
‎2005 Nov 08 12:02 PM
Hi Svetlin,
That was a nice weblog.
Let me explain the issue in more detail.
The program actually is calling FM in a form and that it is the local variable of the form which i need in FM.
Thanks & Regards,
Ankur
‎2005 Nov 08 12:22 PM
Hi
I think you can't externally read it, because the system places the variable in memory only while it runs the routine.
So I believe you should modify the code of routine to export the data by IMPORT/EXPORT command.
Max
‎2005 Nov 08 11:49 AM
Hi
Try to use this trick:
If the program of function group is SALPZ.... and field1 the field you want to read:
DATA: FIELD(30) VALUE '(SAPLZ....)FIELD1'.
FIELD-SYMBOLS: <FS_FIELD> TYPE ANY.
ASSING (FIELD) TO <FS_FIELD>.
max
‎2005 Nov 08 9:36 PM
I think you can. Try the following piece of code :
data field_name(30) type c.
field_name = '(MP016800)EE_BENEFIT_DATA'.
<b><i>MP016800 is the source program which contains the declaration for the field you need. EE_BENEFIT_DATA is the structure defined in that program which contains the string of data I need. I know that the data resides in the first 8 characters of the structure</i></b>
assign (field_name) to <fs1>.
move <fs1> to l_ee.
l_pernr = l_ee(8).
You could do something similar.
‎2005 Nov 08 10:15 PM
In the program where you are calling that function module export the data to a memory id by below command
Export variable to memory id 'MEMLOCATION'.
In the function module just import that data by below command
Import variable from memory id 'MEMLOCATION'.
Here variable should be of same type in both program and function module and also the memory id.
Cheers,
Satya