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

Export Memory

Former Member
0 Likes
671

Hi ,

I have to use one variable's value into another program (in BADI). For that I am exporting that variable from main program and using IMPORT I am using into BADI. Code is shown below,

FREE MEMORY ID 'REFPO'.

EXPORT pa_doc2 FROM v_podoc TO MEMORY ID 'REFPO'.

This is working fine.

Now I have to pass one Internal table to the same BADI from main program.

Shall I pass the Internal table with contents by using EXPORT and IMPORT statements from Memory......??

Please guide me on the same ASAP.

Thanks,

Jay.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

Hi jaywant,

If u want to use EXPORT and SUBMIT in the first report, ur internal table data will be first moved to Mem ID and after SUBMIT, it will go to the 2nd report and execution happens in report 2. There if u use IMPORT, the internal table data will be used there and the control will be back to ur report1.

So, the output of Report 2 will be written at first as a result of ur import in report 2. Then the content of report 1 will be wrtten in output.

See this..

Report 1:

report zscr_navigate.

data: a type i value 10,

b type string,

c type string.

data: int_tab type standard table of zprod with header line.

select * from zprod into table int_tab.

export int_tab to memory id 'TEST'.

submit zscr_navigate1 and return.

write / 'back to main'.

Report 2

REPORT ZSCR_NAVIGATE1.

DATA : b TYPE string VALUE 'hello'.

DATA : int_tab TYPE STANDARD TABLE OF zprod,

fs TYPE zprod.

WRITE / b.

IMPORT int_tab FROM MEMORY ID 'TEST'.

CLEAR fs.

LOOP at int_tab INTO fs.

WRITE / fs.

clear fs.

ENDLOOP.

Hope it helps u..

Reward points if helpful

Thanks,

Aditya

4 REPLIES 4
Read only

Former Member
0 Likes
594

Hi jaywant,

If u want to use EXPORT and SUBMIT in the first report, ur internal table data will be first moved to Mem ID and after SUBMIT, it will go to the 2nd report and execution happens in report 2. There if u use IMPORT, the internal table data will be used there and the control will be back to ur report1.

So, the output of Report 2 will be written at first as a result of ur import in report 2. Then the content of report 1 will be wrtten in output.

See this..

Report 1:

report zscr_navigate.

data: a type i value 10,

b type string,

c type string.

data: int_tab type standard table of zprod with header line.

select * from zprod into table int_tab.

export int_tab to memory id 'TEST'.

submit zscr_navigate1 and return.

write / 'back to main'.

Report 2

REPORT ZSCR_NAVIGATE1.

DATA : b TYPE string VALUE 'hello'.

DATA : int_tab TYPE STANDARD TABLE OF zprod,

fs TYPE zprod.

WRITE / b.

IMPORT int_tab FROM MEMORY ID 'TEST'.

CLEAR fs.

LOOP at int_tab INTO fs.

WRITE / fs.

clear fs.

ENDLOOP.

Hope it helps u..

Reward points if helpful

Thanks,

Aditya

Read only

Former Member
0 Likes
593

Hello!

Try this:

IMPORT (OBJ_TAB) FROM MEMORY ID 'ABCD'.

Where OBJ_TAB is:

OBJ_TAB TYPE STANDARD TABLE OF OBJ_LINE.

And:

TYPES: BEGIN OF OBJ_LINE,

CLUSTERNAME(30),

PROGRAMNAME(10),

END OF OBJ_LINE.

Bye bye!

Read only

Former Member
0 Likes
593

Declare the same internal table type in the badi.

Export the inernal table like ITAB[] in export statement.

IMPORT in your badi to declared internal table it will work.

Regards,

Madan.

Read only

Former Member
0 Likes
593

Hi ,

use Export /Import... DATABASE dbtab(ar) [FROM wa] [CLIENT cl] ID id

An internal table itab is exported under the name tab and the identification "TABLE" to the area "XY"of the data base table INDX (delivered by SAP). The selectable components are provided by the structure wa_indx.

TYPES:

BEGIN OF tab_type,

col1 TYPE i,

col2 TYPE i,

END OF tab_type.

DATA:

wa_indx TYPE indx,

wa_itab TYPE tab_type,

cl TYPE mandt VALUE '100',

itab TYPE STANDARD TABLE OF tab_type.

WHILE sy-index < 100.

wa_itab-col1 = sy-index.

wa_itab-col2 = sy-index ** 2.

APPEND wa_itab TO itab.

ENDWHILE.

wa_indx-aedat = sy-datum.

wa_indx-usera = sy-uname.

wa_indx-pgmid = sy-repid.

EXPORT tab = itab

TO DATABASE indx(XY)

FROM wa_indx

CLIENT cl

ID 'TABLE'.

reward points if helpful,

deepa