.csv's, excel and ssis

Hi we run 2012 std.  I've been using ssis now for 7 years or more and have always (especially lately) shuddered at the thought of needing to bake excel file functionality into my pkgs.  Some of the nightmares I remember include 32 bit directory
limitations, special add ons to the sql server, column typing, jet engines, compatibilities, leading zeros, sheets etc etc.  Maybe I'm wrong but i'm under the impression that full/custom control of a .csv's content involves creating it with excel.
My personal feeling is that it just shouldn't be that difficult.  But that it is and we never know what new surprise the next release of either product brings.
I'm faced with baking some .csv file creation into my pkg and wonder...can I use a more basic approach to creating these files?  One that uses flat file technology if I'm willing to do the formatting?  I vaguely remember testing this
theory (by putting my own delimeters in) once and the file did indeed open in excel.     
I wonder about metadata (related to column headings, data types etc) that might accompany the data in such a file when a .csv is created from excel instead of flat file approach.  I wonder about commas that r in the char data as opposed to being delimeters. 
Maybe I'll wish I'd never gone down this road because I'd lose control over managing such metadata if the need should arise.  My consumer is a separate business and I may not be in a position to tell them to live with the generic way the file
was created.
Does anybody feel my pain?  Any suggestions?  I'm also thinking about reusability thru dmv's, metadata in control tables etc.

