Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Class Upload XML file

Former Member
0 Likes
1,242

Hi

i search a class with the method, that can upload a xml file. Everybody know?

Regards abap

1 ACCEPTED SOLUTION
Read only

Sm1tje
Active Contributor
0 Likes
963

upload it from where? Local directory, server, web page?

6 REPLIES 6
Read only

Sm1tje
Active Contributor
0 Likes
964

upload it from where? Local directory, server, web page?

Read only

Former Member
0 Likes
963

upload from local

Read only

brad_bohn
Active Contributor
0 Likes
963

Did you search? XML has nothing to do with it - you'll probably get a thousand hits for file uploads. Now, if you want to transform the XML once you've uploaded it, that's another story. What do you want to do?

Read only

Former Member
0 Likes
963

yes i forgot the search function now i programing a xml file upload


report z_local.


data lr_cl_xml_doc type ref to cl_xml_document.
data lf_sysubrc type sysubrc.
data lr_if_ixml_node type ref to if_ixml_node.

parameters pm_fil type localfile obligatory.


at selection-screen on value-request for pm_fil.

  call function 'F4_FILENAME'
    exporting
      program_name  = syst-cprog
      dynpro_number = syst-dynnr
    importing
      file_name     = pm_fil.

start-of-selection.
  create object lr_cl_xml_doc.

  call method lr_cl_xml_doc->import_from_file
    exporting
      filename = pm_fil
    receiving
      retcode  = lf_sysubrc.

  check lf_sysubrc = 0.

  call method lr_cl_xml_doc->get_first_node
    receiving
      node = lr_if_ixml_node.

  lr_if_ixml_node = lr_cl_xml_doc->m_document.

Read only

Former Member
0 Likes
963

now i have more question to xml

i had programing this and it's work


  create object lr_cl_xml_doc.

  call method lr_cl_xml_doc->import_from_file
    exporting
      filename = pm_fil
    receiving
      retcode  = lf_sysubrc.

  check lf_sysubrc = 0.

  call method lr_cl_xml_doc->find_node
    exporting
      name = 'printObjects'
    receiving
      node = lr_if_ixml_node.

the xml structur looks like this but is not all date value from xml.


<PLU>
 <longName></longName>
 <popUp></popUp>
 <pluParams>
  <packageLength>25</packageLength>
  <clockCycle mode = "On">
   <packageLength>22</packageLength>
   <stopOnError>No</stopOnError>
  </clockCycle>
  <date>
   <created> 10.06.05</created>
   <lastModified> 08.07.05</lastModified>
  </date>
  <runTime>
   <timeElapsed>1399</timeElapsed>
   <timerRunning>91</timerRunning>
   <timeToStop>120</timeToStop>
   <numOfPackages>517</numOfPackages>
  </runTime>
  <user name = "Administrator"/>
  <loadCellSettings name = "STANDARD"/>
  <refreshDesktop>Yes</refreshDesktop>
  <labelMonitoring>3</labelMonitoring>
 </pluParams>
 <printObjects>
  <printObject ID = "1" type = "numberField">
   <source>event</source>
   <type>net</type>
   <factor>1.00000</factor>
   <format>0,001</format>
   <generalParams>
    <xPos>235</xPos>
    <yPos>500</yPos>
    <font name = "MTBDLFRO" size = "10" region = "W-EUROPE"/>
    <align>left</align>
    <rotation>0</rotation>
    <parentID>-2</parentID>
    <externPO load = "No" name = "" pluGroup = ""/>
   </generalParams>
  </printObject>
  <printObject ID = "2" type = "unitChar">
   <type>weight</type>
   <countryCode>CH</countryCode>
   <generalParams>
    <xPos>96</xPos>
    <yPos>-1</yPos>
    <font name = "ARIAL" size = "10" region = "W-EUROPE"/>
    <align>left</align>
    <rotation>0</rotation>
    <parentID>1</parentID>
    <externPO load = "No" name = "" pluGroup = ""/>
   </generalParams>
  </printObject>

the reference lr_cl_xml_doc is now reference of the node <printObjects>. In next step, i want find or search with a method by id continue node. How i do that?

i find a method in interface if_ixml_node but it won't to be work.


  call method lr_if_ixml_node->find_from_gid
    exporting
      gid  = 1
    receiving
      rval = lr_if_ixml_node_id. 

Regards abap_begin

Read only

Former Member
0 Likes
963

i think, i must to look for attributes?