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

Not able to EXPORT - IMPORT internal table to memory.

Former Member
0 Likes
727

Hi all,

I tried so many ways to transfer internal table to memory and get it back but able to do that.

I exported structure from function module and importedin calling screen and it work fine, but to return result I exported internal table from calling screen and import in function module doesn't work.

here is the code where i am doing.

function module: ZCALL_SCREEN

FUNCTION ZCALL_SCREEN.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(RSNUM) TYPE RSNUM

*" REFERENCE(I_CAUFVD) LIKE CAUFVD STRUCTURE CAUFVD

*" TABLES

*" T_ITAB

*"----


data : " z_mem_caufvd like caufvd,

z_caufvd like caufvd.

move i_caufvd to z_caufvd.

EXPORT z_caufvd = z_caufvd TO MEMORY ID 'z_mem_caufvd'. - this is working fine exporting data

CALL SCREEN '100' STARTING AT 20 5

ENDING AT 140 20.

DATA : itab_out LIKE zmtest1 occurs 0 with header line.

DATA : m_itab LIKE zmtest1 occurs 0 with header line.

import m_itab = m_itab from memory id 'OUT'. - not importing data.

ENDFUNCTION.

Calling screen:

MODULE user_command_0100 INPUT.

EXPORT t_itab = t_itab TO MEMORY ID 'OUT'. - This is not working

CASE ok_code.

WHEN 'ENTER'.

RETURN.

  • Enter your code (perform, function ...)

WHEN 'CANCEL'.

  • Enter your code (perform, function ...)

RETURN.

WHEN OTHERS.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

*&spwizard: output module for tc 'ZPOPUP'. do not change this line!

*&spwizard: update lines for equivalent scrollbar

MODULE zpopup_change_tc_attr OUTPUT.

DATA : item_no(2) TYPE n.

DATA : z_caufvd LIKE caufvd,

z_mem_caufvd LIKE caufvd.

DATA : m_aufnr LIKE caufvd-aufnr,

m_plnbez LIKE caufvd-plnbez.

TYPES : BEGIN OF t_tabmatnr,

matnr LIKE resb-matnr,

END OF t_tabmatnr.

DATA : i_tabmatnr TYPE t_tabmatnr OCCURS 0 WITH HEADER LINE.

CLEAR : i_tabmatnr, t_itab.

IMPORT z_caufvd = z_caufvd FROM MEMORY ID 'z_mem_caufvd'. - - Working fine

IF m_aufnr <> z_caufvd-aufnr AND

m_plnbez <> z_caufvd-plnbez.

move : z_caufvd-aufnr to m_aufnr,

z_caufvd-plnbez to m_plnbez.

SELECT matnr FROM resb INTO TABLE i_tabmatnr WHERE rsnum = z_caufvd-rsnum.

LOOP AT i_tabmatnr.

item_no = item_no + 1.

MOVE : item_no TO t_itab-item_no,

i_tabmatnr-matnr TO t_itab-item.

APPEND t_itab.

CLEAR : i_tabmatnr, t_itab.

ENDLOOP.

ENDIF.

DESCRIBE TABLE t_itab LINES zpopup-lines.

Hi all,

I tried so many ways to transfer internal table to memory and get it back but able to do that.

I exported structure from function module and importedin calling screen and it work fine, but to return result I exported internal table from calling screen and import in function module doesn't work.

here is the code where i am doing.

function module: ZCALL_SCREEN

FUNCTION ZCALL_SCREEN.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(RSNUM) TYPE RSNUM

*" REFERENCE(I_CAUFVD) LIKE CAUFVD STRUCTURE CAUFVD

*" TABLES

*" T_ITAB

*"----


data : " z_mem_caufvd like caufvd,

z_caufvd like caufvd.

move i_caufvd to z_caufvd.

EXPORT z_caufvd = z_caufvd TO MEMORY ID 'z_mem_caufvd'. - this is working fine exporting data

CALL SCREEN '100' STARTING AT 20 5

ENDING AT 140 20.

DATA : itab_out LIKE zmtest1 occurs 0 with header line.

DATA : m_itab LIKE zmtest1 occurs 0 with header line.

import m_itab = m_itab from memory id 'OUT'. - not importing data.

ENDFUNCTION.

Calling screen:

MODULE user_command_0100 INPUT.

EXPORT t_itab = t_itab TO MEMORY ID 'OUT'. - This is not working

CASE ok_code.

WHEN 'ENTER'.

RETURN.

  • Enter your code (perform, function ...)

WHEN 'CANCEL'.

  • Enter your code (perform, function ...)

RETURN.

WHEN OTHERS.

ENDCASE.

ENDMODULE. " USER_COMMAND_0100 INPUT

*&spwizard: output module for tc 'ZPOPUP'. do not change this line!

*&spwizard: update lines for equivalent scrollbar

MODULE zpopup_change_tc_attr OUTPUT.

DATA : item_no(2) TYPE n.

DATA : z_caufvd LIKE caufvd,

z_mem_caufvd LIKE caufvd.

DATA : m_aufnr LIKE caufvd-aufnr,

m_plnbez LIKE caufvd-plnbez.

TYPES : BEGIN OF t_tabmatnr,

matnr LIKE resb-matnr,

END OF t_tabmatnr.

DATA : i_tabmatnr TYPE t_tabmatnr OCCURS 0 WITH HEADER LINE.

CLEAR : i_tabmatnr, t_itab.

IMPORT z_caufvd = z_caufvd FROM MEMORY ID 'z_mem_caufvd'. - - Working fine

IF m_aufnr <> z_caufvd-aufnr AND

m_plnbez <> z_caufvd-plnbez.

move : z_caufvd-aufnr to m_aufnr,

z_caufvd-plnbez to m_plnbez.

SELECT matnr FROM resb INTO TABLE i_tabmatnr WHERE rsnum = z_caufvd-rsnum.

LOOP AT i_tabmatnr.

item_no = item_no + 1.

MOVE : item_no TO t_itab-item_no,

i_tabmatnr-matnr TO t_itab-item.

APPEND t_itab.

CLEAR : i_tabmatnr, t_itab.

ENDLOOP.

ENDIF.

DESCRIBE TABLE t_itab LINES zpopup-lines.

2 REPLIES 2
Read only

Former Member
0 Likes
474

found the solution

Read only

Former Member
0 Likes
474

hi ,

in first program..

z_caufvd = z_caufvd

EXPORT z_caufvd TO MEMORY ID 'z_mem_caufvd'.

Second Program..

t_caufvd type z_caufvd .

IMPORT 'z_mem_caufvd' FROM MEMORY ID TO t_caufvd .

Regards,

Prabhudas