SAP_CONVERT_TO_XML_FORMAT
We are on ECC5.0. I am trying to use function module SAP_CONVERT_TO_XML_FORMAT. I am having problems. When I try to execute the FM I get the message "Error generating the test frame". Do I need to use a different FM. All help is appreciated and will be rewarded.
thanks,
Mani
Its because of the mode you selected to execute. ie you are executing it in SE37.
Try the FM in your program (run time). It will work.
Cheers,
Thomas.
Similar Messages
-
Error in SAP_CONVERT_TO_XML_FORMAT function module
Hi ,
When i am executing function module : SAP_CONVERT_TO_XML_FORMAT its throwing error ,
even i executed from SE37 also same error is coming.
for detail i attached screen shots .
kindly help me to resolve issue <removed by moderator>.
Thanks & Regards,
Meenakshi
Message was edited by: Manish KumarHi,
Then that solves your problem.
Refer link for more info:http://scn.sap.com/thread/926488
thanks,
vidyasagar -
CRM equaling for ECC FM SAP_CONVERT_TO_XML_FORMAT
I am not able to find FM SAP_CONVERT_TO_XML_FORMAT in CRM. Can any one suggest me any other class or alternative FM is there in CRM?
Its because of the mode you selected to execute. ie you are executing it in SE37.
Try the FM in your program (run time). It will work.
Cheers,
Thomas. -
HI
Can anybody tell me "SAP_CONVERT_TO_XML_FORMAT" this fm available in sap 4.6CHi,
The FM Available in 4.6C.
Check the following therds give an idea and u can know it has used in 4.6 c
https://forums.sdn.sap.com/click.jspa?searchID=3234658&messageID=97082
https://forums.sdn.sap.com/click.jspa?searchID=3234658&messageID=27236
<b>Reward points</b>
Regards -
Program is working fine in one version but not in other how to handle this
hi all,
i have a program which works fine in ECC5. in that program i have used some XML related classes and interfaces. but when i try to execute this in 4.6c version its showing lot of all errors saying that so and so class or so and so interface is not supported in 4.6c version like that.
how to overcome these errors, means how to make the classes and interfaces which work fine in ECC5 to work well in 4.6c version.Hello Mr. Rich,
the coding which u provided was very helpful it almost solved my problem,but at
the the last iam stuck up with a small problem. i wrote the coding like this for my
program
tables:mara.
type-pools: truxs.
parameters: p_matnr like mara-matnr.
data: ixml type truxs_xml_table.
data: xxml like line of ixml.
data: size type i.
data: file_str type string.
file_str = 'C:\simp.xml'.
data: begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
aenam like mara-aenam,
vpsta like mara-vpsta,
end of itab_mara.
select matnr ernam aenam vpsta from mara into table itab_mara up to 5
rows where matnr = p_matnr.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
I_XML_DOC_NAME =
IMPORTING
PE_BIN_FILESIZE = size
TABLES
I_TAB_SAP_DATA = itab_mara
CHANGING
I_TAB_CONVERTED_DATA = ixml
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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = size
FILENAME = file_str
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ixml
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.
but when i try to open the XML file into which the data has to be downloaded it shows the following error.
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.
A name was started with an invalid character. Error processing resource 'file:///C:/simp.xml'. Line 1, Position 23
<?xml version="1.0"?><%_TYPE0000000019><%_TYPE0000000019><MATNR Datatype="C" Length="18">00000000008...
help me to resolve this problem.
thanks,
anil. -
Error while downloading data from internal table into XML file
hi all,
i developed a program to download data from into internal table to xml file like this.
tables: mara.
parameters: p_matnr like mara-matnr.
data: begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
aenam like mara-aenam,
vpsta like mara-vpsta,
end of itab_mara.
data: lv_field_seperator type c, " value 'X',
lv_xml_doc_name(30) type c, " string value my xml file,
lv_result type i.
lv_field_seperator = 'x'.
lv_xml_doc_name = 'my xml file'.
types: begin of truxs_xml_line,
data(256) type x,
end of truxs_xml_line.
types:truxs_xml_table type table of truxs_xml_line.
data:lv_tab_converted_data type truxs_xml_line,
lt_tab_converted_data type truxs_xml_table.
data: lv_xml_file type rlgrap-filename value 'c:\simp.xml'.
select matnr ernam aenam vpsta from mara into table itab_mara up to 5
rows where matnr = p_matnr.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = lv_field_seperator
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
I_XML_DOC_NAME = lv_xml_doc_name
IMPORTING
PE_BIN_FILESIZE = lv_result
TABLES
I_TAB_SAP_DATA = itab_mara
CHANGING
I_TAB_CONVERTED_DATA = lt_tab_converted_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.
open dataset lv_xml_file for output in binary mode.
loop at lt_tab_converted_data into lv_tab_converted_data.
transfer lv_tab_converted_data to lv_xml_file.
endloop.
close dataset lv_xml_file.
this program is syntactically correct and getting executed, but when i open the target xml file it is showing the following error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'file:///C:/simp.xml'.
will anyone show me the possible solution to rectify this error
thanks and regards,
anil.Hi,
Here is a small sample program to convert data in an internal table into XML format and display it.
DATA: itab TYPE TABLE OF spfli,
l_xml TYPE REF TO cl_xml_document.
* Read data into a ITAB
SELECT * FROM spfli INTO TABLE itab.
* Create the XML Object
CREATE OBJECT l_xml.
* Convert data in ITAB to XML
CALL METHOD l_xml->create_with_data( name = 'Test1'
dataobject = t_goal[] ).
* Display XML Document
CALL METHOD l_xml->display.
Here are some other sample SAP programs to handle XML in ABAP:
BCCIIXMLT1, BCCIIXMLT2, and BCCIIXMLT3.
Hope this helps,
Sumant. -
Generating an XML Document from an internal table in ABAP
Good day to all of you;
With ABAP, in the R/3 system, I'm trying to figure out a way to accomplish the following:
1) SELECT a set of Purchase Order data into an internal table.
2) Generate an XML document, containing the above data, using a specific schema.
I've been playing around with function module SAP_CONVERT_TO_XML_FORMAT which has the following interface:
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ''
I_LINE_HEADER = ''
I_FILENAME = v_fname
I_APPL_KEEP = ''
I_XML_DOC_NAME = v_docname
IMPORTING
PE_BIN_FILESIZE = v_byte
TABLES
I_TAB_SAP_DATA = i_SapData
CHANGING
I_TAB_CONVERTED_DATA = i_XMLData
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2.
I'm uncertain as to whether or not the Export parameter, I_XML_DOC_NAME refers to some schema or definition and therefore have been excluding it. In doing so, the generated XML document seems to use the field name/type information from my itab for the tags.
If this function module requires an XML Document Name, how do I create one and where do I store it in R/3? If this is not the recommended solution, is anyone familiar with a way to load an XML schema, retrieve some data then have SAP generate an XML document using the schema?
Many thanks for any help available.
THai Phillips
Try with the following Code
This program exports an internal table to an XML file.
Report ZPRUEBA_MML_13 *
Export an internal table to XML document *
NO BORRAR ESTE CODIGO *
REPORT ZPRUEBA_MML_13.
PANTALLA SELECCION *
PARAMETERS: GK_RUTA TYPE RLGRAP-FILENAME.
PANTALLA SELECCION *
TYPE TURNOS *
TYPES: BEGIN OF TURNOS,
LU LIKE T552A-TPR01,
MA LIKE T552A-TPR01,
MI LIKE T552A-TPR01,
JU LIKE T552A-TPR01,
VI LIKE T552A-TPR01,
SA LIKE T552A-TPR01,
DO LIKE T552A-TPR01,
END OF TURNOS.
TYPE TURNOS *
TYPE SOCIO *
TYPES: BEGIN OF SOCIO,
NUMERO LIKE PERNR-PERNR,
REPOSICION LIKE PA0050-ZAUVE,
NOMBRE LIKE PA0002-VORNA,
TURNOS TYPE TURNOS,
END OF SOCIO.
TYPE SOCIO *
ESTRUCTURA ACCESOS *
DATA: BEGIN OF ACCESOS OCCURS 0,
SOCIO TYPE SOCIO,
END OF ACCESOS.
ESTRUCTURA ACCESOS *
START OF SELECTION *
START-OF-SELECTION.
PERFORM LLENA_ACCESOS.
PERFORM DESCARGA_XML.
END-OF-SELECTION.
END OF SELECTION *
FORM LLENA_ACCESOS *
FORM LLENA_ACCESOS.
REFRESH ACCESOS.
CLEAR ACCESOS.
MOVE: '45050' TO ACCESOS-SOCIO-NUMERO,
'MOISES MORENO' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
CLEAR ACCESOS.
MOVE: '45051' TO ACCESOS-SOCIO-NUMERO,
'RUTH PEÑA' TO ACCESOS-SOCIO-NOMBRE,
'0' TO ACCESOS-SOCIO-REPOSICION,
'T1' TO ACCESOS-SOCIO-TURNOS-LU,
'T2' TO ACCESOS-SOCIO-TURNOS-MA,
'T3' TO ACCESOS-SOCIO-TURNOS-MI,
'T4' TO ACCESOS-SOCIO-TURNOS-JU,
'T5' TO ACCESOS-SOCIO-TURNOS-VI,
'T6' TO ACCESOS-SOCIO-TURNOS-SA,
'T7' TO ACCESOS-SOCIO-TURNOS-DO.
APPEND ACCESOS.
ENDFORM.
FORM LLENA_ACCESOS *
FORM DESCARGA_XML *
FORM DESCARGA_XML.
DATA: L_DOM TYPE REF TO IF_IXML_ELEMENT,
M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
G_IXML TYPE REF TO IF_IXML,
W_STRING TYPE XSTRING,
W_SIZE TYPE I,
W_RESULT TYPE I,
W_LINE TYPE STRING,
IT_XML TYPE DCXMLLINES,
S_XML LIKE LINE OF IT_XML,
W_RC LIKE SY-SUBRC.
DATA: XML TYPE DCXMLLINES.
DATA: RC TYPE SY-SUBRC,
BEGIN OF XML_TAB OCCURS 0,
D LIKE LINE OF XML,
END OF XML_TAB.
CLASS CL_IXML DEFINITION LOAD.
G_IXML = CL_IXML=>CREATE( ).
CHECK NOT G_IXML IS INITIAL.
M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
CHECK NOT M_DOCUMENT IS INITIAL.
WRITE: / 'Converting DATA TO DOM 1:'.
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'ACCESOS'
DATAOBJECT = ACCESOS[]
IMPORTING
DATA_AS_DOM = L_DOM
CHANGING
DOCUMENT = M_DOCUMENT
EXCEPTIONS
ILLEGAL_NAME = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
CHECK NOT L_DOM IS INITIAL.
W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
IF W_RC IS INITIAL.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
W_RC.
ENDIF.
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = M_DOCUMENT
IMPORTING
XML_AS_STRING = W_STRING
SIZE = W_SIZE
TABLES
XML_AS_TABLE = IT_XML
EXCEPTIONS
NO_DOCUMENT = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE 'Ok'.
ELSE.
WRITE: 'Err =',
SY-SUBRC.
ENDIF.
LOOP AT IT_XML INTO XML_TAB-D.
APPEND XML_TAB.
ENDLOOP.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
BIN_FILESIZE = W_SIZE
FILENAME = GK_RUTA
FILETYPE = 'BIN'
TABLES
DATA_TAB = XML_TAB
EXCEPTIONS
OTHERS = 10.
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.
FORM DESCARGA_XML *
Thanks & regards
Sreenivasulu P -
hi all,
i was downloading data from the internal table into an XML file. i wrote the coding in the following way. Mr. Rich Heilman helped to solve this requirement to the maximum extent but iam stuck at the last moment. the coding is
tables:mara.
type-pools: truxs.
parameters: p_matnr like mara-matnr.
data: ixml type truxs_xml_table.
data: xxml like line of ixml.
data: size type i.
data: file_str type string.
file_str = 'C:\simp.xml'.
data: begin of itab_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
aenam like mara-aenam,
vpsta like mara-vpsta,
end of itab_mara.
select matnr ernam aenam vpsta from mara into table itab_mara up to 5
rows where matnr = p_matnr.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER =
I_FILENAME =
I_APPL_KEEP = ' '
I_XML_DOC_NAME =
IMPORTING
PE_BIN_FILESIZE = size
TABLES
I_TAB_SAP_DATA = itab_mara
CHANGING
I_TAB_CONVERTED_DATA = ixml
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.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = size
FILENAME = file_str
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = ixml
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.
but when i tried to open the XML file it is showing the following error.
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.
A name was started with an invalid character. Error processing resource 'file:///C:/simp.xml'. Line 1, Position 23
<?xml version="1.0"?><%_TYPE0000000019><%_TYPE0000000019><MATNR Datatype="C" Length="18">00000000008...
do anyone know how to rectify this error.
thanks,
anil.check this thread for complete code sample
https://forums.sdn.sap.com/click.jspa?searchID=2218535&messageID=975797
Raja -
Issue: XML File Downloading to Application Server
Hi All,
I am experiencing an issue downloading an XML File to the Application Server.
I'm using FM SAP_CONVERT_TO_XML_FORMAT to convert SAP data to XML Format.
After getting the XML data into XMLTAB, I'm using:
OPEN DATASET pfile_fs FOR OUTPUT IN BINARY MODE .
LOOP AT xmltab INTO xmltab_w.
TRANSFER xmltab_w TO pfile_fs.
CLEAR xmltab_w.
ENDLOOP.
CLOSE DATASET pfile_fs.
The xml file is downloaded show an Error in '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:/shared/TEST/2009'
But when i download xml file using the FM WS_Download , the XML page has no errors .
I am unable to figure out what could be the issue, If this issue is due to some characters like Chinese or Japanese then .. is there any solution for this .
Please, give me your valuable suggestions.
Thank you,
PraseadDear Prasead,
Hope things are good at your end, i have got the same issue as well, could you please care to share the solution...Wud be of a gr8 help if you could do that, hope to have your response back.
Regards,
Abdul. -
How to Increase the memory size of a File in the Application Server
Hello Abaper's
I have generated a XML file for the data of internal table (with 10 Records). When i download , i can see the XML file for the Entire 10 Records.
But , while transferring the XML file to Applicationserver , it's transferring only upto max 4 Records.I assume that the memory is insufficient to allocate 10 Records. Can we Increase the Memory size of the File on Application server. OR, is there any error in My Source Code.
Code i used to Transfer the XML File to Application server.
OPEN DATASET FNAME FOR OUTPUT IN BINARY MODE.
IF sy-subrc EQ 0.
LOOP AT it_xmltab INTO wa_xmltab.
TRANSFER wa_xmltab TO FNAME.
ENDLOOP.
ELSE.
MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
ENDIF.
CLOSE DATASET FNAME.
Regards
JvHi,
DATA : filename TYPE rlgrap-filename.
DATA : doc_name TYPE char30.
DATA : bin_size TYPE i.
SELECT matnr matkl meins
FROM mara INTO TABLE it_mara
UP TO 10 ROWS.
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
i_filename = filename
i_xml_doc_name = doc_name
IMPORTING
pe_bin_filesize = bin_size
TABLES
i_tab_sap_data = it_mara " contains 10 Records
CHANGING
i_tab_converted_data = it_xmltab.
placing XML File in Appl. Server
DATA : FNAME(60) VALUE 'xyz_File'.
DATA : num TYPE i.
DATA : xmldata(256) TYPE x.
For Writing The data in Application Server
OPEN DATASET FNAME FOR OUTPUT IN BINARY MODE. " ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT it_xmltab INTO wa_xmltab.
TRANSFER wa_xmltab TO FNAME.
ENDLOOP.
ELSE.
MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
ENDIF.
CLOSE DATASET FNAME.
For Reading The data in Application Server
OPEN DATASET FNAME FOR INPUT IN BINARY MODE. " ENCODING DEFAULT.
DO.
IF sy-subrc EQ 0.
READ DATASET fname INTO xmldata.
WRITE :/ xmldata.
Clear xmldata.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET FNAME.
at runtime i can see
it_mara --> contain 10 records
it_xmltab --> contain 7 lines (Each line size is 255 char). This table have XML format data, (unknow format , with all numeric
digits)
it_xmltab is trasferred to application server , but the xml format is generated upto 4 records, and for the remaining records
the XML format is not generated.
the XML data in application server file is
<?xml version="1.0"?><TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY1</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">PC
</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY2</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">
PC </MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000001</MATNR><MEINS Datatype="C" Length="6">EA</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000002</MATNR
Regards
JV -
Create XML file on application server (unix directory) from internal table
Hallo everybody,
I have got the following problem:
I am working with <u><b>release 4.6C</b></u> and have got to create XML files from HR master data and organizational data respectively.
This takes place in 3 steps:
1. Collect the data in an internal table
2. Convert the data to XML format using the function module 'SAP_CONVERT_TO_XML_FORMAT'
3. Download the data
If I download the converted data, which are in an internal table, to the presentation server via the function module WS_DOWNLOAD and open it with the Internet Explorer, everything is ok.
If I download the converted data to the application server, i.e. into a unix directory via
open dataset, loop at internal table, transfer working area to file, close dataset
and then try to open it, this is not possible, because after the last tag some unreadable characters, e.g. a square, appear that arent supposed to be there. Thats what my colleagues told me, for I havent got access to the server.
I have no idea where these characters come from and how I can get rid of them. I guess that either I have to modify (how?) the table with the converted data before the download or I have to use another way to convert the data. For the second way I would probably have to work with an XML class or an XML interface. Unfortunately II am not an expert in working with classes so sample coding would have to be rather detailed.
Heres some more information about how I work with the conversion function module:
call function 'SAP_CONVERT_TO_XML_FORMAT'
exporting
i_field_seperator = lv_field_seperator
i_line_header = lv_line_header
i_filename = lv_xml_file
i_appl_keep = ' '
i_xml_doc_name = lv_xml_doc_name
importing
pe_bin_filesize = lv_result
tables
i_tab_sap_data = gt_data
changing
i_tab_converted_data = lt_tab_converted_data
exceptions
conversion_failed = 1
others = 2.
lv_field_seperator = X.
lv_xml_doc_name = Personalstammdaten Publikation
lv_result: type i
gt_data: fields: PERNR, PERSG, PERSK etc.
types:
begin of truxs_xml_line,
data(256) type x,
end of truxs_xml_line.
types:
truxs_xml_table type table of truxs_xml_line.
data:
lv_tab_converted_data type truxs_xml_line,
lt_tab_converted_data type truxs_xml_table
open dataset lv_xml_file for output in binary mode.
loop at lt_tab_converted_data into lv_tab_converted_data.
transfer lv_tab_converted_data to lv_xml_file.
endloop.
close dataset lv_xml_file
lv_xml_file: /usr/users/.../.../Personendaten_2004-11-02.xml
Hope the information is detailed enough! Otherwise let me know. Thank you in advance.
Message was edited by: Johannes SchwehmHi Raja,
tried the "TEXT" mode, but that didn't help.
There are still characters after the last tag, that are not supposed to be there including a date that is not
the creation date of the file.
Thank you for your help.
Regards
Johannes -
Sending internal table data to application server as an XML file
Hi All,
I am trying to send the internal table data to application server which should be stored in XML format.
I am using the following code:
DATA:
result TYPE xstring.
CALL TRANSFORMATION id
SOURCE tab = p_output-xsfdata
RESULT XML result.
OPEN DATASET l_xml_full_path FOR OUTPUT IN BINARY MODE.
TRANSFER result TO l_xml_full_path.
CLOSE DATASET l_xml_full_path.
And the content in the internal table is :
3C3F786D6C2076657273696F6E3D22312E30223F3E3C736620786D6C6E733D2275726E3A736
73796D206E616D653D22534653592D44415445223E30362F31302F323030393C2F73796D3E2
50617961626C653C6E65772D6C696E652F3E50617274206F6620746865204E616D653C6E657
.......and so on
With this a file is getting created on the application server, but the data is not correct. I am getting the data something like:
<?xml version="1.0" encoding="utf-8"?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><TAB><item>
PD94bWwgdmVyc2lvbj0iMS4wIj8+PHNmIHhtbG5zPSJ1cm46c2FwLWNv
MDA6eHNmIj48c21hcnR4c2Y+PGhlYWRlcj48Z2VuZXJhbD48dmVyc2lvbj4xLjE0LjI8L3ZlcnNp
b24PGZvcm0WkJMX1NESU5WX0xfMzwvZm9ybT48bGFuZ3VhZ2U+RU48L2xhbmd1YWdlPjxkZXZp
Y2UUFJJTlRFUjwvZGV2aWNlPjxvdXRwdXQtZGV2aWNlPlNYU0Y8L291dHB1dC1kZXZpY2UPC9n
ZW5lcmFsPjxwYWdlIG5hbWU9IkZJUlNUIiBpZD0iMDAxIi8PC9oZWFkZXIPGRhdGEgeG1sOnNw
YWNlPSJwcmVzZXJ2ZSIgc3R5bGU9Ii9TTUIxMS9CTF9TRiI+PGdyYXBoaWNzIG5hbWU9IkNPTUxP
R08iIG9iam5hbWU9Ii9TTUI0MC9MRUFGIiBvYmplY3Q9IkdSQVBISUNTIiBpZD0iQk1BUCIgdHlw
ZT0iQkNPTCIgcGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSIgcmVzb2x1dGlvbj0iMDEwMCIvPjx3
aW5kb3cgbmFtZT0iU0VOREVSIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4dCBuYW1l
PSJDT01BRERSIiBzdHlsZT0iL1NNQjExL0JMX1NGIiBvYmpuYW1lPSIvU01CMTEvQkxfU0VOREVS
IiBsYW5nPSJFTiIPHAgbmFtZT0iWlMiPkJhc2VsaW5lIENvbXBhbnk8L3APHAgbmFtZT0iWlMi
PjM0NzUgRGVlciBDcmVlazx0YWIvPlBob25lOjx0YWIvPisxICg2NTApIDg0OS00MDAwPC9wPjxw
IG5hbWU9IlpTIj5QYWxvIEFsdG8sIENBIDk0MzA0PHRhYi8+RmF4Ojx0YWIvPisxICg2NTApIDg0
OS00MjAwPC9wPjxwIG5hbWU9IlpTIj5VU0E8dGFiLz5JbnRlcm5ldDo8dGFiLz5odHRwOi8vd3d3
LnNhcC5jb208L3A+PC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iUEFHRSIgcGFnZT0iRklS
U1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iUEFHRU5VTUJFUiIgc3R5bGU9Ii9TTUIxMS9C
TF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj5QYWdlIDxzeW0gbmFtZT0iU0ZTWS1QQUdFIj4x
PC9zeW0IG9mIDxzeW0gbmFtZT0iU0ZTWS1KT0JQQUdFUyIvPjwvcD48cCBuYW1lPSJUTiIPA==</item>
<item>c3ltIG5hbWU9IlNGU1ktREFURSI+MDYvMTAvMjAwOTwvc3ltPiA8c
RSIMTQ6MDg6MDM8L3N5bT48L3APC90ZXh0Pjwvd2luZG93Pjx3aW5kb3cgbmFtZT0iTkFNRSIg
cGFnZT0iRklSU1QiIHBhZ2UtaWQ9IjAwMSI+PHRleHQgbmFtZT0iRk9STVVMQVJUSVRFTCIgc3R5
bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5hbWU9IlROIj48Y2hyIG5hbWU9Ik1MIj48
c3ltIG5hbWU9IlRJVExFIj5JbnZvaWNlPC9zeW0PC9jaHIPC9wPjwvdGV4dD48L3dpbmRvdz48
d2luZG93IG5hbWU9IkJJTExUT1BBUlRZIiBwYWdlPSJGSVJTVCIgcGFnZS1pZD0iMDAxIj48dGV4
dCBuYW1lPSJXSU5ET1dfVEVYVCIgc3R5bGU9Ii9TTUIxMS9CTF9TRiIgbGFuZz0iRU4iPjxwIG5h
bWU9IlRIIj5CaWxsLVRvLVBhcnR5PC9wPjwvdGV4dD48YWRkcmVzcyBuYW1lPSJCSUxMQUREUkVT
UyIgYWRkcm51bWJlcj0iMDAwMDAyMjQyNyI+PHRleHQgbmFtZT0iQklMTEFERFJFU1MiIHN0eWxl
PSIvU01CMTEvQkxfU0YiIGxhbmc9IkVOIj48cCBuYW1lPSJUMiI+VGVjaCBJbmM8bmV3LWxpbmUv
Could anyone tell me the reason why am I getting the data in this way?
Thanks in advance,
Swapna.
Edited by: NagaSwapna Thota on Jun 10, 2009 5:44 PMHI,
Use this FM SAP_CONVERT_TO_XML_FORMAT to convert the data to XML format and then upload the convert data from the internal table to Application server. -
How to Place a file on application server in XML format
Hi,
Our requirement is to place a file from SAP to a folder on application server in XML and vice-versa.
please suggest.
Thanks
NarendraHi,
1. convert your internal table data to XML format using function module SAP_CONVERT_TO_XML_FORMAT.
2. Convert the XML data into Xstring format using Function module SCMS_BINARY_TO_XSTRING. pass the file size got from the step 1 in importing parameter.
3. loop on the internal table got from the step 2 and use OPEN DATASET, TRANSFER AND CLOSE DATASET -
Run Time Error while Transferring data to Application server
Hello Abaper's,
I have generated a XML data using the FM : " SAP_CONVERT_TO_XML_FORMAT ".
While transferring the data to a File on Application Server using the statement
DATA : wa_xmltab TYPE truxs_xml_line,
it_xmltab TYPE truxs_xml_table.
OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
LOOP AT it_xmltab INTO wa_xmltab.
TRANSFER wa_xmltab TO FNAME. <<<<<<<<<<<<<< Getting Error here
ENDLOOP.
ELSE.
MESSAGE e004(zmsg5) WITH 'File FNAME not opened'.
ENDIF.
CLOSE DATASET FNAME.
The Run Time Error i am Facing is
Short text
The current statement is only defined for character-type data objects.
Error analysis
For the statement
"TRANSFER f TO ..."
only character-type data objects are supported at the argument position
"f".
In this case. the operand "f" has the non-character-type "TRUXS_XML_LINE". The
current program is a Unicode program. In the Unicode context, the type
'X' or structures containing not only character-type components are
regarded as non-character-type.
Regards
jvHello Volker Binder ,
Thank you . it's now transferring the data to Application sercver. I forgot to try using Binay mode,
Thers is one more problem. There are 10 Records in that internal table that is being converted to XML format,
but the XML data is showing only first 4 records.... the XML data format for the remaining data is not seen.
Actual No. of Records in Internal table :
matnr matkl meins
0-BUY1 012 PC
0-BUY2 012 PC
1 EA
2 012 L
3 01 EA
12 EA
23 001 ST
24 015` EA
28 010 EA
29 015` AU
XML Format for the above 10 fields is :
<?xml version="1.0"?><TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY1</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">PC
</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">0-BUY2</MATNR><MATKL Datatype="C" Length="18">012</MATKL><MEINS Datatype="C" Length="6">
PC </MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000001</MATNR><MEINS Datatype="C" Length="6">EA</MEINS>
</TY_MARA><TY_MARA><MATNR Datatype="C" Length="36">000000000000000002</MATNR
This 4th record data in XML is also incomplete..
The above XML format is generated only for 4 records out of 10 Records.
Please let me know , how can i increase the Size / Memory of the Application server file to accomodate for the reamining Records
Regards
Jv -
GUI_Download for XML file ?
Hi Experts,
I have xml data in an internal table say int_xml_data.
While i m downloading this data to presenatation server using gui_download m getting an error:
"The XML page cannot be displayed
Cannot view XML input using 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:/Vendor File.xml'. Line 1, Position 1
3C3F786D6C2076657273696F6E3D22312E30223F3E3C57535F56454E444F525F444154413E3C57535F56454E444F525F444154413E3C4C49464E52204461"
I have used the function like this:-
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = 'C:\Vendor File.xml'
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = int_xml_data
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.
What is the mistake ???
How can the xml data be downloaded to presentation seerver? ?
Function works fine for .txt data but not for xml ???@ Sandeep:
I did this only.
Firstly I converted data into xml using SAP_CONVERT_TO_XML_FORMAT
the code is:
CALL FUNCTION 'SAP_CONVERT_TO_XML_FORMAT'
EXPORTING
I_FIELD_SEPERATOR = ':'
I_LINE_HEADER =
I_FILENAME = w_path
I_APPL_KEEP = ' '
I_XML_DOC_NAME = <w_xml_file>
IMPORTING
PE_BIN_FILESIZE =
TABLES
I_TAB_SAP_DATA = int_final_vendor
CHANGING
I_TAB_CONVERTED_DATA = int_xml_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.
After this I am downloading the data using GUI_Download
Code is
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
FILENAME = w_file
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
IMPORTING
FILELENGTH =
TABLES
DATA_TAB = int_xml_data
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.
What is the mistake ????
Maybe you are looking for
-
I like being able to have my tabs grouped in FF4, but sometimes when the groups are small I'd like to be able to just see all the tabs at once, with the ability to go back into panorama and switch to viewing only one group if need be. Is there a way
-
Error while loading shared libraries libnnz10.so with brconnect
Hi I am experiencing some problems within an installation, brconnect seems to be looking for oracle 10 libraries? while my oracle is a 9.2 ! these are the logs: ERROR CJS-00288 Could not update database statistics.<br>DIAGNOSIS: Command brconnect -u
-
Flash works with all USB web cameras - but what are the limitations (if any) on using a s-video or RGB connector on a graphics card so a camera with enough quality for H.264 streaming can be used? Does Flash recognise them? As the encoding will be gr
-
Convert html into tidy html to convert pdf using iText
hello. I am try to convert html document into pdf. first i tried iText it works properly. but it needs all the tags to be witten correctly. when u try html not well formeted it gives an exception. So is there any way to convert html to pdf. or if not
-
Set default address when card contains several
If someone in your address book has multiple email addresses, how do you set which address is the primary one to which email is sent? (Or does it go to all addresses?)