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

import sentence in methods

Former Member
0 Likes
770

I have export an internal table to abap memory in a function with

export text_data to memory id 'TEXT'.

but i can´t recover it in a badi because i obtein an error for using this sentence in a method

IMPORT text_data FROM MEMORY ID 'TEXT'.

How can i change this sentence or make something to obtein this information?

Thanks in advance

Regards

1 ACCEPTED SOLUTION
Read only

uwe_schieferstein
Active Contributor
0 Likes
737

Hello Carl

The syntax check within classes is more strict than in normal reports. Thus, modify your statement as following:

IMPORT text INTO text_data FROM MEMORY ID 'TEXT'.

Correspondingly, the EXPORT statement should be like this:

EXPORT text FROM text_data TO MEMORY ID 'TEXT'.

Regards

Uwe

I have export an internal table to abap memory in a function with

export text_data to memory id 'TEXT'.

but i can´t recover it in a badi because i obtein an error for using this sentence in a method

IMPORT text_data FROM MEMORY ID 'TEXT'.

How can i change this sentence or make something to obtein this information?

Thanks in advance

Regards

3 REPLIES 3
Read only

Former Member
0 Likes
737

Hello,


Import

TYPES: BEGIN OF OBJ_LINE, 
CLUSTERNAME(30), 
PROGRAMNAME(10), 
END OF OBJ_LINE, 
BEGIN OF B_LINE, 
FIELD_1 TYPE I, 
FIELD_2(1) TYPE N, 
END OF B_LINE. 

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE, 
OBJ_WA TYPE OBJ_LINE, 
B_PROG TYPE STANDARD TABLE OF B_LINE, 
B_WA TYPE B_LINE, 
A(10), 
C_PROG LIKE SYST. 

MOVE: 'A' TO OBJ_WA-CLUSTERNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

MOVE: 'B' TO OBJ_WA-CLUSTERNAME, 
'B_PROG' TO OBJ_WA-PROGRAMNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

MOVE: 'C' TO OBJ_WA-CLUSTERNAME, 
'C_PROG' TO OBJ_WA-PROGRAMNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

IMPORT (OBJ_TAB) FROM MEMORY ID 'ABCD'. 


export

TYPES: BEGIN OF OBJ_LINE, 
CLUSTERNAME(30), 
PROGRAMNAME(10), 
END OF OBJ_LINE. 

DATA: OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE, 

OBJ_WA TYPE OBJ_LINE. 

TYPES: BEGIN OF B_LINE, 
FIELD_1 TYPE I, 
FIELD_2(1) TYPE N, 
END OF B_LINE. 

DATA: B_PROG TYPE STANDARD TABLE OF B_LINE. 

DATA: A(10), 
C_PROG LIKE SYST. 

MOVE: 'A' TO OBJ_WA-CLUSTERNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

MOVE: 'B' TO OBJ_WA-CLUSTERNAME, 
'B_PROG' TO OBJ_WA-PROGRAMNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

MOVE: 'C' TO OBJ_WA-CLUSTERNAME, 
'C_PROG' TO OBJ_WA-PROGRAMNAME. 
APPEND OBJ_WA TO OBJ_TAB. CLEAR OBJ_WA. 

EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'.

Read only

uwe_schieferstein
Active Contributor
0 Likes
738

Hello Carl

The syntax check within classes is more strict than in normal reports. Thus, modify your statement as following:

IMPORT text INTO text_data FROM MEMORY ID 'TEXT'.

Correspondingly, the EXPORT statement should be like this:

EXPORT text FROM text_data TO MEMORY ID 'TEXT'.

Regards

Uwe

Read only

Former Member
0 Likes
737

Hi,

May be the Import and Export commands doesn't work in BADI's i.e too exporting and importing the Internal table.

Better use the Paramters/attributes data that is linked with the methods for the data fetching instead of internal table export/import.

reward if useful.

Regards,

Anji