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

How to Export data to memory and Import data from memory?

former_member455947
Participant
0 Likes
1,025

hi

I have the follwoing some code of program.

The data is not filled from memory. I have to find what is the wrong in code.

REPORT ZIFT_TEST1..

.

.

SELECT-OPTIONS : so_budat FOR bkpf-budat,

sd_saknr FOR ska1-saknr.

.

.

.

.

EXPORT so_budat TO MEMORY ID 'ZBUDAT'.

EXPORT sd_saknr TO MEMORY ID 'ZSAKNR'.

SUBMIT ZIFT_TEST2 AND RETURN.

.

.

.

.

REPORT ZIFT_TEST2..

.

.

SELECT-OPTIONS so_budat FOR bsis-budat NO DATABASE SELECTION.

SELECT-OPTIONS: SD_SAKNR FOR SKA1-SAKNR MATCHCODE OBJECT SAKO.

.

.

.

import so_budat = so_budat from memory id 'ZBUDAT'.

import sd_saknr from memory id 'ZSAKNR'.

.

.

.

Regards

Iftikhar Ali

Islamabad.

hi

I have the follwoing some code of program.

The data is not filled from memory. I have to find what is the wrong in code.

REPORT ZIFT_TEST1..

.

.

SELECT-OPTIONS : so_budat FOR bkpf-budat,

sd_saknr FOR ska1-saknr.

.

.

.

.

EXPORT so_budat TO MEMORY ID 'ZBUDAT'.

EXPORT sd_saknr TO MEMORY ID 'ZSAKNR'.

SUBMIT ZIFT_TEST2 AND RETURN.

.

.

.

.

REPORT ZIFT_TEST2..

.

.

SELECT-OPTIONS so_budat FOR bsis-budat NO DATABASE SELECTION.

SELECT-OPTIONS: SD_SAKNR FOR SKA1-SAKNR MATCHCODE OBJECT SAKO.

.

.

.

import so_budat = so_budat from memory id 'ZBUDAT'.

import sd_saknr from memory id 'ZSAKNR'.

.

.

.

Regards

Iftikhar Ali

Islamabad.

2 REPLIES 2
Read only

Former Member
0 Likes
634

Hi, As per what i see in your code, you want to use EXPORT and IMPORT for selection screen paramters. In that case use can directly use SUBMIT WITH statements. No need of using MEMORY ID concept.

Read only

Former Member
0 Likes
634

Program1----


REPORT demo_program_rep3 NO STANDARD PAGE HEADING.

DATA: number TYPE i,

itab TYPE TABLE OF i.

SET PF-STATUS 'MYBACK'.

DO 5 TIMES.

number = sy-index.

APPEND number TO itab.

WRITE / number.

ENDDO.

TOP-OF-PAGE.

WRITE 'Report 2'.

ULINE.

AT USER-COMMAND.

CASE sy-ucomm.

WHEN 'MBCK'.

EXPORT itab TO MEMORY ID 'HK'.

LEAVE.

ENDCASE.

-


Program2----


REPORT demo_programm_leave NO STANDARD PAGE HEADING.

DATA: itab TYPE TABLE OF i,

num TYPE i.

SUBMIT demo_program_rep3 AND RETURN.

IMPORT itab FROM MEMORY ID 'HK'.

LOOP AT itab INTO num.

WRITE / num.

ENDLOOP.

TOP-OF-PAGE.

WRITE 'Report 1'.

ULINE.

-


end of program 2----


Now you copy this programs with same name as i mentioned and execute demo_programm_leave Program.you will understnad clearly.

Notes::: A logical memory model illustrates how the main memory is distributed from the view of executable programs. A distinction is made here between external sessions and internal sessions .

An external session is usually linked to an R/3 window. You can create an external session by choosing System/Create session, or by entering /o in the command field. An external session is broken down further into internal sessions. Program data is only visible within an internal session. Each external session can include up to 20 internal sessions (stacks).

Every program you start runs in an internal session.

To copy a set of ABAP variables and their current values (data cluster) to the ABAP memory, use the EXPORT TO MEMORY ID statement. The (up to 32 characters) is used to identify the different data clusters.

If you repeat an EXPORT TO MEMORY ID statement to an existing data cluster, the new data overwrites the old.

To copy data from ABAP memory to the corresponding fields of an ABAP program, use the IMPORT FROM MEMORY ID statement.