Wirte the content of an internal table into a text file
Hello Experts,
how can I wirte the content of an internal table into a text file and putit on my local
desktop ?
Regards
ertas
Hi,
You can use the FM GUI_DOWNLOAD for this purpose.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'c:\testmmv.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = LT_STR
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
Implement suitable error handling here
ENDIF.
With regards,
Vamsi
Similar Messages
-
Download Internal Table into a Text File in BSP?
I have an internal table which i need to download into my local pc. I know i can not use FM gui_download. Could some one please post code on how to download the internal table into a text file in BSP. Also i am not sure if i can use save dialog FM. Also need suggestion on which FM to use for save dialog which tells where to save the file.
Any help will be appreciated.
Thanks
NahmanThis might be a good starting point.
<a href="/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table">/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table</a> -
How to download values in an internal table into an excel file
is there any fn module to download the values in an internal table into an excel file..
hi
the function module "GUI_DOWNLOAD" downloads the data from
an internal table into a file (can be xl, dat ,doc etc) .
Plz follow the usage below ;
Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.
Data : lv_filename TYPE STRING.
lv_filename = pa_pfile.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = lv_filename
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = tb_download " table data to b downlaoded
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Pankaj -
The contents in a internal table
Hi Experts,
I have a doubt in filling the contents of an internal table with the database table fields reference.
For eg: There is an internal table like this:
data: begin of t_conditions occurs 0,
kschl like rv13a-kschl,
vkorg like komg-vkorg,
kunnr like komg-kunnr,
matnr like komg-matnr,
kbetr(15) type c,
datab(10) type c,
datbi(10) type c,
end of t_conditions.
in the above example, the "matnr" he has taken with the reference field "komg-matnr"..
Please look at the following internal table:
data: begin of t_material occurs 0,
matnr(18) type c,
matkl(9) type c,
bismt(18) type c,
end of t_material.
In the above 2 examples the declaration of "matnr" field is diffrent from one with the other.
in 1st eg., he has taken as: <b>matnr like komg-matnr</b>
where as in the 2nd eg: <b>matnr(18) type c,</b>
my question is: how can i know where to declare as in the 1st eg., and where to use like in the 2nd eg.,
Please clarify.
I greatly appreciate your help.
Thanks,Hi sey
If you see in the domain level both the DOMIAN's will be the same. So it doesn't matter. All the matnr will have a character type of size 18.
for the programmer reference they will using the table name in which they want to select the data.
i.e for the first ex. he will be selecting data from the KOMG table and in the second from the MARA table.
but both the Matnr type are same.
<b>there is a small change since the second ex doesn't use any table it is simply of type c. the difference is when you reference to any Data DICTIONARY object then it can contain certain conversion exits, etc. so it will apply for your reference data typr</b>
regards
kishore
Message was edited by: Harikishore Sreenivasulu -
How to drop the contents on an internal table?
Dear all,
can some one suggest me the code to drop the content of an internal table.
VJFollowing are the different ways of DELETIONS from ITAB, DTAB and FILE:
DELETE FROM dbtab WHERE cond.
DELETE FROM (dbtabname) WHERE cond.
- DELETE dbtab.
DELETE *dbtab.
DELETE (dbtabname) ... .
- DELETE dbtab FROM TABLE itab.
DELETE (dbtabname) FROM TABLE itab.
- DELETE dbtab VERSION vers.
DELETE *dbtab VERSION vers.
Delete from an internal table
- DELETE itab.
- DELETE itab INDEX idx.
- DELETE itab FROM idx1 TO idx2.
- DELETE itab WHERE cond.
- DELETE ADJACENT DUPLICATES FROM itab.
Delete a program
- DELETE REPORT prog.
Delete text elements
- DELETE TEXTPOOL prog LANGUAGE lg.
Delete a data cluster from a database table
- DELETE FROM DATABASE dbtab(ar) ...ID key.
Delete a data cluster from the cross-transaction application buffer
- DELETE FROM SHARED BUFFER dbtab(ar) ...ID key.
Delete a file
- DELETE DATASET dsn.
Delete a screen
- DELETE DYNPRO f.
Thanks,
Santosh -
How to extract the Html content of a UI Map into a text file or html file?
Hi,
Is there any possibility in OUAF or Java or from the Database, to retrieve the Html Content of a given a UI Map ?
If UI Map name is the input, then it should fetch the entire html portion of it into a text file. How to acheive this?
This needs to be done programatically either by writing some Java code or some SQL at the DB level?
Edited by: OATS Explorer on Dec 29, 2012 9:10 AMF1_MAP.HTML_DEFN would give the html contents and F1_SCHEMA.SCHEMA_DEFN would give you the UI Map's Schema.
SELECT map.map_cd
, map.html_defn
, sch.schema_defn
FROM f1_map map
, f1_schema sch
WHERE map.map_cd = sch.schema_name
AND sch.schema_type_flg = 'F1MP' -
Downloading two internal tables in same text file
I have one internal table as like below.
Data:begin of itab1 occurs 0,
rec(5),
end of itab1.
Itab1 is getting updated from input text file(Continuous text).
Here Itab1 contains one record with Indicator '01 and n number of records with indicator '02'.
This needs to be seperated in to two internal tables.
data:Begin of Itab_Head occurs 0,
Rec_ind(2) type C,
Name(3) type C,
end of itab_Head.
data:Begin of Itab_Item occurs 0,
Rec_ind(2) type C,
Id(3) type C,
Status(10,
end of itab_Item.
loop at itab1.
If itab1-Rec+0(2) = '01'.
Itab_Head-Rec_Ind = itab1-rec+0(2).
Itab_Head-Name = itab1-rec+2(3).
Append Itab_Head.
elseif itab1-rec+0(2) = '02'.
Itab_Item-Rec_Ind = itab1-rec+0(2).
Itab_Item-Id = itab1-rec+2(3).
Append Itab_Item.
endif.
endloop.
After moving to the internal tables I am doing some processing and updating the status of Itab_item.
After all these again I have to download the internal table as a text file.Now my question is.
I have values in 2 diff internal tables.How to download the two in same file.See this sample code.
data: itab1 type string occurs 0 with header line,
itab2 type string occurs 0 with header line.
itab1 = 'itab1_text'.
append itab1.
itab2 = 'itab2_text'.
append itab2.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
exporting
FILENAME = 'C:\ftext.txt'
APPEND = 'X'
changing
DATA_TAB = itab1[].
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
exporting
FILENAME = 'C:\ftext.txt'
APPEND = 'X'
changing
DATA_TAB = itab2[].
Svetlin -
Internal table to a text file in Unix
Hi ,
I was trying to download data from Internal table to a text file in Unix.
How do I do this?
One more thing is the fields on each record of the file should be delimited by the! (pipe) character.
Any one please me with the code.
Thankscheck these links...
ASCII value
ASCII value
Creating a Unix File
or do you mean application server?
then use open dataset. transfer and close dataset.
example:
DATA: e_file like rlgrap-filename value '/usr/sap/tmp/file.txt'.
open dataset e_file for output in text mode.
lOOP AT it_datatab......
transfer it_datatab to e_file.
ENDLOOP.
close dataset e_file.
regds,
kiran -
How to pass the contents of an internal table to the IDoc FIDCC2?
Hi,
I have an internal table. Using its contents, I have to create an Idoc and do GL posting.
I have to use FIDCC2 Idoc and the function module IDOC_INPUT_FIDCC2.
Can u please let me know how to pass the contents of the internal table into the idoc FIDCC2 and do the GL posting?
Regards,
Balaji. RHi balaji,
use function IDOC_INBOUND_FROM_FILE. This will do half the process.
Documentation is missing, but program RSEINB00 explains something,
also some links
[http://help.sap.com/saphelp_nw70/helpdata/EN/dc/6b7f1543d711d1893e0000e8323c4f/frameset.htm]
[RSEINB00 does not work in background]
[RSEINB00 flat file to idoc uploading in XI]
[Loading flat idoc via report RSEINB00 into integration server fails]
Hope it helps.
Regards,
Clemens -
Moving the data from multiple internal tables into a single one
Hello everyone,
I am creating a classical report which uses the following tables.
tables : ekko, ekpo, mara, makt,lfa1.
my input parameter is
Select-options Purchase Order number
Following fields are getting used.
Doc no EKKO-EBELN
Material EKPO-MATNR
Item number EKPO-EBELP
Quantity EKPO-MENGE
Material Group MARA-MATKL
Vendor EKKO-LIFNR
Old Material code MARA-BISMT
Material Desc. MAKT-MAKTX
Vendor name LFA1-NAME1
Now i need to do the following task.
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
3 Find out Old Material code of each and every material from Material master.
4 Find out Material description for each and every material from MAKT.
5 Sort record on Vendor, Purchase Order number and Material.
I have defined seperate internal tables for these operation.
Once i have fetched records into these individual internal tables from the corresponding DB tables i need to move these values into a new internal tables which has all the above fields mentioned
I need to move these values into a new internal table because to display the values on the report.
Any idea for the above ? Plz help with a sample example or some relevant.
Regards,
Ranjith NambiarHi
1 Select record from EKKO Using document number.
2 Select record from EKPO using EKKO record using Document no as key.
Use inner join and retrive data into one internal table.for Ex ITAB1
3 Find out Old Material code of each and every material from Material master.
Use ITAB1 with for allentries in MARA table to get the onl materil number populate in to one table.
4 Find out Material description for each and every material from MAKT.
Get the Material desc with the same manner as above,
5 Sort record on Vendor, Purchase Order number and Material.
now sort the ITAB1 as you req.
now Loop on the ITAB1.
and read above 2 tables for old matnr and matner deac and append into another table as you want.
Hope this will help.
Regards,
Hiren Patel -
To convert the row of an internal table into columns
Hi ,
I want to use the rows of a single column internal table itab1
to form another internal table itab2 with column names same as the rows of itab1 .
How is this possible?
Regards,
Harshit RungtaHi,
Check the link..[Convert Rows of internal table to Columns|http://docs.google.com/Doc?id=dfv2hmgs_5d6bcxqgp&hl=en] -
Writing the hashtable content (both keys and values) into a text file
Hello,
I have a hashtable which have some keys and respective values in it. Now I want to write all thoses content into a text or log file. Can anyone please tell me how to write it.
thanks,
chaitanyaProperties is a subclass of Hashtable. It'll probably work just fine as a drop-in replacement.
Otherwise...if all keys and values are text, then loop through the Entry objects in the Map in question (Hashtable is a Map, and you probably shouldn't be using Hashtable anyway), or loop through the keys and grab the corresponding value for the keys. Read the API docs for java.util.Map. It's pretty straightforward. -
Download chinese text from internal table to PC text file
Hi Experts,
Iam downloading internal table (which is having records in chinese text) on to PC file. But the iam not getting correct text in the pc file. Iam getting some garbage values text.
Iam using GUI_download FM to donwload the text.
Iam using internal table
Begin of itab occurs 0,
text type string,
end of itab.
and passing paramters.
Filename
codepage
table.
Can you please tell me how can I achive this and what are the parameter need to pass for this.
Thank In Advance.Hi,
You can use follwoing funtion modules instead of GUI_DOWNLOAD. It will be more easier.
SAP_CONVERT_TO_CSV_FORMAT
SAP_CONVERT_TO_TEX_FORMAT
SAP_CONVERT_TO_TXT_FORMAT
SAP_CONVERT_TO_XLS_FORMAT
SAP_CONVERT_TO_XML_FORMAT.
I hope this will help you out.
Help children of U.N World Food Program by rewarding points and encourage others to answer your queries. -
Downloading into a text file with comma seperation
hey experts,
well i want to download various fields of an internal table into a text file.but the hitch is that all the columns should be seperated by a comma.something like csv.
could you please help me with this.?
i have tried using gui download but the seperator field was not working.
thanks in advance...
regards,
sandra.hey sandra,
for comma seperation and downloading ,you can use the following fm.
here the i_field seperator should be given as "," as in ur case.
i_tab3 is the table from which the values are being fetched.
and i_tab2 is the table conatining the comma seperated values.
CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ','
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
TABLES
I_TAB_SAP_DATA = I_TAB3
CHANGING
I_TAB_CONVERTED_DATA = I_TAB2
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
after this u can use the gui download fm as required.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = TESTFILNA
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'x'
HEADER = '123'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = I_TAB2
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
hope this helps u.
do reward points if useful.....:-) -
How to pass a internal table into Java Bean
Hi Experts,
I created a JSPDyn page to display Sales orders form R/3 using bapi_sales_order_getlist.
I used JCO to establish connectivity between JSP Dynpage and R/3. I executed the bapi successfully, i want to move the sales orders retrieved from the Bapi to a Java Bean. So that i can use the bean to populate the value as a table.
with regards,
James.
Valuable answers will be rewarded.....Hi Bala,
If you want to pass this internal table between different methods of the same view then write the contents of this internal table to a context node of your view using BIND_TABLE. You can then read the contents of this internal table from the other method using the reference of that node & the GET_STATIC_ATTRIBUTES_TABLE method.
However if you want to pass the internal table between methods of different views then create a context node at the COMPONENTCONTROLLER level & then do a context mapping of this node to your local views context in both your views. You can follow the same BIND_TABLE & GET_STATIC_ATTRIBUTES_TABLE methods approach.
Regards,
Uday
Maybe you are looking for
-
HP Laserjet PRO M177fw - scan to PC
Dear HP, Since today we are the "happy" owner of the Laserjet PRO 177fw. We had before the HP 6600 but, unfortunately it didn't work anymore after 1 year and 8 weeks. (so no warranty) Since we are now the owner of the 177FW, I would really appreciate
-
Problem with RMI in ADB T75 receiver
Hi: I have a problem with an xlet that uses the RMI (IXC) API in the ADB T75 development settop box. I export an object (of type MyObject) implementing the Remote interface, and, later, I import it with no problem. The problem appears after importing
-
Help me match my wants/needs to a Droid, please.
I'll be eligible to buy a new phone in a month or so. Thought I'd better start figuring out what I want now. Here's how I currently use my phone and what (I think) I want my new phone to do. I currently have an LG enV Touch with mobile web. I use it
-
Dear Sirs, I hope to be directing my question into the correct forum's place. I'm new in flash and I'm trying to make some tests My problem is the following: I included one SWF file into 3 HTM pages. This SWF works as a little menu. The SWF file (nam
-
Hi, I have an iPhone 3G running OS 3 and I want to know how to update it to 3.2 instead of iOS 4.0.1 which is what iTunes immediately tries to do. Thanks in advance. Message was edited by: Iy42