Change alignment in CSV file
Hi
I am working on ABAP-CRM 7.0.I am generation a CSV file by concatenating values with comma from a internal table data.
I have text coloumn with left aligned. I need to change it to right aligned. How to do in abap while generating( while concatenating) CSV file?
thanks
Logu
Hi Logu,
You can try this:
[http://www.watto.org/program/abap/download/Z_RIGHT_ALIGN.abap|http://www.watto.org/program/abap/download/Z_RIGHT_ALIGN.abap]
Regards,
Leon
Similar Messages
-
Is it possible to monitor State change of a .CSV file using powershell scripting ?
Hi All,
I just would like to know Is it possible to monitor State change of a .CSV file using powershell scripting ? We have SCOM tool which has that capability but there are some drawbacks in that for which we are not able to utilise that. So i would like
to know is this possible using powershell.
So if there is any number above 303 in the .CSV file then i need a email alert / notification for the same.
Gautam.75801Hi Jrv,
Thank you very much. I modified the above and it worked.
Import-Csv C:\SCOM_Tasks\GCC2010Capacitymanagement\CapacityMgntData.csv | ?{$_.Mailboxes -gt 303} | Export-csv -path C:\SCOM_Tasks\Mbx_Above303.csv;
Send-MailMessage -Attachments "C:\SCOM_Tasks\Mbx_Above303.csv" -To “[email protected]" -From “abc@xyz" -SMTPServer [email protected] -Subject “Mailboxex are above 303 in Exchange databases” -Body “Mailboxex are above 303 in Exchange databases"
Mailboxex - is the line which i want to monitor if the values there are above 303. And it will extract the lines with all above 303 to another CSV file and 2nd is a mail script to email me the same with the attachment of the 2nd extract.
Gautam.75801 -
How to align the CSV file on upload?
Hi All,
I have to upload a CSV file as an attachment in a mail and the data's in the internal table which has to be uploaded in the CSV file are seperated using commas which on uploading appear in the CSV file in the same column but i need the data's to be seperated in different columns and different lines...
Pls help it is very urgent..
Thanks in Advance...Hi
For my understanding you are talking about download.
For that you have to concatenate each fields of final internal table (gt_itab for example) using comma as below.
TYPES: BEGIN OF ty_lines,
line(1023) TYPE c,
END OF ty_lines.
DATA: l_filename TYPE string VALUE 'C:\temp\abcd.csv',
gt_lines TYPE TABLE OF ty_lines,
gw_lines TYPE ty_lines.
LOOP AT gt_itab INTO gw_itab.
CONCATENATE gw_itab-f1
gw_itab-f2 .....
INTO gw_lines-line
SEPARATED BY ','.
APPEND gw_lines TO gt_lines.
ENDLOOP.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_filename
filetype = 'ASC'
confirm_overwrite = 'X'
no_auth_check = 'X'
TABLES
data_tab = gt_lines. -
How to export contacts and change vcf to csv file
I need to export the contacts so I can make updates and import them into my marketing system. iCloud exports in only ,vcf, which cannot be imported anywhere I can find.( that is the entire file, not one contact at a time) I am very frustrated and don't understand Apple using this format for exporting.Every other application I can think of uses .csv and none takes .vcf for import.
Help!You might want to try an app that can export in CSV format, like My Contacts Backup.
-
Dynamically creating oracle table with csv file as source
Hi,
We have a requirment..TO create a dynamic external table.. Whenever the data or number of columns change in the CSV file the table should be replaced with current data and current number of columns...as we are naive experienced people in oracle please give us a clear solution.. We have tried with a code already ..But getting some errors. Code given below..
thank you
we have executed this code by changing the schema name and table name ..Remaining everything same ...
Assume the following:
- Oracle User and Schema name is ALLEXPERTS
- Database name is EXPERTS
- The directory object is file_dir
- CSV file directory is /export/home/log
- The csv file name is ALLEXPERTS_CSV.log
- The table name is all_experts_tbl
1. Create a directory object in Oracle. The directory will point to the directory where the file located.
conn sys/{password}@EXPERTS as sysdba;
CREATE OR REPLACE DIRECTORY file_dir AS '/export/home/log';
2. Grant the directory privilege to the user
GRANT READ ON DIRECTORY file_dir TO ALLEXPERTS;
3. Create the table
Connect as ALLEXPERTS user
create table ALLEXPERTS.all_experts_tbl
(txt_line varchar2(512))
organization external
(type ORACLE_LOADER
default directory file_dir
access parameters (records delimited by newline
fields
(txt_line char(512)))
location ('ALLEXPERTS_CSV.log')
This will create a table that links the data to a file. Now you can treat this file as a regular table where you can use SELECT statement to retrieve the data.
PL/SQL to create the data (PSEUDO code)
CREATE OR REPLACE PROCEDURE new_proc IS
-- Setup the cursor
CURSOR c_main IS SELECT *
FROM allexperts.all_experts_tbl;
CURSOR c_first_row IS ALLEXPERTS_CSV.logSELECT *
FROM allexperts.all_experts_tbl
WHERE ROWNUM = 1;
-- Declare Variable
l_delimiter_count NUMBER;
l_temp_counter NUMBER:=1;
l_current_row VARCHAR2(100);
l_create_statements VARCHAR2(1000);
BEGIN
-- Get the first row
-- Open the c_first_row and fetch the data into l_current_row
-- Count the number of delimiter l_current_row and set the l_delimiter_count
OPEN c_first_row;
FETCH c_first_row INTO l_current_row;
CLOSE c_first_row;
l_delimiter_count := number of delimiter in l_current_row;
-- Create the table with the right number of columns
l_create_statements := 'CREATE TABLE csv_table ( ';
WHILE l_temp_counter <= l_delimiter_count
LOOP
l_create_statement := l_create_statement || 'COL' || l_temp_counter || ' VARCHAR2(100)'
l_temp_counter := l_temp_counter + 1;
IF l_temp_counter <=l_delimiter_count THEN
l_create_statement := l_create_statement || ',';
END IF;
END;
l_create_statement := l_create_statement || ')';
EXECUTE IMMEDIATE l_create_statement;
-- Open the c_main to parse all the rows and insert into the table
WHILE rec IN c_main
LOOP
-- Loop thru all the records and parse them
-- Insert the data into the table created above
END LOOP;The initial table is showing errors and the procedure is created with compilation errors
After executing the create table i am getting the following errors
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "identifier": expecting one of: "badfile,
byteordermark, characterset, column, data, delimited, discardfile,
disable_directory_link_check, exit, fields, fixed, load, logfile, language,
nodiscardfile, nobadfile, nologfile, date_cache, processing, readsize, string,
skip, territory, varia"
KUP-01008: the bad identifier was: deli
KUP-01007: at line 1 column 9
ORA-06512: at "SYS.ORACLE_LOADER", line 19 -
Problem in handling complex CSV file
Hi,
I am facing a strange problem in handling a complex CSV file.
The content of the file is as follows. It is getting executed through an XSD and the target is a table.
First time when the interface is executed ( for e.g session id - 19001) it is getting completed successfully.
Now when making changes in the CSV file suppose adding ( for e.g.-
DEPT,D05,Books,ABC Store
CUST,C01,Sayantan,[email protected]
CUST,C02,Shubham,[email protected])
or deleting ( for e.g.-
CUST,C02,Sarbajit,[email protected])
and running the interface I am not getting the added D05 in the target table nor my C02 data is getting removed i.e.- the updated data in CSV file is not getting fetched and I am getting the same records as i got when i ran interface of session id 19001.
I am not getting why it is happening??
The CSV file used in session id -19001 is:
DEPT,D01,Retail,World Mart
CUST,C01,Anindya,[email protected]
CUST,C02,Rashni,[email protected]
DEPT,D02,Food,Food Bazar
CUST,C01,Abhijit,[email protected]
CUST,C02,Anirban,[email protected]
CUST,C03,Sharmistha,[email protected]
DEPT,D03,Water,SW
CUST,C01,Nirmalya,[email protected]
DEPT,D04,Clothes,City style
CUST,C02,Sarbajit,[email protected]
CUST,C03,Abhishek,[email protected]Here's what you can do to handle CSV files using HSQL.
Say the CSV file contains order data. Each order record contains data about a particular order like order number, product code, quantity, ordered by, date etc. Now lets take a hypothetical requirement which says, the user needs to know how many orders were ordered per product.
Option 1] At the basic level, read the order file, parse each line and write the logic to get count of orders per product.
Option 2] Load this CSV file into a database like MySQL and write database queries to get the orders per product.
So where does this leave us? Have we run out of options? I am sure we would have tried & used the above two options . But I wanted a different approach. Following questions were lingering in my mind:
1] Why can’t I write SQL queries against the CSV file itself. After all it’s like any RDBMS table.
2] Why should I load the CSV file into some database before I query it?
3] Why can’t I create a database table & attach the CSV file to it?
Continue Reading Here: Handling CSV Files -
Want to load excel data into oracle table with out changing it to CSV
Hello all,
I have a requirement in dumping excel data into oracle database table without changing it to CSV file and this has to be used in normal sql/plsql environment i.e., pkg/procedure cant be used in the forms also...
so, can u guys can help me out in this
thanks.............The link Pavan provided discusses Oracle Heterogeneous Services. This allows you (using ODBC) to create a database link from Oracle to a non-Oracle data source like Excel. This would allow you to query the Excel data source from SQL*Plus or any other client tool. But that is probably going to require that your Oracle database is running on Windows since I'm not aware of any Excel ODBC drivers for Unix.
Another potential option would be to write a Java stored procedure that parsed the file. There are a few different Java libraries that can read and write Excel data files. You could load one of those libraries into the database's JVM and then write Java code that parsed the file. You would then be able to call your Java stored procedure from PL/SQL.
Justin -
Problems With Data Alignment when spooling to a CSV file
Dear members,
I am spooling data to a csv file. My data contains 3 columns
For example :
col1 col2 col3
USD,10000033020000000000000,-1144206.34
The 2nd column is alphanumeric, it contains some rows which have only numbers and some which have numbers and alphabets.
The 3rd column contains only numbers with positive or negative values.
I am facing problem with alignment. when i open the spooled csv file then i find that the 3rd column is aligned to right .
In the 2nd column, rows which have only numbers are right justified and rows which have alpha numeric data are left justified.
I tried using the JUSTIFY function in sql plus but still it is not working for me.
Can any body give your opinion on how to control the alignment in spooled csv files.
Your responce is highly appreciated.
Here is my code :
WHENEVER SQLERROR CONTINUE
SET TIMING off
set feedback off
set heading off
set termout OFF
set pagesize 0
set linesize 200
set verify off
set trimspool ON
SET NEWPAGE NONE
col to_char(glcd.segment1||glcd.segment2||glcd.segment3||glcd.segment4||glcd.segment5||glcd.segment6) ALIAS CONCATENATED_SEGMENTS
col CONCATENATED_SEGMENTS justify left
col to_char(decode(glbal.currency_code,glsob.currency_code,
(begin_balance_dr - begin_balance_cr) + (period_net_dr -period_net_cr),
(begin_balance_dr_beq - begin_balance_cr_beq) + (period_net_dr_beq -period_net_cr_beq))) alias Total_Functional_Currency
col Total_Functional_Currency justify left
COlUMN V_INSTANCE NEW_VALUE V_inst noprint
select trim(lower(instance_name)) V_INSTANCE
from v$instance;
column clogname new_value logname
select '/d01/oracle/'|| '&&V_inst' ||'out/outbound/KEMET_BALANCE_FILE_EXTRACT' clogname from dual;
spool &&logname..csv
SELECT glsob.currency_code ||','||
to_char(glcd.segment1||glcd.segment2||glcd.segment3||glcd.segment4||glcd.segment5||glcd.segment6) ||','||
to_char(decode(glbal.currency_code,glsob.currency_code,
(begin_balance_dr - begin_balance_cr) + (period_net_dr -period_net_cr),
(begin_balance_dr_beq - begin_balance_cr_beq) + (period_net_dr_beq -period_net_cr_beq)))
from gl_balances glbal , gl_code_combinations glcd , gl_sets_of_books glsob
where period_name = '&1' /* Period Name */
and glbal.translated_flag IS NULL
and glbal.code_combination_id = glcd.code_combination_id
and glbal.set_of_books_id = glsob.set_of_books_id
and glbal.actual_flag = 'A'
and glsob.short_name in ('KEC-BOOKS' , 'KUE' , 'KEU','KEMS', 'KEAL' , 'KEAL-TW' , 'KEAL-SZ' , 'KEAM')
and glcd.segment1 != '05'
and decode(glbal.currency_code , glsob.currency_code , (begin_balance_dr - begin_balance_cr) + (period_net_dr -period_net_cr) ,
(begin_balance_dr_beq - begin_balance_cr_beq) + (period_net_dr_beq -period_net_cr_beq)) != 0
and glbal.template_id IS NULL
ORDER BY glcd.segment1 || glcd.segment2 || glcd.segment3 || glcd.segment4 || glcd.segment5 || glcd.segment6
spool off
SET TIMING on
set termout on
set feedback on
set heading on
set pagesize 35
set linesize 100
set echo on
set verify on
Thanks
Sandeepi think you do not have to worry about your code when you say that the plain texts created are ok when opened on the notepad. it is on the excel that you will need some adjustments. not sure about this but you might want to read about the applying styles in the excel by going through it's help menu.
-
need to run through a list of old to new data (.csv) file and change them in a sharepoint list - can not make it work
here is my base attempt.
$web = Get-SPWeb site url
$list = $web.lists["List Name"]
$item = $list.items.getitembyid(select from the items.csv old)
$modifiedBy = $item["Editor"]
#Editor is the internal name of the Modified By column
$item["old"] = "new from the .csv file parsed by power sehll
$ite.Syste,Update($false);
$web.Dispose()Hi,
According to your description, my understanding is that you want to update SharePoint field value from a CSV file recursively.
We can import CSV file using the Import-CSV –path command, then update the field value in the foreach loop.
Here is a code snippet for your reference:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$csvVariable= Import-CSV -path "http://sp2010.contoso.com/finance/"
# Destination site collection
$WebURL = "http://sp2010.contoso.com/sites/Utility/"
# Destination list name
$listName = "Inventory"
#Get the SPWeb object and save it to a variable
$web = Get-SPWeb -identity $WebURL
#Get the SPList object to retrieve the list
$list = $web.Lists[$listName]
#Get all items in this list and save them to a variable
$items = $list.items
#loop through csv file
foreach($row in $csvVariable)
#loop through SharePoint list
foreach($item in $items)
$item["ID #"]=$row."ID #"
$item.Update()
$web.Dispose()
Here are some detailed articles for your reference:
http://blogs.technet.com/b/stuffstevesays/archive/2013/06/07/populating-a-sharepoint-list-using-powershell.aspx
http://social.technet.microsoft.com/wiki/contents/articles/25125.sharepoint-2013-powershell-to-copy-or-update-list-items-across-sharepoint-sites-and-farms.aspx
Thanks
Best Regards
Jerry Guo
TechNet Community Support -
How to change an existing line item in CCM catalog using CSV file?
Dear All,
We are using SRM5.0 and CCM 2.0
We have uploaded the material and service master to CCM as supplier catalog from R/3.
The initial Upload was doen successfully.
My query is how to reflect the delta changes in CCM happening in R/3?
If I can generate a CSV file with all those items wich has been changed (Changes can be in description, Plant, status etc) and upload the same file in CCM, will it update the existing line in CCM or create a new line item?
How do i update an existing line item in CCM catalog using a CSV file?
Thanks
AbhishekHi Atul,
I am using CCM 2.0 and SRM 5.0 (EBP5.5).
We are not using XI, so i guess we cant use the program "/ccm/file_upload".
we have migrated the product master data from R/3.
We have developed a report which takes product category as input and gives out flat file in csv format containg all the items in that prod category.
Then we upload the file in CCM by logging thro the brpwser.
Similarly, i can develop another program which will give me a CSV file foll all those items changed in R/3 in a day.
Then we can upload that file in CCM.
But i have doubt if it will update the existing items in catalog.
Hope I could make myself clear.
Thanks
Abhishek -
Powershell: How to change the header name in a imported CSV file
HI All,
I have a csv file in which I want to change the headers names in powershell.
oldnames are name,id
newnames I want to give are: company and transit respectively.
Following is what I wrote in script:
$a = import-csv .\finalexam\employees.csv -header name,id'
foreach ($a in $as[1-$as.count-1]) // I used 1 here because I want it to ignore the exiting headers.
{ $_.name -eq company, $_.id -eq transit}
I think this not entirely correct way to do this. Can someone show me how to fix this.
Regards
SQL 75If you're not an experienced PowerShell programmer, I recommend editing the file in a text editor and changing the name that way.
-- Bill Stewart [Bill_Stewart] -
.CSV files format needs to be changes
Hi ,
I have procdure which converts all my data to .csv format, The problem here is i have used the SQL which has the alias name's Jan-12...upto Dec-12.
The resulting .csv file dispalying this format as 12-Jan ---------up to 12-Dec
I want the .CSV format should contain Jan-12...upto Dec-12.
Pleae advice.
Thanks876639 wrote:
Hi ,
I have procdure which converts all my data to .csv format, The problem here is i have used the SQL which has the alias name's Jan-12...upto Dec-12.
The resulting .csv file dispalying this format as 12-Jan ---------up to 12-DecNo, the resulting .csv file contains whatever data you put into it. It's just a text file with characters in it.
If data is getting changed then that's either being changed by your own code before it's put in the .csv file, or by the application you are using to view the .csv file.
Let me guess, you're loading the .csv file into Microsoft Excel to view it...?
Excel can recognise certain data and change the display formats accordingly e.g. it can recognise numbers and dates and display them in it's default formats. That's not a fault with Oracle or your code in that case, but with how the data is being viewed through Excel.
Is the data still wrong if you open it up in WordPad or Notepad? -
How to change csv file to dat file
Hi,
I want ask you about the data that i got.
Actually, the data in csv file. So, can i change directly file to dat file? Just put c:\Trace.dat?
can or not?
Need your help.
Thank you.
Solved!
Go to Solution.
Attachments:
csv.JPG 108 KBNurHidayah wrote:
Actually this format in MATLAB software. So, i want this dat format because I want to simplify my data imported directly into the software.
And what is the format that is defined? Or are you referring to MAT files, which are binary files specific to Matlab?
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines -
Prime Infrastructure - Automating the change "mac@ - AP name" with CSV file
Hi,
We are going to deploy a lot of new LAP. For each site our customer will give us an excel file with the MAC @ of the AP and the target name.
I was wondering if it was possible to automate the injection of this file "mac <-> ap name" and then apply the predefined template with P.I ?
If yes, could you explain how, as I am new to Prime Infrastructure.,The goal is to avoid to rename each AP individually on prime as there is a lot of AP to deploy.
Many thanks in advance !
Oliv.Hi Oliv:
In the Classic View of Prime Infrastructure, under Configure > Access Points, there's a menu option for Import AP Config. This uses a .csv file to match APs by the MAC address and make changes in bulk. From the online help:
Sample File Header:
AP Name,Ethernet MAC,Location,Primary Controller,Secondary Controller,Tertiary Controller
ap-1, 00:1c:58:74:8c:22, sjc-14-a, controller-4404-1, controller-4404-2, controller-4404-3
The CSV file can contain following fields. AP Ethernet MAC Address is mandatory, Optional fields are AP Name, Location, Primary Controller, Secondary Controller and Tertiary Controller.
Optional fields can be empty. AP Config Import will ignore empty optional field values. However, if Primary Controller and Secondary Controller entries are empty then Unified AP update is not done
Ethernet MAC: AP Ethernet MAC Address
AP Name:AP Name
Location:AP Location
Primary Controller:Primary Controller Name
Secondary Controller:Secondary Controller Name
Tertiary Controller:Tertiary Controller Name -
OPenScript: change delimiter in databank .csv file ?
OPenScript, Forms Functional Test.
I tried change delimiter in databank .csv file - comma (",") to semicolon (";").
but seems OPenScript don't understood semicolon delimiter.
Is it possible use semicolon delimiter in databank .csv files?Hi
You can always do a find an replace in notepad to change from ; to , also if you need to have a comma inside your databank value you can always put that between quotes e.g.
"value1,value2",value3the example above will pass in the value1,value2 as a single parameter.
Regards
Alex
Maybe you are looking for
-
Saving files to a hard drive connected to my Airport Extreme
I just upgraded to Leopard. I am unable to use Backup v 3.1.2 to save files to a hard drive i have connected to my Airport Extreme. Previously, using Tiger i was able to perform this task. I use Finder and see my airport express network and my extern
-
Unable to change country... How do i change it???
What you could do is create a Austrian account to make purchases from the Austrian ps store, and only to make purchases. Continue playing using your Hungarian account. You will have no problems with dlc compatibility, and as long as both accounts are
-
Hello, I currently have 3.0.9.8 portal with 9iAS on Sun Solaris 2.8. I'm trying to create an XML Component. It works with static XML created in the XML code window and our customized XSL, however I'm trying to get dynamic XML from the data server by
-
Accidentally deleted aif file and cannot open my project or even backups!
Please let me know if there is any hope for recovery...I emptied my trash with an aif file in it and now when I open my project it appears to nearly load but then the 100% complete loading bar becomes solid gray and never opens. I apparently never se
-
Help, simple c++ code :S
Hi, so i've been trying to make a simple program that would print in the screen the char that i wrote in the first place... i don't know why, but the following code isn't "printing". #include "stdafx.h" #include "stdio.h" int main() char l; printf("i