Data download to multiple sheets in Excel without using OLE
Hi,
Please let me know if it is possible to download data to multiple sheets in excel without using OLE method
I am in SRM system and the OLE methods are not working
Please share some sample code or reference links if any
Thanks
SekharJ
Edited by: SekharJ on Sep 8, 2009 8:43 AM
Here is my code
LOOP AT it_final INTO wa_final.
AT FIRST.
l_ixml = cl_ixml=>create( ).
l_document = l_ixml->create_document( ).
l_element_flights = l_document->create_simple_element(
name = 'PO_Details'
parent = l_document ).
ENDAT.
l_element_airline = l_document->create_simple_element(
name = 'PO'
parent = l_element_flights ).
l_value = wa_final-object_id.
l_rc = l_element_airline->set_attribute( name = 'Objectid' value =
l_value ).
l_value = wa_final-description.
l_rc = l_element_airline->set_attribute( name = 'Description' value =
l_value ).
l_value = wa_final-number_int.
l_rc = l_element_airline->set_attribute( name = 'Item' value =
l_value ).
l_value = wa_final-description1.
l_rc = l_element_airline->set_attribute( name = 'Description1' value =
l_value ).
l_value = wa_final-quantity.
l_rc = l_element_airline->set_attribute( name = 'Quantity' value =
l_value ).
l_value = wa_final-capex.
l_rc = l_element_airline->set_attribute( name = 'Capex' value =
l_value ).
l_value = wa_final-ser_num.
l_rc = l_element_airline->set_attribute( name = 'SerialNo' value =
l_value ).
l_value = wa_final-plant.
l_rc = l_element_airline->set_attribute( name = 'Plant' value =
l_value ).
l_value = wa_final-loc.
l_rc = l_element_airline->set_attribute( name = 'Location' value =
l_value ).
l_value = wa_final-bundle.
l_rc = l_element_airline->set_attribute( name = 'Bundle' value =
l_value ).
ENDLOOP.
l_streamfactory = l_ixml->create_stream_factory( ).
l_ostream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xlsx'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Edited by: SekharJ on Sep 8, 2009 12:04 PM
Edited by: SekharJ on Sep 8, 2009 12:15 PM
Similar Messages
-
How to export the data to Multiple sheet in Excel
Hi,
How can I export the data to multiple sheets in excel using Crystal Report XI.
Thanks,
Baski.
Edited by: J_Baskaar on Mar 31, 2010 8:14 AMOne of the 3rd-party Crystal report schedulers listed at http://www.kenhamady.com/bookmarks.html allows you to burst a report so that each group at level 1 becomes a separate worksheet inside a single workbook.
-
Export SQL Server Table into Multiple Sheets in Excel
I'm trying to understand the example here.
http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
Basically, I'm up to step #5.
5. Data Flow Task to populate the created sheet with data for that subject. The Data Flow looks like below
I don't understand this part. Has anyone worked with this sample before? Has anyone gotten this to work? I'm trying to learn SSIS better, but I'm finding it hard to get started with this stuff. I guess if I get a couple projects under
my belt, I'll be fine. The hardest part is getting started.
If anyone feels really ambitions today, maybe you can assist me with two other projects as well.
#1)
http://visakhm.blogspot.in/2011/12/simulating-file-watcher-task-in-ssis.html
#2)
http://sqlage.blogspot.in/2013/12/ssis-read-multiple-sheets-from-excel.html
http://beyondrelational.com/modules/24/syndicated/398/Posts/18163/ssis-how-to-loop-through-multiple-excel-sheets-and-load-them-into-a-sql-table.aspx
I'd greatly appreciate any help I can get with this.
Thanks!!
Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.Hi Ryguy72,
The solution introduced in Visakh’s blog does work. I have written the detailed steps for you:
1. Create an Excel file (Des.xls) as the destination file, rename the Sheet1 to “Excel Destination”, and add four columns: ID, Name, Subject, and Marks.
2. Create an Object type variable Subject, a String type variable SheetName, and a String type variable WorkSheetQuery.
3. Set the value of variable SheetName to “Excel Destination$”, and set the expression of variable WorkSheetQuery to:
"CREATE TABLE `" + @[User::SheetName] + "` (
`ID` Long,
`Name` LongText,
`Subject` LongText,
`Marks` Long
4. In the Execute SQL Task outside the Foreach Loop Container, set its General tab as follows:
ResultSet: Full result set
ConnectionType: OLE DB
Connection: LocalHost.TestDB (e.g. an OLE DB Connection to the source SQL Server table)
SQLSourceType: Direct input
SQLStatement: SELECT DISTINCT [Subject] FROM [TestDB].[dbo].[DynamicExcelSheetDemo]
5. In the Result Set tab of this Execute SQL Task, map result “0” to variable “User::Subject”.
6. In the Collection page of the Foreach Loop Container, set the Enumerator option to “Foreach ADO Enumerator”, and set the “ADO object source variable” to “User::Subject”.
7. In the Variable Mapping page of the container, map variable “User::SheetName” to index “0”.
8. Create an OLE DB Connection Manager to connect to the destination Excel file. Choose the provider as Native OLE DB\Microsoft Jet 4.0 OLE DB Provider, specify the fully qualified path of the Excel file (such as C:\Temp\Des.xls), and set the Extended Properties
option of the Connection Manager to “Excel 8.0”. Click “Test Connection” button to make sure the connection is established successfully.
9. Set the General page of the Execute SQL Task inside the container as follows:
ResultSet: None
ConnectionType: OLE DB
Connection: Des (e.g. the OLE DB Connection to the destination Excel file we create above)
SQLSourceType: Variable
SQLStatement: User::WorkSheetQuery
10. In the Data Flow Task, add an OLE DB Source component, set the connection manager to “LocalHost.TestDB”, set “Data access mode” to “SQL command”, and set the “SQL command text” to:
SELECT * FROM [TestDB].[dbo].[DynamicExcelSheetDemo] WHERE [Subject]=?
11. Click the “Parameters…” button, and map Parameter0 to variable “User::SheetName”.
12. Add an Excel Destination component, setup an Excel Connection Manager to the destination Excel file, set the data access mode to “Table name or view name variable”, and select variable name as “User::SheetName”. In this way, the OLE DB Provider can get
the Excel metadata and enable us to finish the column mappings correctly.
13. Since the Microsoft Jet 4.0 has only 32-bit driver, please make sure to set the Run64BitRuntime property of the IS project to False.
In addition, please note that there will be one useless worksheets “Excel Destination” in the Excel file. We can remove them manually or use a Script Task to delete this worksheet programmatically (need to install .NET Programmability Support feature during
Office installing).
Regards,
Mike Yin
TechNet Community Support -
Send multiple records to rfc without using BPM
Dear Experts,
Could you please help on the following scenario.
I need to send multiple customer master data records from a file to rfc without using BPM.
The following is the mapping i am using
source Target( RFC)
====== =============
Tree occurance type Tree occurance
cust_mt 1..1
customer 0..unbound -
> ztest_cust( rfc ) 1..1
cname 1..1 -
> cname 0..1
cno 1..1 -
> cno 0..1
bank -
> bank 0..1
item : 0..unbound
code -
> code 0..1
name -
> name 0..1
location -
> location 0..1
1. Multiple banks possible for one customer
2. Multiple customers possible in datafile from mdm
Problem 1:Only one customer record from file is being sent to RFC thouth many records are in the file, the second, third .. and so on records not being sent to rfc.
Problem 2:
if add o.. unbound for the rfc occurance, <messages>,<message1> tags are getting added in message mapping, and no single customer record sent to rfc..
Your help is rewarded with good points.
Appreciate your help.
Thanks.
sravya.Hi VJ,
Thank you for the immediate reply.
one more thing, when i tried to change the occurences of ztest_cust( rfc) to 0..unbound,
I am not seeing the occurances updated in the imported rfc structure.
The following is the wsdl for rfc, could you please help me to add occurances 0..unbound.
Thanks a lot.
sraya.
<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" name="ZTEST_CUST" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<wsdl:documentation>
test for mdm
</wsdl:documentation>
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions">
<xsd:element name="ZTEST_CUST">
<xsd:complexType>
<xsd:all>
<xsd:element name="CNAME" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="CNO" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="BANK" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZST_CUST" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:element name="ZTEST_CUST.Response">
<xsd:complexType>
<xsd:all>
<xsd:element name="BANK" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="item" type="ZST_CUST" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:all>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="ZST_CUST">
<xsd:sequence>
<xsd:element name="CODE" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="NAME" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="LOCATION" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="60" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ZTEST_CUST.Input">
<wsdl:part name="parameters" element="rfc:ZTEST_CUST" />
</wsdl:message>
<wsdl:message name="ZTEST_CUST.Output">
<wsdl:part name="parameters" element="rfc:ZTEST_CUST.Response" />
</wsdl:message>
<wsdl:portType name="ZTEST_CUST.PortType">
<wsdl:operation name="ZTEST_CUST">
<wsdl:input message="rfc:ZTEST_CUST.Input" />
<wsdl:output message="rfc:ZTEST_CUST.Output" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ZTEST_CUST.SAPBinding" type="rfc:ZTEST_CUST.PortType">
<rfc:binding style="rfc" />
<rfc:type name="ZST_CUST">
<ifr:container xmlns:ifr="urn:sap-com:ifr:v2:metamodel" xmlns:xlink="http://www.w3.org/1999/xlink">
<ifr:descriptor>
<ifr:description language="EN">
test
</ifr:description>
</ifr:descriptor>
<ifr:properties>
<ifr:sourceSystem />
<ifr:sourceClient>
020
</ifr:sourceClient>
<ifr:release>
640
</ifr:release>
<ifr:category>
structure
</ifr:category>
<ifr:unicode1>
true
</ifr:unicode1>
<ifr:unicode2>
true
</ifr:unicode2>
<ifr:isFlatStructure>
true
</ifr:isFlatStructure>
</ifr:properties>
<ifr:definition>
<ifr:internalLength1>
180
</ifr:internalLength1>
<ifr:internalLength2>
360
</ifr:internalLength2>
<ifr:fields>
<ifr:field name="CODE" category="simple">
<ifr:descriptor />
<ifr:properties>
<ifr:helpValuesSupported>
false
</ifr:helpValuesSupported>
<ifr:offset1>
0
</ifr:offset1>
<ifr:offset2>
0
</ifr:offset2>
</ifr:properties>
<ifr:definition>
<ifr:scalarType>
<ifr:definition>
<ifr:type>
CHAR
</ifr:type>
<ifr:abapType>
C
</ifr:abapType>
<ifr:length>
60
</ifr:length>
<ifr:internalLength1>
60
</ifr:internalLength1>
<ifr:internalLength2>
120
</ifr:internalLength2>
<ifr:decimals>
0
</ifr:decimals>
</ifr:definition>
</ifr:scalarType>
</ifr:definition>
</ifr:field>
<ifr:field name="NAME" category="simple">
<ifr:descriptor />
<ifr:properties>
<ifr:helpValuesSupported>
false
</ifr:helpValuesSupported>
<ifr:offset1>
60
</ifr:offset1>
<ifr:offset2>
120
</ifr:offset2>
</ifr:properties>
<ifr:definition>
<ifr:scalarType>
<ifr:definition>
<ifr:type>
CHAR
</ifr:type>
<ifr:abapType>
C
</ifr:abapType>
<ifr:length>
60
</ifr:length>
<ifr:internalLength1>
60
</ifr:internalLength1>
<ifr:internalLength2>
120
</ifr:internalLength2>
<ifr:decimals>
0
</ifr:decimals>
</ifr:definition>
</ifr:scalarType>
</ifr:definition>
</ifr:field>
<ifr:field name="LOCATION" category="simple">
<ifr:descriptor />
<ifr:properties>
<ifr:helpValuesSupported>
false
</ifr:helpValuesSupported>
<ifr:offset1>
120
</ifr:offset1>
<ifr:offset2>
240
</ifr:offset2>
</ifr:properties>
<ifr:definition>
<ifr:scalarType>
<ifr:definition>
<ifr:type>
CHAR
</ifr:type>
<ifr:abapType>
C
</ifr:abapType>
<ifr:length>
60
</ifr:length>
<ifr:internalLength1>
60
</ifr:internalLength1>
<ifr:internalLength2>
120
</ifr:internalLength2>
<ifr:decimals>
0
</ifr:decimals>
</ifr:definition>
</ifr:scalarType>
</ifr:definition>
</ifr:field>
</ifr:fields>
</ifr:definition>
</ifr:container>
</rfc:type>
<wsdl:operation name="ZTEST_CUST">
<ifr:container xmlns:ifr="urn:sap-com:ifr:v2:metamodel" xmlns:xlink="http://www.w3.org/1999/xlink">
<ifr:descriptor>
<ifr:description language="EN">
test for mdm
</ifr:description>
</ifr:descriptor>
<ifr:properties>
<ifr:sourceSystem />
<ifr:sourceClient>
020
</ifr:sourceClient>
<ifr:release>
640
</ifr:release>
<ifr:package>
$TMP
</ifr:package>
<ifr:akhNode />
<ifr:released>
external
</ifr:released>
<ifr:outbound>
false
</ifr:outbound>
<ifr:synchronous>
true
</ifr:synchronous>
<ifr:asynchronous>
false
</ifr:asynchronous>
<ifr:unicode1>
true
</ifr:unicode1>
<ifr:unicode2>
true
</ifr:unicode2>
</ifr:properties>
<ifr:definition>
<ifr:parameters>
<ifr:parameter name="CNAME">
<ifr:descriptor>
<ifr:description language="EN">
Character Field Length = 10
</ifr:description>
</ifr:descriptor>
<ifr:definition>
<ifr:scalarType name="CHAR10">
<ifr:properties>
<ifr:helpValuesSupported>
false
</ifr:helpValuesSupported>
<ifr:fixedValuesListDefined>
false
</ifr:fixedValuesListDefined>
<ifr:mixedCaseSupported>
false
</ifr:mixedCaseSupported>
<ifr:signedNumber>
false
</ifr:signedNumber>
</ifr:properties>
<ifr:definition>
<ifr:type>
CHAR
</ifr:type>
<ifr:abapType>
C
</ifr:abapType>
<ifr:length>
10
</ifr:length>
<ifr:internalLength1>
10
</ifr:internalLength1>
<ifr:internalLength2>
20
</ifr:internalLength2>
<ifr:decimals>
0
</ifr:decimals>
<ifr:outputLength>
10
</ifr:outputLength>
</ifr:definition>
</ifr:scalarType>
</ifr:definition>
<ifr:properties>
<ifr:direction>
in
</ifr:direction>
<ifr:class>
import
</ifr:class>
<ifr:type>
scalar
</ifr:type>
<ifr:optional>
true
</ifr:optional>
<ifr:basedOnDictionaryReference>
true
</ifr:basedOnDictionaryReference>
</ifr:properties>
</ifr:parameter>
<ifr:parameter name="CNO">
<ifr:descriptor>
<ifr:description language="EN">
Character Field Length = 10
</ifr:description>
</ifr:descriptor>
<ifr:definition>
<ifr:scalarType name="CHAR10">
<ifr:properties>
<ifr:helpValuesSupported>
false
</ifr:helpValuesSupported>
<ifr:fixedValuesListDefined>
false
</ifr:fixedValuesListDefined>
<ifr:mixedCaseSupported>
false
</ifr:mixedCaseSupported>
<ifr:signedNumber>
false
</ifr:signedNumber>
</ifr:properties>
<ifr:definition>
<ifr:type>
CHAR
</ifr:type>
<ifr:abapType>
C
</ifr:abapType>
<ifr:length>
10
</ifr:length>
<ifr:internalLength1>
10
</ifr:internalLength1>
<ifr:internalLength2>
20
</ifr:internalLength2>
<ifr:decimals>
0
</ifr:decimals>
<ifr:outputLength>
10
</ifr:outputLength>
</ifr:definition>
</ifr:scalarType>
</ifr:definition>
<ifr:properties>
<ifr:direction>
in
</ifr:direction>
<ifr:class>
import
</ifr:class>
<ifr:type>
scalar
</ifr:type>
<ifr:optional>
true
</ifr:optional>
<ifr:basedOnDictionaryReference>
true
</ifr:basedOnDictionaryReference>
</ifr:properties>
</ifr:parameter>
<ifr:parameter name="BANK">
<ifr:descriptor>
<ifr:description language="EN">
test bank type
</ifr:description>
</ifr:descriptor>
<ifr:definition>
<ifr:complexType xmlns:xlink="http://www.w3.org/1999/xlink" name="ZST_CUST" type="structure" xlink:role="type" xlink:href="/Content?TYPE=type&NAME=ZST_CUST" />
</ifr:definition>
<ifr:properties>
<ifr:direction>
inout
</ifr:direction>
<ifr:class>
tables
</ifr:class>
<ifr:type>
structure
</ifr:type>
<ifr:optional>
true
</ifr:optional>
<ifr:basedOnDictionaryReference>
true
</ifr:basedOnDictionaryReference>
</ifr:properties>
</ifr:parameter>
</ifr:parameters>
</ifr:definition>
</ifr:container>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions> -
how do i re-download system preference onto my computer without using the snowlepord disc, how do i re-download system preference onto my computer without using the snowlepord disc
Do you mean the System Preferenes application?
If so, you should be able to restore it from your backups.
If you don't have backups:
If your Mac came with Snow Leopard, call AppleCare. They'll send a replacement set of discs for a nominal fee.
If it didn't, you can still get the Retail Snow Leopard discs for $30.
Then get a good external HD (or Time Capsule) and start making regular backups. Hard drives fail; other things go wrong; and laptops get lost or stolen. Without good backups, you risk losing all your data.
You might want to review the Time Machine Tutorial, and perhaps browse Time Machine - Frequently Asked Questions. -
Is it possible to display a date as (DD-MON-YYYY) in excel output using excel template in xml publisher where date should be displayed as date only not string.
I've tried to use hierarchy node variables, but it seems like you can't specify a attribute of the hierarchy such as level. So with the WBS hierarchy, if you create a hierarchy node variable, you specify the WBS value to select (If I understand this correctly). I wish I could instead specify "give me all the WBS nodes that happen to have the value of the level attribute greater or equal to 3. If I understand Juergens post, he is saying make security access so that only certain WBS levels can be returned in the query. I suppose we can try that, but that would then preclude getting the level 1 and 2 in the future if the authorization is global.
-
HT1414 Can i download new updates for iOS iPhone4 without using itunes?
Can i download new updates for iOS iPhone4 without using itunes?
Thank you
I did try to do that, but it needs wifi connection to download the software i dont have wifi connection and one more thing, I dont have in front of me right now my personal computer im using another persons computer what should i do just to download the software update now and then when i got home i can download or transfer it on my personal computer when i get back. -
I have a problem in formatting cells in Excel while using OLE method.
Hi All,
I have a problem in formatting cells in Excel while using OLE method.
My requirement is to have certain fields of a cell as text and amount fields should be in number format.
How to format a cell in Excel in OLE method of downloading data to excel.
For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
I want that field to be shown as 0002.(text format)
Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
000000000000000051.(text format).
Amount field should be in number format so that totalling is possible .
So I need some cells in text format and some in number format.
Please suggest a sloution.
Thanks in advance,
Regards,
vidyulatha.Uhttps://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
hope this helps. -
Regading Excel Creation using OLE
hi friends,
i got a new requirement where i have to create the Excel document using OLE. one more thing is some cells has to be filled with some colour and in some cells the text has to come in Vertical manner, this text is used for Header purpose.
please help me urgently...
Suitable Answers will get more points..........Hello,
Also take a look at this code
*& Report ZKRIS_OLE3_PALETTE
*& Displays the full OLE color range in excel
REPORT ZKRIS_OLE3_PALETTE.
TYPE-POOLS ole2 .
DATA: count TYPE i,
count_real TYPE i,
application TYPE ole2_object,
workbook TYPE ole2_object,
excel TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256. " change to 16384 for excel 2007
DATA index TYPE i.
DATA:
h_cell TYPE ole2_object, " cell
h_f TYPE ole2_object, " font
h_int TYPE ole2_object,
h_width TYPE ole2_object,
h_columns TYPE ole2_object,
h_rows TYPE ole2_object,
h_font TYPE ole2_object,
h_entirecol TYPE ole2_object.
DATA: h_range TYPE ole2_object.
DATA: h_merge TYPE ole2_object.
CREATE OBJECT excel 'EXCEL.APPLICATION'.
IF sy-subrc NE 0.
WRITE: / 'No EXCEL creation possible'.
STOP.
ENDIF.
SET PROPERTY OF excel 'DisplayAlerts' = 0.
CALL METHOD OF excel 'WORKBOOKS' = workbook .
SET PROPERTY OF excel 'VISIBLE' = 1.
* creating workbook
SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
CALL METHOD OF workbook 'ADD'.
CALL METHOD OF excel 'WORKSHEETS' = sheet
EXPORTING
#1 = 1.
SET PROPERTY OF sheet 'NAME' = 'Color Palette'.
CALL METHOD OF sheet 'ACTIVATE'.
DATA: col TYPE i VALUE 1,
row TYPE i VALUE 2,
col1 TYPE i VALUE 2,
col_real TYPE i VALUE 1.
row = 1.
col = 3.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'No.'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
CALL METHOD OF excel 'Rows' = h_rows
EXPORTING
#1 = '2:2'.
SET PROPERTY OF h_rows 'WrapText' = 1.
col = 9.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'No.'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
SET PROPERTY OF h_cell 'Bold' = 1.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
CALL METHOD OF excel 'Rows' = h_rows
EXPORTING
#1 = '1:1'.
SET PROPERTY OF h_rows 'WrapText' = 1.
GET PROPERTY OF h_rows 'Font' = h_font.
SET PROPERTY OF h_font 'Bold' = 1.
count = 1.
count_real = count.
row = 2.
col = 3.
DO 56 TIMES.
PERFORM write_num_and_color.
ENDDO.
* autofit
CALL METHOD OF excel 'Columns' = h_columns
EXPORTING
#1 = 'C:L'.
GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
SET PROPERTY OF h_entirecol 'Autofit' = 1.
* write palette on lhs
*range
CALL METHOD OF excel 'Range' = h_range
EXPORTING
#1 = 'A2'
#2 = 'A20'.
CALL METHOD OF h_range 'Merge' = h_merge .
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = 2
#2 = 1.
SET PROPERTY OF h_cell 'Value' = 'Palette'.
SET PROPERTY OF h_cell 'Orientation' = 90. "angled.
SET PROPERTY OF h_cell 'HorizontalAlignment' = 3. "center align
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'Bold' = 1. "bold
SET PROPERTY OF h_f 'Name' = 'Comic Sans MS'.
SET PROPERTY OF h_f 'Size' = '14'.
SET PROPERTY OF h_cell 'VerticalAlignment' = 2. "center align
* autofit
CALL METHOD OF excel 'Columns' = h_columns
EXPORTING
#1 = 'A:A'.
GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
SET PROPERTY OF h_columns 'ColumnWidth' = 4.
*& Form write_num_and_color
* text
FORM write_num_and_color.
index = row_max * ( row - 1 ) + col.
CALL METHOD OF sheet 'Cells' = cells
EXPORTING
#1 = index.
SET PROPERTY OF cells 'Value' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
GET PROPERTY OF h_cell 'Interior' = h_int.
SET PROPERTY OF h_int 'ColorIndex' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'ColorIndex' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
GET PROPERTY OF h_cell 'Interior' = h_int.
SET PROPERTY OF h_int 'ColorIndex' = 1.
SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'ColorIndex' = count_real.
row = row + 1.
col = col - 3.
count = count + 1.
IF count = 29.
count = 1.
row = 2.
col = col + 6.
ENDIF.
count_real = count_real + 1.
ENDFORM. "write_num_and_color -
Call Excel SpreadSheet using OLE and set format = text
Hi All,
I am working on an object, where I need to call Excel SpreadSheet using OLE.
In SpreadSheet, I need to show data as text (Without Excel Internal Modifications).
i.e
if i pass 03/2007 as month in excel, it should show 01/2007 not jan-07.
I am trying to use the code as below.
call method of cell 'SET_FORMAT' = text.
set property of text 'CATEGORY' = 4.
this code is not giving me desired output.
Is there any other method i can call? or property I can set?
can somebody pls send me a document with list of all formattiong methods and properties. I will really appreciate the help.
Regards,
HardikHi, you should concatenate the character ( ' ) into your text, example
CONCATENATE '''' text INTO text.
Then print the variable Text into excel and you will see the format as Text,
Thanks and regards.
David Carballido
PD: Sry for my bad English -
Download to multiple sheet excel in the background
Hi,
I am trying to download data into multiple excel sheets in the background. I was able to create comma delimited csv file in the server, which can be opened as excel file. This is good when it does not have more that one worksheets.
I have three internal table and to send these internal tables in different worksheets in the same excel file.
Is it possible to have multiple sheets excel file from the csv file?
Thanks,
LokmanHi Lokman,
<b>1</b>.
Yes it is Possible.
<b>2</b>.
Am sending one example program .That is clear to understand .
REPORT zvenkat_head MESSAGE-ID zvenkat .
INCLUDE ole2incl. " Include for OLE object
DATA: application TYPE ole2_object,
workbook TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object,
h_f TYPE ole2_object. " font
*Structure for users deleted
DATA: BEGIN OF itab_yb001_udel OCCURS 0,
bname LIKE yb001-bname,
name_text LIKE addr3_val-name_text,
END OF itab_yb001_udel.
DATA: BEGIN OF itab_yb001_tadd OCCURS 0.
INCLUDE STRUCTURE yb001.
DATA: name_text LIKE addr3_val-name_text,
ttext LIKE tstct-ttext.
DATA: END OF itab_yb001_tadd.
*Structure for Transactions deleted
DATA: BEGIN OF itab_yb001_tdel OCCURS 0.
INCLUDE STRUCTURE yb001.
DATA: name_text LIKE addr3_val-name_text,
ttext LIKE tstct-ttext.
DATA: END OF itab_yb001_tdel.
DATA: BEGIN OF itab_yb001_uadd OCCURS 0,
bname LIKE yb001-bname,
name_text LIKE addr3_val-name_text,
END OF itab_yb001_uadd.
PARAMETERS: p_fname LIKE rlgrap-filename. " File name to download
PERFORM download_file.
FORM - DOWNLOAD_FILE
FORM download_file.
DATA index TYPE i.
CREATE OBJECT application 'excel.application'.
SET PROPERTY OF application 'visible' = 0.
CALL METHOD OF application 'Workbooks' = workbook.
CALL METHOD OF workbook 'Add'.
CALL METHOD OF application 'Worksheets' = sheet.
CALL METHOD OF sheet 'Add'.
Create 1 Excel sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 1.
SET PROPERTY OF sheet 'Name' = 'Transactions Added'.
CALL METHOD OF sheet 'Activate'.
PERFORM f_xl_theader.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-m03
EXCEPTIONS
OTHERS = 1.
LOOP AT itab_yb001_tadd.
index = sy-tabix + 1. " 1 - column name
PERFORM fill_cell USING index 1 0 itab_yb001_tadd-bname.
PERFORM fill_cell USING index 2 0 itab_yb001_tadd-tcode.
PERFORM fill_cell USING index 3 0 itab_yb001_tadd-name_text.
PERFORM fill_cell USING index 4 0 itab_yb001_tadd-ttext.
PERFORM fill_cell USING index 5 0 itab_yb001_tadd-agr_name.
ENDLOOP.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-m03
EXCEPTIONS
OTHERS = 1.
Create 2 Excel sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 2.
SET PROPERTY OF sheet 'Name' = 'Transactions Deleted'.
CALL METHOD OF sheet 'Activate'.
PERFORM f_xl_theader.
LOOP AT itab_yb001_tdel.
index = sy-tabix + 1. " 1 - column name
PERFORM fill_cell USING index 1 0 itab_yb001_tdel-bname.
PERFORM fill_cell USING index 2 0 itab_yb001_tdel-tcode.
PERFORM fill_cell USING index 3 0 itab_yb001_tdel-name_text.
PERFORM fill_cell USING index 4 0 itab_yb001_tdel-ttext.
PERFORM fill_cell USING index 5 0 itab_yb001_tdel-agr_name.
ENDLOOP.
tell user what is going on
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text-m04
EXCEPTIONS
OTHERS = 1.
Create 3 Excel Sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 3.
CALL METHOD OF sheet 'Activate'.
SET PROPERTY OF sheet 'Name' = 'Users Added'.
PERFORM f_xl_uheader.
LOOP AT itab_yb001_uadd.
index = sy-tabix + 1. " 1 - column name
PERFORM fill_cell USING index 1 0 itab_yb001_uadd-bname.
PERFORM fill_cell USING index 2 0 itab_yb001_uadd-name_text.
ENDLOOP.
Create 4 Excel sheet
CALL METHOD OF application 'Worksheets' = sheet
EXPORTING #1 = 4.
SET PROPERTY OF sheet 'Name' = 'Users Deleted'.
CALL METHOD OF sheet 'Activate'.
PERFORM f_xl_uheader.
LOOP AT itab_yb001_udel.
index = sy-tabix + 1. " 1 - column name
PERFORM fill_cell USING index 1 0 itab_yb001_udel-bname.
PERFORM fill_cell USING index 2 0 itab_yb001_udel-name_text.
ENDLOOP.
Save excel speadsheet to particular filename
CALL METHOD OF sheet 'SaveAs'
EXPORTING #1 = p_fname "filename
#2 = 1. "fileFormat
PERFORM err_hdl.
Closes excel window, data is lost if not saved
SET PROPERTY OF application 'visible' = 0.
Close the file
CALL METHOD OF workbook 'CLOSE'.
Quit the file
CALL METHOD OF application 'QUIT'.
FREE OBJECT application.
ENDFORM. "DOWNLOAD_FILE
*& Form F_XL_THEADER
Header for XL sheet
--> p1 text
<-- p2 text
FORM f_xl_theader .
output column headings to active Excel sheet
PERFORM fill_cell USING 1 1 1 text-t01.
PERFORM fill_cell USING 1 2 1 text-t02.
PERFORM fill_cell USING 1 3 1 text-t03.
PERFORM fill_cell USING 1 4 1 text-t04.
PERFORM fill_cell USING 1 5 1 text-t05.
ENDFORM. " F_XL_THEADER
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
FORM fill_cell USING i j bold val.
CALL METHOD OF sheet 'Cells' = cells EXPORTING #1 = i #2 = j.
PERFORM err_hdl.
SET PROPERTY OF cells 'Value' = val .
PERFORM err_hdl.
GET PROPERTY OF cells 'Font' = h_f.
PERFORM err_hdl.
SET PROPERTY OF h_f 'Bold' = bold .
PERFORM err_hdl.
ENDFORM. "FILL_CELL
outputs OLE error if any *
--> p1 text
<-- p2 text
FORM err_hdl.
IF sy-subrc <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), sy-subrc.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
Header for XL sheet
--> p1 text
<-- p2 text
FORM f_xl_uheader .
PERFORM fill_cell USING 1 1 1 text-t01.
PERFORM fill_cell USING 1 2 1 text-t03.
ENDFORM. " F_XL_UHEADER
Please try to understand first and replicate to ur requirement.
Please let me know if u have any problem.
<b>Thanks,
Venkat.O</b> -
Loading data from multiple tables to multiple sheets of excel using SSIS
I have a requirement in which I want to load data from 13 tables to 13 respective sheets of single excel file using SSIS.
Can anyone know SSIS logic for developing package for this?see similar example here
http://visakhm.blogspot.in/2013/09/exporting-sqlserver-data-to-multiple.html
In your case you need to use loop to iterate through tables
First get list of tables in a object variable created in SSIS using INFORMATION_SCHEMA.TABLES view
Then add a for each loop based on ADO.NET variable enumerator to iterate through tables and inside loop follow method as in the above link to create the sheet first and populate it.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I have a excel with multiple
sheets with data as shown below
SHEET 1
A 1
B 2
C 3
SHEET 2
B 1
C 2
A 3
SHEET 3
C 1
A 2
B 3
My
query is splitted into 3 categories
I want to have a formula to do math calculation such that data of "A" of SHEET 1 is calculated with "A" of SHEET2 irrespective of the location of "A".
When I include SHEET3, the formula should automatically identify the location of "A" or "B" or "C" and give the result corresponding to A, B or C. Since I want to bifurcate daily report and output printed. I want to use another
excel for output. How to link multiple sheets of one excel and print the output of above in
another excel?
Assume, I have 4 SHEETS, "SHEET 1", "SHEET 2", "SHEET 3" and "SHEET 4". Math calculation need to be done using all 4 sheets. If
I include "SHEET 5", the formula should ignore SHEET 1 automatically and give the results of SHEETS 2 to 5. Similarly, if I include SHEET 6, SHEET 1 and 2 need to be ignored for further calculation and SHEET 3-6 need to be used. How to write
such formula?
How to get pop up alert for multiple rows, if a specific condition is hit?Maybe VBA Code should be a good option for you. I suggest you post you issue to
Excel for Developers forum.
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
Thanks for your understanding.
Best Regards,
Wind -
How to download data into two different columns 2003 excel format in ole
Hi ALL
when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
both fields come in only one column .Can any one suggest
CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI IN CHARACTER MODE.If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
FORM fill_cell USING p_row p_col p_value.
CALL METHOD OF obj_excel 'CELLS' = obj_cell
EXPORTING
#1 = p_row
#2 = p_col.
SET PROPERTY OF obj_cell 'VALUE' = p_value.
ENDFORM. "fill_cell -
How do I convert multiple sheets in excel into one pdf document?
How do I convert multiple sheets (tabs) in excel to one combined pdf document?
Hi Ptizer,
If you have Acrobat PDFMaker enable on Ms Excel. You can click on Create PDF.
And choose settings as highlighted on screen shot it should do the job for you.
Regards,
Ajlan Huda.
Maybe you are looking for
-
Suggestion for a Last.fm plugin
?Hello there, I have recently bought a Creative ZEN X-Fi Style 8GB, and I use last.fm for 2 years now. I figured out people are asking about a piece of software to support the last.fm services on creative mp3 player products for at least 4 years. Rig
-
How to add one flash file to another?
ok, im making a flash website, and in a different file I created a music player that plays a song when the play button is clicked and stops when the stop button is clicked. My question is how do I go and put that song player on my flash website and h
-
What method is called when I press Ctrl+V after selecting a row on a JTable? I tried using the copy() method which works on a text area/field but it doesn't work on the table. Ctrl+V works, but calling the copy() method doesn't.
-
Nokia 2730 classic---it was hung when open the mes...
When I tried to open the message in the inbox. It was hung. I can't open it. Have to tried it several times. Is it becase of software or hardware problems? What should I do?
-
Hi. I'm looking for any example to create a passthrougth proxy service on a business service based on an endpoint HTTP that requires basic authentication plus NTLM domain. I haven't OWSM on this OSB. TIA Corrado