Application Development and Automation 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: 
Read only

Passing data between two programs using FMs?

niti_mod
Explorer
0 Likes
698

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

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
610

Please refer my explanation to similar doubt

Regards

Marcin

Read only

0 Likes
610

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??.

Read only

0 Likes
610

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.
ENDFUNCTION

FUNCTION Z_XY_IMPORT.
* EXPORTING
*   E_datacontainer TYPE whatever
  E_datacontainer =datacontainer.
ENDFUNCTION

REPORT 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