Import export internal table
Hi.
How can i make an import export of an internal table but with the sap memory.
Thanks.
Regards
Miguel
If the number of entries in table is less following logic could be used..
Suppose wa_tab is the work area and lit_tab is the table that you need to import and export into lit_new.
DATA : lv_count_char TYPE CHAR3,
lv_field TYPE char6.
DESCRIBE TBALE lit_tab LINES lv_lines.
SET PARAMETER ID 'LINES' FIELD lv_lines.
---> Setting the value
LOOP at lit_tab INTo wa_tab.
MOVE sy-tabix TO lv_count_char.
CONCATENATE 'FLD' lv_count_char INTO lv_field.
SET PARAMETER ID lv_field FIELD wa_tab.
ENDLOOP.
---> Rerieving the value
GET PARAMETER ID 'LINES' FIELD lv_lines.
DO.
lv_count = lv_count + 1.
MOVE lv_count TO lv_count_char.
CONCATENATE 'FLD' lv_count_char INTO lv_field.
GET PARAMETER ID lv_field FIELD wa_tab.
APPEND wa_tab TO lit_new.
IF lv_count GE lv_lines.
EXIT.
ENDIF.
ENDDO.
Similar Messages
-
Import/export internal tabl
Hi,
This is regarding import/export internal table to 2 different prog, somehow when i execute in prog ztest_hl7, it doesnt work. Please help.
report ztest_hl7.
TYPES:
BEGIN OF tab_type,
para TYPE string,
dobj TYPE string,
END OF tab_type.
DATA:
id TYPE c LENGTH 10 VALUE 'TEXTS',
text1 TYPE string VALUE `IKE`,
text2 TYPE string VALUE `TINA`,
line TYPE tab_type,
itab TYPE STANDARD TABLE OF tab_type.
line-para = 'P1'.
line-dobj = 'TEXT1'.
APPEND line TO itab.
line-para = 'P2'.
line-dobj = 'TEXT2'.
APPEND line TO itab.
EXPORT itab TO MEMORY ID id.
submit ztest_hl6 and return.
report ztest_hl6.
data : id TYPE c LENGTH 10 VALUE 'TEXTS'.
TYPES:
BEGIN OF tab_type,
para TYPE string,
dobj TYPE string,
END OF tab_type.
DATA: itab TYPE STANDARD TABLE OF tab_type,
wa_itab type tab_type.
IMPORT itab FROM MEMORY ID id.
loop at itab into wa_itab.
write:
wa_itab-para,
wa_itab-dobj.
endloop.
Edited by: Hui Leng Yeoh on Jun 26, 2008 11:25 AMHi There are few syntax errors. Comment ur code and Paste this code and check. It is working fine.
report ztest_hl7.
TYPES:
BEGIN OF tab_type,
para TYPE string,
dobj TYPE string,
END OF tab_type.
DATA:
id(10) TYPE c VALUE 'TEXTS',
text1 TYPE string, " VALUE `IKE`,
text2 TYPE string, " VALUE `TINA`,
line TYPE tab_type,
itab TYPE STANDARD TABLE OF tab_type.
text1 = 'IKE'.
text2 = 'TINA'.
line-para = 'P1'.
line-dobj = 'TEXT1'.
APPEND line TO itab.
line-para = 'P2'.
line-dobj = 'TEXT2'.
APPEND line TO itab.
EXPORT itab TO MEMORY ID id.
SUBMIT z7569411 AND RETURN.
data : id(10) TYPE c VALUE 'TEXTS'.
TYPES:
BEGIN OF tab_type,
para TYPE string,
dobj TYPE string,
END OF tab_type.
DATA: itab TYPE STANDARD TABLE OF tab_type,
wa_itab type tab_type.
IMPORT itab FROM MEMORY ID id.
loop at itab into wa_itab.
write:
wa_itab-para,
wa_itab-dobj.
endloop.
Thanks,
vinod. -
Export and import the internal table
Hi,
Could you explain the total internal table data how we export and import please give me example.
Thanks,
HariHi,
Check this thread..
exporting internal table to memory variable -
Dear Experts,
I need a solution for importing from an internal table.
Two variables I_EXP01 and I_EXP02 containing an xml stream have been exported to the database using the following syntax
and depending on the size of I_EXP01 and I_EXP02 two or more entries are created in table LTEX.
EXPORT
L_SAPRL
I_EXP01
I_EXP02
TO DATABASE LTEX(LT)
ID LS_LTEXKEY.
But now i have a few entries of table LTEX in an internal table and they need to be imported from the internal table.
What would be the syntax to import from internal table so that after importing I can de-serialise the data from XML to ABAP.
Thanks & Regards,
AshwiniTry this and let me know if it works:
IMPORT
L_SAPRL
I_EXP01
I_EXP02
To
L_SAPRL1 (same type as above)
I_EXP011 (same type as above)
I_EXP021 (same type as above)
FROM DATABASE LTEX(LT)
ID LS_LTEXKEY.
if it is not working. try using seperate statements for each internal table and see.
Thanks,
Venkatesh.
Edited by: venkatesh333 on Jul 27, 2011 6:23 AM -
Problem while exporting internal table to memory id using EXPORT
Hi friends,
Iam facing a following problem.
I have 4 line items in my va01 tcode.
now when i give material number and quantity and hit enter the processing for that line item starts.
iam moving that current line item to a internal table lt_vbap in userexit_check_vbap.
now for the 2nd line item also i have to move to internal table lt_vbap.
but my problem is that in internal table lt_vbap iam not getting all the line items.
every time the current line item is being processed the the previous line items are being refreshed.
from lt_vbap internal table.
how can i export internal table.
code
move vbap to lt_vbap.
append lt_vbap.
export lt_vbap to memory id 'ZXYZ'.>
Prakash Pandey wrote:
> Hi Priyanka,
>
> The internal table lt_vbap will always be empty unless you import it from the Memory ID (in your case ZXYX).
>
> Use the code this way:
>
> IMPORT lt_vbap FROM MEMORY ID 'ZXYX'.
>
> move vbap to lt_vbap.
>
> append lt_vbap.
>
> export lt_vbap to memory id 'ZXYZ'.
>
> Regards,
> Prakash Pandey
The memory id shud be same in both cases -
Export internal table to memory.
How can I export and import an internal table to memory?
This:
export messtab to memory id 'TAB'. (in program 1)
import messtab=messtab from memory id 'TAB'. (in program 2)
does not work.Even without the brackets it doesn't work.
In program 1 I have:
WRITE text-e21 TO messtab-message.
messtab-type = c_tipo_error.
APPEND messtab. CLEAR messtab.
DELETE messtab WHERE message = space.
EXPORT messtab[] TO MEMORY ID para.
EXIT.
The EXIT leads to program 2, from where I made a submit to program 1, and where I have:
import messtab[] from memory id para.
Where:
DATA: para TYPE tpara-paramid VALUE 'MES',
messtab TYPE TABLE OF bapireturn WITH HEADER LINE.
What's wrong?
Thanks in advance.
Oh, and I've checked the table in program 1 does have an entry. -
Export INTERNAL TABLE to shared buffer
Hi all,
My requirement:
Export INTERNAL TABLE to shared buffer or SAP Memory.
Any help will be appreciated.
Can SET/GET parameter be adopted for internal tables?
Thanks,
TabraizEXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'
also refer to
http://help.sap.com/saphelp_45b/helpdata/en/34/8e73a36df74873e10000009b38f9b8/content.htm -
How to Import customized internal table to smartform from Print Program
Hi Gurus,
I want to Import customized internal table to smartform from print program, Can anybody tell me how it is possible.
With regards,
S.SaravananThere is no problem passing an internal table to a smarforms, smartforms have the same interface as a function module ([Defining the Form Interface|http://help.sap.com/saphelp_nw70/helpdata/en/1c/f40c5bddf311d3b574006094192fe3/frameset.htm] in [Smart Forms|http://help.sap.com/saphelp_nw70/helpdata/en/a5/de6838abce021ae10000009b38f842/frameset.htm]) so could you elaborate a little more on your requirement (is it a standard a custom forms, etc.)
Regards,
Raymond -
How to import the internal table into subroutine as parameter
how to import the internal table into subroutine as parameter, and its structure can be recognized inside the subroutine
Hi Yong,
try this:
parameters: p_tabnm like dd03l-tabname.
field-symbols: <fs_tabname> type standard table.
data: itab_ref type ref to data.
create data itab_ref type standard table of (p_tabnm)
with default key.
assign itab_ref->* to <fs_tabname>.
select * from (p_tabnm) into table <fs_tabname>.
perform subroutine tables <fs_tabname>
using p_tabnm.
*& Form subroutine
text
-->P_<FS_TABNAME> text
-->P_P_TABNM text
form subroutine tables p_tabname type standard table
using p_tabnm.
Here p_tabname already has the structure of the table you gave as input
parameter
endform. " subroutine -
Uregent Requirement, related with export & import of internal table values
Hello All,
According to my requirement
I created a copy program(ZRSEIDOC2) which is copy program of RSEIDOC2attached in T Code WE02.
and I created another program ZXXXXXX.
Now what I am trying to do is
1. I am trying to export the final output table/internal table to program ZXXXXXX.
Export I_listedidc to memory id SID.
2. In Program ZXXXXXX, I used to submit statement & import statement for output table/internal table.
Submit ZRSEIDOC2 using selection-screen 1000.
Import I_Listedidc to memory id SID.
Which give the automated way to find out the output i.e. status,process, .
My Question is..
Is I_listedidc right table/itab, which I am using my statement?
Do I am writing the code in a right way?use:
Export I_listedidc to memory id 'SID'.
Submit ZRSEIDOC2 using selection-screen 1000.
Import I_Listedidc from memory id 'SID'.
A. -
Exporting internal table in a oops
hi friends,
I have to pass internal table to a method and export that internal table.
now when i am passing this internal table i am getting the last value of the table..
i am enclosing code here please go through and modify me regarding this..
REPORT ZTEST_ABAP_PROXY.
DATA PRXY TYPE REF TO ZCO_MI_PROXY_OUTBOUND.
DATA: BEGIN OF I_MARA OCCURS 0,
MATNR LIKE MARA-MATNR,
ERNAM LIKE MARA-ERNAM,
END OF I_MARA.
CREATE OBJECT PRXY.
DATA IT TYPE ZMT_PROXY_OUTBOUND OCCURS 0 WITH HEADER LINE.
TRY.
SELECT MATNR ERNAM INTO TABLE I_MARA FROM MARA UP TO 10 ROWS.
LOOP AT I_MARA.
IT-MT_PROXY_OUTBOUND-MATNR = I_MARA-MATNR.
IT-MT_PROXY_OUTBOUND-ERNAM = I_MARA-ERNAM.
APPEND IT.
ENDLOOP.
CALL METHOD PRXY->EXECUTE_ASYNCHRONOUS
EXPORTING
OUTPUT = IT.
COMMIT WORK.
CATCH CX_AI_SYSTEM_FAULT .
DATA FAULT TYPE REF TO CX_AI_SYSTEM_FAULT .
CREATE OBJECT FAULT.
WRITE :/ FAULT->ERRORTEXT.
ENDTRY.
i need to pass all the values of internal table to output at once..
Thanks and Regards
VijayHi Vijay,
I think the problem is with the output parameter.
Might be I'll give you the background and then explain you the problem. This may help.
In the older release of ABAP there used to be Tables as one of the tabs where one could import/export tables to/from the FM. The problem was that it would difficult to identify what table are being imported and what are bein exported.
So with later releases of ABAP this tab was removed and currently there are Exporting/Importing/Changing tabs. You can use changing in your case if you are passing the table to modify the same.
Now the problem.
As stated above the OUTPUT is a line type (means structure) while IT is a internal table with header lines. So the record in the wa of this table is only transferred to OUTPUT.
What needs to be done.
You need to change the type of the OUTPUT to table type. I am not sure if you know about table type.
You can create a Table Type is se11 under Data Type.
I hope this helps.
Regards,
Saurabh -
Exporting Internal Table from Methods
Hi Experts,
I wanted to export an internal table from Methods and I am using below syntax and its not working.
METHODS get_data IMPORTING value(s_matnr) type mara-matnr
exporting it_tab TYPE STANDARD TABLE itab.
Please let me know what is the proper syntax.
Thanks
BasanagoudaHi,
Define itab as a 'table type' of standard table.
Example: TYPES: t_sflight TYPE STANDARD TABLE OF sflight.
METHODS : get_data IMPORTING s_carrid type sel_carrid
EXPORTING e_tab type t_sflight.
ENDCLASS -
How to export internal table and pass the internal table to another screen?
Hi,
I have a sql SELECT statement that select data from table into internal table. I would like to export out the internal table and pass to another screen and display the data in ALV list. How to export it out? I try but the error given was " The type of "OUT_SELECT_ITAB" cannot be converted to the type of "itab_result".
Another question is, how to pass the internal table that i export out from the function module to another screen?
Here is the code
==============================================================
FUNCTION ZNEW_SELECT_ZSTUD00.
""Local Interface:
*" IMPORTING
*" REFERENCE(IN_SELECT_YEAR) TYPE ZSTUD00-EYEAR
*" EXPORTING
*" REFERENCE(OUT_RESULT) TYPE CHAR9
*" REFERENCE(OUT_SELECT_ITAB) TYPE ZSTUD00
*& Global Declarations
DATA: itab TYPE ZSTUD00,
itab_result TYPE TABLE OF ZSTUD00.
*& Processing Blocks called by the Runtime Environment
itab-eyear = IN_SELECT_YEAR.
SELECT *
FROM ZSTUD00
INTO TABLE itab_result
WHERE eyear = IN_SELECT_YEAR.
IF sy-subrc = 0.
out_result = 'Success'.
OUT_SELECT_ITAB = itab_result.
ELSE.
out_result = 'Fail'.
ENDIF.
ENDFUNCTION.
===============================================================
Please advise. Thanks
Regards,
RaydenHi Nagaraj,
I try to change it in Tables tab page but it state that TABLES parameters are obsolete. when i "Enter". I try to "Enter" again. it seem to be ok but it stil give me the same error.
================================================================
FUNCTION ZNEW_SELECT_ZSTUD00.
""Local Interface:
*" IMPORTING
*" REFERENCE(IN_SELECT_YEAR) TYPE ZSTUD00-EYEAR
*" EXPORTING
*" REFERENCE(OUT_RESULT) TYPE CHAR9
*" TABLES
*" OUT_SELECT_ITAB STRUCTURE ZSTUD00
*& Global Declarations
DATA: itab TYPE ZSTUD00,
itab_result TYPE TABLE OF ZSTUD00.
*& Processing Blocks called by the Runtime Environment
itab-eyear = IN_SELECT_YEAR.
SELECT *
FROM ZSTUD00
INTO TABLE itab_result
WHERE eyear = IN_SELECT_YEAR.
IF sy-subrc = 0.
out_result = 'Success'.
OUT_SELECT_ITAB = itab_result.
ELSE.
out_result = 'Fail'.
ENDIF.
ENDFUNCTION.
===============================================================
regards,
Rayden -
Export internal table to memory in User Exit FM
Hi all,
My scenario here is to export an internal table in one user exit FM and import it back in another user exit FM.
I was trying to use
Export lt_table to memory id 'LABEL'.
then
Import lt_table from memory id 'LABEL'.
But then i hit error in the import statement. How can I rectify this?
Thanks. Answer will be rewarded.Refer to the below related threads
Export an internal table to memory and import from memory into an internal
http://help.sap.com/saphelp_erp2005/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm
Regards,
Santosh -
Export internal table to Excel file pressing a new button created in ALV
Hello, I am trying to implement the functionality to export to excel file inside a button that i have created into my ALV. I don't want to use FileDownload UI.
The code I have set for event handler of this button is the following:
METHOD attach_files .
TYPES:
BEGIN OF tipo_alv_tab,
tipod TYPE objid,
descd TYPE p1000-stext,
begda TYPE begdatum,
endda TYPE enddatum,
pernr TYPE pernr_d,
nombre TYPE ad_namefir,
email TYPE ad_smtpadr,
posicion TYPE p1000-stext,
uodesc TYPE p1000-stext,
END OF tipo_alv_tab.
DATA:
i_alv_tab TYPE TABLE OF tipo_alv_tab,
conv_out TYPE REF TO cl_abap_conv_out_ce,
content TYPE xstring,
lv_filename TYPE string,
xml_out TYPE string.
Fill values from memory
IMPORT name1 TO i_alv_tab FROM MEMORY ID 'ZCA'.
Build XML file with internal table information
CALL TRANSFORMATION ('ID') SOURCE tab = i_alv_tab[] RESULT XML xml_out.
Build XSTRING with XML
CALL FUNCTION 'CRM_IC_XML_STRING2XSTRING'
EXPORTING
instring = xml_out
IMPORTING
outxstring = content.
Format XSTRING
conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
Convert data
conv_out->convert( EXPORTING data = xml_out IMPORTING buffer = content ).
Save file
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = 'Excel File.xls'
i_content = content
i_mime_type = 'application/msexcel'
i_in_new_window = i_in_new_window
i_inplace = i_inplace.
ENDMETHOD.
When pressing the button, the file created is without extension, and with a rare name. When trying to open the file, it seems to be corrupted.
Does anyone know what am I doing wrong???
Please, help is really really appreciated!!!!Hi Jorge,
The export data to excel functionality is available inbuilt in ALV and you dont have to write any implementation. However, if you want to create your own button for it, you can do so as below.
data:
lr_button type ref to cl_salv_wd_fe_button,
lr_function type ref to cl_salv_wd_function.
CREATE OBJECT lr_button.
lr_button->set_text( 'Export to excel' ).
lr_button->set_tooltip( 'Export data to excel' ).
lr_function = l_alv_model->if_salv_wd_function_settings~create_function( id = 'EXCEL' ).
lr_function->set_function_std( IF_SALV_WD_C_STD_FUNCTIONS=>EXPORT_EXCEL ).
lr_function->set_editor( lr_button ).
Now, you have created your own button, created a user defined function for the ALV and set this button as editor for the function. And using the set_function_std method, we have just mapped the functionality of your new button to the existing export to excel functionality in ALV.
Hope this is what you are looking for.
Regards
Nithya
Maybe you are looking for
-
My macbook's display is Widescreen, so why not my display it on my TV?
I just got an Insignia 19" HDTV (LCD) and has good resolution, i'm going to it via mini-DVI to VGA adapter. The thing is, I can't get it to display widescreen on the HDTV. It is a perfectly square picture, I don't understand why. I try changing the s
-
Home Sharing from Mac mini not working to Apple TV anymore
Hi there, My Mac mini (2010 version) is being used as a home theatre. I have been able to connect to my Mac mini through the "Shared" tab in the Finder on my iMac and MacBook Pro along with my Apple TV through Home Sharing on iTunes, up until yesterd
-
Determining My screen size from preferences
Hi I am trying to determine what kind of screen size I have on my macbook pro from within the "about this computer" option in preferences. I know it sounds dumb and could just measure with a ruler ( which I did ) but it came up as 14 inches and there
-
Help - lost icons in finder window
Hi, Somehow i lost some icons, and i can't get them back. When I click on the HD icon, i get the finder window. Listed are: network, MacHD - a line, then: Desktop, User Icon, Applications, Pictures, and Favorites. I almost positive I also had a Music
-
Is there any additional charges texting a person in Canada if I have unlimited texting?
Hey everyone, I have a phone plan with unlimited texting, and I feel if I contact Verizon they're just gonna give me a super confusing answer. I was wondering if it cost any extra money to text a person's phone in Canada if I live in the United State