Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

export data into server and import data into server

former_member189009
Active Participant
0 Likes
2,927

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,611

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)

7 REPLIES 7
Read only

Former Member
0 Likes
1,612

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)

Read only

0 Likes
1,611

Thanks for your sincere answer.    I have no concept about SAP Application server.  what I say server is internal server which can store doc.

Read only

0 Likes
1,611

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.

Read only

0 Likes
1,611

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.

Read only

Former Member
0 Likes
1,611

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

Read only

Former Member
0 Likes
1,611

Check this document on upload data into application server transaction.

http://wiki.sdn.sap.com/wiki/display/Snippets/Uploading+files+to+SAP+Servers+from+Local+machine+from...

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

Read only

Former Member
0 Likes
1,611

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.