Spa504g xml caller id
Hello,
I have an cisco spa504g voip phone with a configration to connect a xml directory. This works good, but the caller id is not showing and the file with the directory in it is then not called. Is is possible to use this directory to get an caller id?
Example directory file:
<CiscoIPPhoneInput>
<Title>Phonebook</Title>
<Prompt>Prompt text.</Prompt>
<URL>http://192.168.1.74/xml/index.php</URL>
<InputItem>
<DisplayName>Filter</DisplayName>
<QueryStringParam>filter</QueryStringParam>
<InputFlags></InputFlags>
<DefaultValue></DefaultValue>
</InputItem>
</CiscoIPPhoneInput>
index.php file:
<?php
header("Content-type: text/xml");
header("Connection: close");
header("Expires: -1");
?>
<CiscoIPPhoneDirectory>
<Title>Phonebook</Title>
<Prompt>Prompt text.</Prompt>
<DirectoryEntry>
<Name>michel bardelmeijer</Name>
<Telephone>06*********</Telephone>
</DirectoryEntry>
</CiscoIPPhoneDirectory>
Kinds regards,
Michel Bardelmeijer
Hi. what is your firmvare version?
I have SPA504 too, but i can't make the external directory work.
i use string like fnc=xml;url=http://10.1.1.47/book.xml, but getting back error "InvalidXmlURL" on phones console.
Similar Messages
-
Change over from a simple Xml call to a rpc-Http call ....
Hi there,
I need to change over from a simple Xml call:
<mx:XML id="urlsGeneral" source="http://www.mySite.com//.../AFS.xml"/>
to a rpc-Http call which is updating the readout if Xml is changed at any time.
I forgot to mention the most important item yet a very simple one: I need this only to be displayed in a title etc, and NOT a datagrid or else example below.
title="{urlsGeneral.urlGeneral.(@name==0).age}
I tried a lot today, but just can't get it right as the id="urlsGeneral" is always the problem.
Any help would be appriciated !!! Thanks in advance. regards aktell2007
<urlsGeneral>
<urlGeneral>
<name>Jim</name>
<age>32</age>
</urlGeneral>
<urlGeneral>
<name>Jim</name>
<age>32</age>
</urlGeneral>
</urlsGeneral>
Another call:
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
public var myData:ArrayCollection;
protected function myHttpService_resultHandler(event:ResultEvent):void {
myData = event.result.urlsGeneral.urlGeneral;
]]>
</mx:Script>
<mx:HTTPService
id="myHttpService"
url="http://www.mySite.com//..../AFS.xml"
result="myHttpService_resultHandler(event)"/>
Preferable I wanted something like this to work:
<mx:Script>
<![CDATA[
import mx.rpc.events.FaultEvent;
import mx.managers.CursorManager;
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.xml.SimpleXMLDecoder;
// Don't use here as it is already used in .swc !
/* import mx.rpc.http.HTTPService; */
private var myHTTP:HTTPService;
private function initConfigCall():void {
myHTTP = new HTTPService();
myHTTP.url = "com/assets/data/changesAppAIRPIOne001.xml";
myHTTP.send();
myHTTP.resultFormat = "xml";
myHTTP.addEventListener(ResultEvent.RESULT, resultHandler);
myHTTP.addEventListener(FaultEvent.FAULT, faultHandler);
CursorManager.setBusyCursor();
private function resultHandler(evt:ResultEvent):void {
var xmlStr:String = evt.result.toString();
var xmlDoc:XMLDocument = new XMLDocument(xmlStr);
var decoder:SimpleXMLDecoder = new SimpleXMLDecoder(true);
var resultObj:Object = decoder.decodeXML(xmlDoc);
// Removed [0] on single node !
appUpdateAvl.text = resultObj.application.configApp.appNewUpDate;
appLastChanged.text = resultObj.application.configApp.appLastChanged;
appChangedSections.text = resultObj.application.configApp.appChangedSections;
CursorManager.removeBusyCursor();
myHTTP.disconnect();
private function faultHandler(event:mx.rpc.events.FaultEvent):void {
var faultInfo:String="fault details: "+event.fault.faultDetail+"\n\n";
faultInfo+="fault faultString: "+event.fault.faultString+"\n\n";
mx.controls.Alert.show(faultInfo,"Fault Information");
var eventInfo:String="event target: "+event.target+"\n\n";
eventInfo+="event type: "+event.type+"\n\n";
mx.controls.Alert.show(eventInfo,"Event Information");
CursorManager.removeBusyCursor();
myHTTP.disconnect();
]]>
</mx:Script>Hi again,
These days there are more quetions than answeres on any forum, and very seldom anybody shares the answer if they lucky enough to work it out so here is my answer for the above question
Change over from a simple Xml call to a rpc-Http call ....
I had it all along as a commend noted: // Removed [0] on single node !
So instead of title="{urlsGeneral.urlGeneral.(@name==0).age} it would be now title="{resultObj.urlsGeneral.urlGeneral.[0].age} and now it works perfectly well. I hope that one or the other of you can use the answer and the code !!! regards aktell2007 -
I have a HTML form calling a .xsql page.
That xsql page includes dynamically generated
XML.
I am trying to use the include-xml directive to call a URL (perl procedure) that will output XML data (dynamically created).
The perl (cgi-bin..) module expects to be called via a POST to parse the arguments automatically.
Is there a way from a xsql page to call a perl module including the arguments that were used to call the xsql page as a POST ?
Thanks for your help.
nullAre you asking whether <xsql:include-xml> supports an option to use HTTP POST instead of HTTP GET to retrieve the XML resource?
As far as passing parameters, you'd need to build up the appropriate URL in the href attribute, referencing the parameter values in the attribute value. -
Adding attachment via XML calls
I am trying to associate an attachment to a punch list item via XML in C#. Whenever I try to insert an Attachment object, I am getting a generic 'Error' message back. The XML is properly formed and I am populating it with values in the same locations as a file attached via the Contract Management interface. The code to insert the punch list item works fine and it appears in the CM interface. Does anyone have any experience with this scenario? Note: I am uploading the physical file separately.
Here is an example of one that worked here. A couple comments on yours. I did not see a Base_sys_item_type in your code. Which I believe is required for this table. Usually whan I have a question about what data I need to send I'll add a record manually then duplicate what I see in the table. Another thing you should know is that the API will not receive actual files. All it currently does is create links. Files still need to be placed in the correct location. I do that here using some code that copies the files to the correct location when we load in bulk.
We are using CM on some huge projects. I have used the API to integrate and to add/delete/update hundreds of thousands of records. Each module seems to be slightly different, so be wary and always test if/how the API works. Each type can have it's own unique list of required fields etc..
<?xml version="1.0" encoding="UTF-8"?><request xmlns="http://app.expedition.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://app.expedition.com/ http://127.0.0.1/exponline/xml-schemas/request.xsd"><header requestType="DETAIL" sysitemtype="DLNK"><sessionId>000TfQLKK1000630000000BURN</sessionId><action>INSERT</action><getUpdatedDataInResponse>true</getUpdatedDataInResponse></header><DLNK>
<attachment>J:\data\<Attachment Name>.PDF</attachment>
<base_item_type>SNT</base_item_type>
<base_master_key>0002YOCBJ0727800000000BURN</base_master_key>
<base_parent_key></base_parent_key>
<base_sys_item_type>SNT</base_sys_item_type>
<created_by></created_by>
<created_date></created_date>
<created_system></created_system>
<date_linked>2009-02-03T12:00:00.0000000</date_linked>
<file_size>0</file_size>
<is_a_url>0</is_a_url>
<item_type>DLNK</item_type>
<last_edit_by></last_edit_by>
<last_edit_date></last_edit_date>
<last_edit_system></last_edit_system>
<linked_by_user>Joe Manzi</linked_by_user>
<linked_by_user_name>Joe Manzi</linked_by_user_name>
<location></location>
<master_key></master_key>
<project_name>"Your Project name"</project_name>
<sender_login_name></sender_login_name>
<subject>test</subject>
<sys_item_type>DLNK</sys_item_type>
</DLNK></request> -
WebLogic: Can I use CMP for HTTP/XML calls like I can for JDBC ConnPools
I have an Entity EJB that I currently persist using WebLogic's CMP with an Oracle Conn Pool and JDBC. I have a new persistance (home-made) storage system that talks XML over HTTP. No real SOAP implementation except in the XML/HTTP communications.
Questions:
Can I still leverage CMP to persist entities - such that I could create a pool of XML/HTTP objects (that open a java.net connection - send a URL request in XML format) and have CMP handle persisting as it does now?
I would think there is some universal way to create a pool of communication objects to talk to anything if you define the mechanisms..right? If so, how do I get CMP to see that? In other words, is CMP only applied to "Known" data sources? Or can I give it my own..create my own weblogic-cmp.xml file.So, you have a home-made persistence solution with your own API and you expect CMP (_Container_ Managed Persistence) to be able to hook into that? Unlikely, right?
Maybe you could implement a JDBC driver on top of your persistence scheme, then you might have a shot.
Vlad.
P.S. Entity beans' performance is so bad everyone recommends against using them -- doing persistence over something as slow as HTTP would only make matters worse. -
SPA504G : Incoming calls are dead when picked up.
i have an issue with my voip system. it does not allow me to answer incoming calls .the phone is ringing but when pick it up it's dead. at the moment i have a Netgear router , ports 5060 and 10000-20000 are open .
there are few thing i did so far like turning off SIP ALG on the router and also reducing expiry time to 2 minutes ,but to no avail .
i also did following setting as NAT setting
Nat mapping enable:yes
keep NAT aliv enable:yes
Handle VIA received:yes
Insert VIA received:yes
Handle VIA rport:yes
Insert VIA rport:yes
Send Resp to Src port:yes
any thing else i can do to solve this out ?
Thanks,Capture SIP packets and syslog/debug messages related to incomming call
Then we can analyze the problem. -
Problem with CALL TRANSFORMATION xml - abap
Hello!
I got the following problems using call transformation to read a xml-file to local abap datatype!
Simple xml file for testing:
<BMECAT>
<HEADER>
asdf
</HEADER>
</BMECAT>
XSLT file:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/">
<xsl:value-of select="./BMECAT/HEADER"/>
</xsl:template>
</xsl:transform>
The xslt transformation works with xslt-tester!
My Source:
DATA: xmlupl TYPE string,
outputx TYPE XSTRING,
lv_string TYPE string.
* in xmlupl my xml import is stored
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
text = xmlupl " variable type string
IMPORTING
buffer = outputx. " variable type xstring
TRY .
CALL TRANSFORMATION path_to_xslt_file
SOURCE XML outputx
RESULT HEADER = lv_string.
CATCH cx_xslt_exception INTO xslt_error.
data: xslt_message type string .
xslt_message = xslt_error->get_text( ).
ENDTRY.
After debugging in xslt_message is stored the following text:
"The element abap was expected for the XML-ABAP transformation"
Can anyone help me with this problem?
Regards,
Danielhi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
Problem with Call Transformation (ABAP to XML)
Hello
I call the tranformation function to serialize. I want to convert a ABAP internal table into XML.One of the column type is of time(t). On transformation, the values are changed.
Ex : If I have a value of 000009 (time format), on calling transformation it gets converted to 00:00:09. I dont want this conversion. I want to have the value as it is. I cant change the column data type from time to string.
Regards
Raghavendrahi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
Problem XML .. Call Transformation
Hi Guru´s,
Please, I need a help!!! ...
I´m creating an XML and my Excel will open it...and I use Call transformation.
Ok, it´s works perfect.... but I had to include a validating data in particular column(ranges data) and I can´t do it...
I try data validation:
But don´t work fine. I suspect that data validation not working very well in call transformation...
Somebody Can help me???
Thanks...
Alexandrehi
good
try this code
Just look at this piece of code, I think it should help you.
DATA : ITAB TYPE TABLE OF SPFLI,
L_XML TYPE REF TO CL_XML_DOCUMENT.
SELECT * FROM SPFLI INTO TABLE ITAB.
CREATE THE XML OBJECT
CREATE OBJECT L_XML.
CONVERT THE DATA TO XML
CALL METHOD L_XML->CREATE_WITH_DATA( DATAOBJECT = ITAB[] ).
DATA IS CONVERTED TO XML; DISPLAY THE XML-DOCUMENT
CALL METHOD L_XML->DISPLAY.
thanks
mrutyun^ -
ABAP-XML conversion via call transformation
Hi folks!
I'm using a deep structure for returning the reply from a function module. To save my test data I wanted to generate an XML from this ABAP structure.
I had in mind that I could use CALL TRANSFORMATION to get the asXML representation of the ABAP structure but I could not figure out how this works.
Can somebody give me a hint how I could convert my deep ABAP structure into XML without much coding?
Thanks!
BirgitHi stonefish,
1. internal table -
> Xml
xml -
> internal table
2. this program will show both.
3. It will do this for
T001 table.
4. Just copy paste in new program.
REPORT abc.
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
BREAK-POINT.
regards,
amit m. -
Custom de disponibilizacao do XML via WebService
Srs.
Preciso da ajuda de vocês em uma solução custom que estou criando via WebServices de disponibilizacao do arquivo XML gerado pelo SEFAZ.
O problema que estou tendo é que, informando um ID de uma NFe, não estou conseguindo ler todos os dados do XML que está armazenado no GRC, durante a leitura está ocorrendo salto entre os dados e não entendo ainda o que pode estar errado.
Segue abaixo o codigo da RFC que estou criando que através do ID ( como eu disse ) me retornaria o XML completo dentro de um unico campo de texto, o que nao esta ocorrendo.
FUNCTION Z_GETXML_BY_MFEID.
""Local Interface:
*" IMPORTING
*" VALUE(I_NFEID) TYPE /XNFE/ID
*" EXPORTING
*" VALUE(E_XML) TYPE CHAR30K
TYPES: begin of typ_tab_xml,
id TYPE string,
docid TYPE SDOK_DOCID,
end of typ_tab_xml.
TYPES: begin of typ_tab_string,
str TYPE Xstring,
end of typ_tab_string.
DATA: wa_xml TYPE typ_tab_xml,
wa_dokobject TYPE SDOKOBJECT,
itb_fileinfo TYPE TABLE OF SDOKFILACI,
wa_fileinfo TYPE SDOKFILACI,
itb_fileBinary TYPE TABLE OF SDOKCNTBIN,
wa_fileBinary TYPE SDOKCNTBIN,
str_xml TYPE string,
tab_string TYPE TABLE OF SDOKCNTASC.
SELECT SINGLE id
docid
FROM /XNFE/XML
INTO wa_xml
WHERE id = I_NFEID.
IF sy-subrc <> 0.
ENDIF.
wa_dokobject-class = '/XNFE/XML1'.
wa_dokobject-objid = wa_xml-docid.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
OBJECT_ID = wa_dokobject
CLIENT = SY-MANDT
AS_IS_MODE =
RAW_MODE = 'X'
TEXT_AS_STREAM =
TABLES
FILE_ACCESS_INFO = itb_fileinfo
FILE_CONTENT_BINARY = itb_fileBinary
EXCEPTIONS
NOT_EXISTING = 1
NOT_AUTHORIZED = 2
NO_CONTENT = 3
BAD_STORAGE_TYPE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
READ TABLE itb_fileinfo INTO wa_fileinfo INDEX 1.
DATA: linha TYPE i,
linha2 TYPE i,
linha_fim TYPE i,
tabela TYPE TABLE OF typ_tab_string.
linha = wa_fileinfo-first_line.
linha_fim = wa_fileinfo-last_line.
Data: len TYPE i.
WHILE linha <= linha_fim.
linha2 = linha + 1.
data LXSTRING type XSTRING.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
INPUT_LENGTH = 4096
FIRST_LINE = LINHA
LAST_LINE = LINHA2
IMPORTING
BUFFER = LXSTRING
TABLES
BINARY_TAB = itb_fileBinary
EXCEPTIONS
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.
Data: str TYPE string.
CALL FUNCTIONEu uso essa função para recuperar o XML:
CALL FUNCTION '/XNFE/CORE_KPRO_XML_READ'
EXPORTING
is_dokobject = ls_dokobject
IMPORTING
ev_content = EV_STRING
EXCEPTIONS
no_existing = 0
no_authorization = 0
no_content = 0
read_failure = 0
convert_failure = 0
OTHERS = 0.
Onde:
ls_dokobject-class = '/XNFE/XML1'.
ls_dokobject-objid = lv_docid .
At.,
Bernardo Braga -
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. -
Hi Friends,
See the followong code which converts xml data into itab.
*& Report ZTEST_XML1 *
REPORT ZTEST_XML1 .
*PURPOSE: This program transfers XML data into SAP internal table format
*The nodes in DOM can be stored as fields in SAP Internal table
type pool definitions
TYPE-POOLS: ixml. "iXML Library Types
type definitions
TYPES: BEGIN OF t_xml_line, "Structure for holding XML data
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line, " XML Table of the structure
*t_xml_line
l_xml_line TYPE t_xml_line, " Record of structure t_xml_line
l_xml_table_size TYPE i. " XML table size
DATA: l_filename TYPE string. " String to hold filename
data: begin of i_final occurs 0,
pnumber(20),
pname(50),
pdes(70),
end of i_final.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'C:\product.xml'.
Validation of XML file: Only DTD included in XML document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
start of selection
START-OF-SELECTION.
Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
Wrap the table containing the file into a stream.
l_istream = l_streamfactory->create_istream_itable( table = l_xml_table
size = l_xml_table_size ).
Creating a document
l_document = l_ixml->create_document( ).
Creating a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
Validate a document
IF pa_val = 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
Parse the stream
IF l_parser->parse( ) <> 0.
IF l_parser->num_errors( ) <> 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
text
<--P_L_XML_TABLE_SIZE text
<--P_L_XML_TABLE text
FORM get_xml_table CHANGING p_l_xml_table_size
p_l_xml_table.
Local variable declarations
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
Upload file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data replacement
= space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. " get_xml_table
*& Form process_dom
text
-->P_L_DOCUMENT text
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE:/.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL.
EXIT.
ENDIF.
Create a node iterator
iterator = node->create_iterator( ).
Get current node
node = iterator->get_next( ).
Loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
Advance to next node
node = iterator->get_next( ).
ENDWHILE.
*delete adjacent duplicates from i_final.
*loop at i_final.
*write:/ i_final-pnumber,i_final-pname,i_final-pdes.
*endloop.
*if not i_final[] is initial.
*modify ztestproduct from table i_final.
*endif.
ENDFORM. " process_dom
in the above code at line no: 268 there is a method:
value = node->get_value( ).in which actual data from XML file is coming.
So the varibale "Value" contains the data.
see line no: 270:
WRITE: AT indent value COLOR COL_GROUP INVERSE.
what ever values i am getting here i want to append to a Internal table ...
Can any body tell me how to do that?
i am sure of reward points.Hai Ravi
REPORT abc.
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[].
Regards
Sreeni -
Xml data to abap internal table
I'm presently working on a interface where data in abap internal table is converted into xml format and placed in the frontend and vice versa.
I'm through with the first part and in secodn part also I'm able to transfer the data from frontend to Document Object Model(DOM) by parsing but finally am not able to put it into an internal table.
Please help (Urgent).
Thanks and regards,
S.K.TripathyHi sitakant,
1. itab --- > xml
xml ---> itab.
2. This program will do both.
(just copy paste in new program)
3.
REPORT abc.
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
BREAK-POINT.
regards,
amit m. -
Code to transfer xml file to abap internal table using transformation
Hi friends
Given the following xml file .the requirementis to display and transfer the xml file to internal table usin transformation and gui_upload.If any onehaving simple code on this please send .
Can any one sugest the steps to be followed to write source code using simple transformation.
<?xml version="1.0" encoding="utf-8" ?>
- <Negara>
- <item>
- <COUNTRY>
<MANDT>600</MANDT>
<ZCODE>500</ZCODE>
<ZDESC>Pening Lalat</ZDESC>
<ZSAPCD>T1</ZSAPCD>
</COUNTRY>
</item>
- <item>
- <COUNTRY>
<MANDT>600</MANDT>
<ZCODE>600</ZCODE>
<ZDESC>Pening Lalat2</ZDESC>
<ZSAPCD>T2</ZSAPCD>
</COUNTRY>
</item>
</Negara>
Thaking Youhi..
1. itab --- > xml
xml ---> itab.
2. This program will do both.
(just copy paste in new program)
3.
REPORT abc.
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[].
<b>Reward points if useful</b>
Regards
Ashu
Maybe you are looking for
-
Photos not showing up in image capture
I've plugged the Iphone into the computer and tried to import the pictures with no luck. It shows the iphone but not pictures available to import, and I have plenty. It's a brand new iPhone 4S restored from my iPhone 4
-
Foreign Languages on a MacBook
Hi, I'm from the small country Denmark, and I'm going to the states here in a little while. I noticed the prices on MacBooks are much cheaper over there, so I'm thinking of buying one while visiting. I have a few questions though. - Can I buy it with
-
When I had a PC, there was a minimize/maximize button similar to the green one on my mac. When a window was maximized, it filled all of the screen except for the start bar. But with the min/max button on the mac, it just has two different sizes. Is i
-
Hi SAP experts, I would like to understand what is CLSD that is closure of production orders. Is it a must & what is the advantage. Particularly in our case, We have roughly 1500 orders getting released per month. When the CO settlement is undertake
-
Hi I am getting error in Extended Syntax Check which is displayed below. Object PROG Z_IUSERS_ACC has insufficient authorization to use objects FUNC FIMA_DAYS_AND_MONTHS_AND_YEARS from package FIMA Z_IUSERS_ACC in package Z_ABAP FIMA_DAYS_AND_MONTHS_