Download with comma seperator
I hav an internal table . I want to download the data using GUI_DOWNLOAD with comma seperator. But condition is condition is i hav to convert the data into CSV format and then download.
How can i do this and send me th coding for example
For comma separation ,
report zcsv.
data: lt_poll type table of ypoll.
data: ls_poll type ypoll.
Changes made here
types: begin of ty_singlerow,
rowdata type string,
end of ty_singlerow.
data: lt_singlerow type table of ty_singlerow.
data: ls_singlerow type ty_singlerow.
Changes ends here
select *
from ypoll
into table lt_poll.
Changes made here
loop at lt_poll into ls_poll.
concatenate ls_poll-mandt
ls_poll-POLLID
ls_poll-TEAM
ls_poll-INITIATOR
ls_poll-DESCRIPTION
ls_poll-APPROVED
ls_poll-INITIATED_DATE
ls_poll-END_DATE
ls_poll-WINNER
into ls_singlerow-rowdata
separated by ','.
append ls_singlerow to lt_singlerow.
clear ls_singlerow.
endloop.
Changes ends here
call method cl_gui_frontend_services=>gui_download
exporting
BIN_FILESIZE =
filename = 'RESULTS_POLL.txt'
FILETYPE = 'ASC'
APPEND = SPACE
WRITE_FIELD_SEPARATOR = SPACE
HEADER = '00'
TRUNC_TRAILING_BLANKS = SPACE
WRITE_LF = 'X'
COL_SELECT = SPACE
COL_SELECT_MASK = SPACE
DAT_MODE = SPACE
CONFIRM_OVERWRITE = SPACE
NO_AUTH_CHECK = SPACE
CODEPAGE = SPACE
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = SPACE
TRUNC_TRAILING_BLANKS_EOL = 'X'
IMPORTING
FILELENGTH =
changing
data_tab = lt_singlerow
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
NOT_SUPPORTED_BY_GUI = 22
ERROR_NO_GUI = 23
others = 24
if sy-subrc <> 0.
write 'Unsuccessful'.
endif.
Similar Messages
-
How to seperate the data with comma seperator ??
Hi,
How to seperate the data with comma seperator ??
E.g i havea row like
Userid,number of days,Total Records
user1,10,100000
So,i will get 10,10000 in the same field and i need to seperate 10 and 10000 so what is the abap function for that
Prafflike this ...
SPLIT field AT ',' INTO
userid
days
records.
is this what you need?
Mike -
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.....:-) -
Mapping a column with comma seperated values
Hi,
I have two tables
1. Tasks (task_id, task_description)
2. Task_assignment (username, task_assignment_value)
the task_assignment_value has a comma seperated list of task_ids.
What is the best ways to map the tables ?
Thanks in advance.
Moinuddin MohammedI have a couple of attributes where I do this. From TopLink's perspective, I just map it as a String. Then, in my accessors for the attribute, I transform the primitive between the String and an Array or however the rest of the app wants to see the attribute.
Here's an example that's actually more complicated than absolutely necessary. The mapped attributed is indicatorValueListString. It is lazily converted to an Array of Enums when it is first accessed. And it is converted back to a String in the preWriteEventCallback that is mapped in the TopLink descriptor.
This implementation attempts to minimize the number of times the String<->Array conversion takes place, but if that's not a concern, it could be made much more simple. Also, at my company we privately manage collections with the Collection classes for dynamic allocation, but publicly exchange Arrays for type-safety. This could also be factored out. ValuedEnumUtils basically manages asking the enum for its delimiter and performing the actual conversion between a String and an Array or back.
private String indicatorValueListString;
private List indicatorValueSelections;
private List indicatorValueSelections() {
if (indicatorValueSelections == null) {
indicatorValueSelections = new ArrayList();
if (indicatorValueListString != null) {
indicatorValueSelections =
java.util.Arrays.asList(ValuedEnumUtils.decodeEnumString(
IndicatorValueEnum.class,indicatorValueListString));
return indicatorValueSelections;
private void indicatorValueSelections(List newIndicatorValueSelections) {
indicatorValueSelections = newIndicatorValueSelections;
public IndicatorValueEnum[] getIndicatorValueSelections() {
return (IndicatorValueEnum[])indicatorValueSelections().toArray(new IndicatorValueEnum[0]);
public void setIndicatorValueSelections(IndicatorValueEnum[] newIvSelections) {
indicatorValueSelections(java.util.Arrays.asList(newIvSelections));
public boolean addIndicatorValueSelection(IndicatorValueEnum anIvEnum) {
return indicatorValueSelections().add(anIvEnum);
public boolean removeIndicatorValueSelection(IndicatorValueEnum anIvEnum) {
return indicatorValueSelections().remove(anIvEnum);
public void preWriteEventCallback(DescriptorEvent aDescriptorEvent) {
// Note: Not using accessor to avoid lazy initialization if no changes
// are necessary.
if (indicatorValueSelections != null) {
indicatorValueListString =
ValuedEnumUtils.encodeEnumString((ValuedEnum[])indicatorValueSelections.toArray());
} -
Need help with complex query with comma seperated
Oracle version - 11.1.0.7.0
Consider there are two tables table1 and table2
Key---- ID
A ---- 1
A ---- 2
A---- 3
B ---- 4
B ---- 5
C ---- 6
C ---- 8
C ---- 9
C ---- 10
D ---- 11
D ---- 12
Table2
ID
1
2
6
8
11
12
I need result as in usedID column I should get comma seperated list of ID which are in table1 and table2 and in NOTUSEDID comma seperated list of ID which are in table1 but not in table2
Key---- USEDID---- NOTUSEDID
A ---- 1,2 ---- 3
B ---- null ---- 4,5
C ---- 6,8 ---- 9,10
D ---- 11,12 ---- nullHi!
Solution for Oracle 11g:
SELECT A.KEY,
listagg(decode(b.id, null, null, a.id), ',') WITHIN GROUP (ORDER BY A.ID) AS USEDID,
listagg(decode(b.id, null, a.id), ',') WITHIN GROUP (ORDER BY A.ID) AS NOTUSEDID
FROM TABLE1 A
LEFT OUTER JOIN table2 b
ON (A.ID = b.ID)
GROUP BY a.key;
Solution for databases prior to Oracle 11g:
Please note that the function wm_concat is undocumented and can't be sorted!
SELECT A.KEY,
wm_concat(decode(b.id, null, null, a.id)) AS USEDID,
wm_concat(decode(b.id, null, a.id)) AS NOTUSEDID
FROM TABLE1 A
LEFT OUTER JOIN table2 b
ON (A.ID = b.ID)
GROUP BY A.KEY;I used the following test case:
create table table1(key varchar2(255), id number);
CREATE TABLE table2(ID NUMBER);
insert into table1 values('A', 1);
INSERT INTO table1 VALUES('A', 2);
INSERT INTO table1 values('A', 3);
INSERT INTO table1 VALUES('B', 4);
INSERT INTO table1 VALUES('B', 5);
INSERT INTO table1 VALUES('C', 6);
INSERT INTO table1 values('C', 8);
INSERT INTO table1 VALUES('C', 9);
INSERT INTO table1 VALUES('C', 10);
INSERT INTO table1 values('D', 11);
insert into table1 values('D', 12);
insert into table2 values(1);
insert into table2 values(2);
insert into table2 values(6);
insert into table2 values(8);
insert into table2 values(11);
insert into table2 values(12);
commit;Best regards,
Matt
Edited by: Matt Schulz on Oct 12, 2011 12:43 PM -
Rows into single column with comma seperator
Hi Friends,
I have the following Query
select A.tradeid||','||A.TICKER||'|'||A.SUBORDINATION||'|'||A.CUSIP||'|'||A.DOCCLAUSE||'|'||A.CURRENCY from table A
where A.ticker in ('LYME','GAADF') and A.tradeid in('456777')
which is returning
456777,LYME|SENIOR UNSECURED|Z1700990|MM|USD
456777,GAADF|SENIOR UNSECURED|Z1246790|MM|USD
I want the result set as:
456777,LYME|SENIOR UNSECURED|Z1700990|MM|USD,456777,GAADF|SENIOR UNSECURED|Z1246790|MM|USD
Please help me to get the result set
Thanks,
ragu.
Edited by: user533548 on Apr 3, 2009 12:54 AM
Edited by: user533548 on Apr 3, 2009 12:55 AMyou could do
select max (ltrim (sys_connect_by_path (tradeid||'|'||TICKER||'|'||SUBORDINATION||'|'||CUSIP||'|'||DOCCLAUSE||'|'||CURRENCY, ','), ','))
from (
select tradeid
, ticker
, subordination
, cusip
, docclause
, currency
, row_number() over (partition by tradeid
order by null
) rn
from x)
start with rn = 1
connect by rn = prior rn + 1like in
SQL> with x as
2 (
3 select 456777 tradeid ,'LYOE' ticker ,'SENIOR UNSECURED' subordination,'Z1830990' cusip,'MM' docclause,'USD' currency from dual union all
4 select 456777 tradeid ,'GAZDF','SENIOR UNSECURED','Z8446790','MM','USD' from dual
5 )
6 select max (
7 ltrim
8 (sys_connect_by_path (tradeid||'|'||TICKER||'|'||SUBORDINATION||'|'||CUSIP||'|'||DOCCLAUSE||'|'||CURRENCY
9 , ',')
10 , ',')) str
11 from (
12 select tradeid
13 , ticker
14 , subordination
15 , cusip
16 , docclause
17 , currency
18 , row_number() over (partition by tradeid
19 order by null
20 ) rn
21 from x)
22 start with rn = 1
23 connect by rn = prior rn + 1
24
SQL> /
STR
456777|GAZDF|SENIOR UNSECURED|Z8446790|MM|USD,456777|LYOE|SENIOR UNSECURED|Z1830990|MM|USD -
Splitting comma seperated column data into multiple rows
Hi Gurus,
Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
Below is the example:
Source Data:
Product Size Stock
ABC X,XL,XXL,M,L,S 1,2,3,4,5,6
Target Data:
Product Size Stock
ABC X 1
ABC XL 2
ABC XXL 3
ABC M 4
ABC L 5
ABC S 6
Which transformation we need to use for getting this output?
Thanks in advance !Hello,
Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
Thanks -
Count the number of elements in comma seperated list of values
Hello Friends,
I have a string with comma seperated list of values say
String v = 34343,erere,ererere,sdfsdfsdfs,4454,5454,dsfsdfsfsd,fsdfsdfsdfs,dfdsfsdfsdfs,sdsfdsf,ererdsdsd45454,fsdfsdfs
Want to count how many elements are existing in this string .
Thanks/KumarHi, Kumar,
REGEXP_COUNT, which Hoek used, is handy, but it only works in Oracle 11. Which version of Oracle are you using?
In any version of Oracle, you can count the commas by seeing how much the string shrinks when you remove them.
LENGTH (str) + 1 - LENGTH (REPLACE (str, ',')) Can str have multiple commas in a row? What if there's nothing between consecutive commas, or nothing by whitespace? Can str begin or end with a comma? Can str consist of nothing but commas? Depending on your answers, you may have to change things. You might want
REGEXP_COUNT ( str
, '[^,]+'
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
Hello,
I want to create stored procedure which will give output rows from "values that are passed as one parameter (comma seperated) to store procedure".
Suppose ,
Parameter value : person 1,person2,person3
table structure :
Project Name | officers 1 | officers 2
here, officers 1 or officers 2 may contain names of multiple people.
expected OUTPUT : distinct list(rows) of projects where person 1 or person 2 or person 3 is either officer1 or officer 2.
please explain or provide solution in detail
- ThanksHi Visakh,
Thanks for reply.
But the solution you provided giving me right output only if officer 1 or officer 2 contains single value , not with comma seperated value.
Your solution is working fine for following scenario :
Project
Officers 1
Officers 2
p1
of11
off21
p2
of12
off22
with parameter : of11,off22 : it will give expected output
And its not working in case of :
Project
Officers 1
Officers 2
p1
of11,of12
off21,off23
p2
of12,of13
off22,off24
with parameter : of11,off22 : it will not give any row in output
I need patten matching not exact match :)
ok
if thats the case use this modified logic
CREATE PROC GetProjectDetails
@PersonList varchar(5000)
AS
SELECT p.*
FROM ProjectTable p
INNER JOIN dbo.ParseValues(@PersonList,',')f
ON ',' + p.[officers 1] + ',' LIKE '%,' + f.val + ',%'
OR ',' + p.[officers 2] + ',' LIKE '%,' + f.val + ',%'
GO
Keep in mind that what you've done is a wrong design approach
You should not be storing multiples values like this as comma separated list in a single column. Learn about normalization . This is in violation of 1st Normal Form
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Comma seperated Column, to get details?
how to do, when Table1 has Column with comma seperated IDs, details are in the Table2.
Table 1
ID Col2
1 10,12
2 18,12
3 5,3
4 10
Table 2
col1 col2
3 new
5 old
10 semi
12 mild
18 very mild
a query/pl sql to get the results in:
Results:
ID Col2
1 10
1 12
2 18
2 12
3 5
3 3
4 10but fails if the column has more number of seperated valuesWhat do you mean? Do you get an error? Or the wrong results?
This works for me on 10gXE:
BANNER
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SQL> drop table t;
Table dropped.
SQL> create table t as
2 select 1 id, '12,13' col from dual union
3 select 2 id, '10,11,12,13' col from dual union
4 select 3 id, '1,2' col from dual union
5 select 4 id, '12,13,14,15' col from dual union
6 select 5 id, '1,2,3,4,5,6,7,8' col from dual union
7 select 6 id, '1' col from dual union
8 select 7 id, '100,101,102' col from dual union
9 select 8 id, '21,22,23,24,25,26,27,28,29,30,31' col from dual;
Table created.
SQL> select id
2 , column_value
3 from ( select id
4 , ','||col||',' col
5 from t
6 )
7 , table(cast(multiset(select substr( col
8 , instr (col, ',', 1, level ) + 1
9 , instr (col, ',', 1, level+1) - instr (col, ',', 1, level) -1
10 )
11 from dual
12 connect by level <= length(col)-length(replace(col,',',''))-1
13 )
14 as sys.odcinumberlist
15 )
16 );
ID COLUMN_VALUE
1 12
1 13
2 10
2 11
2 12
2 13
3 1
3 2
4 12
4 13
4 14
4 15
5 1
5 2
5 3
5 4
5 5
5 6
5 7
5 8
6 1
7 100
7 101
7 102
8 21
8 22
8 23
8 24
8 25
8 26
8 27
8 28
8 29
8 30
8 31
35 rows selected. -
How to store Comma Seperated Value in a File with Jsp
Hai friends,
I need to get all the filed values like Empname,salary ,location..........
and at the end of jsp page i have to put a browse button when i choose a file using theis browse button the total content in the form shoud store in that file as comma seperated values.1. Create JSP
2. When you click the button call the event that saves the data in CSV format
Your question is so broad, I don't have exact answer for you.
What have you done so far?
The man with blues. -
Download report from answers in CSV( Comma seperated)
Hi
I am trying to download the report from answers in .csv format
the . csv file is tab seperated
But the requirement is to have comma seperated
Is there any option in obiee to change the delimiter as comma
Kindly help me
Regards
AbdulThanks for the link. But I am not sure of which file to edit.
Can u please tell the exact file where to change
I am using obiee 10g
Regards
Abdul -
How to pass values with comma to comma seperated param in sp
hi all,
i have one sp which has param name as cordinatorname varchar(max)
in where condition of my sp i passed as
coordinator=(coordinatorname in (select ltrim(rtrim(value)) from dbo.fnSPLIT(@coordinatorname,',')))
but now my promblm is for @coordinatorname i have values as 'coorcinator1', 'coordinato2,inc'
so when my ssrs report taking these values as multiselect, comma seperated coordinator2,inc also has comma already
how to get this solved. please help me..
luckyIn the SSRS report, on the parameters tab of the query definition, set the parameter value to
=join(Parameters!<your param name>.Value,",")
In your query, you can then reference the value like so:
where yourColumn in (@<your param name>)
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Search a text in a text file.Each text is seperated with comma
hi all
I am working on a log search application project.the project comprise of when a user selects from the page either IP,UserID,Website and clicks on the submit button.the next page generates result in the format that this particular user has visited this particular website with this IP on particular date.
I have been provided with the text file and its nomenculture of the file.each word in the file is separated with comma.
so any one can help me with how to search a word in that text file when every data is separated with comma operator.
Isatish_dhn wrote:
hi allHi.
satish_dhn wrote:
I am working on a log search application project.the project comprise of when a user selects from the page either IP,UserID,Website and clicks on the submit button.the next page generates result in the format that this particular user has visited this particular website with this IP on particular date.
I have been provided with the text file and its nomenculture_ of the file.each word in the file is separated with comma.; )
It's nomenclature.
satish_dhn wrote:
so any one can help me with how to search a word in that text file when every data is separated with comma operator.
IYes, use a CSV parser to read these files: [http://ostermiller.org/utils/CSV.html] -
Infospoke flat file with tab seperator
Hello,
I have a infospoke which creates a flat file with comma field separator. I would like to have tab character as a field seperator. How would I change it.Varun,
as Ram told you can give ',' as Separator.
all the best.
Reagrds,
Nagesh Ganisetti.
Maybe you are looking for
-
All, I am evaluating JBI. I understand that the WSDL 2.0 implementation is based on a draft and not on the final version therefore I decided to revert to WSDL 1.1. My problem is in com.sun.jbi.messaging.util.WSDLHelper#getOperationsForService11(Docum
-
Executing JavaScript Embeded in a Servlet From another Window
I'm trying to access an object in a Servlet page from another window in a frameset. I'm getting an Access denied Error. Can anyone help? Very Urgent..
-
Canon Pixma MP800 gone after update driver
After speaking to Apple yesterday about a separate matter, I was talking to the tech support guy about not being able to scan wireless on my Canon MP800 but that I can print wirelessly. The printer not technically a wireless printer, but is found on
-
Sorting Entries by Date Entered
Can Address Book cards be sorted? I can see a (entered) date but need to sort by the most recently added and can't figure out how. The entry date is grayed out and doesn't seem to be a field that can be slected or sorted. There must be a waya to see
-
Windows 7 drivers HP Pavilion 15-b101sd
I've upgraded my system from Windows 8 to 7 but now I miss several drivers, among which the card reader and ethernet card. Does anyone has an idea where to get these? This question was solved. View Solution.