Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

Tags:
Not what you were looking for? View more on this topic or Ask a question