2006 Feb 02 2:54 PM
I have a requirement to convert an input xml string into a complex ABAP structure. I am thinking of using Simple Transformation (ST).
I want to find out if there is any program / function module which can "generate" the transformation code (ST program) by giving the ABAP structure name (ie, the SE11 name of the ABAP structure). That would save a lot of effort. Any ideas?
thanks
2006 Feb 04 7:24 AM
there is no standard FM/program to generate the ST code.
you have to manually create the ST code.
you can check out the following weblog for creating ST programs. (its a six part series)
/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
Regards
Raja
2006 Feb 02 2:59 PM
2006 Feb 02 3:05 PM
sorry, this is talking about SDIXML function modules. My question is specifically about generating ST transformation code.
2006 Feb 02 3:14 PM
2006 Feb 02 3:31 PM
yes, in fact I have tried a lot to get SDIXML_XML_TO_DOM & DOM_TO_DATA work together succcessfully to convert xml to ABAP data (ie, in 2 steps - 1. xml-to-dom & then 2. dom-to-data)....BUT..it does not work..in spite of all the hype about netweaver 6.40 etc etc..
2006 Feb 02 3:58 PM
2006 Feb 02 4:06 PM
no, no, no ... when saying iXML i mean making use of the IF_IXML_... classes / interfaces ...
2006 Feb 02 4:53 PM
ok. I can try IF_XML..classes (that is what SDIXML function modules ultimately use).
DO you have any sample code (or a program within R/3) that uses if_xml classes for my purpose: to convert a xml string into a complex ABAP structure - just by giving the xml string & ABAP structure(or structure name) as parameters - and WITHOUT any further hard-work !
thanks
2006 Feb 02 5:12 PM
2006 Feb 03 4:42 AM
2006 Feb 03 10:55 AM
Hi Janet,
1. XML File -
> Internal table
2. I understand the above is ur requirement.
3. Below is my program.
It does three things :
a) selects data from T001 table
b) Converts into XML and puts it into a file.
c) In second phase,
It reads the file
and Populates the T001 table again (which has been cleareed explicitly)
4. See FIRST PHASE (itab to xml)
SECOND PHASE (xml to itab)
in my program
5.
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 WHERE bukrs = '1000'.
*----
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 .
2006 Feb 06 4:44 AM
Hi Amit,
Which release of SAP you in? The FM 'HR_EFI_CONVERT_STRING_TO_TABLE' does not exist in 4.7 system! As a result program short-dumps.
Thanks,
Sougata.
2006 Feb 06 4:53 AM
HR_EFI_CONVERT_STRING_TO_TABLE simply converts string to table format.
if you want similar functions you can check out the following FMs
CONVERT_STRING_TO_TABLE
SOTR_SERV_STRING_TO_TABLE
Regards
Raja
2006 Feb 04 7:24 AM
there is no standard FM/program to generate the ST code.
you have to manually create the ST code.
you can check out the following weblog for creating ST programs. (its a six part series)
/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1
Regards
Raja
2006 Feb 05 9:25 PM
thanks for your reply. At least you understood my problem.
To me, it seems so obvious that SAP should have be supplying such code-generation tools. Another such example where I can't understand why SAP folks don't get it is: Just like wsdl2java in java world, there should have been a wsdl2abap- to automatically generate web-service client (or server) code in ABAP. anyways..thanks again
2006 Feb 06 4:22 AM
I am not familiar with wsdl2java, but does it generate webservice client based on the WSDL at runtime?
in ABAP as of WAS6.40 you have desing time tools to generate webservice proxy client for a given WSDL.
for details check out this weblog. (particularly the section <b>Release 640</b>)
<a href="/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap">Consuming WebServices with ABAP</a>
Regards
Raja
2006 Feb 06 4:54 AM
Hi Janet,
check out this class, may be this could be of help
CL_PROXY_WSDL2ABAP
Regards
Raja
2006 Feb 15 3:07 AM
thanks. cl_proxy_wsdl2abap is equivalent of wsdl2java in apache axis etc...