Color in .CSV file
Hi,
How can we add color to header of .csv file which is to be sent to the unix server.
Currently iam using the following code:
open dataset l_direc for output in text mode encoding default.
if sy-subrc = 0.
loop at ifile.
transfer ifile to l_direc.
endloop.
endif.
close dataset l_direc.
where the first record in the internal table 'ifile' is the header record.
Please send your suggestions,
Swapna.
arun14 wrote:
Subject: Re: how to manipulate ,csv file using java
how to highlight a particular column in .csv file with a particular colorThere is no formatting information in a .csv file.
Similar Messages
-
How to add colors to a CSV file?
Hi there,
I'm exporting data to a CSV file using printWriter.
Question: is it possible to add colors, bold text or stretch the length of a column in the produced CSV file?
This, of course, should be the end result of the file (not do it when the file is open)
Thank you!xianwinwin wrote:
Question: is it possible to add colors, bold text or stretch the length of a column in the produced CSV file?Of course if you assumed that you'd be looking at the file with a fixed-width font, you could insert a bunch of tabs or spaces to get columns to match up, but I strongly advise you not do that. I think of CSV as a poor-man's excel data file or perhaps a flat database file, but most importantly it holds data in a standard format that can be read and manipulated by many different programs, including ones you write yourself. It is not meant to be for pretty visualization. Try to pretty it up and you possibly ruin it's main reason for existing. For nice visualization I'd create a small app that read the CSV, formatted it nicely and either displayed the data or stored it in some pretty format as a non-CSV file. -
Import *.csv file in phonebook form All-in-One HP Color LaserJet 2840.
We use a HP all-in-one printer ; HP-Color LaserJet 2840. I should like to use the faxing option of this all-in-one for faxing large numbers of faxes. In other words ; batch-faxing or mailing-faxes.
It is possible to use the phonebook option in the faxing part of the software that is installed together with the printer-tools ( dirigent). To enter a large number of customers it is possible to use a *.csv file to import the entries to the phonebook. I have made the *.csv file exactly the way suggested in the instruction; It is possible to export the customer entries from programs like Lotes Notes , Outlook , or Outlook Express. So I export it to a *.csv file in a dos-format as well as a windows-format. But everytime when i try to import the file in the HP-phonebook i receive the mention ;
> "An error has occurred , ...No valid directory entries in this file. Select a file with valid directory entries."
Who can help me out this issue.? Every suggestion is possible.
Another question ; is it possible to use the faxing option of the all-in-one printer for sending large numbers of faxes ? May , someone has experience ?
Thanks in advance !Drivers for the HP Color LaserJet 2800 Series are 16.4 and are included in 10.6.4.
Reset your printing system and see if your Mac can find the printer. -
How to extract data from an arbitrary xml file and export in a nice csv file?
Hallo,
I'm facing big problems in the use of XML files. I have an
application which generates XML files with clusters containing arrays
and scalars like in the example pasted below. My task is to
read it and export the data in a human-friendly CSV document.
Since I don't know the actual content of the cluster, I need some kind
of intelligent vi which goes through the XML file looking for arrays
and other data structures in order to export them properly in the CSV
format (columns with headers).
Thank you
<Cluster>
<Name></Name>
<NumElts>3</NumElts>
<Array>
<Name></Name>
<Dimsize>6</Dimsize>
<I32>
<Name></Name>
<Val>0</Val>
</I32>
<I32>
<Name></Name>
<Val>1</Val>
</I32>
<I32>
<Name></Name>
<Val>2</Val>
</I32>
<I32>
<Name></Name>
<Val>3</Val>
</I32>
<I32>
<Name></Name>
<Val>4</Val>
</I32>
<I32>
<Name></Name>
<Val>5</Val>
</I32>
</Array>
<DBL>
<Name></Name>
<Val>3.14159265358979</Val>
</DBL>
<String>
<Name></Name>
<Val>ciao</Val>
</String>
</Cluster>
Solved!
Go to Solution.Thank you again,
I'm forwarding my vi draft with many comments and an xml file sample.
Data in cluster is stored according to the LabVIEW schema, infact it is generated by LabVIEW.
What I'm trying to do is to access the element of the cluster and read their content using the Invoke node and Property node functions. Could you give it a look, there may be something wrong, I'm not able to access cluster children.
Which funcions should I use? Could you give me an example? You may use the draft I enclosed...
Then write these data in a csv file
should be the easier part.
BODY{font:x-small 'Verdana';margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}
<?xml
version="1.0" encoding="iso-8859-1" ?>
<Contents type="Data"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLSection.xsd">
<section name="beta"
date="7/31/2009" time="3:43:03 PM" version="1.0">
<Cluster>
<Name />
<NumElts>1</NumElts>
<Array>
<Name />
<Dimsize>4</Dimsize>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.93317638164326</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.79233924020314</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.39199947274518</Val>
</DBL>
<DBL>
<Name>number: 0 to 1</Name>
<Val>0.74817197429441</Val>
</DBL>
</Array>
</Cluster>
</section>
</Contents>
Attachments:
read_array.vi 12 KB -
Csv upload -- suggestion needed with non-English character in csv file
<p>Hi All,</p>
I have a process which uploads a csv file into a table. It works with the normal english characters. In case of non-English characters in the csv file it doesn't populate the actual columns.
My csv file content is
<p></p>First Name | Middle Name | Last Name
<p><span style="background-color: #FF0000">José</span> | # | Reema</p>
<p>Sam | # | Peter</p>
<p>Out put is coming like : (the last name is coming as blank )</p>
First Name | Middle Name | Last Name
<p><span style="background-color: #FF0000">Jos鬣</span> | Reema | <span style="background-color: #FF0000"> blank </span></p>
<p>Sam | # | Peter</p>
http://apex.oracle.com/pls/otn/f?p=53121:1
workspace- gil_dev
user- apex
password- apex12
Thanks for your help.
ManishManish,
PROCEDURE csv_to_array (
-- Utility to take a CSV string, parse it into a PL/SQL table
-- Note that it takes care of some elements optionally enclosed
-- by double-quotes.
p_csv_string IN VARCHAR2,
p_array OUT wwv_flow_global.vc_arr2,
p_separator IN VARCHAR2 := ';'
IS
l_start_separator PLS_INTEGER := 0;
l_stop_separator PLS_INTEGER := 0;
l_length PLS_INTEGER := 0;
l_idx BINARY_INTEGER := 0;
l_quote_enclosed BOOLEAN := FALSE;
l_offset PLS_INTEGER := 1;
BEGIN
l_length := NVL (LENGTH (p_csv_string), 0);
IF (l_length <= 0)
THEN
RETURN;
END IF;
LOOP
l_idx := l_idx + 1;
l_quote_enclosed := FALSE;
IF SUBSTR (p_csv_string, l_start_separator + 1, 1) = '"'
THEN
l_quote_enclosed := TRUE;
l_offset := 2;
l_stop_separator :=
INSTR (p_csv_string, '"', l_start_separator + l_offset, 1);
ELSE
l_offset := 1;
l_stop_separator :=
INSTR (p_csv_string,
p_separator,
l_start_separator + l_offset,
1
END IF;
IF l_stop_separator = 0
THEN
l_stop_separator := l_length + 1;
END IF;
p_array (l_idx) :=
(SUBSTR (p_csv_string,
l_start_separator + l_offset,
(l_stop_separator - l_start_separator - l_offset
EXIT WHEN l_stop_separator >= l_length;
IF l_quote_enclosed
THEN
l_stop_separator := l_stop_separator + 1;
END IF;
l_start_separator := l_stop_separator;
END LOOP;
END csv_to_array;and
PROCEDURE get_records (p_clob IN CLOB, p_records OUT varchar2_t)
IS
l_record_separator VARCHAR2 (2) := CHR (13) || CHR (10);
l_last INTEGER;
l_current INTEGER;
BEGIN
-- SIf HTMLDB has generated the file,
-- it will be a Unix text file. If user has manually created the file, it
-- will have DOS newlines.
-- If the file has a DOS newline (cr+lf), use that
-- If the file does not have a DOS newline, use a Unix newline (lf)
IF (NVL (DBMS_LOB.INSTR (p_clob, l_record_separator, 1, 1), 0) = 0)
THEN
l_record_separator := CHR (10);
END IF;
l_last := 1;
LOOP
l_current := DBMS_LOB.INSTR (p_clob, l_record_separator, l_last, 1);
EXIT WHEN (NVL (l_current, 0) = 0);
p_records (p_records.COUNT + 1) :=
REPLACE (DBMS_LOB.SUBSTR (p_clob, l_current - l_last, l_last),
l_last := l_current + LENGTH (l_record_separator);
END LOOP;
END get_records;Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Program to upload csv file to internal table and insert into database table
Hi I'm writing a program where I need to upload a csv file into an internal table using gui_upload, but i also need this program to insert the data into my custom database table using the split command. Anybody have any samples to help, its urgent!
Hi,
Check this table may be it will give u an hint...
REPORT z_table_upload LINE-SIZE 255.
Data
DATA: it_dd03p TYPE TABLE OF dd03p,
is_dd03p TYPE dd03p.
DATA: it_rdata TYPE TABLE OF text1024,
is_rdata TYPE text1024.
DATA: it_fields TYPE TABLE OF fieldname.
DATA: it_file TYPE REF TO data,
is_file TYPE REF TO data.
DATA: w_error TYPE text132.
Macros
DEFINE write_error.
concatenate 'Error: table'
p_table
&1
&2
into w_error
separated by space.
condense w_error.
write: / w_error.
stop.
END-OF-DEFINITION.
Field symbols
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
<data> TYPE ANY,
<fs> TYPE ANY.
Selection screen
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
PARAMETERS: p_file TYPE localfile DEFAULT 'C:\temp\' OBLIGATORY,
p_separ TYPE c DEFAULT ';' OBLIGATORY.
SELECTION-SCREEN: END OF BLOCK b01.
SELECTION-SCREEN: BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
PARAMETERS: p_table TYPE tabname OBLIGATORY
MEMORY ID dtb
MATCHCODE OBJECT dd_dbtb_16.
SELECTION-SCREEN: END OF BLOCK b02.
SELECTION-SCREEN: BEGIN OF BLOCK b03 WITH FRAME TITLE text-b03.
PARAMETERS: p_create TYPE c AS CHECKBOX.
SELECTION-SCREEN: END OF BLOCK b03,
SKIP.
SELECTION-SCREEN: BEGIN OF BLOCK b04 WITH FRAME TITLE text-b04.
PARAMETERS: p_nodb RADIOBUTTON GROUP g1 DEFAULT 'X'
USER-COMMAND rg1,
p_save RADIOBUTTON GROUP g1,
p_dele RADIOBUTTON GROUP g1.
SELECTION-SCREEN: SKIP.
PARAMETERS: p_test TYPE c AS CHECKBOX,
p_list TYPE c AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: END OF BLOCK b04.
At selection screen
AT SELECTION-SCREEN.
IF sy-ucomm = 'RG1'.
IF p_nodb IS INITIAL.
p_test = 'X'.
ENDIF.
ENDIF.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Start of selection
START-OF-SELECTION.
PERFORM f_table_definition USING p_table.
PERFORM f_upload_data USING p_file.
PERFORM f_prepare_table USING p_table.
PERFORM f_process_data.
IF p_nodb IS INITIAL.
PERFORM f_modify_table.
ENDIF.
IF p_list = 'X'.
PERFORM f_list_records.
ENDIF.
End of selection
END-OF-SELECTION.
FORM f_table_definition *
--> VALUE(IN_TABLE) *
FORM f_table_definition USING value(in_table).
DATA: l_tname TYPE tabname,
l_state TYPE ddgotstate,
l_dd02v TYPE dd02v.
l_tname = in_table.
CALL FUNCTION 'DDIF_TABL_GET'
EXPORTING
name = l_tname
IMPORTING
gotstate = l_state
dd02v_wa = l_dd02v
TABLES
dd03p_tab = it_dd03p
EXCEPTIONS
illegal_input = 1
OTHERS = 2.
IF l_state NE 'A'.
write_error 'does not exist or is not active' space.
ENDIF.
IF l_dd02v-tabclass NE 'TRANSP' AND
l_dd02v-tabclass NE 'CLUSTER'.
write_error 'is type' l_dd02v-tabclass.
ENDIF.
ENDFORM.
FORM f_prepare_table *
--> VALUE(IN_TABLE) *
FORM f_prepare_table USING value(in_table).
DATA: l_tname TYPE tabname,
lt_ftab TYPE lvc_t_fcat.
l_tname = in_table.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = l_tname
CHANGING
ct_fieldcat = lt_ftab
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
WRITE: / 'Error while building field catalog'.
STOP.
ENDIF.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_ftab
IMPORTING
ep_table = it_file.
ASSIGN it_file->* TO <table>.
CREATE DATA is_file LIKE LINE OF <table>.
ASSIGN is_file->* TO <data>.
ENDFORM.
FORM f_upload_data *
--> VALUE(IN_FILE) *
FORM f_upload_data USING value(in_file).
DATA: l_file TYPE string,
l_ltext TYPE string.
DATA: l_lengt TYPE i,
l_field TYPE fieldname.
DATA: l_missk TYPE c.
l_file = in_file.
l_lengt = strlen( in_file ).
FORMAT INTENSIFIED ON.
WRITE: / 'Reading file', in_file(l_lengt).
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'ASC'
TABLES
data_tab = it_rdata
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
WRITE: /3 'Error uploading', l_file.
STOP.
ENDIF.
File not empty
DESCRIBE TABLE it_rdata LINES sy-tmaxl.
IF sy-tmaxl = 0.
WRITE: /3 'File', l_file, 'is empty'.
STOP.
ELSE.
WRITE: '-', sy-tmaxl, 'rows read'.
ENDIF.
File header on first row
READ TABLE it_rdata INTO is_rdata INDEX 1.
l_ltext = is_rdata.
WHILE l_ltext CS p_separ.
SPLIT l_ltext AT p_separ INTO l_field l_ltext.
APPEND l_field TO it_fields.
ENDWHILE.
IF sy-subrc = 0.
l_field = l_ltext.
APPEND l_field TO it_fields.
ENDIF.
Check all key fields are present
SKIP.
FORMAT RESET.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Key fields'.
FORMAT RESET.
LOOP AT it_dd03p INTO is_dd03p WHERE NOT keyflag IS initial.
WRITE: /3 is_dd03p-fieldname.
READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
FORMAT COLOR COL_POSITIVE.
WRITE: 'ok'.
FORMAT RESET.
ELSEIF is_dd03p-datatype NE 'CLNT'.
FORMAT COLOR COL_NEGATIVE.
WRITE: 'error'.
FORMAT RESET.
l_missk = 'X'.
ENDIF.
ENDLOOP.
Log other fields
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Other fields'.
FORMAT RESET.
LOOP AT it_dd03p INTO is_dd03p WHERE keyflag IS initial.
WRITE: /3 is_dd03p-fieldname.
READ TABLE it_fields WITH KEY table_line = is_dd03p-fieldname
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
WRITE: 'X'.
ENDIF.
ENDLOOP.
Missing key field
IF l_missk = 'X'.
SKIP.
WRITE: /3 'Missing key fields - no further processing'.
STOP.
ENDIF.
ENDFORM.
FORM f_process_data *
FORM f_process_data.
DATA: l_ltext TYPE string,
l_stext TYPE text40,
l_field TYPE fieldname,
l_datat TYPE c.
LOOP AT it_rdata INTO is_rdata FROM 2.
l_ltext = is_rdata.
LOOP AT it_fields INTO l_field.
ASSIGN COMPONENT l_field OF STRUCTURE <data> TO <fs>.
IF sy-subrc = 0.
Field value comes from file, determine conversion
DESCRIBE FIELD <fs> TYPE l_datat.
CASE l_datat.
WHEN 'N'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
WRITE l_stext TO <fs> RIGHT-JUSTIFIED.
OVERLAY <fs> WITH '0000000000000000'. "max 16
WHEN 'P'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING ',.'.
<fs> = l_stext.
WHEN 'F'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING ',.'.
<fs> = l_stext.
WHEN 'D'.
SPLIT l_ltext AT p_separ INTO l_stext l_ltext.
TRANSLATE l_stext USING '/.-.'.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = l_stext
IMPORTING
date_internal = <fs>
EXCEPTIONS
OTHERS = 1.
WHEN 'T'.
CALL FUNCTION 'CONVERT_TIME_INPUT'
EXPORTING
input = l_stext
IMPORTING
output = <fs>
EXCEPTIONS
OTHERS = 1.
WHEN OTHERS.
SPLIT l_ltext AT p_separ INTO <fs> l_ltext.
ENDCASE.
ELSE.
SHIFT l_ltext UP TO p_separ.
SHIFT l_ltext.
ENDIF.
ENDLOOP.
IF NOT <data> IS INITIAL.
LOOP AT it_dd03p INTO is_dd03p WHERE datatype = 'CLNT'.
This field is mandant
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-mandt.
ENDLOOP.
IF p_create = 'X'.
IF is_dd03p-rollname = 'ERDAT'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-datum.
ENDIF.
IF is_dd03p-rollname = 'ERZET'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uzeit.
ENDIF.
IF is_dd03p-rollname = 'ERNAM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uname.
ENDIF.
ENDIF.
IF is_dd03p-rollname = 'AEDAT'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-datum.
ENDIF.
IF is_dd03p-rollname = 'AETIM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uzeit.
ENDIF.
IF is_dd03p-rollname = 'AENAM'.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data>
TO <fs>.
<fs> = sy-uname.
ENDIF.
APPEND <data> TO <table>.
ENDIF.
ENDLOOP.
ENDFORM.
FORM f_modify_table *
FORM f_modify_table.
SKIP.
IF p_save = 'X'.
MODIFY (p_table) FROM TABLE <table>.
ELSEIF p_dele = 'X'.
DELETE (p_table) FROM TABLE <table>.
ELSE.
EXIT.
ENDIF.
IF sy-subrc EQ 0.
FORMAT COLOR COL_POSITIVE.
IF p_save = 'X'.
WRITE: /3 'Modify table OK'.
ELSE.
WRITE: /3 'Delete table OK'.
ENDIF.
FORMAT RESET.
IF p_test IS INITIAL.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
WRITE: '- test only, no update'.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE.
WRITE: /3 'Error while modifying table'.
FORMAT RESET.
ENDIF.
ENDFORM.
FORM f_list_records *
FORM f_list_records.
DATA: l_tleng TYPE i,
l_lasti TYPE i,
l_offst TYPE i.
Output width
l_tleng = 1.
LOOP AT it_dd03p INTO is_dd03p.
l_tleng = l_tleng + is_dd03p-outputlen.
IF l_tleng LT sy-linsz.
l_lasti = sy-tabix.
l_tleng = l_tleng + 1.
ELSE.
l_tleng = l_tleng - is_dd03p-outputlen.
EXIT.
ENDIF.
ENDLOOP.
Output header
SKIP.
FORMAT COLOR COL_HEADING.
WRITE: /3 'Contents'.
FORMAT RESET.
ULINE AT /3(l_tleng).
Output records
LOOP AT <table> ASSIGNING <data>.
LOOP AT it_dd03p INTO is_dd03p FROM 1 TO l_lasti.
IF is_dd03p-position = 1.
WRITE: /3 sy-vline.
l_offst = 3.
ENDIF.
ASSIGN COMPONENT is_dd03p-fieldname OF STRUCTURE <data> TO <fs>.
l_offst = l_offst + 1.
IF is_dd03p-decimals LE 2.
WRITE: AT l_offst <fs>.
ELSE.
WRITE: AT l_offst <fs> DECIMALS 3.
ENDIF.
l_offst = l_offst + is_dd03p-outputlen.
WRITE: AT l_offst sy-vline.
ENDLOOP.
ENDLOOP.
Ouptut end
ULINE AT /3(l_tleng).
ENDFORM.
Regards,
Joy. -
Can u guys tell me steps/give sample code to upload a ZTABLE from a CSV file.
Iam not using all fields in the CSV file( if file have 5 fields,I am using 3 out of it) and also not all fields in the ZTABLE ( uploading 3 fields out of 7 fields)and some necessary validations.
Thnaks..HI,
Try this. We use this FM and it works quite well.
** internal table to receive stat key figures data from EXCEL
data: begin of intab01 occurs 0,
kostl(10) type n, " cost center number
lstar(10), " stat key figure code
per01(15), " period 01 value
per02(15), " period 02 value
per03(15), " period 03 value
per04(15), " period 04 value
per05(15), " period 05 value
per06(15), " period 06 value
per07(15), " period 07 value
per08(15), " period 08 value
per09(15), " period 09 value
per10(15), " period 10 value
per11(15), " period 11 value
per12(15), " period 12 value
end of intab01.
* Added Input Work Area
data: begin of in_wa,
kostl(10), " cost center number
lstar(10), " stat key figure code
per01(15), " period 01 value
per02(15), " period 02 value
per03(15), " period 03 value
per04(15), " period 04 value
per05(15), " period 05 value
per06(15), " period 06 value
per07(15), " period 07 value
per08(15), " period 08 value
per09(15), " period 09 value
per10(15), " period 10 value
per11(15), " period 11 value
per12(15), " period 12 value
end of in_wa.
data: w_index type i.
* FIELD SYMBOLS
field-symbols : <fs>.
* S E L E C T I O N S C R E E N F I E L D S
parameters: p_input like rlgrap-filename obligatory.
parameters: p_skp type n default 0.
** transfer data from EXCEL input file to internal table INTAB01
perform upload_excel.
form upload_excel.
* load plan data from EXCEL into table INTAB01 via function UPLOAD *
data : i_intern type alsmex_tabline occurs 0 with header line."BCT004
data : w_start_col type i value '1',
w_start_row type i value '1',
w_end_col type i value '18', "must = # of excel columns
w_end_row type i value '65536'.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE' "BCT004
exporting
filename = p_input
i_begin_col = w_start_col
i_begin_row = w_start_row
i_end_col = w_end_col
i_end_row = w_end_row
tables
intern = i_intern.
if i_intern[] is initial. " File empty SLG001
format color col_negative.
skip 1.
write: / 'There is a problem with'.
format color col_normal.
write: / p_input.
format color col_negative.
write: / 'Check the file and rerun'.
skip 2.
write: /15 '>>>>>>>> E N D O F P R O G R A M <<<<<<<<'.
stop.
endif.
* Begin SLG001
sort i_intern by row col.
loop at i_intern.
if i_intern-row <= p_skp.
continue.
endif.
move : i_intern-col to w_index.
if w_index <= 18. "Col 18-last data col
assign component w_index of structure in_wa to <fs>.
move : i_intern-value to <fs>.
endif.
at end of row.
move-corresponding in_wa to intab01.
shift intab01-per01 right deleting trailing ' '.
shift intab01-per02 right deleting trailing ' '.
shift intab01-per03 right deleting trailing ' '.
shift intab01-per04 right deleting trailing ' '.
shift intab01-per05 right deleting trailing ' '.
shift intab01-per06 right deleting trailing ' '.
shift intab01-per07 right deleting trailing ' '.
shift intab01-per08 right deleting trailing ' '.
shift intab01-per09 right deleting trailing ' '.
shift intab01-per10 right deleting trailing ' '.
shift intab01-per11 right deleting trailing ' '.
shift intab01-per12 right deleting trailing ' '.
append intab01 .
clear: in_wa, intab01 .
endat.
endloop.
endform. " upload_excel
<b>See the below links for more example programs</b>
http://sap.ittoolbox.com/code/archives.asp?d=3365&a=s&i=10
http://sap.ittoolbox.com/code/archives.asp?d=3126&a=s&i=10
http://sap.ittoolbox.com/code/archives.asp?d=3127&a=s&i=10
http://sap.ittoolbox.com/code/archives.asp?d=2128&a=s&i=10
http://sap.ittoolbox.com/code/archives.asp?d=1721&a=s&i=10
Thanks
Sudheer -
Query on formating CSV file.
Hi All,
According to my business logic i need to read data from DataBase and need to create CSV file to represent that data. I am able to create CSV file. But i want to format the cells of the CVS file. means like, i want to change the back groung color of a cell. Is it possible to do changes to the cells of CSV file through JAVA program?.
Regards,
Naga.A CSV is, as definition, a comma separated values format.
It can contain only text and you cannot give any formatting definition, neither via Java nor via an editor. -
How can i update an existing item in sap using CSV file?
Hi,
i am trying to update an existing Item in SAP using a CSV file.
in the message log i get an error message that the item already exists.
what should i do in order to update the existing record?
Thanks, UdiHi..........
I would sugest you to use Tab delimited file and choose proper option in order to update the itsm master in DTW......
Regards,
Rahul -
Loading 361000 records at a time from csv file
Hi,
One of my collegue loaded 361000 records from one file file , how is this possible as excel accepts 65536 records in one file
and even in the infopackage the following are selected what does this mean
Data Separator ;
Escape Sign "
Separator for Thousands .
Character Used for Decimal Point ,
Pls let me knowhi Maya,
it just possible, other than ms-excel, we have editor like Textpad that support more 65k rows (and windows Notepad), the file may be generated by program or edited outside in excel, or newer version of excel is used, ms-excel 2007 support more 1 million rows.
e.g we have csv file
customer;product;quantity;revenue
a;x;"1.250,25";200
b;y;"5.5";300
data separator ;
- char/delimeter used to separate field, e.g
escape sign, e.g
- "1.250,25";200 then quantity = 1.250,25
separator for thousands = .
- 1.250,25 means one thousand two hundred ...
char used for decimal point
- - 1.250<b>,</b>25
check
http://help.sap.com/saphelp_nw70/helpdata/en/80/1a6581e07211d2acb80000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw70/helpdata/en/c2/678e3bee3c9979e10000000a11402f/frameset.htm
hope this helps. -
Error while creating table from csv file
I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
Any idea?I am getting an error while creating a table using 'Import Data' button for a csv file containing 22 columns and 8 rows. For primary key, I am using an existing column 'Line' and 'Not generated' options.
ORA-20001: Excel load run ddl error: drop table "RESTORE" ORA-00942: table or view does not exist ORA-20001: Excel load run ddl error: create table "RESTORE" ( "LINE" NUMBER, "PHASE" VARCHAR2(30), "RDC_MEDIA_ID" VARCHAR2(30), "CLIENT_MEDIA_LABEL" VARCHAR2(30), "MEDIA_TYPE" VARCHAR2(30), "SIZE_GB" NUMBER, "RDC_IMG_HD_A" NUMBER, "START_TECH" VARCHAR2(30), "CREATE_DATE" VARCHAR2(30), "RDC_MEDIA_DEST" VARCHAR2(30), "POD" NUMBER, "TAPE" NUMBER, "ERRORS_YN" VA
Any idea? -
Error while refreshing a report using local csv file
Hi,
I'm using BI 4.1 SP02.
While using Rich client, I've created a report with some merged queries, while one of the queries is a local CSV file - saved on AD in some server, and not on the repository inside BO.
While trying to refresh the report with the Rich client, it all went great.
Now, while using BI Launchpad java based app, I can't refresh the report - I get the following error:
"An Internal error occurred while calling 'processDPCommandsEx' API. (Error: ERR_WIS_30270) (WIS 30270)"
Should I be able to refresh a report without the Rich if it contains a local file (which is possible to EDIT only with rich) ?
If so, then did someone ran into this error?
Thank you,
Or.First of all, thanks for both of the replies.
Second,
my problem is unlikely have to do something with permissions from one reasons -
when the report is using XLS\XLSX on same folder(with same name prefix) - the report is running without any problem.
Only problem is while refreshing without Rich while the source is network CSV file.
Any suggestions?
Thanks. -
Issue in conversion of output file from alv to csv file using GUI_DOWNLOAD
hi,
I am using GUI_DOWNLOAD to convert the internal table that am getting as the output of an alv into a csv(comma separated file) file.I am using the following code but its not generating a csv file instead it is generating a normal space delimited file.
The code is as follows:
data : lv_fname type string.
lv_fname = 'C:\Users\pratyusha_tripathi\Desktop\status8.csv'. " Provide the file path & file name with CSV extention
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_fname " File name including path, give CSV as extention of the file
FILETYPE = 'DAT'
WRITE_FIELD_SEPARATOR = '#' " Provide comma as separator
tables
data_tab = ITAB " Pass the Output internal table
FIELDNAMES =
EXCEPTIONS
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.
Kindly let me know what changes can be made to make my code work.Also can GUI_download be used for batch processing and storing the output in application server?
Thanks ,
PratyushaHi,
the short text description for WRITE_FIELD_SEPARATOR is "Separate Columns by Tabs in Case of ASCII Download", so why do you expect a comma?
Try SAP_CONVERT_TO_CSV_FORMAT and then download.
And no, GUI_DOWNLOAD is only for download via SAP GUI to a users computer.
Best regards,
Oliver -
Creation of CSV file on client machine with data from forms
Hi,
My requirement is to generate a CSV file(or .XLS) on the client machine ie local drive with the details shown in a form.
Oracle version -
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production.
I have searched the web for last couple of days and got to know that TEXT_IO is to be used to generate files on client machine. However, when I tried TEXT_IO, it was not able to generate the file on client rather it was able to generate on database server. After further browsing on this, there was a link which said that we need to use CLIENT_TEXT_IO to generate file on client side. For this, i was required to subclass the webutil.pll which i did and corrected the code to use CLIENT_TEXT_IO. The form was unable to compile and was not able to find "webutil_core" package.
I am very confused with the disparity in the information available on the web as in what to use to generate a file on client side. If anyone has use it in the past, can he/she please detail what to use to get things sorted.
Thanks,
ROracle version - Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production. >
So, what is your FORMS version. This is more important than your database version.
My requirement is to generate a CSV file(or .XLS) on the client machine ie local drive with the details shown in a form. Depending on your Forms version, you would use TEXT_IO (if Forms 6i running in Client/Server mode) or WebUtil (if Forms 9i or higher).
I'm going to guess that you are at least using Oracle Forms 9i since you stated that your attempt at using TEXT_IO produced a file on the DB server.
There is more to using WebUtil than just attaching the WEBUTIL.PLL. If you had performed a simple search of the Forms Help System would have found numerous WebUtil topics to include: Introduction to WebUtil, Configuring WebUtil, Using WebUtil in Your Applications and the WebUtil User's Guide. If you have Oracle Forms release 10g or higher, WebUtil is included when you installed Forms, however, you do need to configure your installation to use WebUtil and you must download the Java COM Bridge (jacob.jar) from Source Forge. Take a look at the Configuring WebUtil Forms Help topic to find out which version of the Java COM Bridge you will need to download.
After you have successfully configured WebUtil, take a look at the Using WebUtil in Your Applications topic to find out how to implement WebUtil in a form.
Searching the Internet for answers is great, but don't forget the look at the Forms Help System because the majority of your questions can be answered there. :)
Lastly, configuration of WebUtil is primarily done on your Application Server (AS). However, if you plan to perform preliminary runtime testing by running your Form from the Forms Builder, then you will configure your local runtime to support WebUtil as well as configure your AS. The steps are exactly the same. A common mis-step is to skip a step during the configuration because you don't think the step applies. Take a look at the Forms Help Runtime Setup Checklist topic for a list of step you need to complete in order to enable WebUtil.
Hope this helps,
Craig B-)
If someone's response is helpful or correct, please mark it accordingly. -
Sender "Mail" adapter - CSV file attachment
Hi there
I'm looking for some help in configuring a sender mail adapter that receives ".csv" files. I did read some blogs that mention using the "PayloadSwapBean" module to read the mail attachment instead of the mail content. My problem is to now convert the ".csv" file into a message. Is there a module that I can use ( is it the "MessageTransfomBean" ) and how. Any help would be appreciated.
Thanks
SalilHi Salil,
If you want to send a mail with a body and attachments, the message sender HAS to provide an XI message with attachments. I doubt a CSV file does justice.
As Renjith said you need to convert CSV to XmL.
A short description about the Standard Modules:
MessageTransformationBean is a standard module used to apply the XSLT mapping to the adapter module by using <i>Transform.class</i> ( This xslt mapping is done to create a mail package, Dont confuse with the actual mapping in your case this is NOT for converting csv to xml).
Also this module can be used to change the name and type of payloads by using <i>Transform.contentType</i>, <i>Transform.contentDisposition</i>, <i>Transform.contentDescription</i>.
PayloadSwapbean is a standard module for replacing payloads with other payloads (SWAP)
If you want to give each attachment a certain name use Parameters, <i>swap.keyname</i> for name of the payload and <i>swap.keyvalue</i>.
I Hope the use of standard modules is understood.
Maybe you are looking for
-
How can I get my old iphone 3g apps back?
Hi I need help because I got this iPhone 3G from my mom but I cant install almost any app that I have in my itunes library. Please help me I really just want to get iBooks thats all
-
Are apps removed from app store when DPS contract expires?
My company is debating on whether to renew our DPS contract and the question has come up whether or not once our contract expires, will the apps we've created so far using DPS be removed from the app store since we would no longer be subscribing to t
-
Hi every body, I wrote in E series page, but I thing that it is the correct page to write my problem. I hope if somebody can help me here. O.k. this is my problem. 3 days before I update my phone nokia E65. after the update my language was disappeare
-
Best way to sync with this setup?
I have a shared external drive on my AEBS at home that I keep my iTunes library on, music, movies, tv shows, etc. I want all my media to be available to my Apple TV. On my MacBook Pro, I need be able to sync my iPhone calender, email, non media type
-
Lens flare effect (format Movie Quick Time) doesnt work in Adobe Premiere CS6
Hi Adobe, My video effect lens flare (fornat QUICK TIME MOVIE) for transition video doesnt works. Only the audio show up in my Adobe Premiere CS6. Please I need help from you. Thank you so much ... -SieraG-