‎2013 Jul 16 3:53 AM
Is there two function module or bapi can export data into server and import data into server. As far as I know , it is two step , firstly it will fetch the doc name form the server, then it will fetch the data base on the doc name. so maybe there are three FM or bapi that I should know ,if I want to achieve this goal.
I have another three question, first,how to use this function and bapi. secondly, how much time does this function module will cost,because if we want to fetch all data, we have to call this function module in a loop. thirdly how to define the server, so it can run more effective.
Moderator Message - Please be specific when asking questions for e.g., what server, which data etc.
Message was edited by: Suhas Saha
‎2013 Jul 16 11:07 AM
To upload data into the server you can use the function module C13Z_FILE_UPLOAD_BINARY and to download data from the server you can use the function module C13Z_FILE_DOWNLOAD_BINARY(Assuming that the server you have mentioned is the SAP Application server)
‎2013 Jul 16 11:07 AM
To upload data into the server you can use the function module C13Z_FILE_UPLOAD_BINARY and to download data from the server you can use the function module C13Z_FILE_DOWNLOAD_BINARY(Assuming that the server you have mentioned is the SAP Application server)
‎2013 Jul 17 2:38 AM
Thanks for your sincere answer. I have no concept about SAP Application server. what I say server is internal server which can store doc.
‎2013 Jul 17 7:24 AM
Hi,
To be exact, the above mentioned Function Module will upload/download what ever files from your system to the SAP Internal server which is the Application Server and vice versa.
You can view the uploaded files in through the Transaction AL11.
The upload and the download can maually be done through the transactions cg3z and cg3y.
Hope this helps.
‎2013 Jul 17 10:46 AM
Thanks again.
I have am idea that I run several background job to select data(large amount ) then write the data into the server (AL11) through the statement 'open dataset' . Then I will run a program to get the data from the server write into internal table and do some operation. In order to save some time. I don't know whether this will work. but I want to try ,and I can learn a lot in this try.
So this is why I ask this question.
‎2013 Jul 17 11:21 AM
Check this document.
It has most of the things you need to know about import and export of data from Application Server.
http://wiki.sdn.sap.com/wiki/display/Snippets/Working+With+Files
‎2013 Jul 17 11:23 AM
Check this document on upload data into application server transaction.
Other possible methods.
1. Transactions CG3Y and CG3Z , combined with AL11 to help us find out the directory structure.
2. ABAP PROGRAMMING:
OPEN DATASET / TRANSFER / CLOSE DATASET
To upload the file into Application Server
OPEN DATASET l_filename FOR OUTPUT IN TEXT MODE.
IF sy-subrc NE 0.
RAISE open_file.
ENDIF.
LOOP AT it_text_data. " into l_text_data.
TRANSFER it_text_data TO l_filename.
ENDLOOP.
CLOSE DATASET l_filename.
To read file from application server
DATA: lv_app_server_file TYPE string.
lv_app_server_file = pa_filep.
* To read file from Application server
OPEN DATASET lv_app_server_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
READ DATASET lv_app_server_file INTO wa_file_data.
IF sy-subrc = 0.
APPEND wa_file_data TO tb_file_data.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET lv_app_server_file.
ENDFORM. "upload_app_server
* To convert file to specified format
DATA: lv_file_separator TYPE c.
lv_file_separator = cl_abap_char_utilities=>horizontal_tab.
* To upload file in other formats(CSV, Tab delimited etc)
CALL FUNCTION 'TEXT_CONVERT_TEX_TO_SAP'
EXPORTING
i_field_seperator = <lv_file_separator>
i_tab_raw_data = tb_file_data
TABLES
i_tab_converted_data = tb_testfile_file
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "data_convert
You have a lot of sample codes on the net.
3. FUNCTION MODULES for example
ARCHIVFILE_SERVER_TO_CLIENT & ARCHIVFILE_CLIENT_TO_SERVER
‎2013 Jul 18 6:39 AM
Hi,
I agree with susmitha's reply but we can do as esay way.
if you want export file to application server and then again import that file so after susmita step you can make one bdc on CG3Y so it store file in your local drive.