2006 Jul 06 11:33 AM
Hi
i want to upload XML file from application server
so i don't want to use gui_upload (all the threads i saw in forum use the gui_upload or fronted)
i used
could you say me how i can do it ?
thanks a lot
serge
2006 Jul 06 11:47 AM
Hi,
If you have the XML file on application server,
you can use OPEN DATASET statement.
eg.
DATA: line TYPE string,
file(20) TYPE C value '/usr/test.dat'.
OPEN DATASET file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET file INTO line.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE: / line.
ENDDO.
CLOSE DATASET file.
Regards,
Shashank
Hi
i want to upload XML file from application server
so i don't want to use gui_upload (all the threads i saw in forum use the gui_upload or fronted)
i used
could you say me how i can do it ?
thanks a lot
serge
2006 Jul 06 11:36 AM
Hi serge,
1. we have to use OPEN DATASET, READ, CLOSE DATASET,
to upload file from application server.
2. It does not matter whether its an xml file,
or text file.
regards,
amit m.
2006 Jul 06 11:42 AM
2006 Jul 06 11:47 AM
Hi again,
1. After using DATASET,
and getting the raw xml text file,
into an internal table (eg. UPL)
2. just use this logic.
3.
*----
DATA : BEGIN OF upl OCCURS 0,
f(255) TYPE c,
END OF upl.
DATA: xmlupl TYPE string .
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
*----
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.
2006 Jul 06 11:47 AM
Hi,
If you have the XML file on application server,
you can use OPEN DATASET statement.
eg.
DATA: line TYPE string,
file(20) TYPE C value '/usr/test.dat'.
OPEN DATASET file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
DO.
READ DATASET file INTO line.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE: / line.
ENDDO.
CLOSE DATASET file.
Regards,
Shashank
2006 Jul 06 11:52 AM
Hi,
You can use OPEN DATASET for this purpose.
Try this code:
<b>****************************************</b>
Data:
A_FILE TYPE RLGRAP-FILENAME, "Application server
P_FILE TYPE RLGRAP-FILENAME. "Presentation server
DATA: BEGIN OF ITAB OCCURS 0,
LINE TYPE STRING,
END OF ITAB.
DATA: FILENAME TYPE STRING.
FILENAME = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = FILENAME
TABLES
DATA_TAB = ITAB[]
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
OPEN DATASET A_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT ITAB.
TRANSFER ITAB-LINE TO A_FILE.
ENDLOOP.
<b>*****************************************</b>
Hope this helps,
Regards,
Pragya
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |