Skip to Content
avatar image
Former Member

Open Dataset for XML not reading the XML file, Returning Code 8.

Dear all,

Im trying to open an XML file using Open Dataset, since i have to execute this report in background and GUI_upload doesnt work in background.

The XML file is available in my C:\, say, C:\xmlfile.xml.

But the open dataset is not reading any value into the g_xml_line . it is returning sy-subrc = 8.

Below is my code for that, can anybody help me out to resolve.

DATA : lv_filename LIKE rlgrap-filename.

CLEAR: lv_filename.

lv_filename = p_input.

OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.

IF sy-subrc ne 0.

WRITE:/ 'invalid file'.

else.

DO.

READ DATASET lv_filename INTO g_xml_line.

IF sy-subrc EQ 0.

APPEND g_xml_line TO g_xml_table.

ELSE.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET lv_filename.

ENDIF.

-


TYPES: BEGIN OF t_xml_line,

data(256) TYPE x,

END OF t_xml_line.

DATA: g_xml_table TYPE TABLE OF t_xml_line,

g_xml_line TYPE t_xml_line,

g_xml_table_size TYPE i.

GET REFERENCE OF gt_person INTO gs_result_xml-value.

gs_result_xml-name = 'IPIX'.

APPEND gs_result_xml TO gt_result_xml.

  • Perform the XSLT stylesheet

TRY.

CALL TRANSFORMATION zaum_manh_sync_rpt

SOURCE XML g_xml_table

RESULT (gt_result_xml).

CATCH cx_root INTO gs_rif_ex.

gs_var_text = gs_rif_ex->get_text( ).

MESSAGE gs_var_text TYPE 'E'.

ENDTRY.

-


Kindly suggest me a solution. Points assured

regs,

raja

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 20, 2008 at 03:11 PM

    OPEN Dataset cannot be used for the presentation server. It reads file only from the application server. You have to keep the file in the application server for OPEN DATASET to work.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      After saving the file , below is the code i wrote, but it gives a runtime error with message

      No roll storage space of length 3788808 available for internal storage.

      ***Coding****

      PARAMETERS: p_file TYPE pathintern LOWER CASE DEFAULT '/usr/sap/DEV/SYS/global/XMLABAP2.XML'.

      DATA : lv_filename LIKE rlgrap-filename.

      CLEAR: lv_filename.

      lv_filename = p_file.

      DATA: l_fname TYPE filename-fileintern. " File name

      *GET THE FILENAME FROM THE APPLICATION SERVER

      CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'

      EXPORTING

      directory = p_file

      filemask = '*'

      IMPORTING

      serverfile = l_fname

      EXCEPTIONS

      canceled_by_user = 1

      OTHERS = 2.

      IF sy-subrc NE 0.

      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

      */usr/sap/DEV/SYS/global/substanc

      lv_filename = l_fname.

      OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.

      IF sy-subrc NE 0.

      WRITE:/ 'invalid file'.

      ELSE.

      DO.

      READ DATASET lv_filename INTO g_xml_line.

      • IF sy-subrc EQ 0.

      APPEND g_xml_line TO g_xml_table.

      • ELSE.

      • EXIT.

      • ENDIF.

      ENDDO.

      CLOSE DATASET lv_filename.

      ENDIF.