‎2006 Feb 17 4:23 AM
Hi Experts,
Can you please confirm me on the follwoing ?
1. IS it possible to download data from internal table (SAP) to Application Server(Not Presentaion Server) in XML Format ? If yes how .
2. If i am downloading millions of records from SAP to Application Server, If power failure happen in the middle, is it possible to Catch last downloaded record ? If yes how.
Experts it is very urgent.
Thanks in Advance,
Murali Krishna K
‎2006 Feb 17 4:49 AM
1ST METHOD: U CAN USE <b>TRANSFER</b> COMMAND I SUPPOSE TO TRANSFER THE CONTENTS OF INTERNAL TABLE TO APPLICATION SEVER
<b>
2ND METHOD</b>
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = Your file name
filetype = 'XML'
CHANGING
data_tab = i_data
EXCEPTIONS
file_write_error = 1
no_batch = 2
‎2006 Feb 17 4:30 AM
‎2006 Feb 17 4:35 AM
Hi murali,
1. If i am downloading millions of records from SAP to Application Server, If power failure happen in the middle, is it possible to Catch last downloaded record ? If yes how.
For working with file,
we use OPEN DATASET, TRANSFER commands in abap.
2. Now what happens, that when
we open file, then transfer data to it,
and AFTERWARDS, when we CLOSE the dataset,
AT THIS POINT OF TIME,
the operating system,
SAVES the file on the hard disk
(Until now, its all in the memory only)
3. So, for your requirement,
writing all reocrds, in ONE SHOT
won't serve the purpose.
4. There are TWO Things which need to be done.
a) WRITE the records either one by one
in a loop.
ie. EVERYTIME open the dataset,
trasnfer 1 record,
close the dataset
... Then again for the second record.
b) AT THE SAME TIME,
we need to have some Y TABLE,
(OR ANOTHER DATASET FILE FOR STORING THE LAST RECORD NUMBER)
and issue COMMIT WORK in each loop (if y table is used
to stored the last record)
5. So, we need to follow TWO-WAY DISCIPLINE,
TO ACHIEVE WHAT U REQUIRE.
*-------
6. it possible to download data from internal table (SAP) to Application Server(Not Presentaion Server) in XML Format ? If yes how .
I dont think there is one direct FM
to do it.
7. We needd to first conver the internal table
data to XML Format in another internal table
(there must be a FM for it, im searching for it)
and put the data of this internal tble to
application server file.
regards,
amit m.
‎2006 Feb 17 4:38 AM
Hi again,
1. For converting to XML
we need to use CALL TRANSFORMATION
2. below is the program
for converting (just copy paste in new program)
It will also save the data to presenetaion server.
U can utilise the new generated xml table
to store it in app server.
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.
‎2006 Feb 17 4:49 AM
1ST METHOD: U CAN USE <b>TRANSFER</b> COMMAND I SUPPOSE TO TRANSFER THE CONTENTS OF INTERNAL TABLE TO APPLICATION SEVER
<b>
2ND METHOD</b>
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = Your file name
filetype = 'XML'
CHANGING
data_tab = i_data
EXCEPTIONS
file_write_error = 1
no_batch = 2