Ultrasearch Connection string format issue
Hi,
I have been wrestling with Ultrasearch installation and keep encountering this error when I attempt to load the Ultrasearch Portlet in the 10G MT.
oracle.ultrasearch.query.SearchException: WKG17005: connection failure: Io exception: Invalid connection string format, a valid format is: "//host:port/service_name"
My data_sources.xml file is configured as follows:
<data-source
class="oracle.jdbc.pool.OracleConnectionCacheImpl"
name="UltraSearchDS"
location="jdbc/UltraSearchPooledDS"
username="Ultrasearch"
password="*******"
url="jdbc:oracle:thin:@//hostname:1521:sid"
inactivity-timeout="30"/>
I have verified the setup of the Ultrasearch user in the database, and have verified the Ultrasearch.properties file setup.
I'm not sure if TNS is setup correctly or if the DAD settings for the portal have something to do with this - I was not able to find any referecne to configuration of those files in the Oracle Documenation.
Any help would be greatly appreciated.
Regards,
Roy
Roy
"jdbc:oracle:thin:@//hostname:1521:sid" isn't a valid url. You have to remove the "//", i.e. "jdbc:oracle:thin:@hostname:1521:sid".
The syntax "//host:port/service_name" is used when to want to use a service name instead of SID.
HTH
Chris
Similar Messages
-
WorkflowCA: TNS Connection String format not recognised
When I launch the scripts /wfinstall.csh, I get following error message:
[oracle@blmcqb install]$ Workflow Configuration Assistant - Linux
4
Parameter "wfdir" = /oracle/product/10.2.0/MPROD/wf
Parameter "orahome" = /oracle/product/10.2.0/MPROD
WorkflowCA: /oracle/product/10.2.0/MPROD/wf/install/workflow.log
WorkflowCA:
WorkflowCA: Workflow Configuration in progress...
WorkflowCA: Thu Mar 08 14:51:26 EST 2007
WorkflowCA:
WorkflowCA: Screen width -1024-, screen height -768-
WorkflowCA: TNS Connection String format not recognised
WorkflowCA:
WorkflowCA: Graphics User Interface mode
WorkflowCA:
WorkflowCA: Thu Mar 08 14:51:58 EST 2007
WorkflowCA: Invalid connect methodTWO_TASK=]
WorkflowCA: Terminating..
However, I can access the database without any problem:
[oracle@blmcqb install]$ tnsping OWBLAB
TNS Ping Utility for Linux: Version 10.2.0.3.0 - Production on 08-MAR-2007 15:01:24
Copyright (c) 1997, 2006, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = blmcqb)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = OWBLAB)))
OK (0 msec)
[oracle@blmcqb install]$ sqlplus sys/rootpasswd@owblab as sysdba
SQL*Plus: Release 10.2.0.3.0 - Production on Thu Mar 8 15:02:05 2007
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> select name, open_mode from v$database;
NAME OPEN_MODE
OWBLAB READ WRITE
Does any expert has any idea?I got the same error. Then I gave whole string to ./wfinstall and then the Installation pass ok!
Like: (DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = rubik.my.domain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = rubikdb.my.domain)))
Best Regards Antti -
IPv6 format connection string 10g
Hi
I am using Oracle 10g driver for java 1.4. I am trying to connect to the db using a connection string with an IPv6 format, for example:
jdbc:oracle:thin:fernando/password@[3ffe:ffff:0:f110::91]:1521:perf11
and I can't get connected. It raises the following exception:
java.sql.SQLException: Io exception: Invalid connection string format, a valid format is: "host:port:sid"
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:363)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:401)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:441)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:839)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:193)
Can anybody tell me what have I forgotten or done wrong?
Thank in advanceI have the same queestion:
Can we connect to the Oracle database using a connection string with an IPv6 format? I have no problem using hostname, but would like to know if IPv6 address is supported in db connection url?
Thanks! -
We're having a problem connecting to one of our databases using JDBC thin. There seem to be two formats for the connection strings:
jdbc:oracle:thin:@opctest.deq.state.ms.us:1522:TEST8131
jdbc:oracle:thin:@//opctest.deq.state.ms.us:1522/TEST8131
From a java app, the first throws an "Io exception: Invalid connection string format, a valid format is: "//host:port/service_name" " error; the second throws a TNS-12514: TNS:listener does not currently know of service requested in connect descriptor error.
What confuses me more is that if I test this string from a JSP page:
jdbc:oracle:thin:@opctest.deq.state.ms.us:1522:test8131
it connects fine.
The environment is Oracle9i on Red Hat, running MTS. Java app is running on WinXP. Anyone have an idea what's going on?
Thanks,
HarryI can see a couple of issues in your connect string:
1. I see you are using the sid in uppercase, TEST8131 instead of test8131. If you are working on a unix environment this makes a difference, so use the lower case instead.
2. You are using the 1522 port, check with your database administrator if the instance is registered against the 1522 port, otherwise the error TNS-12514 will show up. I will assume it currently works fine since you have declared the jsp using the same address works fine with this port.
3. Ensure the hostname can be solved just exactly the way you have declared it (fully qualified domain) from the perspective where the jdbc program is running.
4. the format described here: opctest.deq.state.ms.us:1522/TEST8131 is known as the EZConnect, and it is a 10g feature.
~ Madrid -
Dynamic excel connection string
Hi,
I have excel file as source, where the file name can be anything; so to fetch the data from the excel file, I wanted to create a dynamic excel connection string.
So these are the following steps I have followed:
1. For Each Loop:
Step 2:
Step 3: Excel Connection string
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Product\Marketing__Products___Services.xlsx;Extended Properties="EXCEL 12.0 XML;HDR=YES";
Connection String Expression : @[User::SourceFolder]+ @[User::SourceFile]
And Below is the error I'm getting
TITLE: Microsoft Visual Studio
The component reported the following warnings:
Error at PlanningIT_Service [Connection manager "Excel Connection Manager"]: The connection string format is not valid. It must consist of one or more components of the form X=Y, separated by semicolons. This error occurs when a connection string
with zero components is set on database connection manager.
Error at PlanningIT_Service: The result of the expression "@[User::SourceFolder]+ @[User::SourceFile]" on property "\Package.Connections[Excel Connection Manager].Properties[ConnectionString]" cannot be written to the property. The expression
was evaluated, but cannot be set on the property.
Choose OK if you want to continue with the operation.
Choose Cancel if you want to stop the operation.
BUTTONS:
OK
CancelHi,
*) Make sure file names are retrieved properly:
A.txt if you have Name and extension under Collection tab - > Retrieve file name
A if you have Name only under Collection tab - > Retrieve file name
C:\Users\sathya\Desktop\Source_Folder\A.txt if you have Fully qualified under Collection tab - > Retrieve file name
*) variable property - Set EvaluateAsExpression = True
Try below links for examples:
http://msdn.microsoft.com/en-us/library/ms345182.aspx
http://mikedavissql.com/2013/09/16/loop-through-excel-files-in-ssis/
http://www.allaboutmssql.com/2012/09/sql-server-integration-services-rename.html
sathya - www.allaboutmssql.com ** Mark as answered if my post solved your problem and Vote as helpful if my post was useful **. -
Oracle connection string - jdbc format
I'm having issues connecting to an Oracle database from asp.net (C#) - Visual Studio 2013.
I've installed odp.net and in my project I see references for System.Data.OracleClient (Framework tab) and Oracle.DataAccess and Oracle.Web (Extensions tab).
Tried all of those, but getting a problem with the connection string.
Our dbas have given us only one format of connection string that will work, listed below:
jdbc:oracle:thin:@ldap://oid.inf.mycompany.com:3060/myserviceName1,cn=OracleContext,dc=ute,dc=mycompanyname,dc=com
This works fine for developers who use Weblogic, but I can't get this to work with C#.
I put the above value in web.config and use the below code:
using System.Data.OracleClient;
//using Oracle.DataAccess.Client;
using (OracleConnection conn = new OracleConnection())
try
conn.ConnectionString = Properties.Settings.Default.sqlConnStr;
//SqlCommand cmd = conn.CreateCommand();
OracleCommand cmd = conn.CreateCommand();
cmd.CommandText = Properties.Settings.Default.sqlQuery1;
cmd.CommandType = System.Data.CommandType.Text;
//cmd.CommandTimeout = 10;
conn.Open();
log.Info("Getting local users from db");
//SqlDataReader dr = cmd.ExecuteReader();
OracleDataReader dr = cmd.ExecuteReader();
while (dr.Read())
using this, I get errors like below:
System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
at:
conn.Open();
another error seen below:
System.ArgumentException: Keyword not supported: 'jdbc:oracle:thin:@ldap://oid.inf.mycompany.com:3060/myserviceName1,cn'.
at:
conn.ConnectionString = Properties.Settings.Default.sqlConnStr;
Even if these errors can be resolved, how would I specify a user id and password for this format of connection string?
Thanks for any help you can provide,Hello simplify,
For issues regarding Oracle, I would suggest that you could post it to the Oracle forum:
https://community.oracle.com/welcome
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
SSRS 2012 - Windows Server 2012 R2 issue with OLEDB Connection String
Hoping someone can help. As stated above, we are running SQL Server 2012 with SP1 on Windows Server 2012 R2. When I create a Data Source as follows in Reporting Services, I receive the following error message. Any thoughts on why this fails? The same data
source works on Windows Server 2008 R2 Enterprise SQL Server 2008 R2.
Data Source type: OLE DB
Connection string: Provider=Microsoft.ACE.OLEDB.12.0;Data Source="\\networknamehere\CSVFiles";Mode=Read;Extended Properties="text;HDR=YES;FMT=CSVDelimited"
ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot create a connection to data source 'CSV_Datasource'. ---> System.Data.OleDb.OleDbException:
Unspecified error
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at Microsoft.ReportingServices.DataExtensions.ConnectionExtension.Open()
at Microsoft.ReportingServices.Diagnostics.DataExtensionConnectionBase.OpenConnection(IProcessingDataSource dataSourceObj, DataSourceInfo dataSourceInfo, IDbConnection conn)
--- End of inner exception stack trace ---;Hi ABAA101,
According to your description, when you use csv file as data source in SSRS 2012 report, you got the error message.
I tested the issue in my local machine, due to some policy restrictions, I could not install Access in my local machine. To workaround the issue, we can use the connection string like below:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\report;
Extended Properties="text;HDR=Yes;FMT=Delimited"
The csv file is stored in report folder in C driver.
In Query text box in the dataset, we can use the query like below:
Select * from new.csv
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
I need help. (format for DB Connect String and Parameters)
I do not understand the DB Connect String
or the Other Parameters
in the DB Connect String whats the format
Can someone point to some help for using
the Oracle Reports Paper Report TesterHello,
DB Connect String : Like for other tools (SQL*Plus / ..; ) provide a string like
user/password@dbalias
Other parameters : if you have created parameters in your Reports, you can specify their value here.
Example : a parameter P_PARAM is defined in your Reports, you can set the value of "Other parameters" :
P_PARAM=my_value
Regards -
TimesTen issue with connection string on a 64-bit system
Hello dear members,
I need to write code in vbscript that is creating a connection to oracle timesten database.
The TimesTen database is located on a unix server, and the client application is on windows server.
this is my code:
Set mCnTT = CreateObject("ADODB.connection")
mCnTT.ConnectionString = "Provider=MSDASQL.1;DSN=" & TT_DSN & ";" & "TTC_SERVER=" & TT_SERVER & ";" & "TTC_SERVER_DSN=" & TT_SERVER_DSN & ";" & "UID="& TT_UID & ";" & "PWD=" & TT_PWD & ";"
mCnTT.Open
When ran from 64-bit application it will work fine.(I tried it on a stand-alone vbscript)
My problem is that I need this code to work on a 64-bit system server, BUT from a 32-bit application (QTP)
and I'm getting the following error:
"[Microsoft][ODBC Driver Manager] Data Source name not found and no default driver specified"
any idea how to build a connection string that will work? Maybe use a differnet provider?
is MSDAORA provider supporting timesten?
any suggestions will be welcome!
thanks,
RachelSo you will be running a 32-bit application on 64-bit Windows connecting to 64-bit TimesTen on a Unix server; is that correct? Assuming that it is then you need to:
1. Install the 32-bit TimesTen Windows client rather than the 64-bit TimesTen Windows client (a TT 32-bit client will work with a TT 64-server just fine)
2. Use the 32-bit ODBC Administrator applet to configure the DSN rather than the default 64-bit applet
Point (2) is especially important. 32-bit and 64-bit ODBC DDNs are held in completely different places in the Windows registry; 32-bit Apps can't see/use 64-bit DSNs and vice versa.
None of this is directly related to TimesTen; this is all standard Windows 64-bit functionality and issues.
Chris -
Issue in Accessing Azure Diagnostics connection string
Hi Guys,
I'm trying to bring Azure PaaS application in SCOM Monitoring to create custom level monitors and rules, but unable to get discover, getting the message "Storage account for Windows Azure Diagnostics could not be discovered " Event ID 34022.
We have changed the string as suggested in MP Doc, not it is pointing to new changed value "
Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", further digging it looks like there is major changes happened in new Azure SDK 2.5 guess this should be blocking."https://msdn.microsoft.com/en-us/library/azure/dn186185.aspx".Can someone help on this regards,Thanks in Advance!
- Thanks, SaiHi,
In earlier versions of the Windows Azure SDK, the default Windows Azure Diagnostics string provided by the Visual Studio template in the service configuration file was named
DiagnosticsConnectionString. Later Windows Azure SDKs have changed this name to
Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString. By default, however, the SCOM 2007 R2 Windows Azure Management Pack continues to reference the
DiagnosticsConnectionString setting in order to find the storage account from which to collect diagnostics. This has obviously caused some chagrin for those who have deployed new applications and setup SCOM to monitor them only to see no results
in SCOM.
I would like to suggest you go through the two articles below to troubleshoot this issue:
http://robertgreiner.com/2012/05/system-center-operations-manager-windows-azure-storage-account-error/
http://blogs.msdn.com/b/walterm/archive/2012/01/16/resolving-windows-azure-diagnostics-connection-string-issues-with-scom-2007-r2.aspx
Regards,
Yan Li
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
BIAPPS 7.9.6.3 Informatica connect string to PeopleSoft FINSCM issue
I receive tns error when Informatica Workflow runs mappings:
MAPPING> DBG_21075 Connecting to database [PSFTFS.peoplesoft.com], user [SYSADM]
MAPPING> CMN_1761 Timestamp Event: [Sun May 06 18:04:10 2012]
MAPPING> CMN_1022 Database driver error...
CMN_1022 [
Database driver error...
Function Name : Logon
ORA-12154: TNS:could not resolve the connect identifier specified
I created an Application Connection (versus relational) in Informatica Workflow Manager as:
Name:PSFT_9_1_FINSCM
User:SYSADM
Connect String:PSFTFS.peoplesoft.com
The DAC is able to connect to both Informatica repository and integration service ok. I have 11gClient installed and can tsnping and sqlplus to the PeopleSoft database PSFTFS and also can connect using sqldeveloper:
I am able to tnsping PSFTFS
tnsping PSFTFS # nacgdbobil002 - ok
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = nacxxxxxx.oracle.com)(PORT = 10200))
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PSFTFS)))
OK (60 msec)
Also I can connect using sqlplus using full connect string:
sqlplus PSFTFS.peoplesoft.com #nacgdbobil002 - ok
/u100/app/TSTOBI/aptestob2/ora11gClient/product/11.2.0/client_2/bin
sqlplus 'SYSADM/SYSADM@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=nacxxxxxx.oracle.com)(PORT
=10200)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=PSFTFS.peoplesoft.com)))'
The connect string field will not hold all the characters for the full connect string listed above. So should I use a connect string like:
PSFTFS:10200/PSFTFS.peoplesoft.com ??
Do I also need to create a relational connection with the same name as the application connection??
Any other suggestions to get the connection to work for Informatica Workflows?
Thankssolved by adding .peoplesoft.com to tns service name
-
Powershell use Connection String to query Database and write to Excel
Right now I have a powershell script that uses ODBC to query SQL Server 2008 / 2012 database and write to EXCEL
$excel = New-Object -Com Excel.Application
$excel.Visible = $True
$wb = $Excel.Workbooks.Add()
$ws = $wb.Worksheets.Item(1)
$ws.name = "GUP Download Activity"
$qt = $ws.QueryTables.Add("ODBC;DSN=$DSN;UID=$username;PWD=$password", $ws.Range("A1"), $SQL_Statement)
if ($qt.Refresh()){
$ws.Activate()
$ws.Select()
$excel.Rows.Item(1).HorizontalAlignment = $xlCenter
$excel.Rows.Item(1).VerticalAlignment = $xlTop
$excel.Rows.Item("1:1").Font.Name = "Calibri"
$excel.Rows.Item("1:1").Font.Size = 11
$excel.Rows.Item("1:1").Font.Bold = $true
$filename = "D:\Script\Reports\Status_$a.xlsx"
if (test-path $filename ) { rm $filename }
$wb.SaveAs($filename, $xlOpenXMLWorkbook) #save as an XML Workbook (xslx)
$wb.Saved = $True #flag it as being saved
$wb.Close() #close the document
$Excel.Quit() #and the instance of Excel
$wb = $Null #set all variables that point to Excel objects to null
$ws = $Null #makes sure Excel deflates
$Excel=$Null #let the air out
I would like to use connection string to query the database and write results to EXCEL, i.e.
$SQL_Statement = "SELECT ..."
$conn = New-Object System.Data.SqlClient.SqlConnection
$conn.ConnectionString = "Server=10.10.10.10;Initial Catalog=mydatabase;User Id=$username;Password=$password;"
$conn.Open()
$cmd = New-Object System.Data.SqlClient.SqlCommand($SQL_Statement,$conn)
do{
try{
$rdr = $cmd.ExecuteReader()
while ($rdr.read()){
$sql_output += ,@($rdr.GetValue(0), $rdr.GetValue(1))
$transactionComplete = $true
catch{
$transactionComplete = $false
}until ($transactionComplete)
$conn.Close()
How would I read the columns and data for $sql_output into an EXCEL worksheet. Where do I find these tutorials?Hi Q.P.Waverly,
If you mean to export the data in $sql_output to excel document, please try to format the output with psobject:
$sql_output=@()
do{
try{
$rdr = $cmd.ExecuteReader()
while ($rdr.read()){
$sql_output+=New-Object PSObject -Property @{data1 = $rdr.GetValue(0);data2 =$rdr.GetValue(1)}
$transactionComplete = $true
catch{
$transactionComplete = $false
}until ($transactionComplete)
$conn.Close()
Then please try to use the cmdlet "Export-Csv" to export the data to excel like:
$sql_output | Export-Csv d:\data.csv
Or you can export to worksheet like:
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $true
$workbook = $excel.Workbooks.Add()
$sheet = $workbook.ActiveSheet
$counter = 0
$sql_output | ForEach-Object {
$counter++
$sheet.cells.Item($counter,1) = $_.data1$sheet.cells.Item($counter,2) = $_.data2}
Refer to:
PowerShell and Excel: Fast, Safe, and Reliable
If there is anything else regarding this issue, please feel free to post back.
Best Regards,
Anna Wang -
Webi XI report export to excel--- Formatting issue
Post Author: Sougata
CA Forum: WebIntelligence Reporting
We have WEBI report that contains cell with hyperlink. The value of the cell in numeric. Type is string.
When we export this report to excel. In, Excel version is MS-office Excel 2003. In excel it is showing those green with Error --- "NUMBER STORED AS Text".
Any solution?Hi Steve,
As per my understanding, the issue occurs because Excel Destination gets the data from the source. We can change it, but once it re-validates it will change it back. This makes sense since we cannot change the data type in the actual table. To work around
this issue, I suggest that we can add a data conversion or derived column to explicitly cast the values.
Besides, the suggestion post by Arthur means that we can add IMEX=1 to the value of Extended Properties in the connection string of the Excel connection manager in the Properties window to specify Import Mode. For more details about the settings of IMEX,
please see:
https://support2.microsoft.com/kb/194124?wa=wsignin1.0
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Export to Excel formatting Issue
Good Afternoon,
I am trying to export a dataset to excel 2010, however all of the columns are exporting as DT_WSTR although the table that the data is coming from is set correctly either to money or int.
I have tried to change the data type in the advance editor for excel destination, however when I execute the package the data type changes back.
Any idea's?.
Thanks
SteveHi Steve,
As per my understanding, the issue occurs because Excel Destination gets the data from the source. We can change it, but once it re-validates it will change it back. This makes sense since we cannot change the data type in the actual table. To work around
this issue, I suggest that we can add a data conversion or derived column to explicitly cast the values.
Besides, the suggestion post by Arthur means that we can add IMEX=1 to the value of Extended Properties in the connection string of the Excel connection manager in the Properties window to specify Import Mode. For more details about the settings of IMEX,
please see:
https://support2.microsoft.com/kb/194124?wa=wsignin1.0
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
Format issue in opening an XLS attachment sent through email by ABAP2XLSX
I have downloaded the ABAP2XLSX nuggets and tried to send an attachment in the email using the SAP. But when opening the attachment it is giving up an format issue and not able to view the content. I am able to save the XLSX file on the PC and able to read it but when I send it to email it doesn't open correctly and it is in a non readable format. Please find the code that I have been using. Can someone help me on this.
TYPES: BEGIN OF tp_zzrule,
zzprog TYPE zzfunc,
zzdata TYPE zzcri1,
zzseq TYPE zzseq,
zzkey1 TYPE zzkey1,
zzkey2 TYPE zzkey2,
END OF tp_zzrule.
DATA: w_zzrule TYPE tp_zzrule,
t_zzrule TYPE TABLE OF zzourule.
TYPE-POOLS: abap.
DATA: v_document TYPE REF TO cl_document_bcs,
v_recipient TYPE REF TO if_recipient_bcs,
v_main_text TYPE bcsy_text,
v_send_request TYPE REF TO cl_bcs,
v_msub TYPE so_obj_des,
v_size TYPE so_obj_len,
v_string2 TYPE string,
v_attsub TYPE sood-objdes,
v_mailid TYPE ad_smtpadr,
v_sent(1) type c,
v_sent_to_all TYPE os_boolean,
v_string TYPE string,
v_repid TYPE sy-repid,
v_title TYPE so_text255,
v_dochead TYPE so_text255.
DATA lt_test TYPE TABLE OF sflight.
DATA: lo_excel TYPE REF TO zcl_excel,
lo_excel_writer TYPE REF TO zif_excel_writer,
lo_worksheet TYPE REF TO zcl_excel_worksheet,
column_dimension TYPE REF TO zcl_excel_worksheet_columndime.
DATA: ls_table_settings TYPE zexcel_s_table_settings.
DATA: lv_file TYPE xstring,
lv_bytecount TYPE i,
lt_file_tab TYPE solix_tab,
t_objtxt like solisti1 occurs 0 with header line,
t_objbin like solisti1 occurs 0 with header line,
t_objpack like sopcklsti1 occurs 0 with header line,
t_reclist like table of somlreci1 with header line.
DATA: lv_full_path TYPE string,
lv_workdir TYPE string,
lv_file_separator TYPE c.
CONSTANTS: lv_default_file_name TYPE string VALUE 'multi sheet test.xlsx'.
PARAMETERS: p_path TYPE zexcel_export_dir,
p_empty TYPE flag.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
lv_workdir = p_path.
cl_gui_frontend_services=>directory_browse( EXPORTING initial_folder = lv_workdir
CHANGING selected_folder = lv_workdir ).
p_path = lv_workdir.
INITIALIZATION.
cl_gui_frontend_services=>get_sapgui_workdir( CHANGING sapworkdir = lv_workdir ).
cl_gui_cfw=>flush( ).
p_path = lv_workdir.
START-OF-SELECTION.
IF p_path IS INITIAL.
p_path = lv_workdir.
ENDIF.
cl_gui_frontend_services=>get_file_separator( CHANGING file_separator = lv_file_separator ).
CONCATENATE p_path lv_file_separator lv_default_file_name INTO lv_full_path.
SELECT *
INTO TABLE t_zzrule
FROM zzourule
WHERE zzprog = 'RV63A999'.
SELECT * FROM sflight INTO TABLE lt_test.
" Creates active sheet
CREATE OBJECT lo_excel.
For first Sheet in the excel workbook
" Get active sheet
lo_worksheet = lo_excel->get_active_worksheet( ).
lo_worksheet->set_title( ip_title = 'Test sheet one').
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ls_table_settings-show_row_stripes = abap_true.
lo_worksheet->bind_table( ip_table = lt_test
is_table_settings = ls_table_settings ).
lo_worksheet->freeze_panes( ip_num_rows = 3 ). "freeze column headers when scrolling
column_dimension = lo_worksheet->get_column_dimension( ip_column = 'E' ). "make date field a bit wider
column_dimension->set_width( ip_width = 20 ).
For second Sheet in the excel workbook
lo_worksheet = lo_excel->add_new_worksheet( ).
lo_worksheet->set_title( ip_title = 'Second sheet' ).
lo_worksheet->set_cell( ip_column = 'B' ip_row = 2
ip_value = 'This is the test for second sheet by Pavan' ).
ls_table_settings-table_style = zcl_excel_table=>builtinstyle_medium2.
ls_table_settings-show_row_stripes = abap_true.
lo_worksheet->bind_table( ip_table = t_zzrule
is_table_settings = ls_table_settings ).
This will create excel.
CREATE OBJECT lo_excel_writer TYPE zcl_excel_writer_2007.
lv_file = lo_excel_writer->write_file( lo_excel ).
" Convert to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_file
IMPORTING
output_length = lv_bytecount
TABLES
binary_tab = lt_file_tab.
Save the file on to the PC
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = lv_full_path
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).
*--Create and set document with attachment.
v_main_text-line = 'This is the main text not sure where this would print'.
append v_main_text.
TRY.
v_send_request = cl_bcs=>create_persistent( ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
v_msub = 'Test excel with multi sheets.XLS'.
TRY.
v_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = v_main_text
i_subject = v_msub ).
CATCH cx_document_bcs . "#EC NO_HANDLER
ENDTRY.
v_size = lv_bytecount.
*--Add the attachment.
TRY.
v_document->add_attachment( "#EC .., bzw
i_attachment_type = 'EXT'
i_attachment_type = 'XLS'
i_attachment_type = 'RAW'
i_attachment_subject = v_attsub
i_attachment_size = v_size
i_att_content_hex = lt_file_tab ). "#EC .., bzw.
i_att_content_hex = lt_file_tab ). "#EC .., bzw.
CATCH cx_document_bcs . "#EC NO_HANDLER
ENDTRY.
*--Add document object to send request.
TRY.
v_send_request->set_document( v_document ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
*--E-mail recipent list
t_reclist-rec_type = 'U'.
t_reclist-receiver = <email Id here>.
APPEND t_reclist.
CLEAR t_reclist.
LOOP AT t_reclist.
CLEAR v_mailid.
v_mailid = t_reclist-receiver.
*--Create mail recipient object.
TRY.
v_recipient = cl_cam_address_bcs=>create_internet_address( v_mailid ). "#EC .., bzw.
CATCH cx_address_bcs . "#EC NO_HANDLER
ENDTRY.
*--Add recipient object to send request.
TRY.
v_send_request->add_recipient( v_recipient ). "#EC .., bzw.
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
ENDLOOP.
**--Add recipient object to send request.
TRY.
v_sent_to_all = v_send_request->send( i_with_error_screen = 'X' ).
CATCH cx_send_req_bcs . "#EC NO_HANDLER
ENDTRY.
*--Send document.
COMMIT WORK.
IF sy-subrc = 0.
MESSAGE s999(zou01) WITH text-020.
v_sent = 'X'.
ENDIF.I realize this is an old post, but am wondering if you ever resolved this. I'm having the same issue. Download an xlsx file locally opens fine, but attaching the seemingly exact same file throw errors/warnings when trying to open via an email attachment.
Maybe you are looking for
-
How to delete the list that comes up in Open Recent
I apologize because I know this has been answered before, but I cannot find the answer after quite a bit of searching in the forum. I'd like to delete the list that comes up when I choose File/Open Recent and I can't remember how to do that. Could so
-
How to access checkbox in mx:list
I'm trying to access the checkboxes in my list <mx:List itemRenderer="mx.controls.CheckBox" x="0" y="153" id="listVocab" height="297" width="313"></mx:List> but I can't find a way. This is what I'm doing for(var i:int = 0 ; i < listVocab.numC
-
Connecting a Mac to a Window's 2008 small business server
I'm looking to purchase an iMac to use at work. Everyone else in the office uses a PC and are connected to our current Window's 2008 server. I would be the only person using a Mac. Is there any way to connect a Mac to the server?
-
Is there a way to recover pictures that were deleted on the i Pad 2 ??
Is there a way to recover pictures that were deleted on the i Pad 2 ?
-
HT201272 All my iBooks are paused. How do I release them.
I just updated my iPad 2 with 5.1.1. When I transferred my iBooks in from the Store, all the books went into "pause" mode. I can't figure out how to open any of them.