File TXT in Server

Hi!!
I need to keep files TXT in a server.
Initially I kept the files in C:\ and I used the function "CALL FUNCTION 'WS_DOWNLOAD' " for this, but now they need to have the files in a route specifies of a server. Reason why they gave the route me of the server: 192.168.100.001 and the name of the final folder: E:\einvoice\Sap\Out.
how I make to keep files TXT in this new route?
Thanks, regards.

hi check this report where i had upload files to the application and presentation server.
REPORT ZHRO_CORPEDIA_VENDOR_REPORT
NO STANDARD PAGE HEADING
line-size 140
MESSAGE-ID zhris.
T A B L E S
TABLES: pa0105, "Infotype 0105 (Communications)
pa0002, " Infotype 0002 (Personal Data)
pa0000.
T Y P E D E C L A R A T I O N S
*---Types for the final table
types : begin of ty_final ,
pernr like pa0000-pernr, "Personnel number
nachn like pa0002-nachn, "Last Name
vorna like pa0002-vorna, "First Name
usrid like pa0105-usrid, "Communication ID/Number
usrid_long like pa0105-usrid_long,"Communication: Long Identification/Number
end of ty_final.
*---Types to get active employee
TYPES:BEGIN OF TY_PA0000,
PERNR LIKE PA0000-PERNR,
BEGDA LIKE PA0000-BEGDA,
ENDDA LIKE PA0000-ENDDA,
STAT2 LIKE PA0000-STAT2,
END OF TY_PA0000.
I N T E R N A L T A B L E S
*-----Internal table to hold the data of emp like userid, email
data: it_pa0105 like p0105 occurs 0 with header line ,
*-----Internal table to check for active employee
it_pa0000 TYPE STANDARD TABLE OF TY_pa0000 with header line,
*-----Internal table to hold the data of emp like first, last name
it_pa0002 like p0002 occurs 0 with header line,
*-----Internal table for final data
it_final type standard table of ty_final with header line.
*-----Internal table for Error Records
DATA: BEGIN OF T_ERROR OCCURS 0,
PERNR LIKE PERNR-PERNR,
MESSAGE(60) TYPE C,
END OF T_ERROR.
VARIABLE DECLARATIONS *
data : v_pernr like pa0000-pernr,
v_lines type i.
CONSTANTS DECLARATION
*-----Subty '0001' for the system username from pa0105
CONSTANTS: C_SUBTY LIKE PA0105-SUBTY VALUE '0001',
*-----Subty '0010' for the email from pa0105
C_SUBTY1 LIKE PA0105-SUBTY VALUE '0010'.
S E L E C T I O N - S C R E E N
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
parameters:p_date like sy-datum obligatory.
select-options:s_pernr for pa0000-pernr no intervals.
parameters:p_stat2 like pa0000-stat2 .
SELECTION-SCREEN end OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK FILE WITH FRAME TITLE TEXT-FIL.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: P_PC RADIOBUTTON GROUP RAD USER-COMMAND USR. "PC
SELECTION-SCREEN COMMENT 3(5) TEXT-SC1.
PARAMETERS: P_UNIX RADIOBUTTON GROUP RAD DEFAULT 'X'. "UNIX
SELECTION-SCREEN COMMENT 11(5) TEXT-SC2.
parameters:p_file like rlgrap-filename.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN begin OF LINE.
SELECTION-SCREEN COMMENT 1(16) TEXT-002.
parameters:p_file1 like rlgrap-filename.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK FILE.
INITIALIZATION *
initialization.
concatenate '/VOLSAP/HRIS/ARAMARK_' 'DEMO' '.ASC' INTO P_FILE.
concatenate '/VOLSAP/HRIS/ARAMARK_' 'DEMO' '.PRN' INTO P_FILE1.
p_stat2 = '3'.
AT SELECTION-SCREEN *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
F4 help for the flat file path
PERFORM F4_FILEPATH.
S T A R T - O F - S E L E C T I O N
START-OF-SELECTION.
PERFORM GET_DATA.
T O P - O F - P A G E
top-of-page.
PERFORM HEADER.
E N D - O F - S E L E C T I O N
END-OF-SELECTION.
PERFORM TRANSFER_DATA.
perform write_error_log..
*& Form F4_FILEPATH
F4 HELP FOR FILE PATH
FORM F4_FILEPATH.
IF P_UNIX = 'X'.
F4 help for UNIX
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
DYNPFIELD_FILENAME = 'P_FILE'
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
FILETYPE = 'P'
LOCATION = 'A'
SERVER = ''.
IF SY-SUBRC 0.
MESSAGE E000 WITH TEXT-E01 P_FILE.
ENDIF.
ELSEIF P_PC = 'X'.
F4 help for PC
clear p_file.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_PATH = P_FILE
MASK = ',..'
MODE = '0 '
TITLE = 'Choose File'
IMPORTING
FILENAME = P_FILE
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
ENDIF.
ENDFORM. " F4_FILEPATH
*& Form OUTPUT_CORPEDIA_VENDOR_FILE
Output Demographic file
FORM OUTPUT_CORPEDIA_VENDOR_FILE .
IF P_PC = 'X'.
data: v_pcfile type string.
v_pcfile = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = v_pcfile
FILETYPE = 'ASC'
TABLES
DATA_TAB = it_final.
skip 2.
WRITE:/ 'RECORDS SUCCESSFULLY TRANSFERED TO FILE:' , P_FILE .
WRITE:/ 'NO OF RECORDS DOWNLOADED : ', V_LINES .
else.
data: outrec(200) type c .
loop at it_final.
OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE encoding DEFAULT.
outrec+0(8) = it_final-pernr.
outrec+8(40) = it_final-nachn.
outrec+48(40) = it_final-vorna.
outrec+88(30) = it_final-usrid.
outrec+118(40) = it_final-usrid_long.
transfer outrec to p_file.
CLOSE DATASET p_file.
OPEN DATASET P_FILE1 FOR OUTPUT IN TEXT MODE encoding DEFAULT.
transfer outrec to p_file1.
clear outrec.
CLOSE DATASET p_file1.
endloop.
skip 2.
WRITE:/ 'RECORDS SUCCESSFULLY TRANSFERED TO FILE :' , P_FILE .
WRITE:/ 'NO OF RECORDS DOWNLOADED : ', V_LINES .
skip 2.
WRITE:/ 'RECORDS SUCCESSFULLY TRANSFERED TO FILE :' , P_FILE1 .
WRITE:/ 'NO OF RECORDS DOWNLOADED : ', V_LINES .
skip 2.
ENDIF.
ENDFORM. " OUTPUT_CORPEDIA_VENDOR_FILE
*& Form GET_DATA
text
--> p1 text
<-- p2 text
FORM GET_DATA .
clear:it_pa0000,
it_pa0000[].
*---Get the active employee
select PERNR
BEGDA
ENDDA
STAT2
from pa0000
into table it_pa0000
where pernr in s_pernr
and endda >= p_date
and begda <= p_date
and stat2 = p_stat2.
if sy-subrc = 0.
sort it_pa0000 by pernr endda descending.
delete adjacent duplicates from it_pa0000 comparing pernr.
endif.
loop at it_pa0000.
clear : it_pa0002 ,it_pa0105,
it_pa0002] , it_pa0105[ ,
v_pernr.
v_pernr = it_pa0000-pernr.
*---Get first name, last name of the active employee
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = V_pernr
INFTY = '0002'
BEGDA = p_date
ENDDA = p_date
TABLES
INFTY_TAB = it_pa0002.
*---Get SAP ID , email of the active employee
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = v_pernr
INFTY = '0105'
BEGDA = p_date
ENDDA = p_date
TABLES
INFTY_TAB = it_pa0105.
sort it_pa0002 by pernr begda descending.
delete adjacent duplicates from it_pa0002 comparing pernr.
sort it_pa0105 by pernr subty begda descending.
delete adjacent duplicates from it_pa0105 comparing pernr subty.
*---Get employee pernr, First name ,Last name into final table
if not it_pa0002[] is initial.
read table it_pa0002 index 1.
if sy-subrc = 0.
it_final-pernr = it_pa0002-pernr.
it_final-nachn = it_pa0002-nachn.
it_final-vorna = it_pa0002-vorna.
else.
*----message for the name if not maintained.
T_ERROR-PERNR = it_pa0002-PERNR.
CONCATENATE TEXT-EMI '0002'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR.
CLEAR T_ERROR.
ENDIF.
else.
message for infotype if not maintained.
skip 2.
write:/ 'Infotype 0002 is not maintained for this pernr', it_pa0000-pernr.
skip 2.
endif.
if not it_pa0105[] is initial.
read table it_pa0105 with key pernr = it_pa0002-pernr
subty = C_SUBTY.
*--Get SYSTEM USERNAME the final table
if sy-subrc = 0.
it_final-usrid = it_pa0105-usrid.
else.
*--message for the SAP ID if not maintained.
T_ERROR-PERNR = it_pa0105-PERNR.
CONCATENATE TEXT-003 '0105'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR.
CLEAR T_ERROR.
endif.
*--Get Email into the final table
read table it_pa0105 with key pernr = it_pa0002-pernr
subty = C_SUBTY1.
if sy-subrc = 0.
it_final-usrid_long = it_pa0105-usrid_long.
else.
*--message for the Email ID if not maintained.
T_ERROR-PERNR = it_pa0105-PERNR.
CONCATENATE TEXT-004 '0105'
INTO T_ERROR-MESSAGE SEPARATED BY SPACE.
APPEND T_ERROR. CLEAR T_ERROR.
endif.
else.
*--message for infotype 0105 if not maintained.
skip 2.
write:/ 'Infotype 0105 is not maintained for this pernr', it_pa0000-pernr.
skip 2.
ENDIF.
if not it_final-pernr is initial.
append it_final.
clear it_final.
endif.
endloop.
ENDFORM. " GET_DATA
*& Form HEADER
HEADER OF THE OUTPUT
FORM HEADER .
*----variables for the header
DATA: COL1(3) TYPE P. " column left side
DATA: COL2(3) TYPE P. " column right side
DATA: LGTH(3) TYPE P. " length of string
DATA: COMPANY_NAME(60) VALUE 'OfficeMax Inc.'. " Default
DATA: SUB_HEADER(60) VALUE ' '. " Default
WRITE: AT 1 'Report: ', SY-REPID. " left margin column
COL1 = ( SY-LINSZ - STRLEN( COMPANY_NAME ) ) / 2. " center company name
WRITE AT COL1 COMPANY_NAME. " default 'OfficeMax'
COL2 = SY-LINSZ - 16. " 16 columns from
WRITE: AT COL2 'Date:', SY-DATUM. " right margin.
WRITE: AT /1 'System: ', SY-SYSID(3) NO-GAP, '(' NO-GAP, SY-MANDT
NO-GAP, ')'.
LGTH = STRLEN( SY-TITLE ). " title length
COL1 = ( SY-LINSZ - LGTH ) / 2. " center it
WRITE AT COL1(LGTH) SY-TITLE. " the titlebar title
WRITE: AT COL2 'Time:', sy-uzeit. " time
WRITE: AT /1 'User: ', SY-UNAME. " username
COL1 = ( SY-LINSZ - STRLEN( SUB_HEADER ) ) / 2. " center company name
WRITE AT COL1 SUB_HEADER. " description fld
WRITE: AT COL2 'Page:', SY-PAGNO LEFT-JUSTIFIED. " page number
ENDFORM. " HEADER
*& Form TRANSFER_DATA
TRANSFER DATA TO PC/APPLICATION SERVER
FORM TRANSFER_DATA .
describe table it_final lines v_lines .
*---get data into Application Server.
PERFORM OUTPUT_CORPEDIA_VENDOR_FILE .
ENDFORM. " TRANSFER_DATA
*& Form write_error_log
getting messages for unexisted data
FORM write_error_log .
LOOP AT T_ERROR.
skip 2.
write:/1 'Personnel no' , 20 'Message' .
WRITE: /1 T_ERROR-PERNR, 20 T_ERROR-MESSAGE.
ENDLOOP.
ENDFORM. " write_error_log
OR
I feel the server you are trying to download the data is
FTP server. Please see the example code to do the same.
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
And All function modules you need are in function group SFTP. Take a look at the programs RSFTP* how to use these FM. You can use them both for transferring from and to an external system.
reward points if useful,

Similar Messages

  • Need to copy .txt file from FTP server and downloaded on local server directory.

    I need to figure out a way to copy .txt file from ftp server in local server directory using sql jobs.

    Below links will help achieving it:
    https://www.virtualobjectives.com.au/sqlserver/ftp_scripts.htm
    http://www.mssqltips.com/sqlservertip/2884/sql-server-integration-services-ssis-ftp-task-for-data-exchange/

  • Flat file connection: The file name "\server\share\path\file.txt" specified in the connection was not valid

    I'm trying to execute a SSIS package via SQL agent with a flat file source - however it fails with Code: 0xC001401E The file name "\server\share\path\file.txt" specified in the connection was not valid.
    It appears that the problem is with the rights of the user that's running the package (it's a proxy account). If I use a higher-privelege account (domain admin) to run the package it completes successfully. But this is not a long-term solution, and I can't
    see a reason why the user doesn't have rights to the file. The effective permissions of the file and parent folder both give the user full control. The user has full control over the share as well. The user can access the file (copy, etc) outside the SSIS
    package.
    Running the package manually via DTExec gives me the same error - I've tried 32 and 64bit versions with the same result. But running as a domain admin works correctly every time.
    I feel like I've been beating my head against a brick wall on this one... Is there some sort of magic permissions, file or otherwise, that are required to use a flat file target in an SSIS package?

    Hi Rossco150,
    I have tried to reproduce the issue in my test environment (Windows Server 2012 R2 + SQL Server 2008 R2), however, everything goes well with the permission settings as you mentioned. In my test, the permissions of the folders are set as follows:
    \\ServerName\Temp  --- Read
    \\ServerName\Temp\Source  --- No access
    \\ServerName\Temp\Source\Flat Files --- Full control
    I suspect that your permission settings on the folders are not absolutely as you said above. Could you double check the permission settings on each level of the folder hierarchy? In addition, check the “Execute as user” information from job history to make
    sure the job was running in the proxy security context indeed. Which version of SSIS are you using? If possible, I suggest that you install the latest Service Pack for you SQL Server or even install the latest CU patch. 
    Regards,
    Mike Yin
    If you have any feedback on our support, please click
    here
    Mike Yin
    TechNet Community Support

  • Java code to create a new .txt file in FTP server  --- Help

    Hi,
    I wrote a standalone java app which creates a .txt file in my local machine and transfers it to FTP server. But my requirement now is to create a new .txt file with the same content in FTP server itself instead of creating locally with basic java code.
    I'm aware of transfering file from local machine to the FTP server using STOR command of FTP. But i never tried creating a new file & writing content into that in FTP server.
    So, if any one did this before please help me out with source code or any idea ???
    Thank you.
    Vj.

    simply_vijay wrote:
    thanks for your reply. yes i've seen the Apache Commons NET API , but there is no method or class to create a new file in FTP server. I'm really worried how to solve this problem ???Sure there is.
    There's a method where you can write data to a file on the server using an OutputStream, right? Well, instead of writing to a FileOutputStream, write to that OutputStream instead. Remember to close the OutputStream and call the method which says you're finished with the command (I forget what it's called).

  • Problem when I upload txt files to the server

    Hi, I have a problem when I try to upload files to the server, and I can't understand the fail.
    My case is:
    I have a jsp page where a from is.
    This form is sended to a servlet that proccess its content and upload the attach file to the server.
    It works correctly (it uploads the files, txt, xls and csv), the problem is when I try to upload a txt file like this, for example:
    Depth     Age
    0     0,1
    2     0,9
    3     2
    5     6
    6     9
    8     12
    34     25
    56     39
    101     40When I verify the uploaded file, this one has a character extra of return of line (a small square). This character prevents me from working then correctly with the file, on having detected a column of more.
    Which can be the problem?
    The code I use to uploaded the file is:
    try
        MyConnection Objconnection = new MyConnection();
        boolean isMultipart = FileUpload.isMultipartContent(req);
        // Create a factory for disk-based file items
        FileItemFactory factory = new DiskFileItemFactory();
         // Create a new file upload handler
        ServletFileUpload upload = new ServletFileUpload(factory);
        // Set overall request size constraint
        upload.setSizeMax(1024*512); //524288 Bytes (512 KB)
         // Parse the request
        List items = upload.parseRequest(req);
        // Process the uploaded items
        Iterator iter = items.iterator();
        String dat = new String();
        String typeFile = new String();
        while (iter.hasNext())
            FileItem item = (FileItem) iter.next();
            if (item.getFieldName().equals("typeFile") )
                typeFile = item.getString();
            if (!item.isFormField())
            String fieldName = item.getFieldName();
            String fileName = item.getName();
            String contentType = item.getContentType();
            boolean isInMemory = item.isInMemory();
            long sizeInBytes = item.getSize();
            int numbers=0;
            for(int i=fileName.length();(i=fileName.lastIndexOf('\\',i-1))>=0;)
                 numbers++;
            String stringFile[] = fileName.split("\\\\");
            HttpSession session = req.getSession(true);
            String loginSesion = (String)session.getAttribute("UserLogin");
            String newUserFolder = loginSesion;
            File createFile = new File("/usr/local/tomcat/webapps/Usuarios/FilesUp/"+newUserFolder);
            if ("AgeModel".equals(typeFile))
                createFile = new File("/usr/local/tomcat/webapps/Usuarios/FilesUp/AgeModels/"+newUserFolder);
            if (!createFile.exists())
                createFile.mkdir();
            fileName = stringFile[numbers];
            File uploadedFile = new File("/usr/local/tomcat/webapps/Usuarios/FilesUp/"+newUserFolder+"/"+fileName);
            if ("AgeModel".equals(typeFile) )
                uploadedFile = new File("/usr/local/tomcat/webapps/Usuarios/FilesUp/AgeModels/"+newUserFolder+"/"+fileName);
            existe = Objconnection.existFile(fileName, typeFile, loginSesion);
            if ( true == existe )
                 exito = false;
            else
                item.write(uploadedFile);
                ....// NOW REGISTER THE FILE IN TH DATA BASE
        } // if (!item.isFormField())
    } // WHILE ( iter.hasNext() )
                catch(Exception e) {
                out.println("Error de Aplicaci�n " + e.getMessage());
                return exito;
    ...THANKS

    Hi,
    Sorry I am aware this question was posted way back, but I am having similar problem and haven't been able to find the fix yet.
    So please let me known if you have got any ideas.
    My problem is same that I have to upload a CSV file from Client Machine (Windows) to Unix Application Server.
    I am using JSP method post and multipart/form-data (as in http://www.roseindia.net/jsp/file_upload/Sinle_upload.xhtml.shtml).
    The file is uploaded fine but the problem is it displays carraige Return (^M) a square boxes on Unix file.
    I can't ask user to convert file to Unox format before uploading. They just convert excel file to CSV and upload.
    Is there any way I can get rid of these characters as I have to use this file further.
    Sorry, I can't use any paid utility or tool for it.
    I would appreciate if you could please help.
    Thanks,
    SW

  • How to convert from SQL Server table to Flat file (txt file)

    I need To ask question how convert from SQL Server table to Flat file txt file

    Hi
    1. Import/Export wizened
    2. Bcp utility
    3. SSIS 
    1.Import/Export Wizard
    First and very manual technique is the import wizard.  This is great for ad-hoc and just to slam it in tasks.
    In SSMS right click the database you want to import into.  Scroll to Tasks and select Import Data…
    For the data source we want out zips.txt file.  Browse for it and select it.  You should notice the wizard tries to fill in the blanks for you.  One key thing here with this file I picked is there are “ “ qualifiers.  So we need to make
    sure we add “ into the text qualifier field.   The wizard will not do this for you.
    Go through the remaining pages to view everything.  No further changes should be needed though
    Hit next after checking the pages out and select your destination.  This in our case will be DBA.dbo.zips.
    Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
    Hit next and then finish.  Once completed you will see the count of rows transferred and the success or failure rate
    Import wizard completed and you have the data!
    bcp utility
    Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
    This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported.  For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
    To create a format file all we really need is the type and the count of columns for the most basic files.  In our case the qualifier makes it a bit difficult but there is a trick to ignoring them.  The trick is to basically throw a field into the
    format file that will reference it but basically ignore it in the import process.
    Given that our format file in this case would appear like this
    9.0
    9
    1 SQLCHAR 0 0 """ 0 dummy1 ""
    2 SQLCHAR 0 50 "","" 1 Field1 ""
    3 SQLCHAR 0 50 "","" 2 Field2 ""
    4 SQLCHAR 0 50 "","" 3 Field3 ""
    5 SQLCHAR 0 50 ""," 4 Field4 ""
    6 SQLCHAR 0 50 "," 5 Field5 ""
    7 SQLCHAR 0 50 "," 6 Field6 ""
    8 SQLCHAR 0 50 "," 7 Field7 ""
    9 SQLCHAR 0 50 "n" 8 Field8 ""
    The bcp call would be as follows
    C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
    Given a successful run you should see this in command prompt after executing the statement
    Starting copy...
    1000 rows sent to SQL Server. Total sent: 1000
    1000 rows sent to SQL Server. Total sent: 2000
    1000 rows sent to SQL Server. Total sent: 3000
    1000 rows sent to SQL Server. Total sent: 4000
    1000 rows sent to SQL Server. Total sent: 5000
    1000 rows sent to SQL Server. Total sent: 6000
    1000 rows sent to SQL Server. Total sent: 7000
    1000 rows sent to SQL Server. Total sent: 8000
    1000 rows sent to SQL Server. Total sent: 9000
    1000 rows sent to SQL Server. Total sent: 10000
    1000 rows sent to SQL Server. Total sent: 11000
    1000 rows sent to SQL Server. Total sent: 12000
    1000 rows sent to SQL Server. Total sent: 13000
    1000 rows sent to SQL Server. Total sent: 14000
    1000 rows sent to SQL Server. Total sent: 15000
    1000 rows sent to SQL Server. Total sent: 16000
    1000 rows sent to SQL Server. Total sent: 17000
    1000 rows sent to SQL Server. Total sent: 18000
    1000 rows sent to SQL Server. Total sent: 19000
    1000 rows sent to SQL Server. Total sent: 20000
    1000 rows sent to SQL Server. Total sent: 21000
    1000 rows sent to SQL Server. Total sent: 22000
    1000 rows sent to SQL Server. Total sent: 23000
    1000 rows sent to SQL Server. Total sent: 24000
    1000 rows sent to SQL Server. Total sent: 25000
    1000 rows sent to SQL Server. Total sent: 26000
    1000 rows sent to SQL Server. Total sent: 27000
    1000 rows sent to SQL Server. Total sent: 28000
    1000 rows sent to SQL Server. Total sent: 29000
    bcp import completed!
    BULK INSERT
    Next, we have BULK INSERT given the same format file from bcp
    CREATE TABLE zips (
    Col1 nvarchar(50),
    Col2 nvarchar(50),
    Col3 nvarchar(50),
    Col4 nvarchar(50),
    Col5 nvarchar(50),
    Col6 nvarchar(50),
    Col7 nvarchar(50),
    Col8 nvarchar(50)
    GO
    INSERT INTO zips
    SELECT *
    FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
    FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
    ) as t1 ;
    GO
    That was simple enough given the work on the format file that we already did.  Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
    SSIS
    Next is my favorite playground in SSIS
    We can do many methods in SSIS to get data from point A, to point B.  I’ll show you data flow task and the SSIS version of BULK INSERT
    First create a new integrated services project.
    Create a new flat file connection by right clicking the connection managers area.  This will be used in both methods
    Bulk insert
    You can use format file here as well which is beneficial to moving methods around.  This essentially is calling the same processes with format file usage.  Drag over a bulk insert task and double click it to go into the editor.
    Fill in the information starting with connection.  This will populate much as the wizard did.
    Example of format file usage
    Or specify your own details
    Execute this and again, we have some data
    Data Flow method
    Bring over a data flow task and double click it to go into the data flow tab.
    Bring over a flat file source and SQL Server destination.  Edit the flat file source to use the connection manager “The file” we already created.  Connect the two once they are there
    Double click the SQL Server Destination task to open the editor.  Enter in the connection manager information and select the table to import into.
    Go into the mappings and connect the dots per say
    Typical issue of type conversions is Unicode to non-unicode.
    We fix this with a Data conversion or explicit conversion in the editor.  Data conversion tasks are usually the route I take.  Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
    New look in the mappings
    And after execution…
    SqlBulkCopy Method
    Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy.  Not only fast but also handy for those really “unique” file formats we receive so often
    Bring over a script task into the control flow
    Double click the task and go to the script page.  Click the Design script to open up the code behind
    Ref.
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • While downloading file to application server its overwriting the earlier fi

    hi if i am using below code with date time stamp the file is downloaded to the application server correctly and each time i execut eht program a difference file is generated as date time stamp differs each time but
    whne i remove the date time stamp ie sy-datum and sy-uzeit as we dont need to display the date time stamp with the file each time i execute the program a file is generated but it overwrites the ealier existing file please suggest as each time it shoul generate a new file....
    Concatenate file name sy-datum sy-uzeit '.txt' into v_datetimefile
    file on Appplication Server is selected
      CALL FUNCTION 'FILE_GET_NAME'
         EXPORTING
                CLIENT                        = SY-MANDT
               logical_filename              = 'ZFILE'

    Hi,
    first of all decide you have to overwrite the existing file or you want to create the new, i think the answer is there in your query itself, if you want to create new then concatenate the date and time, else don't do that.
    below are the additions we can use while opening the data set.
    FOR INPUT
    FOR OUTPUT
    FOR APPENDING
    IN BINARY MODE
    IN TEXT MODE
    AT POSITION p
    TYPE ctrl
    MESSAGE mess
    FILTER f
    Reward if useful.
    Thanks,
    Sreeram.

  • File from application server

    Hi Guys,
    I want to pick file from application server as an attachment and send as mail.
    Thanks

    *This program will allowed you to send email with attachment.
    First, specify the attachment file from your local hardisk and execute.
    Next, specify the sender email address and click the send button.
    report z_mail.
    data method1 like sy-ucomm.
    data g_user like soudnamei1.
    data g_user_data like soudatai1.
    data g_owner like soud-usrnam.
    data g_receipients like soos1 occurs 0 with header line.
    data g_document like sood4 .
    data g_header like sood2.
    data g_folmam like sofm2.
    data g_objcnt like soli occurs 0 with header line.
    data g_objhead like soli occurs 0 with header line.
    data g_objpara like selc occurs 0 with header line.
    data g_objparb like soop1 occurs 0 with header line.
    data g_attachments like sood5 occurs 0 with header line.
    data g_references like soxrl occurs 0 with header line.
    data g_authority like sofa-usracc.
    data g_ref_document like sood4.
    data g_new_parent like soodk.
    data: begin of g_files occurs 10 ,
    text(4096) type c,
    end of g_files.
    data : fold_number(12) type c,
    fold_yr(2) type c,
    fold_type(3) type c.
    parameters ws_file(4096) type c default 'c:\debugger.txt'.
    Can me any file fromyour pc ....either xls or word or ppt etc ...
    g_user-sapname = sy-uname.
    call function 'SO_USER_READ_API1'
    exporting
    user = g_user
    PREPARE_FOR_FOLDER_ACCESS = ' '
    importing
    user_data = g_user_data
    EXCEPTIONS
    USER_NOT_EXIST = 1
    PARAMETER_ERROR = 2
    X_ERROR = 3
    OTHERS = 4
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    fold_type = g_user_data-outboxfol+0(3).
    fold_yr = g_user_data-outboxfol+3(2).
    fold_number = g_user_data-outboxfol+5(12).
    clear g_files.
    refresh : g_objcnt,
    g_objhead,
    g_objpara,
    g_objparb,
    g_receipients,
    g_attachments,
    g_references,
    g_files.
    method1 = 'SAVE'.
    g_document-foltp = fold_type.
    g_document-folyr = fold_yr.
    g_document-folno = fold_number.
    g_document-objtp = g_user_data-object_typ.
    *g_document-OBJYR = '27'.
    *g_document-OBJNO = '000000002365'.
    *g_document-OBJNAM = 'MESSAGE'.
    g_document-objdes = 'sap-img.com testing by program'.
    g_document-folrg = 'O'.
    *g_document-okcode = 'CHNG'.
    g_document-objlen = '0'.
    g_document-file_ext = 'TXT'.
    g_header-objdes = 'sap-img.com testing by program'.
    g_header-file_ext = 'TXT'.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = sy-uname
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    FOLMEM_DATA =
    RECEIVE_DATA =
    File from the pc to send...
    method1 = 'ATTCREATEFROMPC'.
    g_files-text = ws_file.
    append g_files.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header
    method1 = 'SEND'.
    g_receipients-recnam = 'MK085'.
    g_receipients-recesc = 'B'.
    g_receipients-sndex = 'X'.
    append g_receipients.
    call function 'SO_DOCUMENT_REPOSITORY_MANAGER'
    exporting
    method = method1
    office_user = g_owner
    ref_document = g_ref_document
    new_parent = g_new_parent
    importing
    authority = g_authority
    tables
    objcont = g_objcnt
    objhead = g_objhead
    objpara = g_objpara
    objparb = g_objparb
    recipients = g_receipients
    attachments = g_attachments
    references = g_references
    files = g_files
    changing
    document = g_document
    header_data = g_header.
    *-- End of Program

  • Delete file on application server (Froms9iAS)

    How can I delete file on application server (Froms9iAS) from client machine (file such as *.txt,*dbf). I try use old win_api_utility (from Forms6i) but it doesn't work.

    Check out Webutil.
    More on it in the Forms page.

  • How to Select the Latest file from Application Server?

    Dear All,
    I am working on object, which had requirement to Pick the file from application server.
    The Application server contain the files in ‘/temp/sms/’ directory. The files are having the name Like ‘smsqry_yyyymmddhhmmss.txt’ and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333’) from that all and after getting the file I have to delete the file from application server.
    So How to do this.
    Regards

    hi,
    look function group EPSF-
    esp. fm EPS_GET_DIRECTORY_LISTING
    if you're looking fo OS-date and time
    look here:Re: How do I convert MTIME to date and time?
    A.
    Message was edited by: Andreas Mann

  • Deleting file from application server

    can any one tell me how to delete file from application server?

    Hi,
      Use statement
      delete dataset 'tmpfile.txt'.
    \tmp\file.txt is the file path on application server which you want to delete.
    Regards
    Sailaja.

  • Copy file from FTP server to sap application server

    Hi,
    I am able to copy a particular file from FTP server to sap application server using FTP_CONNECT, FTP_COMMAND and FTP_DISCONNECT. But here my problem is, it copies into default application server path(DIR_HIOME). I want to copy into specified folder in the application server. How can I specify the required destination path.
    Can you please suggest how to achieve this.
    Thanks,
    Shiva Kankanala

    try something like this:
    data: user(30) type c value 'ftpuser', "ftp username
                  pwd(30) type c value 'ftppass', "ftp password
                  host(64) type c value '255.255.255.255', "ftp server IP
                  cmd1(80) type c value 'lcd /dump', "location on app server where you want to copy the file
                  cmd2(80) type c value 'get', "specifies you are going to get the file from ftp server
                  dest like rfcdes-rfcdest value 'SAPFTPA',
                  file(15) type c value 'file.txt'. "specifies file that you want to get from ftp server
    data: hdl type i,
            key type i value 26101957,
            slen type i.
    slen = strlen( pwd ).
    call function 'HTTP_SCRAMBLE'
        EXPORTING
          source      = pwd
          sourcelen   = slen
          key         = key
        IMPORTING
          destination = pwd.
    call function 'FTP_CONNECT'
        EXPORTING
          user            = user
          password        = pwd
          host            = host
          rfc_destination = dest
        IMPORTING
          handle          = hdl.
    call function 'FTP_COMMAND'
        EXPORTING
          handle        = hdl
          command       = cmd1
        TABLES
          data          = result
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      loop at result.
        write at / result-line.
      endloop.
    CONCATENATE cmd2 file INTO cmd2 SEPARATED BY SPACE.
    call function 'FTP_COMMAND'
          EXPORTING
            handle        = hdl
            command       = cmd2
          TABLES
            data          = result
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        loop at result.
          write at / result-line.
        endloop.
        refresh result.

  • How to fetch file from app. server without complete filename?

    Hi,
    In my report I have to read data from txt file on application server.
    My file name on App. server conatain system id and date and time stam.
    my file path :- /User/IDD/S10009112007101525
    here,'User'  is dirctory
            'IDD' is folder in directory
            'S100' is system id
             '09112007' is date
             '101525'  is time in hour,miniute,second format.
    From my program I can only pass directory , Folder name,System Id,Date only. I don't have time value in my program.
    So please tell me how to fetch files without having time stamp value from app. server.
    Plz send me exact code.It's urgent.
    Message was edited by:
            Manisha Kadam
    Title was edited by:
            Alvaro Tejada Galindo

    Do you want to return the file to the user on click of button or something?
    Then, use web_show_document with http link which you are speaking about.
    Else download the file to client using Webutil.

  • Problem in uploading file from Application Server

    Hi everyone,
    i got a problem in uplaoding a file from application server.i am having two folder (one folder name is current and another one is processed)in application server. In current folder i am having N no of files.I want to upload all the files names into one internal table and i want to process one by one file.After processing each file the file should be moved to processed folder and the files should not exist in current folder.All these process must be done everyday.Please rectify my problem asap.

    Ramesh,
    Take authorization from basis guy.
    Use the below code to get the list of files from require directory
    *& Report  ZDIRFILES                                                   *
    REPORT  ZDIRFILES    .
    PARAMETER: p_fdir            type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
            include structure salfldir.
    data: end of it_filedir.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
      call function 'RZL_READ_DIR_LOCAL'
           exporting
                name     = p_fdir
           tables
                file_tbl = it_filedir.
    Now in internal table "it_filedir"  will have all your files.
    For moving and deleting
    report zrich_0001.
    Parameters: d1 type localfile default '/usr/sap/TST/SYS/fld1/Data1.txt',
                d2 type localfile default '/usr/sap/TST/SYS/fld2/Data1.txt'.
    data: begin of itab occurs 0,
          rec(20) type c,
          end of itab.
    data: wa(20) type c.
    start-of-selection.
      open dataset d1 for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset d1 into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset d1.
      open dataset d2 for output in text mode.
      loop at itab.
        transfer itab to d2.
      endloop.
      close dataset d2.
      delete dataset d1.
    Check below FM if required
    To move the file to archive directoryuse FMs 'PFL_COPY_OS_FILE'
    To Delete 'EPS_DELETE_FILE'.
    Don't forgot to reward if useful

  • HOw to delete files from remote server?

    Hi,
    I want to delete files from a directory on remote server.
    I use the following command to delete on current server:
    find $srcdir -mtime +90 -name "COR*.txt" -exec rm -f {} \;
    Now, how can I delete files from remote server ?
    Thanks!
    Yogini

    Some possible options:
    1. There exists SSH implementation for Windows.
    2. You can make a workaround. You can setup share for specific/wanted directory.
    Then you can mount it on Linux machine and execute command localy and delete files "localy" in mounted directory.
    3. You can setup FTP server on Windows machine and do that remotely via FTP commands.

Maybe you are looking for

  • Issue during integrating OIM 9.1 with novell edirectory 8.8

    Hi, We are trying to integrate OIM 9.1 with Novell edirectory 8.8 using novell edirectory 9.0.4.2 connector. while privisioning i m facing the following issue DOBJ.THROWABLE_IN_SAVE Unhandled throwable java.lang.NoClassDefFoundError in com.thortech.x

  • How can I determine the number and size of the items in a window?

    With operating systems before Mavericks, the number of items contained and the total size was displayed at the bottom of an open window.  This was valuable, for example, when assembling files and folders for burning to discs.  How can I quickly obtai

  • HT5312 Okay, this explains about the rescue email, but not about resetting your security questions? Help please?

    I have a bad memory and I can't remember the answers to my security questions, so I need to reset them, although I have no clue how to do that....

  • Budget values

    HI all,    for one project budget values were defined in usd., we want to change the currency to other currency. .How can we change.?? in t.code: cj30 it's showing the budget values... but not allowing to change the currency....

  • Aggregate data in query

    Hi, I have location, amount and date in table. For a particular date and location I want the total amount as the query output. Ex: Location Amount A1 100 Is there a way this can be done? Can you please provide me with the SQL for this task? Thanks,.