Converting XLS to SAP
Why do we use TEXT_CONVERT_XLS_TO_SAP??????? what exactly this FM perform???????????
Hi,
ABAP code for uploading an Excel document into an internal table. See code below for structures. The code is based on uploading a simple Excel spreadsheet or for an actual Excel file click here.
There are also a couple of alternatives which use fucntion modules KCD_EXCEL_OLE_TO_INT_CONVERT
and ALSM_EXCEL_TO_INTERNAL_TABLE but the method below is by far the simplest method to use.
*: Description :
*: This is a simple example program to get data from an excel :
*: file and store it in an internal table. :
*: Author : www.sapdev.co.uk, based on code from Jayanta :
*: SAP Version : 4.7 :
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION F4_FILENAME
EXPORTING
field_name = P_FILE
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION TEXT_CONVERT_XLS_TO_SAP
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = X
i_tab_raw_data = it_raw WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
Similar Messages
-
Convert report from SAP to Excel
Hi All,
How to convert report from SAP to Excel.Here now taking default text(.txt) format.But we want defualt taking (.xls) format only.
Regards
Ushahi usha
u can even export the text in txt format and later right click and open with excel , u wont be able to directly import it into excel as it is not giving u any option to upload in excel directly
Regards,
Manish -
How to convert Xls file into Xml file
Hi,
I am trying to convert Xls file into Xml but there is no any direct procedure for it
Pls help me out to convert Xls file into Xml file
Thanks
Anushreeyou will require to write a module in your file adapter for the same.
ref: /people/sap.user72/blog/2005/07/04/read-excel-instead-of-xml-through-fileadapter as mentioned in the earlier post.
Else you can also use Conversion Agent to read the same.
Ref: http://help.sap.com/saphelp_nw04/helpdata/en/43/4c38c4cf105f85e10000000a1553f6/content.htm -
Can anyone recommend a good application or the best way to convert .xls files to pdf?
ThanksHave you tried printing and selecting "Save as PDF"? Or Save As and selecting PDF? I don't have Excel 2004 anymore so I don't know if it has the Save as PDF feature but the standard OS X print dialog has the selection for printing to PDF.
-
Mac OS batch convert .xls to .pdf not option
Mac OS batch convert .xls to .pdf not option....WHY NOT???? This was never issue on Windows, and the software notes it supports pdf convert from .xls format (BUT NOT IN MAC VERSION) Any work arounds? Will this becoming in update? Really not acceptable for such expensive software.
Hi Yvan,
Thank you, that script will be most useful.
Sincerely,
RicD -
Converting '.xls' file to '.txt' in BDC Session method
Hi gurus,
Happy DIWALIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII------',','
Please help me in converting '.xls' file to '.txt' in BDC Session method. Is there is any method or function module for this conversion. Please help me with coding.
Thanks and regards,Hi
File->save as -> Save as type ( text tab delimted.txt) ->Click on yes .
Now open .txt file -> here data will be tab delimted.
genrally i use tab delimted file to upload the data.
Even if you want to programtically then get the data from xls file to Internal table,now use concatenate with comma ,now download it.
Check the below program :
Upload xls file and you can see .txt file ( with comma delimted)
Input ( XLS file )
aaa 1245 2344 233 qwww
233 2222 qwww www www
Output ( .txt file with comma delimted)
aaa,1245,2344,233,qwww
233,2222,qwww,www,www
REPORT ZFII_MISSING_FILE_UPLOAD no standard page heading.
data : begin of i_text occurs 0,
text(1024) type c,
end of i_text.
Internal table for File data
data : begin of i_data occurs 0,
field1(10) type c,
field2(10) type c,
field3(10) type c,
field4(10) type c,
field5(10) type c,
end of i_data.
data : begin of i_download occurs 0,
text(1024) type c,
end of i_download.
data : v_lines type sy-index.
data : g_repid like sy-repid.
data v_file type string.
data: itab like alsmex_tabline occurs 0 with header line.
data : g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '1',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
download the file into comma delimted file.
perform download_data.
*& Form upload_data
text
--> p1 text
<-- p2 text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append i_data.
clear i_data.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
first Field
i_data-field1 = itab-value.
second field
when '0002'.
i_data-field2 = itab-value.
Third field
when '0003'.
i_data-field3 = itab-value.
fourth field
when '0004'.
i_data-field4 = itab-value.
fifth field
when '0005'.
i_data-field5 = itab-value.
endcase.
endloop.
endif.
append i_data.
ENDFORM. " upload_data
*& Form download_data
text
--> p1 text
<-- p2 text
FORM download_data.
loop at i_data.
concatenate i_data-field1 ',' i_data-field2 ',' i_data-field3 ','
i_data-field4 ',' i_data-field5 into i_download-text.
append i_download.
clear : i_download,
i_data.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME =
'C:\Documents and Settings\smaramreddy\Desktop\fff.txt'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = i_download
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. " download_data
Regards
Pavan -
Convert .xls to .xml in the form of sap b1
Dear sir
How can i convert the data from excel to XML file format who accept the "GetXMLelementCount" class use in programmingYou entered a question on the wrong forum: this is about SAP Business One
Integration Technology. -
How to convert xls files into xml
hi all,
please tell me how to convert the xls files into xmlHey Sayee,
This gives you step by step procedure to start up
saptechnical com/Tutorials/XI/Adapter/Index.htm
http://help.sap.com/saphelp_nw04/helpdata/en/8b/895e407aa4c44ce10000000a1550b0/content.htm
Regards
Pothana -
Convert .xls files in a folder to .xlsx file
I am getting a file from a client with extension .xls but it can't be read in SSIS or with OPENROWSET function. I believe the file has the .xls extension but it is not excel file. I can open the file manually, I am looking for powershell script to open and
save the file as .xlsx.
I tried to use the following code but it is not working. Any help on this would be appreciated.
$xlFixedFormat
=
[Microsoft.Office.Interop.Excel.XlFileFormat]::xlWorkbookDefault
$excel
= New-Object
-ComObject excel.application
$excel.visible
=
$true
$folderpath
=
"c:\test\*"
$filetype
="*xls"
Get-ChildItem
-Path
$folderpath
-Include
$filetype |
ForEach-Object
`
$path
= ($_.fullname).substring(0,($_.FullName).lastindexOf("."))
"Converting $path to $filetype..."
$workbook
=
$excel.workbooks.open($_.fullname)
$workbook.saveas($path,
$xlFixedFormat)
$workbook.close()
$excel.Quit()
$excel
=
$null
[gc]::collect()
[gc]::WaitForPendingFinalizers()
MohammeduHi Mohammedu,
Let’s see what format the problem file’s
format is first. You might be interested in my Remove-ComObject
function; it gets rid of Excel vestiges, you can get it here and
read about it here.
What does the following code return?
$file
=
'C:\x.xls'
# <-- your Workbook's full path
$xl
= New-Object
-ComObject
Excel.Application
-Property
Visible
=
$true
$wb
=
$xl.Workbooks.Open($file)
$wb.FileFormat
-as
'Microsoft.Office.Interop.Excel.XlFileFormat'
$wb.Close($false)
$xl.Quit()
Remove-ComObject
Robert Robelo -
Error While converting xml to sap abap string.
Hi Experts,
As i am doing an cross Application from SAP to .Net and vice versa.I am receiving an xml from .Net and it should be converted to ABAP string Using the following function module SMUM_XML_PARSE
And the following string i am receiving from .net
<Root><qApprovalInfo><RequesterId>xxxx</RequesterId><RequesterName>xxx</RequesterName><ApproverId>xxxx</ApproverId><ApproverLevel>1</ApproverLevel><PendingApprovalId>0200169911</PendingApprovalId><CreatedDate>20/07/2011</CreatedDate><CreatedBy>xx</CreatedBy><ModifiedDate>2011-07-20 16:45</ModifiedDate><ModifiedBy>xxxx</ModifiedBy><ApplicationCode>EPAY</ApplicationCode><WorkFlowCode>EPX</WorkFlowCode><ApprovalStatus>APPROVED</ApprovalStatus><ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments><Mode>CREATE</Mode><ActionSource>DESKTOP</ActionSource></qApprovalInfo><qApprovalHidden><Approverl>40002664</Approver><EmployeeId>40016515</EmployeeId></qApprovalHidden></Root>
In this xml i am getting all the values except the <ActionComments><![CDATA[APPROVED(through Desktop)]]></ActionComments>
is their any way to convert that CDATA value?..
have anybody come across the following issue ?...
can anybody provide the solution for this?.
Edited by: basavaraj.p on Aug 29, 2011 10:54 AMHi,
SMUM_XML_PARSE is a simplified, unreleased and undocumented version of the powerful, released and documented iXML
If you look at the GET_ELEMENT subroutine in that function module, you'll see that the nodes of type CO_NODE_CDATA_SECTION are simply ignored.
The simpliest thing for you, maybe, is to duplicate the code of SMUM_XML_PARSE (as it is rather easy to handle), and add a section to GET_ELEMENT. You'll have also to use IF_IXML_CDATA_SECTION interface and ixml_iid_cdata_section constant.
Documentation is here: [SAP Library: Interface if_ixml_cdata_section|http://help.sap.com/saphelp_nw70/helpdata/en/bb/576658dca511d4990b00508b6b8b11/frameset.htm ]
Best regards,
Sandra -
Convert XML to SAP internal table
Hi gurus,
My program is suppose to get current exchange rate file from website and upload it in SAP.
by using FM 'HTTP_GET', im getting the data in XML format.My problem is..i have tried to use transformation but failed to
map it against XML data element..and i have tried to use CALL FUNCTION 'SCMS_TEXT_TO_XSTRING' and then CALL FUNCTION 'SMUM_XML_PARSE' but it returns initial value with error ''line 0 col 12-unexpected symbol: '>'' .
Below is an excerpt of my XML file:
..<xml version>
..<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
.. xmlns:o="urn:schemas-microsoft-com:office:office"
.. xmlns:x="urn:schemas- microsoft-com:office:excel"
.. xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
.. <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"> <WindowHeight>10875</WindowHeight>........ <WindowWidth>13260</WindowWidth><WindowTopX>480</WindowTopX><WindowTopY>30</Wind
.. <Style ss:ID="Default" ss:Name="Normal">
.. <Alignment ss:Vertical="Bottom"/>
.. <Borders/>
.. <Font/>
.. <Interior/>
.. <NumberFormat/>
.. <Protection/>
.. </Style>
.. <Style ss:ID="BoldColumn">
.. <Font ss:FontName="Microsoft Sans Serif" x:Family="Swiss" ss:Bold="1"/>
.. <Worksheet ss:Name="Page1"><Table ss:StyleID="s21" > <Column ss:Width="130"/> <Column ss:Width="85"/> <Column .. ss:Width="85"/> <Column ss:Width="85"/> <Column ss:Widt
.. Cell><Cell ss:MergeAcross="1" ss:StyleID="BoldColumn"><Data ss:Type="String">Average Buying Rates</Data></Cell><Cell .. ss:MergeDown="1" ss:StyleID="BoldColumn"><Data ss:Type="Stri
.. ss:Type="Number">47.3732</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">47.5374</Data></Cell><Cell .. ss:StyleID="Decimal"><Data ss:Type="Number">48.2323</Data></Ce
.. " ><Data ss:Type="String">HONG KONG</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. .. ss:Type="String">HKD</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Numb
.. ss:Type="Number">22.8131</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">23.2595</Data></Cell>.. .. </Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String"
.. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">IDR</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">3.0395</Data></Cell><Cell ss:StyleID="Decimal"><Data
.. ecimal"><Data ss:Type="Number">30.6424</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data .. ss:Type="String">AUSTRALIA</Data></Cell><Cell ss:StyleID="StringLiteralCe
.. ell ss:StyleID="Decimal"><Data ss:Type="Number">0.3392</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">0.3409</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Typ
.. StringLiteral" ><Data ss:Type="String">DENMARK</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data .. ss:Type="String">DKK</Data></Cell><Cell ss:StyleID="Decimal"><Data ss
.. ata ss:Type="Number">4.4550</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6073</Data></Cell>.. </Row><Row></Row><Row></Row><Row><Cell ss:MergeAcross="4" ss:Style
.. s of 23 November 2010</Data></Cell></Row><Row></Row><Row><Cell ss:MergeAcross="4" .. ss:StyleID="BoldColumn_Left" ><Data ss:Type="String">2. Foreign Exchange Rates (THOMSON REUTE
.. ><Data ss:Type="String">ZAR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.2735</Data></Cell>.. <Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.3125</Data></
.. ="Decimal"><Data ss:Type="Number">106.5459</Data></Cell><Cell ss:StyleID="Decimal"><Data .. ss:Type="Number">107.5164</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Da
.. a></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">4.6916</Data></Cell></Row><Row><Cell .. ss:StyleID="StringLiteral" ><Data ss:Type="String">BANGLADESH</Data></Cell><Cell
.. r">0.0074</Data></Cell></Row><Row><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">KENYA</Data></Cell><Cell .. ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">KE
.. ><Cell ss:StyleID="StringLiteral" ><Data ss:Type="String">VIET NAM</Data></Cell><Cell ss:StyleID="StringLiteralCenter" >.. <Data ss:Type="String">VND</Data></Cell><Cell ss:StyleI
.. A</Data></Cell><Cell ss:StyleID="StringLiteralCenter" ><Data ss:Type="String">LKR</Data></Cell><Cell .. .. ss:StyleID="Decimal"><Data ss:Type="Number">0.2686</Data></Cell><Cell ss:St
.. String">OMR</Data></Cell><Cell ss:StyleID="Decimal"><Data ss:Type="Number">77.7094</Data></Cell><Cell
Please help me to translate my XML file into SAP format...i need it fixed urgently..
Edited by: Guest101 on Dec 28, 2010 12:11 PMIt has 2 part one is source code and another is the XML file
create an XML file with the data provided in the last 2.
then place it in a path mention the path in the below source.
1. Complete code for converting XML to internal table in SAP.
*& Report ZTST_PGM02
REPORT ZTST_PGM02.
Load iXML Lib.
type-pools: ixml.
class cl_ixml definition load.
data: G_IXML type ref to if_ixml.
data: STREAMFACTORY type ref to if_ixml_stream_factory.
data: ISTREAM type ref to if_ixml_istream.
data: DOCUMENT type ref to if_ixml_document.
data: PARSER type ref to if_ixml_parser.
data: LV_FILE_URL type rlgrap-filename.
You should provide the parameter for file name
LV_FILE_URL = 'D:\navps\input_xml.xml'.
types: begin of XML_LINE,
DATA(256) type x,
end of XML_LINE.
types: begin of TY_HEADER,
CUST_NAME(20) type c,
CARD_NO(20) type c,
TAX_AMOUNT(10) type c,
TOTAL_AMOUNT(10) type c,
end of TY_HEADER.
types: begin of TY_ITEM,
ITEM_NO(4) type n,
ITEM_ID(20) type c,
ITEM_TITLE(50) type c,
ITEM_QTY(10) type c,
ITEM_UPRICE(10) type c,
end of TY_ITEM.
data: GV_HEADER type TY_HEADER.
data: GT_ITEM type standard table of TY_ITEM with header line.
data: XML_TABLE type table of XML_LINE,
XML_TABLE_SIZE type i.
The next step is creating the main factory for the iXML library:
G_IXML = cl_ixml=>create( ).
Now Create Stream Factory
STREAMFACTORY = G_IXML->create_stream_factory( ).
upload a file from the client's workstation
call function 'WS_UPLOAD'
exporting
filename = LV_FILE_URL
filetype = 'BIN'
importing
filelength = XML_TABLE_SIZE
tables
data_tab = XML_TABLE
exceptions
others = 11.
wrap the table containing the file into a stream
ISTREAM = STREAMFACTORY->create_istream_itable( table = XML_TABLE
size = XML_TABLE_SIZE )
Get the file data as Stream
*istream = streamfactory->create_istream_uri( public_id = lv_file_url
system_id = lv_file_url ).
Create XML Document instance
DOCUMENT = G_IXML->create_document( ).
Create parser Object
PARSER = G_IXML->create_parser( stream_factory = STREAMFACTORY
ISTREAM = istream
DOCUMENT = document ).
Parse an XML document into a DOM tree
*parser->parse( ).
Parsing Error Processing
if PARSER->parse( ) ne 0.
if PARSER->num_errors( ) ne 0.
data: PARSEERROR type ref to if_ixml_parse_error,
STR type STRING,
I type i,
COUNT type I,
INDEX type i.
COUNT = PARSER->num_errors( ).
write: COUNT, ' parse errors have occured:'.
INDEX = 0.
while INDEX < COUNT.
PARSEERROR = PARSER->get_error( INDEX = index ).
I = PARSEERROR->get_line( ).
write: 'line: ', i.
I = PARSEERROR->get_column( ).
write: 'column: ', i.
STR = PARSEERROR->get_reason( ).
write: STR.
INDEX = index + 1.
endwhile.
endif.
endif.
Close the stream since it #s not needed anymore
call method ISTREAM->close( ).
clear ISTREAM.
Now try to make it look good
data : lv_size type sytabix,
lv_ret_code type sysubrc.
data: lo_xml_document type ref to cl_xml_document.
field-symbols: <fs_xml_data> type any table.
lo_xml_document = document.
call method lo_xml_document->get_as_table
importing
table = <fs_xml_data>
size = lv_size
retcode = lv_ret_code
*data: items type ref to if_ixml_node_collection.
*items = document->get_elements_by_tag_name( name = 'Item' ).
*data: iterator type ref to if_ixml_node_iterator,
node type ref to if_ixml_node.
*iterator = document->create_iterator( ).
*node = iterator->get_next( ).
*while not node is initial.
do something with the node
node = iterator->get_next( ).
*endwhile.
DATA : GV_NODE type ref to if_ixml_node.
DATA : GV_NODETEXT type STRING.
data: GV_FIRST_TIME.
GV_FIRST_TIME = 'X'.
GV_NODE = DOCUMENT.
GT_ITEM-item_no = 1.
perform GET_DATA tables GT_ITEM
using GV_NODE
changing GV_HEADER.
Last item is still not added.
append GT_ITEM.
write : GV_HEADER-cust_name,
GV_HEADER-card_no,
GV_HEADER-tax_amount,
GV_HEADER-total_amount.
loop at GT_ITEM.
write /:.
write : GT_ITEM-item_no,
GT_ITEM-item_id,
GT_ITEM-item_title,
GT_ITEM-item_qty,
GT_ITEM-item_uprice.
endloop.
FORM Get_data *
form get_data tables YT_ITEM structure GT_ITEM
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type TY_HEADER.
data: INDENT type i.
data: PTEXT type ref to if_ixml_text.
data: STRING type string.
data: TEMP_STRING(100).
case X_NODE->get_type( ).
when if_ixml_node=>co_node_element.
STRING = X_NODE->get_name( ).
GV_NODETEXT = STRING.
when if_ixml_node=>co_node_text.
PTEXT ?= X_NODE->query_interface( IXML_IID_TEXT ).
if PTEXT->ws_only( ) is initial.
STRING = X_NODE->get_value( ).
case GV_NODETEXT.
when 'Customer'.
clear GV_HEADER.
when 'Name'.
move STRING to GV_HEADER-cust_name.
when 'Cardnum'.
move STRING to GV_HEADER-card_no.
when 'Tax'.
move STRING to GV_HEADER-tax_amount.
when 'Total'.
move STRING to GV_HEADER-total_amount.
Iteam details
when 'ID'.
move STRING to GT_ITEM-item_id.
when 'Title'.
move STRING to TEMP_STRING.
move TEMP_STRING to GT_ITEM-item_title.
when 'Quantity'.
move STRING to GT_ITEM-item_qty.
when 'UnitPrice'.
move STRING to GT_ITEM-item_uprice.
endcase.
endif.
endcase.
if GV_NODETEXT = 'Customer'.
clear GV_HEADER.
elseif GV_NODETEXT = 'Item'.
if GV_FIRST_TIME ne 'X'.
append GT_ITEM.
clear : gt_item.
GT_ITEM-item_no = gt_item-item_no + 1.
endif.
GV_FIRST_TIME = ' '.
endif.
Get the next child
X_NODE = x_node->get_first_child( ).
Recurse
while not X_NODE is initial.
perform GET_DATA tables GT_ITEM
using X_NODE
changing GV_HEADER.
X_NODE = x_node->get_next( ).
endwhile.
endform.
Create an XML file with the following DATA given below and place it in the path mentioned above source code.
2. XML File DATA. You create an XML File in this format to test the same.
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
- <Order>
- <Customer>
<Name>Bill Buckram</Name>
<Cardnum>234 234 234 234</Cardnum>
</Customer>
- <Manifest>
- <Item>
<ID>209</ID>
<Title>Duke: A Biography of the Java Evangelist</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>208</ID>
<Title>100% Pure: Making Cross Platform Deployment a Reality</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>204</ID>
<Title>Making the Transition from C++ to the Java(tm) Language</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>202</ID>
<Title>Web Servers for Fun and Profit</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
- <Item>
<ID>210</ID>
<Title>I Think Not: Dukes Likeness to the Federation Insignia</Title>
<Quantity>1</Quantity>
<UnitPrice>$10.75</UnitPrice>
</Item>
</Manifest>
- <Receipt>
<Subtotal>$53.75</Subtotal>
<Tax>$4.43</Tax>
<Total>$58.18</Total>
</Receipt>
</Order> -
If you have answer, please provide specific and detailed steps.
Situation 1:
Start:
150+ files in .xls OR .xlsx format
data contains many characters EXCEPT "Tab"
Process:
Use Automator to:
Select Files from Finder window
Convert selected files from xls/xlsx to TAB-DELIMITED file format
End:
150+ files in .txt format
files have identical names to those from "Start:"
data is TAB-DELIMITED
Situation 2:
Start:
150+ files in .xls OR .xlsx format
data contains many characters EXCEPT | (pipe, vertical bar)
Process:
Use Automator to:
Select Files from Finder window
Convert selected files from xls/xlsx to |-delimited file format
End:
150+ files in .txt format
files have identical names to those from "Start:"
data is "|"-delimitedIf your post is addressed to my response then the answer is you have to write your own or search on-line to see if something exists to do what you want.
As you note there is no pre-built script for this.
regards
Message was edited by: Frank Caggiano - Are you certain there isn;t something in Excel to export as a tab delimited file?
This link Convert An Excel Spreadsheet To A Tab Delimited Text File seems to indicate that the function is in Excel already. -
Function module for convert date as sap internal format ?
Hi All,
Is there any standard function module to convert the date filed as SAP internal date?
My problem is while uploading data from excel sheet date filed can be any format
for exp: dd/mm/yyyy or mm/dd/yyyy or yyyy/dd/mm or dd-mm-yyyy,mm-dd-yyyy
dd-mm-yyyy or dd.mm.yyyy or mm.dd.yyyy etc...
In our case there is no particular format in excel it can be differ for each user. I know we have few FM's in standard.
But those are not working for my req. pls help me if you have any idea.
Thanks in advance.
Regards,
Venkat Mote.Hi Venkatesh,
Can you please check with the following function module. For my case, it is working fine.
CALL FUNCTION 'CONVERT_DATE_TO_INTERN_FORMAT'
EXPORTING
datum = p_gs_date
dtype = 'DATS'
IMPORTING
idate = p_gs_date
Hope it helps to you.
Regards
Rajkumar Narasimman -
Convert xml into SAP using dataset
Hi All,
How to convert XML into itab using dataset, in this conversion have any function module available? please give me a sample program (having any). and material also.
Thanks,
Suresh maniarasuHi,
First you need to get the XML file Data into SAP using the Function Module and can populate the data into an inernal table.
TEXT_CONVERT_XML_TO_SAP
DMC_CONVERT_XML_TO_TABLE
or you can use the following classes
CL_RSRD_CONVERTER_XML
CL_WDR_XML_CONVERT_UTIL
CL_EXM_IM_ISHCM_CONV_XML_SAP
Thank U,
Jay.... -
Elance for mac stuff? convert XLS - Numbers and make it look good
I often use elance.com for small projects. I have a project to convert some XLS sheets to Numbers. One of the main purposes is to make it look better, so I need a consulant who not only knows how to use numbers but understands design.
is there a group like elance but more mac focused...in order to get bids? or a few groups i should look at for small projects like this?
Also, as an aside, has anyone made a plug in for Excel so it can import numbers and actually work like numbers (ie, i know i can covert numbers to excel, but i really wish numbers was also available on the PC, barring that at least some plug in or somthing close?)There is no Excel plugin available to decipher Numbers documents.
Given the past behaviour of M…Soft, I would be surprised if they offer one some day.
Apple always made a serious work to allow its customers to import/export M…Soft created files but there was no effort of this kind in the other world.
I would be surprised too if a Window version of Numbers was delivered one day.
Apple development resources aren't large enough to allow them to waste these resources on such a project.
At this time, it seems that they have some difficulties to maintain the two versions (mac and iPad) of iWork applications so, it would be very bad news for users of these products if they move some engineers on such a new task.
Yvan KOENIG (VALLAURIS, France) jeudi 19 août 2010 17:30:02
Maybe you are looking for
-
Ipod partially recognized by windows and not at all by itunes
I haven't been able to find any1 else with this problem but when I connect my ipod to my computer(using either USB 2.0 or firewire) the "Do not disconnect" screen appears on the ipod and then it just sits there. (it also charges but ya) The ipod does
-
Startup key combination does not work
Hi all, Not quite sure what I have done... Received my MacBook Pro today... I installed 10.4.8, installed boot camp 1.1.1, set a partition of 10 GB for windows and in the partition manager of the XP setup I deleted what I thought was a 100 odd MB par
-
Hi there- I am trying to create a game for my mobile. The "problem" is that I have more than 500 swfs that I want to pack using the Adobe Mobile Packager. And I am getting this error: "Maximum number of application files exceeded or file names too lo
-
Any help/ideas for ATI X800 XT
Aloha, I've searched & searched so I'm hoping someone here might have an idea where to get an ATI X800 XT card for my G5. I have heard rumors that they have started making/shipping them again. Any assistance would be greatly appreciated. Mahalo in ad
-
OEM Strings in BIOS don't update?
Hi, UCS sets OEM string data into the BIOS that includes the service profile and service template name. This is what it looks like when I run smbiosdump: OEM Strings: #23 Cisco1 $SPI:DEN-ESX-A6 $SPT:99-Hot_Standby $SYS:DEN-UCSFI-01