Problem in downloading XML file.
Hi,
I am trying to download XML file from application server to internal table. I am using statement
READ DATASET gv_file_name_with_dir
INTO gv_file.
DATA: gv_file_name_with_dir TYPE char128,
gv_file TYPE string.
I am gettiing dump.
A character set conversion is not possible
Please reply as soon as possible.
Regards,
Mukesh Kumar
Hello mukesh kumar ,
Try with this procedure you will get it.
DATA : lv_filename TYPE char1000.
DATA: BEGIN OF gi_text OCCURS 0,
champ(1000),
END OF gi_text.
READ DATASET lv_filename INTO gi_text.
if sy-subrc eq 0.
IF gi_text IS NOT INITIAL.
APPEND gi_text.
ENDIF.
endif.
Regards,
Santosh Marupally
Similar Messages
-
Xslt ecc6 ISO-8859-1 problem when download xml file
Hello,
i create an ABAP test program:
*& Report Z_ABAP_TO_XML *
*& Write the data from an internal ABAP table into an XML document, *
*& and write it onto your frontend computer *
REPORT z_abap_to_xml.
TYPE-POOLS: abap.
CONSTANTS gs_file TYPE string VALUE 'C:\Users\Marco Consultant\Desktop\test.xml'.
* This is the structure for the data to go into the XML file
TYPES: BEGIN OF ts_person,
cust_id(4) TYPE n,
firstname(20) TYPE c,
lastname(20) TYPE c,
END OF ts_person.
* Table for the XML content
DATA: gt_itab TYPE STANDARD TABLE OF char2048.
* Table and work area for the data to fill the XML file with
DATA: gt_person TYPE STANDARD TABLE OF ts_person,
gs_person TYPE ts_person.
* Source table that contains references
* of the internal tables that go into the XML file
DATA: gt_source_itab TYPE abap_trans_srcbind_tab,
gs_source_wa TYPE abap_trans_resbind.
* For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
* Fill the internal table
gs_person-cust_id = '3'.
gs_person-firstname = 'Bill'.
gs_person-lastname = 'Gates'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '4'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
* Fill the source table with a reference to the data table.
* Within the XSLT stylesheet, the data table can be accessed with
* "IPERSON".
GET REFERENCE OF gt_person INTO gs_source_wa-value.
gs_source_wa-name = 'IPERSON'.
APPEND gs_source_wa TO gt_source_itab.
* Perform the XSLT stylesheet
TRY.
CALL TRANSFORMATION z_abap_to_xml
SOURCE (gt_source_itab)
RESULT XML gt_itab.
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
* Download the XML file to your client
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = gs_file
CHANGING
data_tab = gt_itab
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
not_supported_by_gui = 22
error_no_gui = 23
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.
and i created XSLT test conversion:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<CUSTOMERS>
<xsl:apply-templates select="//IPERSON/item"/>
</CUSTOMERS>
</xsl:template>
<xsl:template match="IPERSON/item">
<item>
<customer_id>
<xsl:value-of select="CUST_ID"/>
</customer_id>
<first_name>
<xsl:value-of select="FIRSTNAME"/>
</first_name>
<last_name>
<xsl:value-of select="LASTNAME"/>
</last_name>
</item>
</xsl:template>
</xsl:transform>
Seem all correct infact the program download a file XML but the file have the encoding="UTF-16" also if i have specified "iso-8859-1" and if i tried to opend the xml file the file appears not correct because is generated with as first character "#", why?
Below the xml generated..
What i have to do to generate a correct XML without errors?
#<?xml version="1.0" encoding="utf-16"?>
<CUSTOMERS>
<item>
<customer_id>0003</customer_id>
<first_name>Bill</first_name>
<last_name>Gates</last_name>
</item>
<item>
<customer_id>0004</customer_id>
<first_name>Frodo</first_name>
<last_name>Baggins</last_name>
</item>
</CUSTOMERS>hello all!
i resolve the problem using:
* Perform the XSLT stylesheet
g_ixml = cl_ixml=>create( ).
g_stream_factory = g_ixml->CREATE_STREAM_FACTORY( ).
g_encoding = g_ixml->create_encoding( character_set = 'utf-16' "unicode
byte_order = 0 ).
resstream = g_stream_factory->CREATE_OSTREAM_ITABLE( table = gt_xml_itab ).
call method resstream->set_encoding
exporting encoding = g_encoding.
I think it's the right way, i put all my ABAP program updated:
*& Report Z_ABAP_TO_XML *
*& Write the data from an internal ABAP table into an XML document, *
*& and write it onto your frontend computer *
REPORT z_abap_to_xml.
TYPE-POOLS: abap.
CONSTANTS gs_file TYPE string VALUE 'C:UsersMarco ConsultantDesktop est.xml'.
data: g_ixml type ref to if_ixml.
data: g_stream_factory type ref to IF_IXML_STREAM_FACTORY.
data: resstream type ref to if_ixml_ostream.
data: g_encoding type ref to if_ixml_encoding.
* This is the structure for the data to go into the XML file
TYPES: BEGIN OF ts_person,
cust_id(4) TYPE n,
firstname(20) TYPE c,
lastname(20) TYPE c,
END OF ts_person.
* Table for the XML content
DATA: gt_xml_itab TYPE STANDARD TABLE OF char2048.
* Table and work area for the data to fill the XML file with
DATA: gt_person TYPE STANDARD TABLE OF ts_person,
gs_person TYPE ts_person.
* Source table that contains references
* of the internal tables that go into the XML file
DATA: gt_source_itab TYPE abap_trans_srcbind_tab,
gs_source_wa TYPE abap_trans_resbind.
* For error handling
DATA: gs_rif_ex TYPE REF TO cx_root,
gs_var_text TYPE string.
* Fill the internal table
gs_person-cust_id = '3'.
gs_person-firstname = 'Bill'.
gs_person-lastname = 'Gates'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '4'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '5'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '6'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '7'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '8'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '9'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '10'.
gs_person-firstname = 'Frodo'.
gs_person-lastname = 'Baggins'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '11'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
gs_person-cust_id = '88'.
gs_person-firstname = 'Frodoèé'.
gs_person-lastname = 'Baggins~¦Üu0192'.
APPEND gs_person TO gt_person.
* Fill the source table with a reference to the data table.
* Within the XSLT stylesheet, the data table can be accessed with
* "IPERSON".
GET REFERENCE OF gt_person INTO gs_source_wa-value.
gs_source_wa-name = 'IPERSON'.
APPEND gs_source_wa TO gt_source_itab.
* Perform the XSLT stylesheet
g_ixml = cl_ixml=>create( ).
g_stream_factory = g_ixml->CREATE_STREAM_FACTORY( ).
g_encoding = g_ixml->create_encoding( character_set = 'utf-16' "unicode
byte_order = 0 ).
resstream = g_stream_factory->CREATE_OSTREAM_ITABLE( table = gt_xml_itab ).
call method resstream->set_encoding
exporting encoding = g_encoding.
TRY.
CALL TRANSFORMATION z_abap_to_xml
SOURCE (gt_source_itab)
RESULT XML gt_xml_itab.
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
gs_var_text = gs_rif_ex->get_text( ).
MESSAGE gs_var_text TYPE 'E'.
ENDTRY.
* Download the XML file to your client
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = gs_file
FILETYPE = 'BIN'
CHANGING
data_tab = gt_xml_itab
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
not_supported_by_gui = 22
error_no_gui = 23
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.
*-- we don't need the stream any more, so let's close it...
CALL METHOD resstream->CLOSE( ).
CLEAR resstream. -
Problem while reading XML file from Aplication server(Al11)
Hi Experts
I am facing a problem while reading XML file from Aplication server using open data set.
OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
IF sy-subrc <> 0.
EXIT.
ENDIF.
READ DATASET v_dsn INTO v_rec.
WHILE sy-subrc <> 0.
ENDWHILE.
CLOSE DATASET v_dsn.
The XML file contains the details from an IDOC number , the expected output is XML file giving all the segments details in a single page and send the user in lotus note as an attachment, But in the present output after opening the attachment i am getting a single XML file which contains most of the segments ,but in the bottom part it is giving the below error .
- <E1EDT13 SEGMENT="1">
<QUALF>001</QUALF>
<NTANF>20110803</NTANF>
<NTANZ>080000</NTANZ>
<NTEND>20110803<The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
/SPAN></NTEND>
<NTENZ>000000</NTENZ>
for all the xml its giving the error in bottom part , but once we open the source code and if we saved in system without changing anything the file giving the xml file without any error in that .
could any one can help to solve this issue .Hi Oliver
Thanx for your reply.
see the latest output
- <E1EDT13 SEGMENT="1">
<QUALF>003</QUALF>
<NTANF>20110803</NTANF>
<NTANZ>080000</NTANZ>
<NTEND>20110803</NTEND>
<NTENZ>000000</NTENZ>
<ISDD>00000000</ISDD>
<ISDZ>000000</ISDZ>
<IEDD>00000000</IEDD>
<IEDZ>000000</IEDZ>
</E1EDT13>
- <E1EDT13 SEGMENT="1">
<QUALF>001</QUALF>
<NTANF>20110803</NTANF>
<NTANZ>080000</NTANZ>
<NTEND>20110803<The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
/SPAN></NTEND>
<NTENZ>000000</NTENZ>
E1EDT13 with QUALF>003 and <E1EDT13 SEGMENT="1">
with <QUALF>001 having almost same segment data . but E1EDT13 with QUALF>003 is populating all segment data
properly ,but E1EDT13 with QUALF>001 is giving in between. -
I can not do the update , what should I do to fix this error ?
"There was a problem with downloading the file . For tips on troubleshooting , please go to Customer Support . ( Error code : 204 ) ." thanksHi,
Please refer to the help document below:
Error downloading, installing, or updating Creative Cloud applications
Regards,
Sheena -
GUI_UPLOAD - Problem in uploading xml file
Hi,
I have problem in uploading xml file into itab.
Here is the code
begin of GS_STRING,
STR(72) type C,
end of GS_STRING,
GT_STRING like standard table of GS_STRING,
call function 'GUI_UPLOAD'
EXPORTING
FILENAME = FILE_NAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = GT_STRING
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
others = 17.
if SY-SUBRC <> 0.
message I499(SY) with 'File upload failed'.
stop.
endif.
endif.
In debuggin mode, i can see the itab uploaded with xml payload. But in that same place, the hexadecimal format has double zeros 00 after each character.
XML message : <?xml
Correct Hexadecimal : 3C3F786D6C
Hexadecimal in itab : 3C003F0078006D006C00
This makes the resultant xml invalid.
can anyone help me to solve this?
Thanks,
Uma
Edited by: Uma Maheswari on May 30, 2008 4:15 PMwhat do you want to do with the uploaded XML?
i use the following
constants: line_size type i value 255.
data: begin of xml_tab occurs 0,
raw(line_size) type x,
end of xml_tab,
file type string,
size type i.
call function 'GUI_UPLOAD'
exporting
filename = filename
filetype = 'BIN'
has_field_separator = ' '
header_length = 0
importing
filelength = size
tables
data_tab = xml_tab
exceptions
others = 1. -
How to Download XML File to internal table
Hi Friends,
This is my urgent requirement. How to download XML File to Internal table.
regards
pauldharmaHai,
Please check this Link
http://www.sap-img.com/abap/upload-direct-excel.htm
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/excel-file-download-to-an-internal-table-in-sap-crm-1719453#
tables: zinv_release,
zpo_release.
** decleration of data
DATA: BEGIN OF my_tab OCCURS 0.
INCLUDE STRUCTURE zinv_release.
DATA: END OF my_tab.
*DATA: hex_tab TYPE x VALUE '09'.
DATA: rec(200)."'/usr/test.dat'.
DATA:
zhours(20) TYPE c,
MINS(20) type c. "decimals.
data: coma.
coma = ','.
SELECTION-SCREEN BEGIN OF BLOCK txt
WITH FRAME TITLE text-001.
PARAMETERS: dsn(60) DEFAULT '\\sapdev01\prod\'.
SELECTION-SCREEN END
OF BLOCK txt.
*using a dataset to get text
OPEN DATASET dsn FOR INPUT IN TEXT MODE.
IF sy-subrc = 0.
DO.
READ DATASET dsn INTO rec.
IF sy-subrc <> 0.
EXIT.
ENDIF.
split rec at coma into
zpo_release-REL_GRP
zpo_release-REL_CODE
zpo_release-RESPREL
zpo_release-ALTREL
zpo_release-MANAGER
ZHOURS
MINS
zpo_release-FROMTIME
zpo_release-TOTIME
zpo_release-EXCLWKENDS.
move zpo_release-REL_GRP to my_tab-REL_GRP.
move zpo_release-REL_CODE to my_tab-REL_CODE.
move zpo_release-RESPREL to my_tab-RESPREL.
move zpo_release-ALTREL to my_tab-ALTREL.
move zpo_release-MANAGER to my_tab-MANAGER.
move ZHOURS to my_tab-ZHOURS.
move MINS to my_tab-mins.
move zpo_release-FROMTIME to my_tab-fromtime.
move zpo_release-TOTIME to my_tab-totime.
move zpo_release-EXCLWKENDS to my_tab-exclwkends.
APPEND my_tab.
ENDDO.
INSERT zpo_release FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
** DELETE zmm_ppa_cc FROM TABLE tab.
** INSERT zzzak_emp FROM TABLE my_tab ACCEPTING DUPLICATE KEYS.
IF sy-subrc = 0.
MESSAGE i000(zv) WITH 'File Successful stored in DB.' '' '' ''.
** ELSE.
MESSAGE i000(zv) WITH 'File already stored in DB.' '' '' ''.
endif.
ENDIF.
reward if helpful
raam -
How to download XML file to ITAB
hi friends
this is my urgent req. how to download XML file to Local itab
any other function or sample program available.
with luv.
pauldharmaHi,
please check this code.
Uploading Excel file to SAP Using Function Module ALSM_EXCEL_TO_INTERNAL_TABLE
REPORT ZEXCELUPLOAD.
PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
begcol TYPE i DEFAULT 1 NO-DISPLAY,
begrow TYPE i DEFAULT 1 NO-DISPLAY,
endcol TYPE i DEFAULT 100 NO-DISPLAY,
endrow TYPE i DEFAULT 32000 NO-DISPLAY.
* Tick don't append header
PARAMETERS: kzheader AS CHECKBOX.
DATA: BEGIN OF intern OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern.
DATA: BEGIN OF intern1 OCCURS 0.
INCLUDE STRUCTURE alsmex_tabline.
DATA: END OF intern1.
DATA: BEGIN OF t_col OCCURS 0,
col LIKE alsmex_tabline-col,
size TYPE i.
DATA: END OF t_col.
DATA: zwlen TYPE i,
zwlines TYPE i.
DATA: BEGIN OF fieldnames OCCURS 3,
title(60),
table(6),
field(10),
kz(1),
END OF fieldnames.
* No of columns
DATA: BEGIN OF data_tab OCCURS 0,
value_0001(50),
value_0002(50),
value_0003(50),
value_0004(50),
value_0005(50),
value_0006(50),
value_0007(50),
value_0008(50),
value_0009(50),
value_0010(50),
value_0011(50),
value_0012(50),
value_0013(50),
value_0014(50),
value_0015(50),
value_0016(50),
value_0017(50),
value_0018(50),
value_0019(50),
value_0020(50),
value_0021(50),
value_0022(50),
value_0023(50),
value_0024(50),
value_0025(50),
value_0026(50),
value_0027(50),
value_0028(50),
value_0029(50),
value_0030(50),
value_0031(50),
value_0032(50),
value_0033(50),
value_0034(50),
value_0035(50),
value_0036(50),
value_0037(50),
value_0038(50),
value_0039(50),
value_0040(50),
value_0041(50),
value_0042(50),
value_0043(50),
value_0044(50),
value_0045(50),
value_0046(50),
value_0047(50),
value_0048(50),
value_0049(50),
value_0050(50),
value_0051(50),
value_0052(50),
value_0053(50),
value_0054(50),
value_0055(50),
value_0056(50),
value_0057(50),
value_0058(50),
value_0059(50),
value_0060(50),
value_0061(50),
value_0062(50),
value_0063(50),
value_0064(50),
value_0065(50),
value_0066(50),
value_0067(50),
value_0068(50),
value_0069(50),
value_0070(50),
value_0071(50),
value_0072(50),
value_0073(50),
value_0074(50),
value_0075(50),
value_0076(50),
value_0077(50),
value_0078(50),
value_0079(50),
value_0080(50),
value_0081(50),
value_0082(50),
value_0083(50),
value_0084(50),
value_0085(50),
value_0086(50),
value_0087(50),
value_0088(50),
value_0089(50),
value_0090(50),
value_0091(50),
value_0092(50),
value_0093(50),
value_0094(50),
value_0095(50),
value_0096(50),
value_0097(50),
value_0098(50),
value_0099(50),
value_0100(50).
DATA: END OF data_tab.
DATA: tind(4) TYPE n.
DATA: zwfeld(19).
FIELD-SYMBOLS: <fs1>.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
mask = '*.xls'
static = 'X'
CHANGING
file_name = filename.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = begcol
i_begin_row = begrow
i_end_col = endcol
i_end_row = endrow
TABLES
intern = intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE:/ 'Upload Error ', SY-SUBRC.
ENDIF.
END-OF-SELECTION.
LOOP AT intern.
intern1 = intern.
CLEAR intern1-row.
APPEND intern1.
ENDLOOP.
SORT intern1 BY col.
LOOP AT intern1.
AT NEW col.
t_col-col = intern1-col.
APPEND t_col.
ENDAT.
zwlen = strlen( intern1-value ).
READ TABLE t_col WITH KEY col = intern1-col.
IF sy-subrc EQ 0.
IF zwlen > t_col-size.
t_col-size = zwlen.
* Internal Table, Current Row Index
MODIFY t_col INDEX sy-tabix.
ENDIF.
ENDIF.
ENDLOOP.
DESCRIBE TABLE t_col LINES zwlines.
SORT intern BY row col.
IF kzheader = 'X'.
LOOP AT intern.
fieldnames-title = intern-value.
APPEND fieldnames.
AT END OF row.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
DO zwlines TIMES.
WRITE sy-index TO fieldnames-title.
APPEND fieldnames.
ENDDO.
ENDIF.
SORT intern BY row col.
LOOP AT intern.
IF kzheader = 'X'
AND intern-row = 1.
CONTINUE.
ENDIF.
tind = intern-col.
CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
ASSIGN (zwfeld) TO <fs1>.
<fs1> = intern-value.
AT END OF row.
APPEND data_tab.
CLEAR data_tab.
ENDAT.
ENDLOOP.
CALL FUNCTION 'DISPLAY_BASIC_LIST'
EXPORTING
file_name = filename
TABLES
data_tab = data_tab
fieldname_tab = fieldnames.
*-- End of Program
Uploading Excel file to SAP Using Function Module TEXT_CONVERT_XLS_TO_SAP
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.
here are the links for further details
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
http://www.sap-img.com/abap/upload-direct-excel.htm
reward if helpful
raam -
Problems with reading XML files with ISO-8859-1 encoding
Hi!
I try to read a RSS file. The script below works with XML files with UTF-8 encoding but not ISO-8859-1. How to fix so it work with booth?
Here's the code:
import java.io.File;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import java.net.*;
* @author gustav
public class RSSDocument {
/** Creates a new instance of RSSDocument */
public RSSDocument(String inurl) {
String url = new String(inurl);
try{
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(url);
NodeList nodes = doc.getElementsByTagName("item");
for (int i = 0; i < nodes.getLength(); i++) {
Element element = (Element) nodes.item(i);
NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);
System.out.println("Title: " + getCharacterDataFromElement(line));
NodeList des = element.getElementsByTagName("description");
line = (Element) des.item(0);
System.out.println("Des: " + getCharacterDataFromElement(line));
} catch (Exception e) {
e.printStackTrace();
public String getCharacterDataFromElement(Element e) {
Node child = e.getFirstChild();
if (child instanceof CharacterData) {
CharacterData cd = (CharacterData) child;
return cd.getData();
return "?";
}And here's the error message:
org.xml.sax.SAXParseException: Teckenkonverteringsfel: "Malformed UTF-8 char -- is an XML encoding declaration missing?" (radnumret kan vara f�r l�gt).
at org.apache.crimson.parser.InputEntity.fatal(InputEntity.java:1100)
at org.apache.crimson.parser.InputEntity.fillbuf(InputEntity.java:1072)
at org.apache.crimson.parser.InputEntity.isXmlDeclOrTextDeclPrefix(InputEntity.java:914)
at org.apache.crimson.parser.Parser2.maybeXmlDecl(Parser2.java:1183)
at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:653)
at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
at org.apache.crimson.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:185)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at getrss.RSSDocument.<init>(RSSDocument.java:25)
at getrss.Main.main(Main.java:25)I read files from the web, but there is a XML tag
with the encoding attribute in the RSS file.If you are quite sure that you have an encoding attribute set to ISO-8859-1 then I expect that your RSS file has non-ISO-8859-1 character though I thought all bytes -128 to 127 were valid ISO-8859-1 characters!
Many years ago I had a problem with an XML file with invalid characters. I wrote a simple filter (using FilterInputStream) that made sure that all the byes it processed were ASCII. My problem turned out to be characters with value zero which the Microsoft XML parser failed to process. It put the parser in an infinite loop!
In the filter, as each byte is read you could write out the Hex value. That way you should be able to find the offending character(s). -
Performance problem when creating XML-file
Hi,
I want to create a XML-file with customer data from an internal table. This internal table has appr. 62000 entries. It takes hours to create the elements of the file.
This is the coding I have used:
loop at it_debtor.
at first.
Creating a ixml factory
l_ixml = cl_ixml=>create( ).
Creating the dom object model
l_document = l_ixml->create_document( ).
Fill root node
l_element_argdeb = l_document->create_simple_element(name = 'argDebtors'
parent = l_document ).
endat.
Create element 'debtor' as child of 'argdeb'
l_element_debtor = l_document->create_simple_element(
name = 'debtor'
parent = l_element_argdeb ).
Create elements as child of 'debtor'
l_value = it_debtor-admid.
perform create_element using 'financialAdministrationId'.
l_value = it_debtor-kunnr.
perform create_element using 'financialDebtorId'.
l_value = it_debtor-name1.
21 child elements in total are created
endloop.
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect internal XML table to stream factory
l_ostream = l_streamfactory->create_ostream_itable( table =
l_xml_table ).
Rendering the document
l_renderer = l_ixml->create_renderer( ostream = l_ostream
document = l_document ).
l_rc = l_renderer->render( ).
open dataset p_path for output in binary mode.
if sy-subrc eq 0.
loop at l_xml_table into rec.
transfer rec to p_path.
endloop.
close dataset p_path.
if sy-subrc eq 0.
write:/ wa_lines, 'records have been processed'.
endif.
else.
write:/ p_path, 'can not be opened.'.
endif.
form create_element using p_text.
check not l_value is initial.
l_element_dummy = l_document->create_simple_element(
name = p_text
value = l_value
parent = l_element_debtor ).
endform. " create_element
Please can anyone tell me how to improve the performance.
The method create_simple_element takes a long time.
SAP release : 46C
Regard,
ChristineHi Christine!
There might be several reasons - but you have to look at the living patient, not only the dead coding.
You did not show any selects, loop at ... where or read table statements -> the usual slow parts are not included (or visible...).
Of course the method-calls can contain slow statements, but you can also have problems because of size (when internal memory gets swaped to disc).
Make a runtime analysis (SE30), have a look in SM50 (details!) for the size, maybe add an info-message for every 1000-customer (-> will be logged in job-log), so you will see if all 1000-packs are executed in same runtime.
With this tools you have to search for the slow parts:
- general out of memory problems, maybe because of to much buffering (visible by slower execution at the end)
- slow methods / selects / other components by SM30 -> have a closer look
Maybe a simple solution: make three portions with 20000 entries each and just copy the files into one, if necessary.
Regards,
Christian -
Download XMl file from SFTP: performance issue
Hi All,
I am downloading an XML file of size almost 15-20 MB from an SFTP using winSCP.
A C# code is written in SSIS script component which loops the remote directory to find the recent file then it downloads it. This process is taking almost 20 minutes to run in SSIS.
Could anyone please suggest me the optimized solution.
few keynotes: 1> on SFTP, there will be always more number of files, say 50-60.
2> file size may grow with time
3> comparing filename to find latest file because filename is suffixed with timestamp e.g. filename_YYYYMMDD.xml
below is my C# code used in script component
public void Main()
string hostName = (string)Dts.Variables["HostName"].Value;
string userName = (string)Dts.Variables["UserName"].Value;
string password = (string)Dts.Variables["Password"].Value;
string sshHostKeyFingerprint = (string)Dts.Variables["SshHostKeyFingerprint"].Value;
string winscpexecutablePath = (string)Dts.Variables["winscpExecutablePath"].Value;
string localOutPath = (string)Dts.Variables["User::localOutPath"].Value;
string remoteDirectory = (string)Dts.Variables["User::ftpRemoteDirectory"].Value;
string latestFileName = null;
List<DateTime> fileDate = new List<DateTime>();
Dictionary<DateTime, string> dicfiledate = new Dictionary<DateTime, string>();
// Setup session options
SessionOptions sessionOptions = new SessionOptions
Protocol = Protocol.Sftp,
HostName = hostName,
UserName = userName,
Password = password,
SshHostKeyFingerprint = sshHostKeyFingerprint
try
using (Session session = new Session())
session.ExecutablePath = winscpexecutablePath;
session.Open(sessionOptions);
RemoteDirectoryInfo directory = session.ListDirectory(remoteDirectory);
RemoteFileInfo[] fileInfo = new RemoteFileInfo[directory.Files.Count];
if (fileInfo.Length <= 0)
Dts.Variables["User::isFileExist"].Value = false;
else
Dts.Variables["User::isFileExist"].Value = true;
List<string> lstFileNames = new List<string>();
for (int i = 0; i < directory.Files.Count; i++)
lstFileNames.Add(directory.Files[i].Name);
Dictionary<DateTime, int> dictFinal = new Dictionary<DateTime, int>();
for (int i = 0; i < lstFileNames.Count; i++)
if (lstFileNames[i].StartsWith("metrics_"))
int year = Convert.ToInt32(lstFileNames[i].Substring(8, 4));
int month = Convert.ToInt32(lstFileNames[i].Substring(12, 2));
int date = Convert.ToInt32(lstFileNames[i].Substring(14, 2));
dictFinal.Add(new DateTime(year, month, date), i);
var sortedDateTime = dictFinal.Keys.OrderByDescending(x => x);
int latestFileIndex = dictFinal[Convert.ToDateTime(sortedDateTime.First())];
latestFileName = lstFileNames[latestFileIndex];
// files transfer mode
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Binary;
TransferOperationResult transferResult;
transferResult = session.GetFiles(remoteDirectory + latestFileName, @"" + localOutPath + @"\", false, transferOptions);
transferResult.Check();
// Print results
bool fireAgain = false;
foreach (TransferEventArgs transfer in transferResult.Transfers)
Dts.Events.FireInformation(0, null,
string.Format("Download of {0} succeeded", transfer.FileName),
null, 0, ref fireAgain);
Dts.TaskResult = (int)DTSExecResult.Success;
catch (Exception e)
Dts.Events.FireError(0, null,
string.Format("Error when using WinSCP to Download files: {0}", e),
null, 0);
Dts.TaskResult = (int)DTSExecResult.Failure;Hi Rahul,
Is it possible for you to get the latest file by comparing the CreationTime of these files other than comparing the file names? If so, you can try the code in Reza’s blog:
http://www.rad.pasfu.com/index.php?/archives/30-Find-Last-Created-File-in-Special-Directory-SSIS.html
Alternatively, maybe you can try a free third party SFTP Task available on the CodePlex:
http://ssissftp.codeplex.com/
Regards,
Mike Yin
TechNet Community Support -
Problem reading an xml file using java
i have a Com File which is called through .Net application and i made another java application that call the same COM file using JNI . but the problem is that the xml format generated from the Com file in case of the .Net application is approx 49.9K and the same Xml file Contents generated through java is half the size of the previous file in .net about 24.9K . I had figured out that the .Net application generates the xml file as unicode format while the java application generates the same xml format as ANSI format which is approx the half of the .Net counterpart .
but the problem now is that i can't deserialize the java generated xml to convert it into its java object using XMLDecoder because it is ill formed xml whereas its tags are well structured .
even when i try to open that .NEt xml file into the IE browser it structures the xml file successfully
while the java xml file version tells me that the file is ill formed knowing that the file is well structured and all the tags are valid.First of, that's not "Unicode" and "ANSI". Those are not really encodings per-se. "Unicode" is sometimes used to refer to UTF-16/UCS-2, and "ANSI" is sometimes used to refer to whatever the current 1-byte encoding of the machine is. But again: Those are not valid encoding names. The encodings used are probably UTF-16 (or UCS-2) and UTF-8, respectively.
Next: unless you tell us some exact error message we can't tell you what went wrong.
And if you want to find out if any given XML file is valid, just run it through some validator (such as [the one from the W3C|http://validator.w3.org/]). -
Performance problems loading an XML file into oracle database
Hello ODI Guru's,
I am trying to load and XML file into the database after doing simple business validations. But the interface takes hours to complete.
1. The XML files are large in size >200 Mb. We have an XSD file for the schema definition instead of a DTD.
2. We used the external database feature for loading these files in database.
The following configuration was used in the XML Data Server:
jdbc:snps:xml?f=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xml&d=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xsd&re=initialLoad&s=CM&db_props=oracle&ro=true
3. Now we reverse engineer the XML files and created models using ODI Designer
4. Similar thing was done for the target i.e. an Oracle database table as well.
5. Next we created a simple interface with one-to-one mapping from the XSD schema to the Oracle database table and executed the interface. This execution takes more than one hour to complete.
6. We are running ODI client on Windows XP Professional SP2.
7. The Oracle database server(Oracle 10g 10.2.0.3) for the target schema as well as the ODI master and work repositories are on the same machine.
8. I tried changing the following properties but it is not making much visible difference:
use_prepared_statements=Y
use_batch_update=Y
batch_update_size=510
commit_periodically=Y
num_inserts_before_commit=30000
I have another problem that when I set batch_update_size to value greater that 510 I get the following error:
java.sql.SQLException: class org.xml.sax.SAXException
class java.lang.ArrayIndexOutOfBoundsException said -32413
at com.sunopsis.jdbc.driver.xml.v.a(v.java)
The main concern is why should the interface taking so long to execute.
Please send suggestions to resolve the problem.
Thanks in advance,
Best Regards,
NikunjApproximately how many rows are you trying to insert?
One of the techniques which I found improved performance for this scenario was to extract from the xml to a flat file, then to use SQL*LOADER or external tables to load the data into Oracle. -
I am having a problem when downloading a file. What can I do?
Today (April 8, 2011) when I tried to download a file (.zip) firefox froze. When firefox got to the download window (i.e where you choose to save the file onto you computer) it froze. It wouldn't save the file, nor would it let me close the download window and cancel the download. This has happen twice this year. I had to force quit the program. I am on the latest version of Mac OS X and firefox 3.6.16.
See this article: [[Firefox Hangs]]
''<hr>Note: If anyone's reply has solved your problem, then please mark that reply as "Solved It" to the right of that reply after logging in your account. It will help us to concentrate on new questions.'' -
LPX-00004 - Problems while inserting xml files in a xmltype column
I've faced two problems while trying to insert xml files into my table containing a xmltype column:
create table xml_test (id number(20),content xmltype)
I use following java code for writing xml docs into db:
conn.setAutoCommit(false);
OraclePreparedStatement stmt = (OraclePreparedStatement)
conn.prepareStatement("INSERT INTO xml_test (id,content) VALUES(?,?)");
File file = new File(file1);
InputStream in1 = new FileInputStream(file1);
Reader r1 = new BufferedReader(new InputStreamReader(in1, "UTF-8"));
int len = 0;
StringBuffer text = new StringBuffer();
while ((len = r1.read()) != -1) {
text.append((char) len);
in1.close();
r1.close();
XMLType poXML1 = XMLType.createXML(conn, text.toString());
for (int i = 1; i <= 1; i++) {
stmt.setInt(1, i);
stmt.setObject(2, poXML1);
stmt.execute();
conn.commit();
1. problem: occures only if a xml schema has been assoicated to the specific xmltype column. it seems that the length of a specific xml tag in the document is limited. but why?
java.sql.SQLException: ORA-22814: attribute or element value is larger than specified in type
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
at test.insertXML(test.java:84)
at test.main(test.java:261)
hier the xml-schema of the xmltype column "content":
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="AUTOR-ID" type="xs:string"/>
<xs:element name="BODY" type="xs:string"/>
<xs:element name="CONTENT">
<xs:complexType>
<xs:sequence>
<xs:element ref="METADATEN"/>
<xs:element ref="BODY"/>
</xs:sequence>
<xs:attribute name="content-id" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="DATUM" type="xs:string"/>
<xs:element name="KEYWORD" type="xs:string"/>
<xs:element name="METADATEN">
<xs:complexType>
<xs:sequence>
<xs:element ref="DATUM"/>
<xs:element ref="TITEL" maxOccurs="unbounded"/>
<xs:element ref="KEYWORD" maxOccurs="unbounded"/>
<xs:element ref="AUTOR-ID"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TITEL" type="xs:string"/>
</xs:schema>
2. problem: hier i have no idea what is happening ... please help
java.sql.SQLException: ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00004: internal error "MultiChar overflow"
Error at line 61
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1093)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:656)
at test.insertXML(test.java:53)
at test.main(test.java:259)It's hard for me to tell you more without seeing your instance data, but for problem #1, if you look at the underlying SQL types being generated by your schema, you will see that the default SQL mapping for a "string" in your schema is a VARCHAR2(4000) (and I believe this would be only 2000 for a varying width character set like UTF8).
You can specify that you wish this column to be mapped as a CLOB in your schema if this is the problem. Also note that there is a 64K limit on the size of an individual node in XMLType. -
good morning,
i've a problem when i try to import an XML file to SQL.
In my particular case i've an xml file structured like this:
<?xml version="1.0" encoding="UTF-8"?>
<Flussi xmlns="http://indennitario.acquirenteunico.it/Semplificato/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Flusso xsi:type="FlussoSI1.1150Type" COD_FLUSSO="1150" COD_SERVIZIO="SI1">
<IdentificativiRichiesta>
<CodPratGestore>688628</CodPratGestore>
</IdentificativiRichiesta>
</Flusso>
</Flussi>
I managed to import that file in that way:
DECLARE @XML AS XML, @hDoc AS INT, @SQL NVARCHAR (MAX)
SELECT @XML = '<Flussi
>
<Flusso COD_FLUSSO="1150" COD_SERVIZIO="SI1">
<IdentificativiRichiesta>
<CodPratGestore>688628</CodPratGestore>
</IdentificativiRichiesta>
</Flusso>
</Flussi>'
EXEC sp_xml_preparedocument @hDoc OUTPUT, @XML
SELECT
Cod_flusso = Events.value('@COD_FLUSSO', 'int'),
Cod_servizio = Events.value('@COD_SERVIZIO', 'varchar(20)'),
--EventIsFixed = Events.value('(IsFixed)[1]', 'varchar(20)'),
--EventKind = Events.value('(EventKind)[1]', 'varchar(20)'),
PIVAUtenteUscente = Events.value('(IdentificativiRichiesta/PIVAUtenteUscente)[1]', 'varchar(20)'),
CodPratUtente=Events.value('(IdentificativiRichiesta/CodPratUtente)[1]', 'varchar(20)'),
CodPOD=Events.value('(DatiTecnici/CodPOD)[1]', 'varchar(20)'),
Cf=Events.value('(AnagraficaClienteFinale/CF)[1]', 'varchar(20)'),
Cmor=Events.value('(DefinizioneIndennizzo/Cmor)[1]', 'float'),
Credito=Events.value('(DefinizioneIndennizzo/Credito)[1]', 'float'),
DataSwitching=Events.value('(DefinizioneIndennizzo/DataSwitching)[1]', 'varchar(20)'),
DataEmissione=Events.value('(FattureIndennizzo/DataEmissione)[1]', 'varchar(20)'),
TipoFattura=Events.value('(FattureIndennizzo/TipoFattura)[1]', 'varchar(20)'),
DataScadenza=Events.value('(FattureIndennizzo/DataScadenza)[1]', 'varchar(20)'),
IdentificativoFattura=Events.value('(FattureIndennizzo/IdentificativoFattura)[1]', 'varchar(20)'),
NumeroGiorniErogazione=Events.value('(FattureIndennizzo/NumeroGiorniErogazione)[1]', 'int')
--ParameterName = Events.value('(Fields/Parameter[@Name="Name"]/@Value)[1]', 'varchar(20)'),
--ParameterDuration = Events.value('(Fields/Parameter[@Name="Duration"]/@Value)[1]',
'varchar(20)')
FROM
@XML.nodes('/Flussi/Flusso') AS XTbl(Events)
EXEC sp_xml_removedocument @hDoc
The problem is that when i try to import the initial file with this kind of attributes: xsi:type="FlussoSI1.1150Type" i can't get the data.
does anyone know how to solve the problem? thank youdeclare @x xml='<?xml version="1.0" encoding="UTF-8"?>
<Flussi xmlns="http://indennitario.acquirenteunico.it/Semplificato/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Flusso xsi:type="FlussoSI1.1150Type" COD_FLUSSO="1150" COD_SERVIZIO="SI1">
<IdentificativiRichiesta>
<CodPratGestore>688628</CodPratGestore>
</IdentificativiRichiesta>
</Flusso>
</Flussi>'
;WITH XMLNAMESPACES(default 'http://indennitario.acquirenteunico.it/Semplificato/1.0')
select p.q.value('@COD_FLUSSO','int'),
p.q.value('@xsi:type[1]','varchar(100)'),
p.q.value('@COD_SERVIZIO','varchar(10)'),
p.q.value('(IdentificativiRichiesta/CodPratGestore)[1]','int')
from @x.nodes('/Flussi/Flusso')p(q)
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page
Maybe you are looking for
-
Issue with the presence indicator in list/library web part.
When viewing a user field (Created By, Modified By or a custom People column) through the list web part (either through the default page /Forms/AllItems.aspx or a custom web part page using a list/library) the presence indicator always says presence
-
A Few Ideas for a Future Photoshop Project
Sorry, guys. Everything is installed and working nicely here. The dog has not eaten my keyboard, and I have not got any points on my CC License (only because the Photoshop cops haven't caught me yet). So I thought I'd share this nice idea for a ph
-
How to check that my table is parent table or child table before trucating
Hi: say i wanted to trucate a table .the table might be a parent table or might be a child table.if its a child table then there wouldnt be any problems in truncating. if its a parent table the i believe i would have to diable all the foreign key con
-
Hello friends, In my source file , the first line is the header i want to ignore the first line(header) in FCC i tried with document-offset : 1 in FCC But it is not working any suggestions. Thanks Srinivas
-
HT1688 where did I find my iphone photos on my computer?
Hpow do I find iPhone photos on my compter? I just sync the phone.