Application Development 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: 

Upload XML file from application server to internal table

Former Member
0 Kudos

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.

2 REPLIES 2

jurjen_heeck
Active Contributor
0 Kudos

> 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.....

jan_krohn
Active Participant
0 Kudos

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