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

Former Member
0 Likes
2,269

Hi,

I would like to know how to pass data between two programs ( i . e SE38 ) .

Thanks and Regards,

Prasad

3 REPLIES 3
Read only

Manohar2u
Active Contributor
0 Likes
987

SAP Memory

SAP memory is a memory area to which all main sessions within a SAPgui have access. You can use SAP memory either to pass data from one program to another within a session, or to pass data from one session to another. Application programs that use SAP memory must do so using SPA/GPA parameters (also known as SET/GET parameters). These parameters can be set either for a particular user or for a particular program using the SET PARAMETER statement. Other ABAP programs can then retrieve the set parameters using the GET PARAMETER statement. The most frequent use of SPA/GPA parameters is to fill input fields on screens (see below).

ABAP Memory

ABAP memory is a memory area that all ABAP programs within the same internal session can access using the EXPORT and IMPORT statements. Data within this area remains intact during a whole sequence of program calls. To pass data to a program which you are calling, the data needs to be placed in ABAP memory before the call is made. The internal session of the called program then replaces that of the calling program. The program called can then read from the ABAP memory. If control is then returned to the program which made the initial call, the same process operates in reverse. For further information, refer to Data Clusters in ABAP Memory.

Refer to this link

http://help.sap.com/saphelp_47x200/helpdata/en/9f/db9df735c111d1829f0000e829fbfe/frameset.htm

Regds

Manohar

Read only

Former Member
0 Likes
987

one method is using submit statemnet with ranges and parameters.

in prog 1.

ranges: r_matnr for mara-matnr.

data: v_matnr type matnr value '0000000001'.

r_matnr-sign = 'I'.

r_matnr-option = 'EQ'.

r_matnr-low = v_matnr.

append r_matnr.

submit prog2 with s_matnr in r_matnr

with p_matnr = v_matnr.

in prog 2.

select-options: s_matnr for mara-matnr no-display.

parameters: p_matnr type matnr.

loop at s_matnr.

write:/ s_matnr-low.

endloop.

write: p_matnr.

method 2 is the use of export and import parameters.

example:

TYPES: BEGIN OF ITAB3_TYPE,

CONT(4),

END OF ITAB3_TYPE.

DATA: XSTR TYPE XSTRING,

F1 TYPE C LENGTH 4,

F2 TYPE P,

ITAB3 TYPE STANDARD TABLE OF ITAB3_TYPE WITH

NON-UNIQUE DEFAULT KEY INITIAL SIZE 2.

EXPORT F1 FROM F1

F2 FROM F2

ITAB3 FROM ITAB3

TO DATA BUFFER XSTR.

TYPES: BEGIN OF ITAB3_LINE,

CONT(4),

END OF ITAB3_LINE.

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

F1(4),

F2(8) TYPE P DECIMALS 0,

ITAB3 TYPE STANDARD TABLE OF ITAB3_LINE,

INDX_WA TYPE INDX.

  • Import data.

IMPORT F1 = F1 F2 = F2 ITAB3 = ITAB3

FROM SHARED BUFFER INDX(ST) ID INDXKEY TO INDX_WA.

  • After import, the data fields INDX-AEDAT and

  • INDX-USERA in front of CLUSTR are filled with

  • the values in the fields before the EXPORT

  • statement.

Regards,

Ravi

Read only

Former Member
0 Likes
987

Hi Prasad

hi ,

check this sample

1.

DATA TEXT1(10) VALUE 'Exporting'.

DATA ITAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

DO 5 TIMES.

ITAB-BOOKID = 100 + SY-INDEX.

APPEND ITAB.

ENDDO.

EXPORT ITAB

TO MEMORY ID 'table'.

2. IMPORTING DATA

DATA JTAB LIKE SBOOK OCCURS 10 WITH HEADER LINE.

IMPORT ITAB TO JTAB FROM MEMORY ID 'table'.

LOOP AT JTAB.

WRITE / JTAB-BOOKID.

ENDLOOP.

Rgds,

Prakash