04-06-2006 6:26 AM
Hi,
I use CALL TRANSFORMATION to transfer XML to ABAP structure. But error occurred. But an exception from the class CX_SY_MOVE_CAST_ERROR was caught. Error content is 'No valid source context supplied'. What is the possible reason for such error?
Thanks a lot.
Best regards,
Abby
04-06-2006 6:30 AM
Hi abby,
1. just check out if syntax is like the on in the program.
itab --- > xml
xml ---> itab.
2. This program will do both.
(just copy paste in new program)
3.
REPORT abc.
*----
DATA
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
a(100) TYPE c,
END OF itab.
DATA: xml_out TYPE string .
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
FIRST PHASE
FIRST PHASE
FIRST PHASE
*----
Fetch Data
SELECT * FROM t001 INTO TABLE t001.
*----
XML
CALL TRANSFORMATION ('ID')
SOURCE tab = t001[]
RESULT XML xml_out.
*----
Convert to TABLE
CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = xml_out
i_tabline_length = 100
TABLES
et_table = itab.
*----
Download
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filetype = 'BIN'
filename = 'd:\xx.xml'
TABLES
data_tab = itab.
SECOND PHASE
SECOND PHASE
SECOND PHASE
BREAK-POINT.
REFRESH t001.
CLEAR t001.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'D:\XX.XML'
filetype = 'BIN'
TABLES
data_tab = upl.
LOOP AT upl.
CONCATENATE xmlupl upl-f INTO xmlupl.
ENDLOOP.
*----
XML
CALL TRANSFORMATION ('ID')
SOURCE XML xmlupl
RESULT tab = t001[]
.
BREAK-POINT.
regards,
amit m.
04-06-2006 6:31 AM
Mostly the XML data file may not contain any data or else if it contains data, it is not in the sepecified format.
To load data into SAP internal table from XML the data needs to be specified correctly in the format SAP understands.
04-06-2006 6:55 AM
Hi,
Thank you for your answers.
The XML is sent out from XI and it contains content.
Must the data type and data length of XML definition be the same with the ABAP structure definition?
Thank you.
04-06-2006 9:07 AM
Welcome to SDN
'No valid source context supplied' generally happen when the source xml is blank or not in the right format.
anyhow , if you post a sample of the xml file and the definition of your target ABAP internal table and the XLST program, we can see whether anything is wrong.
(note that in the XSLT program the ELEMENT (which represents a itab column) name has to be in upper case
Regards
Raja
Reward points to helpful answers by choosing the appropriate radiobutton in the answers
04-24-2013 7:58 PM
Hi
Change trying the declaration part of Result table
instead of DATA :result_table TYPE STANDARD TABLE OF char2048.
change it to
DATA :result_table TYPE STANDARD TABLE OF x255.
i hope it will work