ActionScript to bind XML data to components
How can I use ActionScript to bind XML data to a comboBox
component instead of using the component inspector? (I have done
the latter, successfully, but that doesn’t allow access to
the code - .)
My ActionScript so far imports the data (the trace picks it
up) – but the ‘cbType.dataProvider line’
doesn’t work. It works when I change the data provider to an
array – so what am I doing wrong?
MY CODE:
import mx.data.components.XMLConnector;
var xcFestival:XMLConnector = new XMLConnector();
xcFestival.ignoreWhite = true;
xcFestival.direction = "receive";
xcFestival.URL = "festivalItems.xml";
xcFestival.trigger();
//POPULATE THE COMPONENTS WITH THE DATA
var festXMLlistener:Object = new Object();
festXMLlistener.result = function(evt:Object) {
trace(xcFestival.results);
cbType.dataProvider = xcFestival.results;
xcFestival.addEventListener("result",festXMLlistener);
This is on a stand - alone system
Using Designer ES ......
I saved the Form as an xdp form
and it seems as if all goes well until
View the data and nothing appears - or
just the names of the fields appear
Similar Messages
-
Trying to bind XML data and form fields
I have a fairly simple PDF - and I am trying to bind XML data to he form fields.
In the designer I can bring up the data connection and
select Global - for the binding method - and as I understand it - this will link Form Fields and XML data fields with the same name - (sounds logical to me)
but all that happens is :
I see the name of the field in the form field rahter than seeing the actual data
should I select : None as the binding or normal ....
but Normal doesnt show Anything - even after i select it .
I can't quite seem to make this work -
Any help here would be appreciated
Thanks :)This is on a stand - alone system
Using Designer ES ......
I saved the Form as an xdp form
and it seems as if all goes well until
View the data and nothing appears - or
just the names of the fields appear -
Bind XML data to PDF417 barcode - LiveCycle Designer ES
Trying to create a shipping form for a supplier that contains a PDF417 barcode. The source data will come from an XML data file. The form in not interactive, the data file will simply populate the pdf form, read-only via a Coldfusion program that queries our shipping data. But I'm not quite able to connect the dots. Does anyone know how to supply the data in the correct format within the XML doc? It consists of 5 fields / row, with 10 rows max. I'm unclear because the barcode software previously used embedded control chars within the data, such as record separators, group separators, and end of transmission. Do I need to include these for LiveCycle? As you've probably already guessed, yes, I do not use LiveCycle much at all.
I'm using LiveCycle ES2 version 9
Any advice is much appreciated. Thanks!There are a couple of ways to populate the barcode from Designer. First, is the manual coding method. In the "calculate" or (preferably) the "pre-print" event you change the .rawValue of the barcode object and change it to the value of the fields you wish to include. Alternatively there is a fairly good script generator built into designer that is accesible through the barcode object properties UI. Here you can have the content of the barcode auto-filled based on the entire form or selected fields in a collection. As a general rule of thumb: never select XML as your barcode data format and don't use the auto-generated code on a form with more than 30 or 40 fields.
-
UIX with XSQL as XML data provider and event handler
Hello ,
I would like to bind XML data to messageinput elements of a form element
as values to be presented before entering (data provider)
as well as input values to be persisted after completing the form (event handler).
My impression (as a newbee) is that only for BC4J integration there is a bidirectional binding with view objects.
Can i use 'include' to bind a static xml file as data source for output?
How can i use XSQL to be bound as data for input as well as for output of a form?
A last question concerning a page with 3 tabs:
do i need 3 different pages and requests to get the data of the 3 tabs
or is it possible to get the whole data of the page in one request
and distribute it over the 3 tabs.
Any help appreciated
Thanks
Klaus DreistadtYou could do this, but we don't provide any tools to make this easy.
You'd have to write an implement of the DataObject interface
that gives your UI access to the XML document, and write custom
event handlers to perform the "set" side of things. The Data Binding
and UIX Controller chapters of the UIX developer's guide will give you
a high-level view of how to accomplish this, but nothing specifically
about reading or writing to XML documents. -
Query with bind var created under apex to generate xml data
Hi all;
BiP: 10.1.3.4
Apex: 4
DB 10G
Goal: want to generate a report by running a query with bind variables under apex.
problem: when attempted to create a query under shared components in apex, at the downloading xml data stage, I always get "no data found" eror. Thus I can't save xml data for further report work. This only occurs when bind var involved. I have tticked "incl. session variables" and added the item but to no avail.
Does anyone know how to do this and get the xml data to recive the bind variable ?
Thanks.
luluTo get the xml data, sql query has to return something. Why the sql is not returning anything can be better investigated outside the BI Publisher with special tool like SQL Developer or TOAD. There you have to run your query and make it working. One of the steps would be to try the sql without the parameter, see what data it brings back and go from there. One of possibilities why the parameter kills the output may be the NULL values involved, but you need to try the sql outside the BIP first.
-
How do I use the Session State to manage bind variables & download xml data
I have a Report Query with more than 30 queries; many have bind variables in them. I'd like to create sample xml so that I can develop my word templates. When I try to download the XML data Source for Layout, it doesn't ask for the bind variable values.
How can I download the XML data without replacing the bind variable values in each of the queries?
Thank you.If you are using the Standalone version, then first of all make sure to UNCHECK (BIP10g 10.1.3.4.1)
"AUTO RUN" (it is under General Settings when you select your Report Definition)
Next, you should define the parameters in the corresponding parameter Section.
Its simplest form is of "Text" type so you will have to enter values at runtime.
Then these parameters can be used in your query as bind variables.
When you run the report it will prompt for parameter values. Enter these values
and you would get a sample of your XML data.
This should work and you should not find any issues.
regards
Jorge -
Date time field will not bind over into XML data file
am using the Current Date field in a form that is supposed to give me the current date & time. In the Object, Value, I am using a "calculated - Read Only" , with Run-time property of Date and Time. WHen I view this as a PDF, the current datae & time display on the form as well as when I view the body pages, the {current date/time} is displayed in the actual field of the form. My only problem is I want to bind this so I can export the data to an XML data file, to import to an Access Database. WHen I use these settings, I do not have a "binding" tab to use. WHen I change vaule to "calculation script), it then pops up the binding tab and let's me export the field to the XML data file, but the data in that field is not comming over (the date & time). The field comes into the database inport, but is blank. What am I doing wrong..?? Thanks in advance for any suggestions...
Well, I'm assuming that when you change it to a calculation script you see the date in the PDF and therefore have the script to set the value written properly. So, if you change the binding from None to Normal or an explicit binding the date will be exported in the data. If all of that is correct, then the most likely problem is the data format you are exporting is not a format that your database will accept.
Chris
Adobe Enterprise Developer Support -
Schema binding versus XML data binding
I have been able to create a fillable XFA form using XML data and employing the xfa.host.importData(""); script.
This has worked well.
I now find that I must do a similar thing - only using a schema to bind the data to the PDF form fields ...
Can you help me to find out what the differences are between these two approaches and alos can you help me to find some good documentation on how to perform this ?
thanksI noticed that the default scripting language was set to formcalc - and by chabging this to javascript - I no longer get this error -
I have moved on to my next error -
which is: the data doesn't at all load as expected -
This particular form is only slightly more complicated d than my last loadable form but, truly , the only difference between them, really, is using I am using a schema for this particular form and my previous form didn't and that one works fine and functions perfectly - (this one .... no!)
I could probably skip the schema and proceed without it but that would defeat the whole purpose of using the schema in the first place so it is not really an option .
some data loads as the default of zero - is it possible for you to review this pdf for me? - just to get me past this hurdle.
The schema is good - and the data as well.
I would appreciate it .
Thanks -
Hi,
Summary: I cannot get my DataGrid binding with XML data.
Specifically, I cannot bind a DataGridColumn with a child of a
child using the dataField property. However, I can bind with a
direct child.
I'm currently building an application where I retrieve data
from a XML database and contact it through posting a XQuery to the
database. I set the resultFormat of my HTTPServer to "e4x".
quote:
<mx:HTTPService id="searchRequest" url="
http://localhost:8080/exist/rest/db/"
contentType="application/xml" useProxy="false"
method="POST" resultFormat="e4x" />
I receive this data:
quote:
<exist:result exist:hits="1" exist:start="1"
exist:count="1" xmlns:exist="
http://exist.sourceforge.net/NS/exist">
<schedule>
<tournament>
<sport>Testing Our DTD</sport>
<tname>Well-formed Document</tname>
<match>
<mdate>Oct. 12, 2007</mdate>
<competitor>
<cname>sd</cname>
<score>2</score>
</competitor>
<competitor>
<cname>sdgs</cname>
<score>3</score>
</competitor>
<location>
<city>San Luis Obispo</city>
<state>CA</state>
<country>USA</country>
<stadium>Test Stadium, OPTIONAL</stadium>
</location>
<tv>SVN</tv>
<description>Basic testing...</description>
</match>
</tournament>
</schedule>
</exist:result>
I receive the data fine however, I cannot nested
elements of the XML nodes I retrieve. Here is my data grid.
quote:
<mx:DataGrid id="grid" width="446" height="100%"
dataProvider="{searchRequest.lastResult.schedule.tournament.match}"
enabled="true">
<mx:columns>
<mx:DataGridColumn headerText="Tournament" />
<mx:DataGridColumn headerText="Match Date"
dataField="mdate" />
<mx:DataGridColumn headerText="Sport" />
<mx:DataGridColumn headerText="City"
dataField="location.city"/>
<mx:DataGridColumn headerText="State"
dataField="location.state"/>
</mx:columns>
</mx:DataGrid>
The 'mdate' shows up however, 'location.city'
and 'location.state' do not. I am not sure how the dataField works.
Does it get the 'current' node and allow me to drill down in the
XML node?
I will note that I can get it working with a labelFunction
and an ItemRenderer. I feel that using either of those methods for
this is a bit verbose.The default DGColumn picks up the property value by doing
data[dataField]. Due to this the nested value would not be picked
up.
By extending DGColumn and overriding the itemToLabel function
it is possible to get the desired functionality by adding code to
detect "field1.field2" kind of dataField value and returning the
nested value.
This custom DGColumn can be used whererever the functionality
is desired. -
Dynamically populating more than one field using xml data binding
Hi All,<br /><br />I have the following code that works fine to dynaically populate a<br />second drop-down list2 from a choice in drop-down list1 using xml data<br />biding.<br /><br />var tempString = "xfa.record." + this.boundItem(xfa.event.newText);<br />var oItems = xfa.resolveNode(tempString);<br />var nItemsLength = oItems.nodes.length;<br /><br />myinfo.page1.state.clearItems();<br />myinfo.page1.state.rawValue = null;<br /><br />for (var nItemCount = 0; nItemCount < nItemsLength; nItemCount++)<br />{<br />myinfo.page1.state.addItem(oItems.nodes.item(nItemCount).value);<br />}<br /><br />Here is my xml file<br /><br /><?xml version="1.0" encoding="UTF-8"?><br /><myinfo><br /><country/><br /><countries><br /><item uiname="United States" token="US"/><br /><item uiname="South Africa" token="SA"/><br /><item uiname="Australia" token="AU"/><br /></countries><br /><state/><br /><AU><br /><item>Australian Capital Territory</item><br /><item>New South Wales</item><br /><item>Northern Territory</item><br /><item>Queensland</item><br /><item>South Australia</item><br /><item>Tasmania</item><br /><item>Victoria</item><br /><item>Western Australia</item><br /></AU><br /><US><br /><item>California</item><br /><item>New York</item><br /><item>Texas</item><br /><item>Michigan</item><br /><item>North Carolina</item><br /><item>South Carolina</item><br /></US><br /><SA><br /><item>Eastern Cape</item><br /><item>Free State</item><br /><item>Gauteng</item><br /><item>KwaZulu-Natal</item><br /><item>Limpopo</item><br /><item>Mpumalanga</item><br /><item>Northern Cape</item><br /><item>North-West</item><br /><item>Western Cape</item><br /></SA><br /></myinfo><br /><br />I have two questions:<br /><br />1) I want to be able to structure my xml in a way that I can populate<br />a third drop-down list3 from a choice in list2. I need to know how to<br />to include the different capital cities of the states in my xml data<br />so that they can get populated in list3 from a selection in list2;<br /><br />2) And be able to script the third list3 to get dynamically populated<br />from a choice in list2.<br /><br />Thanks in advance for your help.
I would like to ask someone for help.
I have an XML file a result of the XSLT transformation. A schema was created based on this XML and this schema is bound to a form as a data source. When I preview my form using a Preview tab with transformed XML as a Data File in LiveCycle Designer 8.1, I can see only the first form data across 3 Text fields on the form. The rest of the forms are not getting displayed. What am I doing wrong?
Here is the part of the XML file Im trying to display on the form:
FORM 1
FORM 1 DESCRIPTION
$5000
FORM 2
FORM 2 DESCRIPTION
$7000
FORM 3
FORM 3 DESCRIPTION
$4000
Part of the schema that was created based on the XML file from above:
Thank you. -
How to search XML data from a HTTPMultiService and display the result on the Spark List
Hello all,
I am totally new to Flash Builder and Actionscript and hope someone might be able to help me out. I basically create a mobile app with a single view. The view has a TextInput as a search box and a search button. I conntected a Data/Service using a local XML file and bind the Data to a Spark List. Innitally the List will show nothing until the user enter the search term and hit the button. The List suppose to show the XML data that match the search term.
Now is my problem. I cannot make the List to show the data that match the search text. The List just shows ALL the data.
Here are my MXML code:
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:shopping="services.shopping.*"
title="Search">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected function button1_clickHandler(event:MouseEvent):void
navigator.popView();
protected function list_creationCompleteHandler(event:FlexEvent):void
getDataResult.token = shopping.getData();
protected function seach_clickHandler(event:MouseEvent):void
getDataResult.token = shopping.getSearchData(searchTxt.text);
]]>
</fx:Script>
<fx:Declarations>
<s:CallResponder id="getDataResult"/>
<shopping:Shopping id="shopping"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:actionContent>
<s:Button height="79" label="Back" click="button1_clickHandler(event)"/>
</s:actionContent>
<s:List id="list" left="0" right="0" top="111" bottom="0"
creationComplete="list_creationCompleteHandler(event)" labelField="english">
<s:AsyncListView list="{getDataResult.lastResult}"/>
</s:List>
<s:TextInput id="searchTxt" x="80" y="34" width="250" height="49" enabled="true"
prompt="search..."/>
<s:Button id="search" x="338" y="35" width="72" height="49" label="s"
click="seach_clickHandler(event)"/>
</s:View>
Here is the _Super_Shopping.as file:
* This is a generated class and is not intended for modification. To customize behavior
* of this service wrapper you may modify the generated sub-class of this class - Shopping.as.
package services.shopping
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.services.wrapper.HTTPServiceWrapper;
import com.adobe.serializers.xml.XMLSerializationFilter;
import mx.rpc.AbstractOperation;
import mx.rpc.AsyncToken;
import mx.rpc.http.HTTPMultiService;
import mx.rpc.http.Operation;
import valueObjects.Shop;
[ExcludeClass]
internal class _Super_Shopping extends com.adobe.fiber.services.wrapper.HTTPServiceWrapper
private static var serializer0:XMLSerializationFilter = new XMLSerializationFilter();
// Constructor
public function _Super_Shopping()
// initialize service control
_serviceControl = new mx.rpc.http.HTTPMultiService();
var operations:Array = new Array();
var operation:mx.rpc.http.Operation;
var argsArray:Array;
operation = new mx.rpc.http.Operation(null, "getData");
operation.url = "assets/data/shopping.xml";
operation.method = "GET";
operation.serializationFilter = serializer0;
operation.properties = new Object();
operation.properties["xPath"] = "/::shop";
operation.resultElementType = valueObjects.Shop;
operations.push(operation);
operation = new mx.rpc.http.Operation(null, "getSearchData");
operation.url = "assets/data/shopping.xml";
operation.method = "GET";
operation.resultFormat = "text";
argsArray = new Array("item");
operation.argumentNames = argsArray;
operation.properties = new Object();
operation.properties["xPath"] = "/::shop";
operation.resultElementType = valueObjects.Shop;
operations.push(operation);
_serviceControl.operationList = operations;
preInitializeService();
model_internal::initialize();
//init initialization routine here, child class to override
protected function preInitializeService():void
* This method is a generated wrapper used to call the 'getData' operation. It returns an mx.rpc.AsyncToken whose
* result property will be populated with the result of the operation when the server response is received.
* To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value.
* You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events.
* @see mx.rpc.AsyncToken
* @see mx.rpc.CallResponder
* @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received.
public function getData() : mx.rpc.AsyncToken
var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getData");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send() ;
return _internal_token;
public function getSearchData(item:String) : mx.rpc.AsyncToken
var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getSearchData");
var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(item);
return _internal_token;
The getSearchData() supposed to return XML data that match the search text, but it doesn't. Can anyoen help?
Thank you!Hi,
are you able to change dynamically the operation.url = "assets/data/shopping.xml";?
i need to do that based on the users input.
Thanks in advance, -
XML data and duplicating MCs for gallery
Ok big question...
how would i go about loading XML data in this format ,
<info>
<category></category>
<subcategory></subcategory>
<picture>
http://img.</picture>
</info>
<info>
<category></category>
<subcategory></subcategory>
<picture>
http://img.</picture>
</info>
Then About 20 additional Infos like that. Now the whole xml
list has the same tags. How would i go about displaying them in
flash? I wanted to use one MC and have it duplicate for each info
category and place the MCs on the stage so it looks like a gallery.
Each MC would have a picture with some info on it loaded form the
XML.
I think i would need to use the Dataset but im not even sure
how i would go about doing this.Something like this
http://www.adobe.com/products/flash/flashpro/video/gallery/
But for pictures only i don't need something that complex
also i don't need to sort anything. I was hoping to just use the
components and bind them. Also the xml feed would be updated every
couple of minutes with more content so i might need to list like 20
thumbs then make a button to seperate the loaded content. So maybe
like 20 thumbs showing then they click a page 2 button and it shows
the next 20 thumbs. That layout out is perfect though. -
I would like to know how to bring xml data into flash.
Specifically images that someone can click on the thumbnail and
view the larger image. please can anyone point me to some tutorials
or sites that i can start to learn how to do this.
thanks.Hi
First of all, read every thing you can in Flash Help to get
to know the different methods of loading XML.
XML can be loaded with 'built-in' components or parsed in
Actionscript, the Help files will explain both.
Next - Google for 'XML Image or Picture Gallery' you'll find
plenty
Hope it helps -
Hi
I am too new to this and still tring to learn. Well here is what I am into. I am trying to make a simple product catalog, using native components
a combobox to display DISTINCT health issues
a listbox to display the products associated to the selected health issue item in ComboBox
a textarea to display complete information about the selected product in listbox
Data comes from single external xml file.
I was able to start off with Combo, but I don't know how to display DISTINCT ITEMS IN IT? Now it display all items including duplicates. Then I added eventlistener to Combo, which on change, the data for selected item is displyed in Textarea, but i don't know how to hook this to List component.
All files available here:
https://docs.google.com/folder/d/0ByHOlDbL5njbX1FFd1UtTFNzMTg/edit
Sure some of you can do it so easy. Appreciate your time and help.
Thank you
KristteeFilter the XML before using it to create your dataProvider http://joshblog.net/2007/05/17/filter-xml-data-with-e4x-in-flash-part-2/
-
Hi guys,
How to upload a XML file into sap?
is there any function module?
can anybody give me an example program for converting or uploading XML data into sap.
regards,
vinoth.Hi all,
The XML code and XML file given is running fine for me, but when i am using it, my XML file and code, the tables GV_header and GT_item are filling in the perform but outside perform it's empty. Please find the code and XML file , PLease give the answer its urgent, points will be given for sure.
My function module code is:-
FUNCTION Z_MMI_XML_EXTRACT_COPY.
""Local interface:
*" IMPORTING
*" REFERENCE(DOCTYPE) LIKE DRAW-DOKAR
*" REFERENCE(DOCNUM) LIKE DRAW-DOKNR
*" REFERENCE(DOCVER) LIKE DRAW-DOKVR
*" REFERENCE(DOCPART) LIKE DRAW-DOKTL
*" TABLES
*" T_HEADER STRUCTURE ZFI_HEADER
*" T_ITEMS STRUCTURE ZFI_ITEMS
Load iXML Lib.
type-pools: ixml.
class cl_ixml definition load.
data: G_IXML type ref to if_ixml.
data: STREAMFACTORY type ref to if_ixml_stream_factory.
data: ISTREAM type ref to if_ixml_istream.
data: DOCUMENT type ref to if_ixml_document.
data: PARSER type ref to if_ixml_parser.
You should provide the parameter for file name
*LV_FILE_URL = 'C:input_xml.xml'.
types: begin of XML_LINE,
DATA(256) type x,
end of XML_LINE.
***types: begin of TY_HEADER,
CUST_NAME(20) type c,
CARD_NO(20) type c,
TAX_AMOUNT(10) type c,
TOTAL_AMOUNT(10) type c,
end of TY_HEADER.
***types: begin of TY_ITEM,
ITEM_NO(4) type n,
ITEM_ID(20) type c,
ITEM_TITLE(50) type c,
ITEM_QTY(10) type c,
ITEM_UPRICE(10) type c,
end of TY_ITEM.
*data: GV_HEADER type TY_HEADER.
*data: GV_HEADER like zfi_header occurs 0 with header line.
data : GV_HEADER LIKE ZFI_HEADER.
*data: GT_ITEM type standard table of TY_ITEM with header line.
*data: GT_ITEM type standard table of zfi_items with header line.
data: GT_ITEM type standard table of zfi_items with header line.
data: XML_TABLE type table of XML_LINE,
XML_TABLE_SIZE type i.
data: LV_FILE_URL type rlgrap-filename.
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 .
DATA : BEGIN OF wa_draw OCCURS 0,
dokar LIKE draw-dokar,
doknr LIKE draw-doknr,
dokvr LIKE draw-dokvr,
doktl LIKE draw-doktl,
END OF wa_draw.
DATA : g_documenttype LIKE bapi_doc_aux-doctype,
g_documentnumber LIKE bapi_doc_aux-docnumber,
g_documentpart LIKE bapi_doc_aux-docpart,
g_documentversion LIKE bapi_doc_aux-docversion.
*" Itab required in IMPORTING parameter of BAPI
DATA : t_documentfile LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE.
DATA : t_documentstructure LIKE bapi_doc_structure OCCURS 0 WITH HEADER
LINE,
itab required in TABLES parameters of BAPI
t_documentfiles LIKE bapi_doc_files2 OCCURS 0 WITH HEADER LINE,
t_components LIKE bapi_doc_comp OCCURS 0 WITH HEADER LINE,
t_return LIKE bapiret2.
DATA : l_docfile TYPE string.
***FILL THE TYPE OF ATTACHMENT in IMPORTING itab**
t_documentfile-wsapplication = 'XML'.
APPEND t_documentfile.
wa_draw-dokar = DOCTYPE.
wa_draw-doknr = DOCNUM.
wa_draw-doktl = DOCPART.
wa_draw-dokvr = DOCVER.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
EXPORTING
documenttype = wa_draw-dokar
documentnumber = wa_draw-doknr
documentpart = wa_draw-doktl
documentversion = wa_draw-dokvr
documentfile = t_documentfile "IMPORTING itab of BAPI
getstructure = '1'
getcomponents = 'X'
ORIGINALPATH = ' '
HOSTNAME = ' '
getheader = 'X'
DOCBOMCHANGENUMBER =
DOCBOMVALIDFROM =
DOCBOMREVISIONLEVEL =
IMPORTING
return = t_return
TABLES
documentstructure = t_documentstructure
documentfiles = t_documentfiles "TABLES itab of BAPI
components = t_components
LOOP AT t_documentfiles .
ENDLOOP.
l_docfile = t_documentfiles-docfile.
The next step is creating the main factory for the iXML library:
G_IXML = cl_ixml=>create( ).
Now Create Stream Factory
STREAMFACTORY = G_IXML->create_stream_factory( ).
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
*filename = 'C:DMS_SPA.XML'
filename = l_docfile
filetype = 'BIN'
IMPORTING
FILELENGTH = XML_TABLE_SIZE
TABLES
data_tab = XML_TABLE.
ISTREAM = STREAMFACTORY->create_istream_itable( table = XML_TABLE
size = XML_TABLE_SIZE )
Create XML Document instance
DOCUMENT = G_IXML->create_document( ).
Create parser Object
PARSER = G_IXML->create_parser( stream_factory = STREAMFACTORY
ISTREAM = istream
DOCUMENT = document ).
Parse an XML document into a DOM tree
*parser->parse( ).
Parsing Error Processing
if PARSER->parse( ) ne 0.
if PARSER->num_errors( ) ne 0.
data: PARSEERROR type ref to if_ixml_parse_error,
STR type STRING,
I type i,
COUNT type I,
INDEX type i.
COUNT = PARSER->num_errors( ).
write: COUNT, ' parse errors have occured:'.
INDEX = 0.
while INDEX < COUNT.
PARSEERROR = PARSER->get_error( INDEX = index ).
I = PARSEERROR->get_line( ).
write: 'line: ', i.
I = PARSEERROR->get_column( ).
write: 'column: ', i.
STR = PARSEERROR->get_reason( ).
write: STR.
INDEX = index + 1.
endwhile.
endif.
endif.
Close the stream since it �s not needed anymore
call method ISTREAM->close( ).
clear ISTREAM.
DATA : GV_NODE type ref to if_ixml_node.
DATA : GV_NODETEXT type STRING.
data: GV_FIRST_TIME.
GV_FIRST_TIME = 'X'.
GV_NODE = DOCUMENT.
*GT_ITEM-item_no = 1.
GT_ITEM-itemno_acc = 1.
perform GET_DATA tables GT_ITEM
using GV_NODE
changing GV_HEADER.
Last item is still not added.
append GT_ITEM.
APPEND GV_HEADER.
*T_HEADER[] = gv_header[].
t_items[] = gt_item[].
**write : GV_HEADER-cust_name,
GV_HEADER-card_no,
GV_HEADER-tax_amount,
GV_HEADER-total_amount.
**loop at GT_ITEM.
write /:.
write : GT_ITEM-item_no,
GT_ITEM-item_id,
GT_ITEM-item_title,
GT_ITEM-item_qty,
GT_ITEM-item_uprice.
**endloop.
ENDFUNCTION.
FORM Get_data *
***form get_data tables YT_ITEM structure gt_ITEM
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type TY_HEADER.
form get_data1 tables YT_ITEM structure zfi_items
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type zfi_header.
***form get_data tables YT_ITEM structure GT_ITEM
using value(x_node) type ref to if_ixml_node
changing Y_HEADER type TY_HEADER.
data: INDENT type i.
data: PTEXT type ref to if_ixml_text.
data: STRING type string.
data: TEMP_STRING(100).
case X_NODE->get_type( ).
when if_ixml_node=>co_node_element.
STRING = X_NODE->get_name( ).
GV_NODETEXT = STRING.
when if_ixml_node=>co_node_text.
PTEXT ?= X_NODE->query_interface( IXML_IID_TEXT ).
if PTEXT->ws_only( ) is initial.
STRING = X_NODE->get_value( ).
case GV_NODETEXT.
when 'Customer'.
when 'HEADER'.
clear GV_HEADER.
when 'Name'.
when 'INVOICE_IND'.
move STRING to GV_HEADER-cust_name.
move STRING to GV_HEADER-INVOICE_IND.
when 'CompanyCode'.
move STRING to GV_HEADER-CompanyCode.
when 'OBJ_TYPE'.
move STRING to GV_HEADER-OBJ_TYPE.
when 'username'.
move STRING to GV_HEADER-username.
when 'PO_reference'.
move STRING to GV_HEADER-PO_reference.
when 'Invoice_Date'.
move STRING to GV_HEADER-Invoice_Date.
when 'Posting_Date'.
move STRING to GV_HEADER-Posting_Date.
when 'Amount'.
move STRING to GV_HEADER-Amount.
when 'Currency'.
move STRING to GV_HEADER-Currency.
*APPEND GV_HEADER.
Iteam details
when 'invoice_doc_item'.
move STRING to GT_ITEM-ITEMNO_ACC.
when 'currency'.
move STRING to TEMP_STRING.
move TEMP_STRING to GT_ITEM-CURRENCY.
when 'Quantity'.
move STRING to GT_ITEM-Quantity.
when 'UoM'.
move STRING to GT_ITEM-UoM.
endcase.
endif.
endcase.
if GV_NODETEXT = 'Header'.
clear GV_HEADER.
elseif GV_NODETEXT = 'Item'.
if GV_FIRST_TIME ne 'X'.
append GT_ITEM.
clear : gt_item.
GT_ITEM-ITEMNO_ACC = gt_item-itemno_acc + 1.
endif.
GV_FIRST_TIME = ' '.
endif.
Get the next child
X_NODE = x_node->get_first_child( ).
Recurse
while not X_NODE is initial.
perform GET_DATA tables GT_ITEM
using X_NODE
changing GV_HEADER.
X_NODE = x_node->get_next( ).
endwhile.
endform.
the XML file is:-
Thanx in advance
Maybe you are looking for
-
SOAP Sender Adapter converting Ukranian Characters to Unrecognizable Characters
Hello All, The scenario i am talking about here is SOAP - XI - R/3. And IDoc is posted to R/3 system via XI and hence we are using SOAP Adapter as Sender Adapter and IDoc Adapter as receiver Adapter. The third party which is sending the data to XI is
-
Splitting an apple ID so we can use Friend Finder
How can I "split" an Apple ID so my wife and I can use Find Friends? My wife and I each have an iPhone and share a Mac. We've always shared the same Apple ID. We've updated to iOS 5 on our phones, but still run Snow Leopard on the Mac. Thus, we are n
-
EPM Workspace EPM Inside Frame error- Please help ASAP!!
Can someone please help me resolve below error with EPM- I've created resports in web analysis studio and am emailing smartcut URL to about 200 users. 3 of the users are getting below error- "EPM Workspace cannot function inside of a frame" pop ups a
-
T400s Problems with screen after reconnecti​on power.
I am happy for my T400s but is some times has screen issues when the power is plug in and it wakes up from sleep. I have some pictures of it. Image 1 Video Video of the problem Is there a problem with the computer ?
-
Re: Values from R/3 - CRM
Hello... We are adding a new field in CRM-Marketing , under basic tab ... We have used the EEW to add this field. However, now we need to link this new field from CRM - > ProjectSystems (R3) to populate the values(f4)........ how can we achive this ?