2014 Aug 27 4:34 PM
Hi!!
I'have 4.6c version and I must to read an XML file from server, I wrote this sample code:
REPORT zflavio_xml2.
* & ------------------------------------------------ --------------------- *
* Date & Declaration
* & ------------------------------------------------ --------------------- *
DATE: LIKE rlgrap-filename file.
file = '/usr/usrsap/CRD/transfer/SEPASCT_SSBPAE/IN/R4_ESEMPIO.xml'.
DATE: gcl_xml TYPE REF TO cl_xml_document.
DATE: gv_subrc TYPE sy-subrc.
DATA: TYPE gv_xml_string xstring.
DATA: TYPE gv_size sytabix.
DATE: gt_xml_data TYPE TABLE OF smum_xmltb.
DATA: TYPE gwa_xml_data smum_xmltb OCCURS 0 WITH HEADER LINE.
* DATA: TYPE gwa_xml_data smum_xmltb.
DATE: gt_return TYPE TABLE OF bapiret2.
DATA: TYPE gv_tabix sytabix.
DATE: len TYPE i.
* & ------------------------------------------------ --------------------- *
* & Start-of-selection
* & ------------------------------------------------ --------------------- *
START-OF-SELECTION.
OPEN DATASET file FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
DO.
READ DATASET INTO gv_xml_string file. "ACTUAL LENGTH len.
* IF sy-subrc NE 0.
EXIT.
* ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET file.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = gv_xml_string
TABLES
xml_table = gwa_xml_data
return = gt_return.
WRITE: / 'heirarchy', 11 'Type', 17 'Name', 37 'Value'.
LOOP AT gwa_xml_data.
WRITE: / gwa_xml_data-hier,
11 gwa_xml_data-type,
17 gwa_xml_data-cname,
37 gwa_xml_data-cValue.
CLEAR gwa_xml_data.
ENDLOOP.
the problem is that in the internal table, the program writes correctly the first twenty records, but it cuts all the others.
Does anyone know help me?
Thanks a lot,
Flavio Mariola
2014 Aug 28 10:13 AM
Hi Flavio,
I tried you sample code, and works fine in 7.3.
How do you mean cuts all the records? Do you mean truncating the lines or only shows the first 20 records?
Regards,
Alex
Hi!!
I'have 4.6c version and I must to read an XML file from server, I wrote this sample code:
REPORT zflavio_xml2.
* & ------------------------------------------------ --------------------- *
* Date & Declaration
* & ------------------------------------------------ --------------------- *
DATE: LIKE rlgrap-filename file.
file = '/usr/usrsap/CRD/transfer/SEPASCT_SSBPAE/IN/R4_ESEMPIO.xml'.
DATE: gcl_xml TYPE REF TO cl_xml_document.
DATE: gv_subrc TYPE sy-subrc.
DATA: TYPE gv_xml_string xstring.
DATA: TYPE gv_size sytabix.
DATE: gt_xml_data TYPE TABLE OF smum_xmltb.
DATA: TYPE gwa_xml_data smum_xmltb OCCURS 0 WITH HEADER LINE.
* DATA: TYPE gwa_xml_data smum_xmltb.
DATE: gt_return TYPE TABLE OF bapiret2.
DATA: TYPE gv_tabix sytabix.
DATE: len TYPE i.
* & ------------------------------------------------ --------------------- *
* & Start-of-selection
* & ------------------------------------------------ --------------------- *
START-OF-SELECTION.
OPEN DATASET file FOR INPUT IN BINARY MODE.
IF sy-subrc = 0.
DO.
READ DATASET INTO gv_xml_string file. "ACTUAL LENGTH len.
* IF sy-subrc NE 0.
EXIT.
* ENDIF.
ENDDO.
ENDIF.
CLOSE DATASET file.
CALL FUNCTION 'SMUM_XML_PARSE'
EXPORTING
xml_input = gv_xml_string
TABLES
xml_table = gwa_xml_data
return = gt_return.
WRITE: / 'heirarchy', 11 'Type', 17 'Name', 37 'Value'.
LOOP AT gwa_xml_data.
WRITE: / gwa_xml_data-hier,
11 gwa_xml_data-type,
17 gwa_xml_data-cname,
37 gwa_xml_data-cValue.
CLEAR gwa_xml_data.
ENDLOOP.
the problem is that in the internal table, the program writes correctly the first twenty records, but it cuts all the others.
Does anyone know help me?
Thanks a lot,
Flavio Mariola
2014 Aug 28 10:13 AM
Hi Flavio,
I tried you sample code, and works fine in 7.3.
How do you mean cuts all the records? Do you mean truncating the lines or only shows the first 20 records?
Regards,
Alex
2014 Aug 28 12:17 PM
yes, I'm sorry. the example works. I did not notice that the file was put on the server was truncated and different from what I expected.
Thank you,
Flavio
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |