Application Development 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: 

Use of IMPORT/EXPORT in methods

Former Member
0 Kudos

Hi,

Is it possible to use IMPORT/EXPORT statements in the methods which are part of BADI's.

Thanks

Rajavardhana reddy

5 REPLIES 5

former_member181962
Active Contributor
0 Kudos

It is possible.

YOu can use import from memroy id if you know that it has been exported to memory in the main program.

Regards,

Ravi

Former Member
0 Kudos

yes, it is possible .

Former Member
0 Kudos

hi,

Yes it is possible with Memory id ..

Regards,

santosh

Former Member
0 Kudos

HI,

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

Regards,

Laxmi.

Former Member
0 Kudos

Hi,

Its possible to use import and export to memory

Id in BAPI but they should be part of same luw.

IMPORT f itab FROM MEMORY.

Additions:

1. ... TO g (for each field f to be imported)

2. ... ID key

Imports data objects (fields or tables) from the ABAP/4 memory

(see EXPORT). Reads in all data without an ID that was exported

to memory with "EXPORT ... TO MEMORY.". In contrast to the

variant IMPORT FROM DATABASE, it does not check that the

structure matches in EXPORT and IMPORT.

EXPORT obj1 ... objn TO MEMORY.

Additions:

1. ... FROM g (for each field to be exported)

2. ... ID key

Exports the objects obj1 ... objn as a data cluster to ABAP/4

memory.

If you call a transaction, report or dialog module (with CALL

TRANSACTION, SUBMIT or CALL DIALOG), the contents of ABAP/4

memory are retained, even across several levels. The called

transaction can then retrieve the data from there using IMPORT

... FROM MEMORY. Each new EXPORT ... TO MEMORY statement

overwrites any old data in ABAP/4 memory - no data is appended.

Regards

amole