2009 Aug 07 10:47 AM
We have a requirement where we need to upload XML file from application server to the internal table.
I am getting a blank internal table, with the following error message in bapirept2 table.
line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or c
My code extract is as below :
Open DATASET p_file for INPUT in BINARY MODE.
if sy-subrc = 0.
Do.
READ DATASET p_file into gt_data LENGTH g_length.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gt_data.
ENDDO.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
INPUT_LENGTH = g_length
* FIRST_LINE = 0
* LAST_LINE = 0
IMPORTING
BUFFER = g_xstring
TABLES
BINARY_TAB = gt_data
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.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = g_xstring
TABLES
XML_TABLE = gt_smum_xmltb
RETURN = gt_bapiret2
.
Close DATASET p_file.Please rectify me.
We have a requirement where we need to upload XML file from application server to the internal table.
I am getting a blank internal table, with the following error message in bapirept2 table.
line 1 col 1-unexpected symbol; expected '<', '</', entity reference, character data, CDATA section, processing instruction or c
My code extract is as below :
Open DATASET p_file for INPUT in BINARY MODE.
if sy-subrc = 0.
Do.
READ DATASET p_file into gt_data LENGTH g_length.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gt_data.
ENDDO.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
INPUT_LENGTH = g_length
* FIRST_LINE = 0
* LAST_LINE = 0
IMPORTING
BUFFER = g_xstring
TABLES
BINARY_TAB = gt_data
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.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
XML_INPUT = g_xstring
TABLES
XML_TABLE = gt_smum_xmltb
RETURN = gt_bapiret2
.
Close DATASET p_file.Please rectify me.
2009 Aug 07 4:45 PM
> Please rectify me.
You'ved poste in the wrong forum. This forum is about the gui and your requirement has nothing to do with that.....
2009 Aug 10 3:07 PM
Perhaps this article I've written will help you:
[heidoc.net|http://www.heidoc.net/joomla/en/technology-science/sap-and-xslt/5-tutorial-data-exchange-between-abap-and-xml]
Best wishes,
Jan
Edited by: Jan Krohn on Jul 15, 2011 10:44 AM
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |