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,
Tabraiz
EXPORT (OBJ_TAB) TO MEMORY ID 'ABCD'
also refer to
http://help.sap.com/saphelp_45b/helpdata/en/34/8e73a36df74873e10000009b38f9b8/content.htm
Similar Messages
-
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 -
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 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 -
Internal table in shared memory
I'm using an internal table in a shared memory area. Depending on the existance of rows i would like to modify these rows or appending new rows.
So i need read and write access.
I tried to use attach_for_write( ) but after that i cannot read the table, sy-subrc is always 4.
So i tried to read the table with attach_for_read( ) first. I can read it, and the result is now sy-subrc = 0.
But after attaching the table via attach_for_write i'm unable to modify the table, how can i do this?myshmhandle = zca_shm_repstat_area=>attach_for_update( ).
CREATE OBJECT myroot AREA HANDLE myshmhandle.
read table myshmhandle->root->it_stat with key mandt = sy-mandt report = sy-repid
ASSIGNING <p>.
if sy-subrc = 0.
<p>-freq = wa_stat-freq + 1.
<p>-ldate = sy-datum.
<p>-ltime = sy-uzeit.
<p>-userid = sy-uname.
ins = abap_false.
else.
wa_stat-mandt = sy-mandt.
wa_stat-report = sy-repid.
wa_stat-freq = 1.
wa_stat-ldate = sy-datum.
wa_stat-ltime = sy-uzeit.
wa_stat-userid = sy-uname.
ins = abap_true.
append wa_stat to myroot->it_stat.
endif.
myshmhandle->set_root( myroot ).
myshmhandle->detach_commit( ).
Running the first time, everyting is ok. Running the second time the read will give back sy-subrc = 0 and <p> contains the correct values. after running to the end the table has no rows at all and is inconsitent I cant see what i'm doing wrong. -
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 XML in Background
Hi
I need to export a internal table into xml file in background using open dataset. The file is getting created but i am not able to open the file using IE/XML editor . When i open the file uisng wordpad i can see some charcters at the end of file which prevents it from opening in xml editor. if i delete the characters(box like) and save the file. i am able to open the file
When i downalod the same internal table via frontend using ws_downlod it works pefectly. no junk charcters are appended in the end. and hence files opens perfectly
below is the extract of program
START-OF-SELECTION.
PERFORM get_data.
PERFORM create_xml.
FORM get_data.
REFRESH accesos.
CLEAR accesos.
MOVE: '45050' TO accesos-socio-numero,
'MOISES MORENO' TO accesos-socio-nombre,
'0' TO accesos-socio-reposicion.
APPEND accesos.
ENDFORM.
i am using the following function modules
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
name = 'ACCESOS'
dataobject = accesos[]
IMPORTING
data_as_dom = l_dom
CHANGING
document = m_document
EXCEPTIONS
illegal_name = 1
OTHERS = 2.
CHECK NOT l_dom IS INITIAL.
w_rc = m_document->append_child( new_child = l_dom ).
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
document = m_document
IMPORTING
xml_as_string = w_string
size = w_size
TABLES
xml_as_table = it_xml
EXCEPTIONS
no_document = 1
OTHERS = 2.
LOOP AT it_xml INTO xml_tab-d.
APPEND xml_tab.
ENDLOOP.
The following syntax for open datset which does not work
lv_physcial_file = '
hdat03\test.xml'.
OPEN DATASET lv_physcial_file IN BINARY MODE FOR OUTPUT MESSAGE l_msg.
LOOP AT xml_tab.
TRANSFER xml_tab TO lv_physcial_file.
ENDLOOP.
The ws_download function works
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
many thnaksHi Chetan,
Can you just try changing the syntax to the following, I not sure if that will help but just try and see.
OPEN DATASET lv_physcial_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
Regards
Mohamed -
EXPORT / IMPORT TO/FROM SHARED BUFFER
Hello all,
I am facing a problem with the EXPORT/IMPORT to SHARED BUFFER statements.
In my report program , I export data to the shared memory.
I then call a transaction to park an accouting document.
The BTE 2218 gets triggered in the process. Here the IMPORT works fine.
Later, there is a standard function module which is called IN UPDATE TASK.
Within this, the IMPORT statement fails.
It works on one server but not on another.
Notes :
The IMPORT works in debugging mode but fails if I simply run.
Another point is that the ID used for identifying the shared memory uses sy-uname.
Can the visiblity of sy-uname in UPDATE TASK be controlled by settings ?
Any ideas on this ?
Please don't copy paste the help on SHARED BUFFER etc.
Thanks in advance.Hi Mariano,
the issue is to due to multiple servers present where SHARED MEMORY is specific for each application server.
So we export data into shared memory in program A, we have to be sure, that program B or FM which is called in background or update task by program A runs on the same application server
Here, the problem is when program A calls the program B or FM in background or update it’s a dynamic scheduling to all application server with have batch work processes and not the same application server that of calling program A always, so program B runs on another application server which has different shared memory.
Solution will be:-
To Force program B to run on same application server as of calling program A by
passing sy-host of calling program A to Function module “JOB_CLOSE” parameter
name “TARGETSERVER”. OR
Instead of using SHARED MEMORY we will use DATABASE.
EXPORT itab FROM itab TO DATABASE indx(ar) CLIENT sy-mandt ID job_number in programA where job number is unique.
Then IMPORT itab TO itab FROM database indx(ar) CLIENT sy-mandt ID job_number in program B Where job number is passed from program A to B.
Then DELETE FROM DATABASE indx(ar) CLIENT sy-mandt ID job_number.
Regards,
Vignesh Yeram -
Export Internal table by calling static method
Hi friends,
Can u please tell me how to get internal table in export parameter by calling static method.
OR can u tell me how to declare internal table in method parameter.
Thanks in advanceRaja's method will work for all tables irrespective of the structure and is the best possible approach. However, if your requirement is simple and you do not have to deal with a lot many tables,
1. Create a Type-Pool, suppose ztypl
2. Within the type pool, declare a Structure type,
TYPES: BEGIN OF ztypl_struct1,
"Place your fields here
END OF ztypl_strict1,
"Create a table of type ztypl_struct1 here
ztypl_table1 TYPE TABLE OF ztypl_struct1.
Use "ZTYPL_TABLE1" as the "Associated type" in your method's Parameter definition in SE24.
eg.
IT_TABLE TYPE ZTYPL_TABLE1
If you are writing your class in an include,
METHODS my_method1
IMPORTING
it_table1 TYPE ztypl_table1.
Do remember to include
TYPE-POOLS: ztypl.
in your class's Constructor / Include program.
Please award points if helpful.
Regards,
Ryan
Message was edited by:
Ryan Cannel -
Export internal table from report to web-dynpro
Hi,
I am trying to export an internal table from a report to my web dynpro pragram however its not working.
Statement used in my report -
EXPORT it_ordbk FROM it_ordbk TO MEMORY ID 'ZORDBK'.
Statement used in my web dynpro program
IMPORT it_ordbk to it_ordbk FROM MEMORY ID 'ZORDBK'.
This dynpro application is being called in HTML container on the screen.
Kindly help.
Cordially,
DanishHi Danish,
do not use export or import in Webdynpro.
try to create a class with global variables and in the report or at the place of Export fille the data .
and next in the place of Import memory to to call the global variable in the webdynpro and fill the internal table
go to se24> create a zclasss-> methods initialize>create a ztable same as export table and also declare in glaobal vairaible
--> next in the webdynpro program -->call the method retrive and push the global data to internal table.
Prabhudas -
Exporting internal table to memory variable
I need to extract some data within a program into an internal table. Then I need to export the internal table into a memory variable
Then in another program i need to import this memory variable into another internal table
How to do the import export into a memory variableSee the simple example :
REPORT ZTEST_AMEM1.
tables : lfa1.
data : begin of i_lfa1 occurs 0 ,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
end of i_lfa1.
start-of-selection.
select lifnr
name1
land1 from lfa1
into table i_lfa1 up to 100 rows.
Export
export i_lfa1 to memory id 'SAP'.
submit ztest_amem2 and return.
write:/ 'hello'.
*& Report ZTEST_AMEM2
REPORT ZTEST_AMEM2.
data : begin of j_lfa1 occurs 0,
lifnr like lfa1-lifnr,
name1 like lfa1-name1,
land1 like lfa1-land1,
end of j_lfa1.
start-of-selection.
import i_lfa1 to j_lfa1 from memory id 'SAP'.
loop at j_lfa1.
write:/ j_lfa1-lifnr,j_lfa1-name1,j_lfa1-land1.
endloop. -
Problem in exporting internal table to memory
Hi,
I have to export two internal tables (thead and titem) from a report (RFTBCF00) to memory which i will import in my function module can anyone letme know hw it cud b done .
Points will b assigned
Thnx,You can take the help of this example:
report z_82235_test1 .
types: begin of tab1,
a(1),
b(1),
end of tab1.
types: begin of tab2,
c(1),
d(1),
end of tab2.
data: itab1 type table of tab1,
wa1 like line of itab1,
itab2 type table of tab2,
wa2 like line of itab2.
wa1-a = '1'.
wa1-b = '2'.
append wa1 to itab1.
clear wa1.
wa1-a = '3'.
wa1-b = '4'.
append wa1 to itab1.
clear wa1.
export itab1 to memory id '001'.
export itab2 to memory id '002'.
submit z_82235_test2 and return exporting list to memory .
Maybe you are looking for
-
What's the point in buying a new MacBook?
Hi all, Recently I went with my iBook G4 to the Apple store to troubleshoot a small problem, but they were unable to help me as after only 7 years, the machine was rendered obsolete and they didn't feel obliged to help. My iBook recently died and I f
-
Oracle transaction runs a long time
Hi, we work with transactions(Oracle 8.1.7). User A performs long-time action and he changes the records in database by starting transaction. When user B wants to change the record, which was already changed by user A, it occurs following: user B can
-
NEED URGENT HELP! HP-eprint
i cannot acivate hp-eprint after reinstallation!! i use e-print from my phone every day in work and this is not good! when i try to activate i get message "we could not reach the server please try again" but if i try again i get the same message! it
-
Unable to publish - Unable to find ejb-jar with uri itr-ejbs.jar in ear
I'm using Weblogic 10.3.4 with Eclipse Juno before i was with Eclipse Galileo. Since the update i'm not able to publish my ear anymore. I search on the internet the explanation of this stacktrace but i don't find a understandable answer so i ask to y
-
How to change the maximum number of process per user in BW ?
Hi, Do you know how to change the maximum number of process allowed per user ? With RSRT we can customize the number of process per query but I don't know where we can customize the maximum number of process per user. In fact, my production environme