here is the solution I am going with.  It is mostly untested and in need of review for efficiency and maintainability.  Its a first draft.
I am not a fan of ssis's flat file components.  They affect time to market in an agile environment.   I am a fan of reusability.  I haven't considered yet how this solution can work with linked servers.
Basically what I've tried to achieve here is dynamic functionality that can take a subset of any table's columns and format them into either a csv or fixed positional multiple row resultset (with a hdr if format is csv).  Both ID (unique
record identifier) and FileInstanceId (surrogate for original file name) must minimally be present on the source data table whose columns r being formatted for eventual landing in a flat file.  it would be ssis's responsibility to land the resultset
returned by this tool into a flat file.  
There r two metadata tables, one at the table level and one at the column level.  Constants r allowed in the 2nd.  There is a proc and a function.  The function made the proc slightly more readable.  There is an option for double quotes
around string values.  Presently, there r no constraints preventing bogus/contradictory data from being entered into the metadata tables.
USE [somedb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ourAppNameSourceDataTables](
[ID] [int] IDENTITY(1,1) NOT NULL,
[TableName] [varchar](128) NULL,
[DatabaseName] [varchar](128) NULL,
[Format] [varchar](25) NULL,
[IsActive] [bit] NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_ourAppNameSourceDataTables] PRIMARY KEY CLUSTERED
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[ourAppNameSourceDataTables] ADD DEFAULT (getdate()) FOR [ModifiedDate]
GO
USE [somedb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ourAppNameSourceDataColumns](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FK_ourAppNameSourceDataTables] [int] NULL,
[TargetColumnName] [varchar](128) NULL,
[Order] [smallint] NULL,
[SourceColumnName] [varchar](128) NULL,
[IsConstant] [bit] NULL,
[ConstantValue] [varchar](100) NULL,
[FromColumn] [smallint] NULL,
[ToColumn] [smallint] NULL,
[AlsoDoubleQuoteDelimit] [bit] NULL,
[IsActive] [bit] NULL,
[ModifiedDate] [datetime] NOT NULL,
CONSTRAINT [PK_ourAppNameSourceDataColumns] PRIMARY KEY CLUSTERED
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[ourAppNameSourceDataColumns] ADD DEFAULT (getdate()) FOR [ModifiedDate]
GO
USE [somedb]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[usp_createOurAppNameFiles]
@table varchar(128),
@database varchar(128),
@FileInstanceID bigint
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
declare @format varchar(25)
declare @fileID int
declare @hdrVar varchar(max) = null
declare @lowRecordId bigint
declare @highRecordId bigint
declare @currentID bigint
declare @rowCount bigint
declare @dtlVar varchar(max)
declare @tblFinal table (id int primary key, record varchar(max)) -- holds final results
--get file properties
select @format = [Format],
@fileID = [ID]
from [dbo].[ourAppNameSourceDataTables]
where [IsActive] = 1 and
[TableName] = @table and
[DatabaseName] = @database
--build a header if csv, coalesce can also be used
if @format = 'csv' begin
select @hdrVar =
(SELECT
',' + TargetColumnName
FROM [dbo].[ourAppNameSourceDataColumns]
where [FK_ourAppNameSourceDataTables] = @fileID and
IsActive=1
order by [Order]
for xml path (''))
insert @tblFinal select -1, substring(@hdrVar,2, len(@hdrVar) -1)
end
--data type charactersitics
create table #Meta (SourceColumnName varchar(128) primary key,
Characteristics varchar(100))
declare @sqlMeta varchar(max) = 'insert #Meta select COLUMN_NAME, DATA_TYPE from ' +
@database +
'.[INFORMATION_SCHEMA].[COLUMNS] where TABLE_SCHEMA + ' +
'''' + '.' + '''' + ' + TABLE_NAME = ' + '''' + @table + ''''
exec (@sqlMeta)
--template
declare @tblTemplate table (ID int primary key, [Order] smallint, SourceColumnName varchar(128),
IsConstant bit, ConstantValue varchar(100),
FromColumn smallint, ToColumn smallint, AlsoDoubleQuoteDelimit bit, Characteristic varchar(100))
insert @tblTemplate
select a.*,Characteristics from
select ID,[Order],case when SourceColumnName is null then '' else SourceColumnName end SourceColumnName,
IsConstant,ConstantValue,FromColumn,ToColumn,AlsoDoubleQuoteDelimit
from [dbo].[ourAppNameSourceDataColumns]
where [IsActive] =1 and
[FK_ourAppNameSourceDataTables] = @fileId
) a
left join #Meta b
on a.SourceColumnName = b.SourceColumnName
drop table #Meta
--create the equivalent of an unpivot query for the data
declare @sqlPivotQuery varchar(max)
SELECT @sqlPivotQuery = (
select
' union all select ID,' +
case when IsConstant = 1 then '''' + case when ConstantValue is null then '' else ConstantValue end + ''''
else 'cast(case when ' + SourceColumnName + ' is null then ' + '''' + '''' + ' else ' + SourceColumnName + ' end as varchar(max))' end +
',' +
cast([ORDER] as varchar(5)) +
',' + '''' + case when characteristic is null then '' else characteristic end + '''' + ',' +
case when FromColumn is null then 'null' else cast(FromColumn as varchar(5)) end + ',' +
case when ToColumn is null then 'null' else cast(ToColumn as varchar(5)) end + ',' +
cast(AlsoDoubleQuoteDelimit as char(1)) +
' from ' +
@database + '.' + @table +
' where FileInstanceId = ' + cast(@FileInstanceId as varchar(19))
FROM @tblTemplate
order by [Order]
for xml path (''))
set @sqlPivotQuery = 'insert #Pivot ' + substring(@sqlPivotQuery,12,len(@sqlPivotQuery) - 9)
--unpivot the data
create table #Pivot (pk int identity(1,1) primary key, ID bigint,value varchar(max),[order] smallint, characteristic varchar(100),
FromColumn smallint,ToColumn smallint, AlsoDoubleQuoteDelimit bit)
create index ix on #Pivot(ID)
exec (@sqlPivotQuery)
--build required records
select @rowCount = count(*) from #Pivot
if @rowCount > 0
begin
select @lowRecordId = min(ID) from #Pivot
select @highRecordId = max(ID) from #Pivot
set @currentID = @lowRecordId
While @currentId <= @highRecordId
begin
set @dtlVar = ''
select @dtlVar =
(SELECT
case when @format = 'csv' then ',' else '' end +
case when AlsoDoubleQuoteDelimit = 1 then '"' else '' end +
dbo.udf_ourAppNameFieldFormat (value,characteristic,FromColumn, ToColumn) +
case when AlsoDoubleQuoteDelimit = 1 then '"' else '' end
FROM #Pivot
where [ID] = @currentId
order by [Order]
for xml path (''))
insert @tblFinal
select @currentId,case when @format = 'csv' then substring(@dtlVar,2,len(@dtlVar) -1) else @dtlvar end
select @currentId = min(ID) from #Pivot where ID > @currentId
if @currentId is null set @currentId = @highRecordId + 1
end
end
drop table #Pivot
select record from @tblFinal order by id
END TRY
BEGIN CATCH
DECLARE @ErrorMessage VARCHAR(500),@ErrorSeverity VARCHAR(10),@ErrorState CHAR(4)
SELECT
@ErrorMessage = ERROR_MESSAGE(),
@ErrorSeverity = ERROR_SEVERITY(),
@ErrorState = ERROR_STATE();
RAISERROR (@ErrorMessage, -- Message text.
@ErrorSeverity, -- Severity.
@ErrorState -- State.
END CATCH
END
GO
USE somedb
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[udf_ourAppNameFieldFormat]
@value varchar(max),
@characteristic varchar(100),
@FromColumn smallint,
@ToColumn smallint
RETURNS varchar(max)
AS
BEGIN
declare @return varchar(max) = ltrim(rtrim(case when @value is null then '' else @value end))
set @return = case when @characteristic like '%date%' then
case when @return = '' then @return
else CONVERT(VARCHAR(8), cast(@return as datetime), 112)
end
else @return
end
if @FromColumn is null or @ToColumn is null return @return
if @ToColumn < @FromColumn return null
if len(@return) >= @ToColumn - @FromColumn + 1 return substring(@return,1,@ToColumn - @FromColumn + 1)
set @return = @return + replicate(' ', @ToColumn - @FromColumn + 1 - len(@return))
RETURN @return
END
GO

Similar Messages

  • Retrieve from CSV or excel and publish in Dreamweaver

    I have been racking me little brain. All I want to do is
    publish some data stored in a CSV or excel file (there are only two
    fields Title and Text) onto a web page. so that when the data is
    changed the web page updates the informations.
    All i want to do is get the data and publish it...nothing to
    fancy i think...just totally stuck
    I seams simple enough if you know but I am struggling.
    Please help
    Or if there is a tutorial that i can use.

    I have been racking me little brain. All I want to do is
    publish some data stored in a CSV or excel file (there are only two
    fields Title and Text) onto a web page. so that when the data is
    changed the web page updates the informations.
    All i want to do is get the data and publish it...nothing to
    fancy i think...just totally stuck
    I seams simple enough if you know but I am struggling.
    Please help
    Or if there is a tutorial that i can use.

  • How to read a .csv file(excel format) using Java.

    Hi Everybody,
    I need to read a .csv file(excel) and store all the columns and rows in 2d arrays. Then I can do the rest of the coding myself. I would like it if somebody could post their code to read .csv files over here. The .csv file can have different number of columns and different number of rows every time it is ran. The .csv file is in excel format, so I don't know if that affects the code or not. I would also appreciate it if the classes imported are posted too. I would also like to know if there is a way I can recognize how many rows and columns the .csv file has. I need this urgently so I would be very grateful to anybody who has the solution. Thanks.
    Sincerely Taufiq.

    I used this
    BufferedReader in = new BufferedReader (new FileReader ("test.csv"));
    // and                
    StringTokenizer parser = new StringTokenizer (str, ", ");
                    while (parser.hasMoreTokens () == true)
                    { //crap }works like a charm!

  • Import row based complex csv or excel to DB using SSIS

    What is the best approach to deal with complex row based object hierarchy in CSV or Excel file in importing into DB?
    eg. We have the following CSV or Excel data (Pipe delimited and \r\n separate a new row):
    START|\r\n
    MEMBER|Mr|John|Lee|\r\n
    INSURANCE|2015-1-15|LIFE|\r\n
    END|\r\n
    START|\r\n
    MEMBER|Ms|Mary|Scott|\r\n
    INSURANCE|2015-1-10|LIFE|\r\n
    END|\r\n
    Here each START/END marks one record. The final goal is to transform it into an XML like this:
    <Members>
       <Member>
         <Title>Mr<\Title>
         <FN>John<\FN>
         <LN>Lee<\LN>
         <Insurance>
             <Join_Date>2015-1-10<\Join_Date>
             <Category>Life<\Category>
         <\Insurance>
       <\Member>
       <Member>
       <\Member>
    <\Members>
     Thanks for any input.

    Hi awlinq,
    There is no direct option for converting Excel to XML. There are two common methods to achieve this requirement:
    Create a schema defines the structure of the XML file based on the requirement as XML Source, then use this it to format the excel file to XML file in Microsoft Excel. For more details, please refer to the following blog:
    http://www.excel-easy.com/examples/xml.html
    Store data into a SQL table and then convert it into XML by using bulk copy utility (BCP) and FOR XML syntax with T-SQL query. The following links are for your references:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/bbc70f56-1421-4970-a3c8-c03e990e0054/convert-ms-excel-file-to-xml-using-ssis?forum=sqlintegrationservices
    http://www.codeproject.com/Tips/239156/Export-data-from-SQL-Server-as-XML
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Ssrs 2008 export to excel and csv file

    In a ssrs 2008 report, the user will export data to PDF, excel, and CSV files. When the report is exported to excel or csv file, the user wants me to hide some tablixes. Thus can you show me code on how to export the reports to csv or excel file without
    and be able to hide a few tablixes?

    Hi jazz_dog,
    According to your description, you want to set the visibility for some tablixes based on the exporting file type. Right?
    In Reporting Services 2008, we don't have any parameter to get type of exporting file. So we can only create a parameter and select a type before exporting to a file. Then use conditional expression to control the visibility. It's definitely not a good workaround,
    so your goal can't be achieved in Reporting Services 2008. However, for Reporting Service 2008R2 or later version, we have a build-in parameter called Render Format Name, this parameter will display the type of exporting file automatically. So we can make
    the judgment in expression based on the value of this parameter.
    Reference:
    Built-in Globals and Users References (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Export to excel and csv

    I have table in a jsp and an export button. When user clicks on the export button the data in the table should be exported to either text, csv or excel depending on the option user chhoses. Can anyone help me with this? How to export to excel and csv format.

    Hi arthur_branham,
    I really liked the way you have replied. Can you pleae share the code with me at [email protected] below is my problem...
    I had data in XML.I have displayed the data in jsp. Now i need to provide a link "Export to Excel" in jsp which will invokea servlet prepare the excel report and open up directly through a servlet....
    I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
    This is my code in servlet...
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet spreadSheet = wb.createSheet("Users");
    spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
    spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
    // Creating Rows
    HSSFRow row = spreadSheet.createRow(0);
    HSSFCell cell = row.createCell((short) 1);
    cell.setCellValue("Year 2005");
    cell = row.createCell((short) 2);
    cell.setCellValue("Year 2004");
    HSSFRow row1 = spreadSheet.createRow(1);
    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    cell = row1.createCell((short) 0);
    cell.setCellValue("Revenue ($)");
    cell = row1.createCell((short) 1);
    cell.setCellValue("25656");
    cell = row1.createCell((short) 2);
    cell.setCellValue("15457");
    FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
    ServletOutputStream out = response.getOutputStream();
    wb.write(output);
    output.flush();
    output.close();
    forward = null;
    In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
    1)If possible help me with the above code.
    2)Or else plz sahre you code with me...
    Its urgent....
    Thanks in advance...

  • Export to Excel and CSV rounding differ

    Hi All,
    I was able to export data from report to excel and csv formats.However the excel format shows the downloaded values with decimal roundings, whereas CSV format is not showing the decimal roundings.
    For example
    Overall result is 253,333.39
    Excell download will show it as 253,333.39
    Assume that i have a scalling factor of 1000
    CSV download will show is as 253.
    How to download report with decimal roundings to CSV format.
    Cheers,
    Suresh.

    Hi Anil,
    Thanks for Reply, For example i have a Keyfigure as XXX with scaling factor as 1000.
    The overall result for XXX is 253*1000 = 253,333.359
    The overall result displayed in a BW web report is 253.
    When we download the data to Excel it shows the value as
    253,333.359.Which is correct.
    The same function when we download to CSV format we can only see the total as 253*1000.
    Hope this explains.
    Cheers,
    Suresh.

  • Increase width for Excel and CSV reports

    HI ,
    I am having problem with data in Excel and CSV reports , since the data is large and the width of the column is fixed its is displaying ###### ,
    can u suggest me how to make the wodth of the columns variable depending upon the data passed.
    I want to know how to increase the width of column in Excel and csv reports dynamically.
    Thanks & Regards
    Dipty

    What has this to do with JSF?
    It is obvious that it is a setting/bahaviour of Excel. Just doubleclick at the right column border, then it will be widen according to the largest cell contents.

  • Excel Connection Manager suddenly can no longer connect to Excel from SSIS package

    <p>During the last 3 months, I used 32 bit SSIS 2008 (v 10.50.2500.0) on an WinXp machine (v 5.1.2600 SP3 Build 2600) to create a package that writes multiple query results (reports) to an excel spreadsheet. Each report is written to a different
    tabbed sheet in the same spreadsheet. </p><p>The package was&nbsp;working just fine until May 9 2013, when suddenly every single&nbsp;Data Flow task with an Excel Destination&nbsp;displayed error icons and raised the&nbsp;following
    error message when opening the Advanced Editor:</p><p>SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005 Description: "Unspecified error". <br />Error at &lt;DataFlow task name&gt;: SSIS
    error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager &lt;Excel connection Manager&gt; failed with error code 0xC0202009. There may be error messages posted before this with more
    information on why the Acquire Connection method call failed. Exception from HRESULT: 0Xc020801c (Microsoft.SQlServer.DTSPipelineWrap)</p><p>Originally the error message reported that the Error Code was "0x8000FFFF", but I can't seem
    to reproduce that error code since. Now I am only getting the above error message.</p><p>From the time I created the original package (when it worked fine) until now, I have been using the same computer, writing to a (32 bit) 2010 Excel file in
    a local folder. The filename and location have not changed. The ConnectionString has not changed. The Connnection String I am using is Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Conversion\Conversion Results_dt01.xlsx;Extended Properties="EXCEL
    12.0 XML;HDR=YES;". </p><p>Now an attempt to create and test a NEW Connection Manager yields me this error. "Test connection failed because of an error in initializing provider. Unspecified error.",&nbsp; whereas before I had
    no problems creating a new connection manager.</p><p>I checked a second SSIS package, which I also built during the past 3 months, which loads multiple sheets from multiple Excel files to a SQL Server 2008 database holding table. It uses the same
    ACE OLE DB 12.0 connection to load the Excel speadsheets and this package continues to work fine on the same workstation.</p><p>In desparation, wondering if the Microsoft ACE OLE DB 12.0 driver had become corrupt (even though the second package
    was raising no errors), I did download and install the Microsoft ACE OLE DB 12.0 driver.&nbsp; That did not solve my problems with the first package.</p><p>I need to get this package running again ASAP as it is targeted for UAT testing in a
    matter of days. Any help with this issue would be greatly appreciated!</p>

    I submitted this issue above and now I am having the same problem again. I am using the same local computer, the same operating system (WinXp v 5.1.2600 SP3 Build 2600) as originally described. I am working with the same SSIS package that
    writes multiple query results (reports) to an excel spreadsheet. This package has been successfully executed multiple times, but now I am suddenly getting the same error as follows:
    Error at 1ConversionContacts [Connection manager "Excel Connection Manager"]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available.  Source: "Microsoft Access Database Engine"  Hresult: 0x80004005  Description: "Unspecified error".
    Error at DFlow Write soft deleted duplicate claims to Excel sheet [Excel Destination - write duplicate claim nbrs that have been removed to Excel [61]]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method
    call to the connection manager "Excel Connection Manager" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
    The package will not run because of these multiple errors (multiple because it occurs on every single excel destination in the package).
    I have Run64BitRuntime set to false on the project. I have triple checked that the excel file name (which I created and can access) exists with the correct name in the correct path, which is local on my machine. The file is the same file in the same
    location as when the package worked.  I am running the SSIS service under my own network login, as I was when the package worked. I have been consistently getting this same error whenever I change my network password without updating the password
    in the SSIS service, but I have triple verified that the service is using my latest password. If I try to open and edit the Excel Destination in any DataFlow task I get the same error. I can successfully create a new Excel Connection Manager pointing
    to the same excel file. However if I try to assign the newly created Excel Connection Manager in the data flow, I cannot activate the drop down to choose the Excel sheet without getting an 'Unspecified error' message. I then swapped out
    the file with its template version, and ensured the name was updated as correct. I still get the same errors.
    Oh, and the SSIS package is extracting data from a SQL Server 2008 database with an ADO.net Connection Manager using Windows authentication. I have no problems with the SQL Server connection, it has always worked and still does.  It is only
    the connection to excel output file which is locally stored on my machine.
    Has anyone got any suggestions for me?

  • Getting error while trying to upload the data in excel from SSIS package through sql agent job

    We are getting below errors.
    Error:
    The Microsoft Jet database engine cannot open the file '\\serversdev\Documents\QC Files\Prod.xls'. It is already opened exclusively by another
    user, or you need permission to view its data.
    Please suggest ASAP
    Regards,
    Ramu
    Ramu Gade

    Hi Dikshan Gade,
    According to your description, you want to upload data from excel to database, when you call ssis package through SQL Server Agent job, you got the error message.
    To troubleshoot the problem, please refer to the following steps:
    Validate that the account has permissions on the file and the folder.
    Verify that the file and the data source name (DSN) are not marked as Exclusive.
    Make sure SQL Server Agent Services service account has the permission to access the database.
    We can check SQL Server Agent’s activity logs, Windows Event logs and SSIS logs to get more clues. Also the tool Process Monitor is helpful to track the cause of registry or file access related issues. For more information about the issue, please refer to
    the following KB article:
    http://support.microsoft.com/kb/306269
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Difference b/w Loading a Flat File made from EXCEL and NOTEPAD

    Hi
    Is there any difference in Loading a flat file made from MS-Excel and Note Pad. Imean performance or errors etc....
    GSR

    S R G,
    Theres no much difference only that when loading from excel we store excel in CSV format.  In notepad we use seperators like comma aand write one row at a time, then next....
    Rest everything is same...
    thats y it is preferable to load from excel as it is easier to represent and create...

  • APEX Report Data Download in Excel and PDF format

    Hi,
    Can someone please guide me how to download APEX report data in Excel and PDF format.I know this is possible through BI Publisher but that is extra Licence cost for client so i don't want to use that option.
    Thanks in advance.
    Regards
    Prabhat Mishra

    1005844 wrote:
    Hi ,
    Thanks for Reply,
    I am using APEX 4.2 but when i am trying to download the IR data then getting 3 options only(CSV,HTML and Email).
    PrabhatWell, Excel should understand the .csv format for offloads. Perform web seraches to see what can be done for pdfs

  • Download as a CSV file (excel)

    hi all,
    I am trying to download it as a CSV file (local and unix files), but when i get the data in excel , the issue occurs is:
    F1     F2     F3                                        
    OU Code     OU Name     OU Description                                        
    0000010000     0000010000-PG/US/PRIM CARE                                             
    0000010001     0000010001-PG/US/APOTH COMMODIT     APOTHECON COMMODITY                                        
    note: in the first line iam getting as F1,F2 & F3. i dont want these to come, rest all iam getting it perfectly.
    For downloading it i used the below code:
    *&      Form  DOWNLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM DOWNLOAD_FILE .
    **Add column headers
      clear x_out_prctr.
      x_out_prctr-prctr = 'OU Code'.
      x_out_prctr-ktext = 'OU Name'.
      x_out_prctr-ltext = 'OU Description'.
      x_out_prctr-OUTNAME = 'OU Type Name'.
      x_out_prctr-OTNAME = 'Organization Type Name'.
      x_out_prctr-POUCODE = 'Parent OU'.
      x_out_prctr-STATUS =  'Status'.
      x_out_prctr-OUOUNAME = 'OU Owner'.
      x_out_prctr-OUAUNAME = 'OU Assistant'.
      x_out_prctr-OUCUNAME = 'OU Controller'.
      x_out_prctr-OUMRUNAME = 'OU MSP Rep'.
      Insert x_out_prctr into it_out index 1.
    Insert x_out_prctr into it_out1 index 1.
      clear x_out_prctr.
      IF p_local = c_x.
        perform gui_download.
      elseif p_unix = c_x.
        open dataset p_file for output in text mode encoding non-unicode
            ignoring conversion errors.
        if sy-subrc = 0.
    *-For Profit Center
          loop at it_out into x_out_prctr.
            transfer x_out_prctr to p_file.
            if sy-subrc ne 0.
              write:/ 'Error writing file'(011), p_file.
              stop.
            endif.
          endloop.
        endif.
      Close dataset
        close dataset p_file.
      endif.
    ENDFORM.                    " DOWNLOAD_FILE
    *&      Form  GUI_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM GUI_DOWNLOAD .
      DATA : lv_fname TYPE string.
      CLEAR lv_fname.
      lv_fname = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = lv_fname
          FILETYPE                = 'DBF'
        TABLES
          DATA_TAB                = it_out
        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.
    ENDFORM.                    " GUI_DOWNLOAD
    could any one solve my issue ASAP?
    Regards,
    Shalini

    Hi Karthik,
    when i give the file type as ASC it  is not working, The column heading are getting messed up when i use this. the column heading is coming in one text line. but when i changed it to other one...everthing is working fine...but....in the downloaded file in the first line iam getting the F1 ,F2, F3 ..which i dont want it. if i delete this line my problem will be solved.
    my program code is:
                     Includes                                            *
    *--- BMS standard header and footer routines
    INCLUDE zsrepthd.
    *--- ALV Routinesg
    INCLUDE zvsdi_alv_routines_ver3.
    *--- Authorization Check
    INCLUDE z_selection_auth_check.
                     Types Declarations                                  *
    **-Profit Center
    *-For CEPC table
    TYPES: BEGIN OF ty_cepc,
            prctr TYPE prctr,
            datbi TYPE datbi,
           END OF ty_cepc.
    *-For CEPCT table
    TYPES: BEGIN OF ty_cepct,
            prctr TYPE prctr,
            datbi TYPE datbi,
            ktext TYPE ktext,
            ltext TYPE ltext,
           END OF ty_cepct.
    *-Output field name
    TYPES: BEGIN OF ty_output,
            prctr(10) TYPE c,
            ktext(40) TYPE c,
            ltext TYPE ltext,
            OUTNAME(13) TYPE c,
            OTNAME(30) TYPE c,
            POUCODE(13) TYPE c,
            STATUS(8) TYPE c,
            OUOUNAME(17) TYPE c,
            OUAUNAME(30) TYPE c,
            OUCUNAME(30) TYPE c,
            OUMRUNAME(17) TYPE c,
           END OF ty_output.
                     Internal Table Declarations                         *
    DATA:
    *--- Alv parameters
         it_out_alvp TYPE typ_alv_form_params, "for alv parameters
    **--To store prctr for profit center data
         it_profit_prctr type standard table of ty_cepc,
    **--To store text for profit center data
         it_text_prctr type standard table of ty_cepct.
    **--To store output for profit center data
    DATA: BEGIN OF it_out occurs 0,
            prctr(10) TYPE c,
            ktext(40) TYPE c,
            ltext TYPE ltext,
            OUTNAME(13) TYPE c,
            OTNAME(30) TYPE c,
            POUCODE(13) TYPE c,
            STATUS(8) TYPE c,
            OUOUNAME(17) TYPE c,
            OUAUNAME(30) TYPE c,
            OUCUNAME(30) TYPE c,
            OUMRUNAME(17) TYPE c,
           END OF it_out.
                     Work Area Declarations                              *
    DATA: x_profit_prctr type ty_cepc,
          x_text_prctr type ty_cepct,
          x_out_prctr type ty_output,
                     Data Declarations                                   *
          v_prctr TYPE cepc-prctr,
          l_prctr(10) TYPE c,
          l_ktext(40) TYPE c.
                     Constants Declarations                              *
    CONSTANTS: c_0  TYPE char1 VALUE '0',
               c_x  TYPE char1 VALUE 'X'.
                     Selection Screen                                    *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-fr1.
    SELECT-OPTIONS:  s_prctr FOR v_prctr.
    PARAMETERS:      p_date TYPE sy-datum OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-fr2.
    PARAMETERS: p_local RADIOBUTTON GROUP rb1 USER-COMMAND cmd DEFAULT 'X',
                p_unix  RADIOBUTTON GROUP rb1,
                p_file TYPE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK b2.
                     Initialization                                      *
    INITIALIZATION.
                     At Selection Screen                                 *
    AT SELECTION-SCREEN.
                     At Selection value request                          *
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      IF p_local = c_x.
    *--- Getting F4 help for Costcenter file
        PERFORM get_filename CHANGING p_file.
      ELSEIF p_unix = c_x.
        MESSAGE i999(zi) WITH 'This fucntion is not available'(i01).
      ENDIF.
                     Start-of-Selection                                  *
    START-OF-SELECTION.
    *--- Check Authorizations for Selection-screen
      PERFORM z_selection_auth_check.
    **-- Get the profit center data from tables CEPC,CEPCT
      PERFORM f_get_profitcenter.
                     End-of-Selection                                    *
    END-OF-SELECTION.
    **-- Download data to final internal table.
      PERFORM data_output.
      IF NOT it_out[] IS INITIAL.
    *--- Fill the structure for calling the ALV form
        PERFORM initialize_alv_params.
    **-- Display ALV Report
        PERFORM setup_and_display_alv_ver2
           USING
            it_out_alvp      "Parameter structure
            it_out[]         "Internal Data table(header table)
            it_out[].        "Dummy table for Hierarchical ALV!!(item table)
    **-- Down load to excel.
        PERFORM download_file .
      ENDIF.
    *&      Form  f_top_of_page
    *This is to write the top of page
    FORM top_of_page.
      DATA:  lt_list TYPE slis_t_listheader,
             lx_list TYPE slis_listheader.
    *--- Title name
      CLEAR lx_list.
      lx_list-typ  = 'S'.
      lx_list-key  = 'Title name'(t13).
      lx_list-info = sy-title.
      APPEND lx_list TO lt_list.
      IF NOT lt_list IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary = lt_list.
      ENDIF.
    ENDFORM.                    "top_of_page
    *&      Form  init_page_head
    Description : This subroutine initializes the fields in table BHDGD  *
                  for printing the report heading.                       *
    FORM init_page_head.
      bhdgd-line1  = 'Profit Center Extraction'(h04).
      bhdgd-line2  = sy-title.
      bhdgd-lines  = sy-linsz.
      bhdgd-fcpyrt = sy-uline.
      bhdgd-inifl  = '0'.
    ENDFORM.                    "init_page_head
    *&      Form  initialize_alv_params
    Description : Form to initialize ALV Params
    FORM initialize_alv_params.
      CONSTANTS: lc_alv_grid  TYPE char1 VALUE 'G',  "Grid
                 lc_u         TYPE char1 VALUE 'U'.
      MOVE 'IT_OUT' TO  it_out_alvp-tablname.   "final TABLE
      MOVE sy-repid    TO   it_out_alvp-repid.
      MOVE lc_alv_grid TO   it_out_alvp-alvtype.
      MOVE c_x         TO   it_out_alvp-bringdefaultvar.
      MOVE lc_u        TO   it_out_alvp-variantsavetype.
    ENDFORM.                    " initialize_alv_params
          FORM it_out_init_events                                       *
    -->this is form is to modify the events
    FORM it_out_init_events
          CHANGING
           alevnts TYPE slis_t_event.
      FIELD-SYMBOLS <alevnt> TYPE slis_alv_event.
      LOOP AT alevnts ASSIGNING <alevnt>.
        CASE <alevnt>-name.
          WHEN  slis_ev_top_of_page.
            MOVE 'TOP_OF_PAGE'  TO <alevnt>-form.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "it_out_init_events
    *&      Form  get_filename
    Description : This subroutine is used for F4 Prompting
    FORM get_filename CHANGING p_path LIKE rlgrap-filename.
      DATA : l_file  LIKE ibipparms-path, "Local file for upload/download
             l_repid LIKE syst-cprog,     "ABAP program, caller in external
                                          "procedures
             l_dynnr TYPE syst-dynnr.     "Current screen No
      l_repid = syst-cprog.
      l_dynnr = syst-dynnr.
    *--- Function module used for F4 help
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = l_repid
          dynpro_number = l_dynnr
        IMPORTING
          file_name     = l_file.
      MOVE l_file TO p_path.
    ENDFORM.                    " get_filename
    *&      Form  F_GET_PROFITCENTER
    *Get the profit center data from CEPC,CEPCT
    FORM f_get_profitcenter.
      SELECT prctr
             datbi
             from cepc
             into table it_profit_prctr
             where prctr in s_prctr
             and   datbi >= p_date.
      IF sy-subrc = c_0.
        SORT it_profit_prctr BY prctr datbi.
      ENDIF.
      If not it_profit_prctr is initial.
        SELECT prctr
               datbi
               ktext
               ltext
               from cepct
               into table it_text_prctr
               for all entries in it_profit_prctr
               where prctr = it_profit_prctr-prctr
               and   datbi = it_profit_prctr-datbi.
        IF sy-subrc = c_0.
          SORT it_text_prctr BY prctr datbi ktext ltext.
        ENDIF.
      endif.
    ENDFORM.                    " F_GET_PROFITCENTER
    *&      Form  DATA_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM DATA_OUTPUT .
      loop at it_profit_prctr into x_profit_prctr.
        read table it_text_prctr into x_text_prctr with key prctr =
                                                x_profit_prctr-prctr
                                                            datbi =
                                                x_profit_prctr-datbi.
        if sy-subrc = 0.
          x_out_prctr-prctr = x_text_prctr-prctr.
          concatenate x_text_prctr-prctr x_text_prctr-ktext into l_ktext
           separated by '-'.
          x_out_prctr-ktext = l_ktext.
          x_out_prctr-ltext = x_text_prctr-ltext.
          x_out_prctr-outname = 'Profit Center'.
          x_out_prctr-status = 'Active'.
        endif.
        append x_out_prctr to it_out.
      endloop.
    ENDFORM.                    " DATA_OUTPUT
    *&      Form  DOWNLOAD_FILE
          text
    -->  p1        text
    <--  p2        text
    FORM DOWNLOAD_FILE .
    **Add column headers
      clear x_out_prctr.
      x_out_prctr-prctr = 'OU Code'.
      x_out_prctr-ktext = 'OU Name'.
      x_out_prctr-ltext = 'OU Description'.
      x_out_prctr-OUTNAME = 'OU Type Name'.
      x_out_prctr-OTNAME = 'Organization Type Name'.
      x_out_prctr-POUCODE = 'Parent OU'.
      x_out_prctr-STATUS =  'Status'.
      x_out_prctr-OUOUNAME = 'OU Owner'.
      x_out_prctr-OUAUNAME = 'OU Assistant'.
      x_out_prctr-OUCUNAME = 'OU Controller'.
      x_out_prctr-OUMRUNAME = 'OU MSP Rep'.
      Insert x_out_prctr into it_out index 1.
    Insert x_out_prctr into it_out1 index 1.
      clear x_out_prctr.
      IF p_local = c_x.
        perform gui_download.
      elseif p_unix = c_x.
        open dataset p_file for output in text mode encoding non-unicode
            ignoring conversion errors.
        if sy-subrc = 0.
    *-For Profit Center
          loop at it_out into x_out_prctr.
            transfer x_out_prctr to p_file.
            if sy-subrc ne 0.
              write:/ 'Error writing file'(011), p_file.
              stop.
            endif.
          endloop.
        endif.
      Close dataset
        close dataset p_file.
      endif.
    ENDFORM.                    " DOWNLOAD_FILE
    *&      Form  GUI_DOWNLOAD
          text
    -->  p1        text
    <--  p2        text
    FORM GUI_DOWNLOAD .
      DATA : lv_fname TYPE string.
      CLEAR lv_fname.
      lv_fname = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                = lv_fname
          FILETYPE                = 'DBF'
        TABLES
          DATA_TAB                = it_out
        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.
    ENDFORM.                    " GUI_DOWNLOAD
          FORM it_out_alv_fieldcat_before                               *
    -->  PT_FCAT                                                       *
    -->  ALVP                                                          *
    FORM it_out_alv_fieldcat_before  CHANGING
        pt_fcat TYPE slis_t_fieldcat_alv
        alvp TYPE typ_alv_form_params.
      DATA: lx_fcat TYPE slis_fieldcat_alv.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'PRCTR'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Code'(010).
      lx_fcat-seltext_m      = 'OU Code'(010).
      lx_fcat-seltext_s      = 'OU Code'(010).
      lx_fcat-reptext_ddic   = 'OU Code'(010).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'KTEXT'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Name'(030).
      lx_fcat-seltext_m      = 'OU Name'(030).
      lx_fcat-seltext_s      = 'OU Name'(030).
      lx_fcat-reptext_ddic   = 'OU Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'LTEXT'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Description'(040).
      lx_fcat-seltext_m      = 'OU Description'(040).
      lx_fcat-seltext_s      = 'OU Description'(040).
      lx_fcat-reptext_ddic   = 'OU Description'(040).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUTNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Type Name'(013).
      lx_fcat-seltext_m      = 'OU Type Name'(013).
      lx_fcat-seltext_s      = 'OU Type Name'(013).
      lx_fcat-reptext_ddic   = 'OU Type Name'(013).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OTNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Organization Type Name'(030).
      lx_fcat-seltext_m      = 'Organization Type Name'(030).
      lx_fcat-seltext_s      = 'Organization Type Name'(030).
      lx_fcat-reptext_ddic   = 'Organization Type Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'POUCODE'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Parent OU Code'(013).
      lx_fcat-seltext_m      = 'Parent OU Code'(013).
      lx_fcat-seltext_s      = 'Parent OU Code'(013).
      lx_fcat-reptext_ddic   = 'Parent OU Code'(013).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'STATUS'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Status'(008).
      lx_fcat-seltext_m      = 'Status'(008).
      lx_fcat-seltext_s      = 'Status'(008).
      lx_fcat-reptext_ddic   = 'Status'(008).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUOUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Owner User Name'(017).
      lx_fcat-seltext_m      = 'OU Owner User Name'(017).
      lx_fcat-seltext_s      = 'OU Owner User Name'(017).
      lx_fcat-reptext_ddic   = 'OU Owner User Name'(017).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUAUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Assistant User Name'(030).
      lx_fcat-seltext_m      = 'OU Assistant User Name'(030).
      lx_fcat-seltext_s      = 'OU Assistant User Name'(030).
      lx_fcat-reptext_ddic   = 'OU Assistant User Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUCUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU Controller User Name'(030).
      lx_fcat-seltext_m      = 'OU Controller User Name'(030).
      lx_fcat-seltext_s      = 'OU Controller User Name'(030).
      lx_fcat-reptext_ddic   = 'OU Controller User Name'(030).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUT'.
      lx_fcat-fieldname      = 'OUMRUNAME'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'OU MSP Rep User Name'(017).
      lx_fcat-seltext_m      = 'OU MSP Rep User Name'(017).
      lx_fcat-seltext_s      = 'OU MSP Rep User Name'(017).
      lx_fcat-reptext_ddic   = 'OU MSP Rep User Name'(017).
      APPEND lx_fcat TO pt_fcat.
    ENDFORM.                    " it_out_alv_fieldcat_before
    Thanks & Regards,
    Shalini

  • SSIS 2012 - Use OPENROWSET in SSMS and SSIS

    HI Experts , 
    I am getting very much confused with 64 bit ,31 bit environment in SQL server, SSIS and MS office , Accessdatabase engine
    which I want to use for ETL as what should be the combination
    My scenario - I have written an SP with  OPENrowset to be used  in EXECUTE SQL TASK and load data into SQL Table
    example 
    SELECT * into myTable 
         FROM OPENROWSET (
        'Microsoft.ACE.OLEDB.12.0',
        'Excel 12.0;Database=E:\SourceFolder\Department.xlsx;HDR=YES;IMEX=1',
        'SELECT * FROM [Sheet1$]');
    My SQL SERVER version is :: 
    Microsoft SQL Server 2012 - 11.0.2316.0 (X64) 
    Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)
    MS OFFICE 2010, 64 Bit 
    After executing 
    sp_configure 'show advanced options', 1;
    RECONFIGURE;
    sp_configure 'Ad Hoc Distributed Queries', 1;
    RECONFIGURE;
    My OPENROWset query Store Procedure is working fine in SSMS but when I executed Same SP in EXECUTE SQL TASK ,it failed .
    Also I was not able to used Excel as a Source , I forgot the error but it did not even allowed me to select a sheet Name in Excel Source..
    After doing bit of google I found that we need to have MS office 2010 in 32 bit because our BIDS is 32 Bit .
    I asked my admin team to uninstall MS office 2010 64 bit and Install 32 bit version.
    Now my versions are 
    SQL server 2012 , 64 bit 
    MS office 32 bit 
    Now
    1) I am able to Take excel sheets as Source in SSIS Excel Source transformation but package fail 
    2) SP with OPENROWSET Query in which was running fine earlier in SSMS  is also throwing error
    3) and Execute SQL TASK with same SP in SSIS are  throwing error ..
    NOW I Installed AccessDatabaseEngine i.e. 32-bit but same issue 
    "The 32-bit OLE DB provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server"
    PLEASE TELL ME THE COMBINATION .. I cannot reinstall SQL SERVER but definately MS OFFICE VERSION AND ACCESSdatabase engine version
    I WANT 
    1) MY OPENROW SET QUERY CAN RUN BOTH IN SSMS and Execute SQL Task (SSIS).
    2) I can use Excel as a Source in SSIS Package (with out making RUN64bitRUNTIME to FALSE )
    PLEASE ASSIST

    Hi Visakh , 
    I might sound stupid asking almost same things again even after reading the Link but thing are not very clear with me and I am  still getting an error while running 
    SELECT * --INTo productlist
    FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
        'Excel 12.0 Xml;HDR=YES;Database=D:\Mushtaq\ExcelS\Dept.xlsx',
        'SELECT * FROM [S$]'
    both IN SSMS and Execute SQL Task(Even after making Runas64bit to FALSE) ..
    [Execute SQL Task] Error: Executing the query "SELECT * 
    INTO productlist
     FROM OPENROWSET
    ('Micro..." failed with the following error: 
    "OLE DB provider 'Microsoft.ACE.OLEDB.12.0' 
    cannot be used for distributed queries because the provider is configured 
    to run in single-threaded apartment mode.". 
    Possible failure reasons: Problems with the query, 
    "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
    I have also executed below Query in SSMS but no luck:
    USE [master]
    GO
    sp_configure 'show advanced options', 1
    GO
    RECONFIGURE WITH OverRide
    GO
    sp_configure 'Ad Hoc Distributed Queries', 1
    GO
    RECONFIGURE WITH OverRide
    GO
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' ,  N'AllowInProcess' ,  1
    GO
    EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' ,  N'DynamicParameters' ,  1
    GO
    But NOO Luck :(
    I need to know what is wrong or missing in my Current environment to execute them in SSMS and SSIS
    My Environment.
    1)SQL SERVER 2012 64 Bit
    2)MS office 32 Bit
    3)MicrosoftAccessDataBase Engine 2010 -32 Bit .. 
    Please assist..

  • Read data from Excel and write into oracle database

    Hi
    I want  to know how can i read data from excel and write into oracle database using java.Kindly help me out to find a solution.
    Thanks and Regards
    Neeta

    Hai,
    I am suggesting the solution.
    I will try out and let u know soon.
    Make a coma separated file from your excel file.
    Assuming that your requirement allows to make a csv file.
    This file may be passed as an file object to be read by java.Using JDBC you must be able to populate the data base.You can also use String Tokenizer if needed.
    You do not want to  go via sql Loader?
    For reading the excel file itself do you want java?

