2011 May 06 11:05 AM
Hello everyone,
Is there a way to pass data between two programs using function modules.
i know there are other options such as submit a program,export/import to memory id etc
But is it possible to pass data using FMs?
Regards,
Niti
Hi Niti,
this is possible as long all programs run in the same process, are not interrupted by any screen i/o.
create two FMs in one function group. In TOP include, declare the data to be shared globally :
* INCLUDE ZXYTOP.
DATA:
datacontainer type whatever.FUNCTION Z_XY_EXPORT.
* IMPORTING
* I_datacontainer TYPE whatever
datacontainer = I_datacontainer.
ENDFUNCTIONFUNCTION Z_XY_IMPORT.
* EXPORTING
* E_datacontainer TYPE whatever
E_datacontainer =datacontainer.
ENDFUNCTIONREPORT Z_PROG1.
...
CALL FUNCTION Z_XY_EXPORT
EXPORTING
I_datacontainer = your_datacontainer_just_filled.
...REPORT Z_PROG2.
CALL FUNCTION Z_XY_IMPORT
IMPORTING
E_datacontainer = your_datacontainer_needed_here.
...
...If you want to share the data between independent work processes and/or users, you can make use of shared buffers or the modern way shared objects.
Regards,
Clemens
2011 May 06 11:40 AM
2011 May 06 12:21 PM
Suppose i need to pass data to another program using FM how should i proceed.
eg
program1 the user gives an input as 1 which is type integer
now this value '1' should be available to some other program for further processing.
but i need to use only function module.
is it possible and how??.
2011 May 06 1:26 PM
Hi Niti,
this is possible as long all programs run in the same process, are not interrupted by any screen i/o.
create two FMs in one function group. In TOP include, declare the data to be shared globally :
* INCLUDE ZXYTOP.
DATA:
datacontainer type whatever.FUNCTION Z_XY_EXPORT.
* IMPORTING
* I_datacontainer TYPE whatever
datacontainer = I_datacontainer.
ENDFUNCTIONFUNCTION Z_XY_IMPORT.
* EXPORTING
* E_datacontainer TYPE whatever
E_datacontainer =datacontainer.
ENDFUNCTIONREPORT Z_PROG1.
...
CALL FUNCTION Z_XY_EXPORT
EXPORTING
I_datacontainer = your_datacontainer_just_filled.
...REPORT Z_PROG2.
CALL FUNCTION Z_XY_IMPORT
IMPORTING
E_datacontainer = your_datacontainer_needed_here.
...
...If you want to share the data between independent work processes and/or users, you can make use of shared buffers or the modern way shared objects.
Regards,
Clemens
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |