Convert in xml format
how to download any report in xml. directly thru code.
means if a report is run report should be download in xml format.
any fuction module ???
points will be awarded.
Hi check this one ......
*& Report ZTEST_XML2 *
REPORT ZTEST_XML2 .
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_ostream TYPE REF TO if_ixml_ostream,
l_renderer TYPE REF TO if_ixml_renderer,
l_document TYPE REF TO if_ixml_document.
DATA: l_element_flights TYPE REF TO if_ixml_element,
l_element_airline TYPE REF TO if_ixml_element,
l_element_flight TYPE REF TO if_ixml_element,
l_element_from TYPE REF TO if_ixml_element,
l_element_to TYPE REF TO if_ixml_element,
l_element_dummy TYPE REF TO if_ixml_element,
l_value TYPE string.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
DATA: lt_spfli TYPE TABLE OF spfli.
DATA: l_spfli TYPE spfli.
START-OF-SELECTION.
Fill the internal table
SELECT * FROM spfli INTO TABLE lt_spfli.
Sort internal table
SORT lt_spfli BY carrid.
Start filling xml dom object from internal table
LOOP AT lt_spfli INTO l_spfli.
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 with value flights
l_element_flights = l_document->create_simple_element(
name = 'flights'
parent = l_document ).
ENDAT.
AT NEW carrid.
Create element 'airline' as child of 'flights'
l_element_airline = l_document->create_simple_element(
name = 'airline'
parent = l_element_flights ).
Create attribute 'code' of node 'airline'
l_value = l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'code' value =
l_value ).
Create attribute 'name' of node 'airline'
SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ
l_spfli-carrid.
l_rc = l_element_airline->set_attribute( name = 'name' value =
l_value ).
ENDAT.
AT NEW connid.
Create element 'flight' as child of 'airline'
l_element_flight = l_document->create_simple_element(
name = 'flight'
parent = l_element_airline ).
Create attribute 'number' of node 'flight'
l_value = l_spfli-connid.
l_rc = l_element_flight->set_attribute( name = 'number' value =
l_value ).
ENDAT.
Create element 'from' as child of 'flight'
CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
l_element_from = l_document->create_simple_element(
name = 'from'
value = l_value
parent = l_element_flight ).
Create attribute 'airport' of node 'from'
l_value = l_spfli-airpfrom.
l_rc = l_element_from->set_attribute( name = 'airport' value =
l_value ).
Create element 'to' as child of 'flight'
CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
l_element_to = l_document->create_simple_element(
name = 'to'
value = l_value
parent = l_element_flight ).
Create attribute 'airport' of node 'from'
l_value = l_spfli-airpto.
l_rc = l_element_to->set_attribute( name = 'airport' value =
l_value ).
Create element 'departure' as child of 'flight'
l_value = l_spfli-deptime.
l_element_dummy = l_document->create_simple_element(
name = 'departure'
value = l_value
parent = l_element_flight ).
Create element 'arrival' as child of 'flight'
l_value = l_spfli-arrtime.
l_element_dummy = l_document->create_simple_element(
name = 'arrival'
value = l_value
parent = l_element_flight ).
Create element 'type' as child of 'flight'
CASE l_spfli-fltype.
WHEN 'X'.
l_value = 'Charter'.
WHEN OTHERS.
l_value = 'Scheduled'.
ENDCASE.
l_element_dummy = l_document->create_simple_element(
name = 'type'
value = l_value
parent = l_element_flight ).
ENDLOOP.
IF sy-subrc NE 0.
MESSAGE 'No data into db table ''spfli'' type 'E'.
please run program
***''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
ENDIF.
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( ).
Saving the XML document
l_xml_size = l_ostream->get_num_written_raw( ).
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = 'c:\temp\flights.xml'
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Prasad.
Similar Messages
-
Which are function modules used to convert into XML format in SAP 4.6c Ver
which are function modules used to convert into XML format in SAP 4.6c Ver
Hi,
check this program , I think this will help you
TYPE-POOLS: ixml.
TYPES: BEGIN OF xml_line,
data(256) TYPE x,
END OF xml_line.
data : itab like catsdb occurs 100 with header line.
data : file_location type STRING.
data : file_name like sy-datum.
data : file_create type STRING.
file_name = sy-datum .
file_location = 'C:\xml\'.
concatenate file_location file_name into file_create.
concatenate file_create '.XML' into file_create.
DATA: l_xml_table TYPE TABLE OF xml_line,
l_xml_size TYPE i,
l_rc TYPE i.
select * from catsdb into table itab.
append itab .
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 = l_xml_size
TABLES
i_tab_sap_data = itab
CHANGING
I_TAB_CONVERTED_DATA = l_xml_table
EXCEPTIONS
CONVERSION_FAILED = 1
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.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = l_xml_size
filename = file_create
filetype = 'BIN'
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 24.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
write : 'INTERNAL TABLE DATA IS SUCCESSFULLY DOWNLOADED TO LOCATION', file_create .
Thanks. -
Idoc be converted into XML format
Hi,
Can idoc be converted into XML format? If yes guide me the path , how to do?
Thanks
Avi<b>Hi,
we can .
Follow the link
http://www.erpgenie.com/sap/sapedi/Conversion%20of%20IDOCs%20to%20XML%20format.pdf</b>
Thanks
Manju
<u><b>Don't repeat the Questions</b></u> -
Hi...
I am having the Input file like as shown below.
<Node>
<Company>SAP</Company>
<NAME>RAM</NAME>
<END-Node>
I need to convert the above into file into the below xml format.
<?xml version="1.0" encoding="UTF-8" >
<Node>
<Company>SAP</Company>
<NAME>RAM</NAME>
</Node>
Can you please help in this issue?
Thanks in advance
LeelaHi Leela
This source file cannot be read using normal ways. Use of XMLAnonymizerBean will not help as this is not an XML file and no name space present.
You can read this file using FCC
DT_Source
Root
Input
and FCC parameters
Root.fieldNames input
ignoreRecordsetName true
Root.fieldSeparator 'nl'
After reading this you need to use a Java mapping. As this is having < tags and its not XML file Graphical and XSLT cannot handle this.
Get the values in Java mapping as company and name variable and append it to target like this
StringBuffer xml = new StringBuffer();
xml.append("<?xml version='1.0' encoding='UTF-8'?>");
xml.append("<ns0:MT_TstTarget xmlns:ns0="http://host.com/TestCase3">");
xml.append("<Node><Company>").append(company).append("</Company>");
xml.append("<Name>").append(name).append("</Name></Node>");
xml.append("</ns0:MT_TstTarget>");
But as said above....... getting input file corrected is best solution
Thanks
Gaurav -
Converting Sequence (XML format presaved) to my CUSTOM format?
Hi Experts!
I need Teststand Style Sheet for XML. (e.g. TAGS explanation when you saved your sequence in XML's format)
For example when I saved TestStand's sequence at XML format previously I got: _____________________________________________________________ Main classname='Objs' valueflags='4194304'><value lbound='[0]' ubound='[]'/></Main><Setup classname='Objs' valueflags='4194304'><value lbound='[0]' ubound='[]'/></Setup><Cleanup classname='Objs' valueflags='4194304'><value lbound='[0]' ubound='[]'/></Cleanup><GotoCleanupOnFail classname='Bool' valueflags='4194312'><value>false</value></GotoCleanupOnFail><RecordResults classname='Bool' valueflags='4194312'><value>true</value></RecordResults> _____________________________________________________________ I would like to know what EVERY of tags (<value>,<Main>,<GotoCleanupOnFail> ….and many others) means??? e.g. you can say that <value> is a tag that responsible for the LOOP value. I need to deal with tags because I want from the present XML saved sequence to build my custom sequence in my CUSTOM format (e.g. TO CONVERT TestStand’s sequence to other format)
Any ideas? any suggestions?
Thank you!!!
Thank you & Best Regards
*I use LabVIEW 8.X & TestStand 3.5/4.0.1 versions only
Solved!
Go to Solution.TestStand does not support saving sequence files in other formats than the predefined formats (ini, binary and xml). So you have two different choices:
a) Write a tool which converts one of the sequence file types into your custom format. This enables you to export the sequence to custom tools, but needs quite some work.
b) Use "Sequence File Translator". You can find info on this in the TestStand Reference Manual in chapter 15.
Regarding b) i want to tell you some more things here in this post:
- You can use it only to important any format into TestStand, not the other way round. So this is designed for customers who create sequences outside of TestStand but want to use it in TestStand for execution.
- It requires the knowledge of the file layout you want to convert. You have write an DLL as described in the manual.
- Changes done to the sequence within TestStand will never be saved back into the original file. You can save the sequence in a new TestStand sequence file though.....
hope this helps,
Norbert
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it. -
Hi all,
Can anyone tell how to convert the data in R3 to XML format.
thanx,
krishsame thread.
Re: function module to covert internal table to xml format
for more reference.
ABAP to XML with several internal tables
Re: Convert to XML format -
Data is not converting in XML format in output while download in report
Hi All, While downloading the report in XML format value '&' is not changing its XML format '&', but showing in debug mode and sam thing while download its not showing in output. showing in debug like; MS NA - DCS Tooling & Automation but in output showing the data like: MS NA - DCS Tooling & Automation because of this getting issue. Please help me out . Thanks and Regards Sankil
In that case, it is correct.
Try replacing & with & before downloading xml in case you want & to appear as & in web browser view. -
How can I convert IDoc in XML format w/DTD into a string?
I want to send by e-mail outbound IDoc in XML format with its document type definition (DTD).
I want to be able to get the same output result into a string than the XML file IDoc port type with DTD activated. I have created a FM (based on SAP "OWN_FUNCTION") assigned to an IDoc port of type ABAP-PI that executes the following processing steps:
1-Extract outbound IDoc information to get the sender & recipient mail addresses (EDP13 / EDIPHONE tables).
2-Convert & Transform IDoc data into XML string using FM IDX_IDOC_TO_XML.
3-Prepare and send e-mail with XML attachement using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
I cand generate the e-mail with the XML file attachement but FM IDX_IDOC_TO_XML does not convert the IDoc with proper formating and DTD.
What should I use to accomplish the IDoc conversion to XML w/DTD into a string?
Should I use XSLT tools ?
How does that work?
Thank you
Carlmuks wrote:
Use decimal string to number
Specifically, you can define a constant with a different datatype on the input on the lower left if you need a different datatype (e.g. U8, I64, DBL, etc) Are all your values integers or do you also need to scan fractional numbers? In this case, you should use "fract/exp string to number" instead.
LabVIEW Champion . Do more with less code and in less time . -
Convert PDF to XML Format . Can´t get it working :(
Hi everybody,
I am a Rocky in Acrobat Scriptingand I need some helpd to convert a PDF file into an XML format using the build in javascript console.
The only thing I got so far is:
this.saveAs("/e/test.xml","com.adobe.acrobat.xml-1-00")
I got this information from the refrence guide, but I did not find an accurate example. Can you lend me a hand ? If you find a solution can you also explain me the different sections of the code because I still want to learn something besides using the copy and paste option.
Thank you very much:
RolandBernd Alheit wrote:
What happens when you try it?
The problem is I tried it several times, but nothing happens at all. The reference guide mentioned a second file with the ending *.xls will be created but nothing happens at all. Can you help me out ? -
Any java experts pls help me in converting attribute to XML formats
Pls help me oh my god i am a newbie here and i am given this project.
I had just written a XML doc. which looks like this
<ConsumerTransfer>
<TransactionId>
123:123
</TransactionId>
<Billingoption>
cash
</Billingoption>
</ConsumerTransfer>
I need to make this to attributes like
private String TransactionId()
private String BillingOption()
and so on.....
I need to convert this attributes to XML format
can any show me an example or the source codes for this
Really, I appreciate it.
JimmyKnotFor such node level operations I think that DOM would be a good idea. So here you go. Look for some nice tutorial for DOM and you got it.
salut -
Converting String To XML Format and send as attachment
Hi
My requirement is to convert String into XML Format and that XML File i have to send as an attachment
can any one one give solution for this Problem.
Thank you
Venkatesh.Khi,
i m filling the itab first and converting to xml
itab contaning these data
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.
after conversion data is coming like that
#<?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>
but errors are 1) # is coming at the first
2)for 'encoding="utf-16"?>', it is not coming perfectly, some other data (iso-8859-1) should come here
can anybody plz solve it.
regards,
viki -
Converting string to XML format
Hi All,
I have a requirement to convert string to xml format and download it. Atpresent, I have a string which is a collection of xml tags. I want to convert this string to xml format like <VALUE004>20387899.437</VALUE004>
<VALUE005>20387899.437</VALUE005>
<VALUE006>20387899.437</VALUE006>
Is there any function module for this.Chk this thread.
Re: Regd: File Conversion to XML format -
Converting xml string to valid xml format In biztalk expression shape
<DocumentElement>
<ApplicationStatus>
<ApplicationName>XpathDebatch</ApplicationName>
<Status>Stopped</Status>
<ReceivePorts>RcvRates, </ReceivePorts>
<Sendports>SendRates, </Sendports>
<Orchestration>xpathDebatch.BizTalk_Orchestration1,</Orchestration>
</ApplicationStatus>
</DocumentElement>
<DocumentElement>
<ApplicationStatus>
<ApplicationName>SendingSMTPEmail</ApplicationName>
<Status>Stopped</Status>
<ReceivePorts>SendingSMTPEmail_1.0.0.0_SendingSMTPEmail.Process_SendSMTPEMail_Port_RcvInputMsg_6d1bf831128e1b5e, </ReceivePorts>
<Sendports>SendingSMTPEmail_1.0.0.0_SendingSMTPEmail.Process_SendSMTPEMail_Port_SendSMTPMail_6d1bf831128e1b5e, </Sendports>
<Orchestration>SendingSMTPEmail.Process_SendSMTPEMail,</Orchestration>
<Pipeline>SendingSMTPEmail.SP_SendSMTPEMail</Pipeline>
</ApplicationStatus>
</DocumentElement>
<DocumentElement>
<ApplicationStatus>
<ApplicationName>OracleTest</ApplicationName>
<Status>Stopped</Status>
<ReceivePorts>RcvFromOracle, </ReceivePorts>
<Sendports>SendToFolder, </Sendports>
</ApplicationStatus>
</DocumentElement>
<DocumentElement>
Hello all,
I am getting an string(variable) like I shown above, I want to convert that to Proper Xml Format in
Expression shape itself (<root>Data</root>)
so that I can Load it to xml and send it to Local Folder.
ThanksHi
NILESH_AES,
Based on your title, your case related to BizTalk. I will move your thread to
BizTalk Server > BizTalk Server General
forum for better support.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Converting string xml to xsd format ?
Hi,
my web service receives a xml as an input in string format.
it is passed to other web services for processing purpose.
during execution of each web service, I need to extract some node values multiple times which causes performance overhead.
can I convert the input xml (as string) into xsd structure (similar to OTD) so that I can simply map it while passing it to other web services? it should save me unnecessary extraction of same nodes in other web services.
how to do it?
is there any better approach for this?
surajWithin the JBI environment, the XML message is typically passed around as a DOM Document (wrapped as a TRAX DOMSource), so the document is parsed only once. This should be very quick, even when evaluating XPath functions to find parts of the document repeatedly. DOM and OTD aren't that dissimilar, so you should be comfortable with it.
When sending the XML message "across the wire", you are forced to serialize to XML again. This is the foundation of interoperability and loose coupling.
Sometimes converting the XML to a more convenient form (different schema) can help make it easier/quicker to run queries against. -
Using File Content Conversion converting XML format to text format
Hi All,
I am able to convert to Text format using file content conversion, But the requirement is to convert the same for the structure with additional subnodes as in the example (also complex nested structures)
<ns0:SendXSDEmployeeDetails xmlns:ns0="http://ehro.eds.com/FRAMEWORK/FileToFile/FileCConverion">
<Employee>
<Employee_ID>2</Employee_ID>
<Employee_Name>KannanKumar</Employee_Name>
<Address>
<Street>13th Cross Reddy</Street>
<City>Bangalore</City>
<Pincode>641026</Pincode>
<Phone_No>
<t1>9901934934</t1>
<t2>9901934934</t2>
</Phone_No>
</Address>
</Employee>
</ns0:SendXSDEmployeeDetails>
can any one help on this please
I have already seen the blogs :
/people/krishnakumar.ramamoorthy3/blog/2007/01/27/generic-mapping-to-convert-nested-xml-to-flat--receiver-file-adatper
/people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping
<b>Can any one help to do this in simple way</b><br>Hi,
Like correctly pointed by JaiShankar, the Sender File Adapter currently does not supoort such stracutures.
the strcuture supported is described in this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm
Regards
Bhavesh
Maybe you are looking for
-
Two computers setup the same, behave differently
I'm working at a small business, running an office of Macs, one of which, a Mac Pro, is running OS 10.6.8 and Filemaker (port #5003). We want that computer, and specifically that application, to be accessible remotely through a static IP. Comcast ass
-
Outlook Integration/SAP running slowly
Hello, I have the outlook Add-On running within SAP and irrespective of whether SAP is actually open or not i get the following message headed 'Progress Information' - Opening the logon window... this issue has only started happening within the last
-
I can't find a solid answer to this question. Does anyone know whether or not the iPhone 2.0 firmware will support the landscape mode for typing SMS messages? I put off buying the original iPhone because I played with the text messaging instore and c
-
Hi, I am looking for a good tutorial which explain on how to use explain plain with some examples. If you know some online page then let me know. --Harvey.
-
Does anyone know why a magic mouse won't scroll in calendar in mavericks?
does anyone know why a magic mouse won't scroll in calendar in mavericks? It will scroll in a window that has an indicator scroll bar on the right side but not in the new seamless calendar view. The built in trackpad on my mid 2012 macbook pro will s