2009 May 25 5:01 AM
Dear experts,
Could you please tell me how to generate to below xml file?
<?xml version="1.0" encoding="utf-8" ?>
- <faxmakerdata>
- <RECIPIENTS>
- <FAX>
- <RECIPIENT>
<FIRSTNAME>><![CDATA[]]></FIRSTNAME>
<LASTNAME><![CDATA[]]></LASTNAME>
<COMPANY><![CDATA[]]></COMPANY>
<DEPARTMENT><![CDATA[]]></DEPARTMENT>
<EMAILADDRESS><![CDATA[]]></EMAILADDRESS>
<NUMBER><![CDATA[2937]]></NUMBER>
<VOICENUMBER><![CDATA[]]></VOICENUMBER>
</RECIPIENT>
</FAX>
</RECIPIENTS>
</faxmakerdata>
I have used "SDIXML_DATA_TO_DOM " but there will appear <Item>
could you please tell me how to do?
2009 May 25 5:32 AM
Hi,
after SDIXML_DATA_TO_DOM fm Use SDIXML_DOM_TO_XML to convert DOM to XML
then u can use any download file FM .
DATA:
TABLESTATS LIKE MSSTABSIZEINFO,
IVALUE TYPE I,
BEGIN OF VERSIONTAB OCCURS 0,
VERSIONDAT LIKE SY-DATUM,
END OF VERSIONTAB,
CMD(384) TYPE C,
XML_AS_STRING TYPE XSTRING,
DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
DOM TYPE REF TO IF_IXML_ELEMENT,
TABLENAME(128) TYPE C,
RC TYPE SY-SUBRC,
L_EXISTS LIKE DD02L-ACTFLAG.
convert table to a DOM
CALL FUNCTION 'SDIXML_DATA_TO_DOM'
EXPORTING
NAME = 'spinfo'
DATAOBJECT = SPINFO[]
IMPORTING
DATA_AS_DOM = DOM
CHANGING
DOCUMENT = DOCUMENT
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC = 0.
CALL METHOD DOCUMENT->APPEND_CHILD
EXPORTING
NEW_CHILD = DOM
RECEIVING
RVAL = RC.
IF RC = 0.
convert DOM to XML
CALL FUNCTION 'SDIXML_DOM_TO_XML'
EXPORTING
DOCUMENT = DOCUMENT
PRETTY_PRINT = 'X'
IMPORTING
XML_AS_STRING = XML_AS_STRING
SIZE = IVALUE
TABLES
XML_AS_TABLE = XML_AS_TABLE
EXCEPTIONS
OTHERS = 2.
IF SY-SUBRC = 0.
MOVE XML_AS_STRING TO XML_AS_STRING_OUT-XML_STRING.
MOVE IVALUE TO XML_AS_STRING_OUT-LENGTH.
ENDIF.
ENDIF.
ENDIF.
Salil...
2009 May 25 8:07 AM
After i used SDIXML_DATA_TO_DOM and 'SDIXML_DOM_TO_XML',I get below XML information
<?xml version="1.0" encoding="utf-8"?>
<faxmakerdata>
<item>
<RECIPIENTS>
<FAX>
<RECIPIENT>
<FIRSTNAME><![CDATA[]]></FIRSTNAME>
<LASTNAME><![CDATA[]]></LASTNAME>
<COMPANY><![CDATA[]]></COMPANY>
<DEPARTMENT><![CDATA[]]></DEPARTMENT>
<EMAILADDRESS><![CDATA[]]></EMAILADDRESS>
<NUMBER><![CDATA[274]]></NUMBER>
<VOICENUMBER><![CDATA[]]></VOICENUMBER>
</RECIPIENT>
</FAX>
</RECIPIENTS>
</item>
</faxmakerdata>
How can I get information? How to delete <Item> </Item>?
<?xml version="1.0" encoding="utf-8" ?>
<faxmakerdata>
<recipients>
<fax>
<recipient>
<firstname><![CDATA[]]></firstname>
<lastname><![CDATA[]]></lastname>
<company><![CDATA[]]></company>
<department><![CDATA[]]></department>
<emailaddress><![CDATA[]]></emailaddress>
<number><![CDATA[274]]></number>
<voicenumber><![CDATA[]]></voicenumber>
</recipient>
</fax>
</recipients>
</faxmakerdata>
2009 May 25 6:50 AM
Hi,
After that you have to call 'SDIXML_DOM_TO_XML' FM also
try with this FM
Regards,
Jyothi CH.
2009 Jun 12 4:24 AM
2009 Jun 26 4:45 PM
Please, can you send me the program where you generate the xml file? I have to generate some similar file, but I don't know how to create the '!CDATA[]> from an internal table.
I generate for field data which is a text field, the xml file as:
.....
....
<DATA>-RETENCION</DATA>
....
....
but I need to generate it as:
....
....
<DATA><![CDATA[-RETENCION-]]></DATA>
...
...
Thanks in advance,
Regards,
Alice