Maybe you are looking for

  • DVI- HDMI discoloration on HDTV (as second monitor)

    Hello all. I have been having some issues when using my Philips CRT 30" 1080i HDTV as a second monitor via a DVI->HDMI cable. There seems to be a discoloration that occurs (my best guess being a "green" discoloration) that occurs in the top left corn

  • MacBook to 47 inch LCD Television

    I am trying to figure a way to take what is playing (movie)on my MacBook and display it in high quality on my 47 inch LCD TV. I have the AppleTV, but can't around the syncing issue (port error) and want to figure out a way through cables to display a

  • G5 dualcore kernal panic. bad ram? bad speaker connection? both?

    i've got a new G5 dual core 2.3 and i have this problem. i've got a pair of polk pc speakers that plug into the back of this machine in the audio input (mini phono) and work fine. when i first got the machine, i also installed a matching pair of king

  • Cand change the slide show ?

    hello, can change http://mdphoto.ro/poze/Moni/flashgallery.html you reach the final picture and then give the next automatically take me to the second picture. can this be?

  • SSRS Print one row then detail urgent...

    hi all, I have a report that has two sections of data. In a list component with textboxes I have Barcode, warehouse location, pallets. Then below this I have detail information in a tablix including Racklocation Use by date, Qty, Product, Description