Trying to use FTP to get data from a different server

Hi Friends,
    I have to use FTP to get data from a different server and upload it on SAP server. Now my problem is when I m trying to do ftp through command line it brings the file but with no data.
   Through ABAP program nothing is happening.
Here's my code--
  V_PASSWORD = 'test@123'.
  V_PWD_LEN = STRLEN( V_PASSWORD ).
  CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
      SOURCE      = V_PASSWORD
      SOURCELEN   = V_PWD_LEN
      KEY         = CS_KEY_500098
    IMPORTING
      DESTINATION = V_PASSWORD.
  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = 'test'
      PASSWORD        = V_PASSWORD
      HOST            = '176.0.1.6'
      RFC_DESTINATION = 'SAPFTPA'
    IMPORTING
      HANDLE          = MI_HANDLE
    EXCEPTIONS
      NOT_CONNECTED   = 1
      OTHERS          = 2.
  CHECK SY-SUBRC = 0.
  cmd = 'lcd d:\ftp'. .
  PERFORM FTP_COMMAND USING CMD.
  CMD = 'asc'.
  PERFORM FTP_COMMAND USING CMD.
  CONCATENATE 'dir' 'ftpt*' INTO CMD SEPARATED BY SPACE.
  PERFORM FTP_COMMAND USING CMD.
  cmd = 'ls'.
concatenate 'ls' INTO CMD SEPARATED BY SPACE.
  PERFORM FTP_COMMAND USING CMD.
  cmd = 'mget trial.txt'.
CONCATENATE 'mget' 'trial.txt' INTO CMD SEPARATED BY SPACE.
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      HANDLE        = MI_HANDLE
      COMMAND       = CMD
    TABLES
      DATA          = MTAB_DATA1
    EXCEPTIONS
      TCPIP_ERROR   = 1
      COMMAND_ERROR = 2
      DATA_ERROR    = 3
      OTHERS        = 4.
  IF SY-SUBRC = 0.
    LOOP AT MTAB_DATA1.
      WRITE: / MTAB_DATA1.
    ENDLOOP.
  ELSE.
    CONCATENATE 'Error in FTP Command while executing' CMD INTO ERROR SEPARATED BY SPACE.
    WRITE: / ERROR.
  ENDIF.

Hi
try this.....in one of my reqt, i done this successfully....
FORM FTPCON.
FTP-------------------------------------------------------*
  CLEAR DSTLEN.
  SET EXTENDED CHECK OFF.
  DSTLEN = STRLEN( S_PWD ).     -
>  (S_PWD (password) is a selection screen field )                  
  CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
      SOURCE      = S_PWD
      SOURCELEN   = DSTLEN
      KEY         = KEY
    IMPORTING
      DESTINATION = S_PWD.
  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = P_USER                   -
> Username
      PASSWORD        = S_PWD             -
> password
      HOST            = P_HOST                  -
> Host
      RFC_DESTINATION = P_DEST         -
> Destination
    IMPORTING
      HANDLE          = HDL
    EXCEPTIONS
      NOT_CONNECTED   = 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.
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      HANDLE        = HDL
      COMMAND       = 'set passive on'
    TABLES
      DATA          = RESULT
    EXCEPTIONS
      TCPIP_ERROR   = 1
      COMMAND_ERROR = 2
      DATA_ERROR    = 3.
  CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
      HANDLE         = HDL
      FNAME          = G_FCNAME
      CHARACTER_MODE = 'X'
    TABLES
      TEXT           = T_FILE1
    EXCEPTIONS
      TCPIP_ERROR    = 1
      COMMAND_ERROR  = 2
      DATA_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.
  CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
      HANDLE         = HDL
      FNAME          = G_FCNAME1
      CHARACTER_MODE = 'X'
    TABLES
      TEXT           = T_FILE2
    EXCEPTIONS
      TCPIP_ERROR    = 1
      COMMAND_ERROR  = 2
      DATA_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.
  CALL FUNCTION 'FTP_DISCONNECT'
    EXPORTING
      HANDLE = HDL.
  CALL FUNCTION 'RFC_CONNECTION_CLOSE'
      EXPORTING
        DESTINATION          = P_DEST
      EXCEPTIONS
        DESTINATION_NOT_OPEN = 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.                    " FTPCON
Hope it helps.....

Similar Messages

  • Anyone knows about using java to get data from MS Access database.

    hi there
    anyone knows about using java to get data from MS Access database? thank you

    there is a list of jdbc drivers at:
    http://industry.java.sun.com/products/jdbc/drivers
    they have several ms access drivers listed.
    also, you can use a jdbc-odbc bridge which allows you to use jdbc to connect to any odbc data source:
    http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/bridge.doc.html

  • I would like to use DDE to send data from a Lookout Server to an Excel

    Hello National Instruments,
    I would like to use DDE to send data from a Lookout Server to an Excel
    Spreadsheet.
    I have Lookout 6.1 on a server connected to 4 client workstations
    The operating system on the server is Windows Server 2003 R2; Standard Edition;
    Service Pack 2
    I have opened DDE Share but after filing in Share Name; Static Application
    Name; Static Topic Name
    I get a message, "Can't bind to DSDM service"
    I also get this message when I press add a Share
    What are the steps to setting up this type of communications link?
    Thanks,
    David Lopez
    Scada Functional Analyst

    Ryan,
    I have followed the steps on the Knowledge Base "How do I use DDE To Send Data Across the Network To Excel From Lookout?" but what I am seeing is that the computer with excel (Computer B)hangs up displaying an hour glass continuously leaving me no option but to go into task manager to stop excel.  It appears to me that the dde share is not working properly on my windows xp where lookout resides or I do not have a certain service turned on.  I do have the DDE services turned on both computers.  I have my computer set up as computer A with Lookout and Process1 as the process with a pot set up as pot1.  On my computer (Computer A) I also have the dde share set up per the KB example.
    On computer B I have the dde services turned on and I am typing the following into an excel worksheet Cell  ='\\TAG23232\NDDE$'|'Process1$'!Pot1
    TAG 23232 is Computer A's Name
    Do you have any suggestions???

  • How BW get data from MS SQL server DB?

    I got infomation about this from help.com, http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm.
    this web told me, when BW application server must be Win NT.BW can get data from MS SQL server DB.
    but our BW application server was AIX.
    Did you know other solution to this?

    Hi,
    you need to use the DBConnect or in BI7.0 the UDConnect features.
    regards
    Siggi
    See also: http://help.sap.com/saphelp_nw70/helpdata/EN/a1/89786c3df35c4ea930a994e884bb4c/frameset.htm
    or
    http://help.sap.com/saphelp_nw70/helpdata/EN/44/bcdce1dcaf56a3e10000000a1553f6/frameset.htm
    Edited by: Siegfried Szameitat on Aug 13, 2008 9:16 AM

  • How to use RFC to get data from BW?

    Hi all, we need to get data from BW using RFC, I am not  familiar with BW and RFC, would you please give me some advice? Many thanks in advance!

    would you please bring your solution  to light here?
    thank you
    God's blessing
    Andreas

  • Get data from file in server to client and vice versa

    after greeting
    i really didn't know how to use socket and serversocket to get data from file in the server and display it to client.
    also read file from client and save it to server.
    really i didn't know how to do it.
    really i want the reply as soon as possible

    You REALLY need to work through the Java networking tutorials:
    http://java.sun.com/docs/books/tutorial/networking/index.html

  • Getting Data from 2 different table and saving it in the third table

    Hi,
    My question is i have 2 different table where the data is stored. And Nothing is at Level0 and i don't need it.
    Table A will be at Level1, this is a scroll and depending on this value the level2 grid will be populated with the values.
    Say for example Table A is groups; data e.g., Cars, MotorBike etc
    Table B will have the data for Group Cars: Holden, Toyota, Honda etc., MotorBike: Honda, Suzuki, Yamaha etc.,
    Now lets say there are 3 divisions in the company AA , BB
    Division AA has been allocated group Cars only
    Division BB has been Allocated Both Cars and MotorBikes.
    To do this i have used a query view where depending on the Division i choose the group and then i get the required fileds.
    Now my Problem is that i need to save this data in table C but on the ad-hoc basis can't write a query with in the code to do that.
    tried using work record on the scroll but i cant do that as well. Any Suggestions?
    One more thing when the Page open this data should be pre-populated on the page depending on the division, the user will not be able to select anything from the prompt.
    Edited by: 952330 on Aug 12, 2012 8:32 PM

    I hope I can clarify:
    For our purposes here:
    Table 1 = "Step 2 - Product Sizes"
    Table 2 = "Option id Master"
    Table 3 = "Export - Product Info"
    Table 1:
    The user would enter values for "productcode," "Horz," and "Vert"
    "Size" would auto fill based on values in Horiz and Vert (I have this taken care of already).
    Table 2: This is a completely static table that I want to search against. - Data from other tables in the doc does not alter or change the data in this doc.
    We just want to look at table 2. Find the existing value in "table 2 : size" column that matches the "table 1 : size" column  and then pull the "optionids" and "productprice" from that row.
    Can the value from "Table 1 : Size" be used as a search term in "Table 2 : Size?"
    Table 3: The user does not enter any values on this table. 
    "productcode" is pulled from table 1 - "Table 1 :: A5" = "Table 3 :: A5"
    "optionids" and "productprice" are pulled from Table 2 columns "D" and "E" - however we do not know which Table 2 row it is pulling from until we enter data in Table 1.
    As I'm writing this I'm realizing that
    A. this is probably really confusing to you.
    B. this may be impossible inside of numbers.
    If you have some other method that would facilitate the same out come but be structured differently please let me know.
    --- maybe to help you understand further what I am doing here is my current workflow:
    I record the size of a piece of art.
    Then I manually go to my "Option id Master" and find the same size.
    I then copy the corresponding "optionids" and "productprice" cells. (these options control the prices displayed on my website)
    I got to my "Export - Product Info" table and paste the values in the corresponding cells.
    I was hoping to automate this as it takes a long time when you have hundreds of products.
    Thanks for the help!

  • Taking data from two different server in a single table

    Hi All,
    can u plz tell me i want take a data from a two different server in a single table
    Thanks,
    Bell.

    Again, you have written the same sentence. I have 2 servers Server1 and Server2 and one table called my_table (You or God knows where this table is).
    Now tell us what you want to do ?
    Sidhu
    http://amardeepsidhu.blogspot.com

  • Using forms6i and reading data from MS SQL server 7

    Hi!
    I have been given a new task to connect to Microsoft SQL SERVER 7 with Oracle 6/6i development with ODBC and extract specific data.
    I am realy stuck with this I hope some one will help me with this as soon as possible.
    thanka

    I did a similar thing with developer 2000 (Form 4.5) and SQL server6.5.
    There are lots of things involved and there will be issues that need to be resolved in you application but you can take one thing at a time and you should be able to do it.
    -First make sure that your SQL server is up and running.
    -Then make a client machine that connects to SQL server.
    -On the client install your Form6 or 6i.
    -Install ODBC manager on your Client Machine.
    -Get the Oracle ODBC driver for SQL server.
    -There is a document available with developer 2000 for open data source. It should be with your Form6/6i documentation. It has got a section for connection with SQL server.
    Start with this and where ever you get stuck ask away question on the forum.
    Hope this help

  • Getting images from a different server?

    ok, I have a site, wich I cant upload anything onto, and I have a site I can upload stuff onto. On the site that I cant upload onto, I have a page with a java object on it. whos code follows:
    <APPLET archive="DuriusWaterPic.jar" WIDTH="400" HEIGHT="100" ALIGN="MIDDLE" CODE="DuriusWaterPic.class">
    <PARAM NAME="cabbase" VALUE="DuriusWaterPic.cab">
    <PARAM NAME="dotsize" VALUE="7">
    <PARAM NAME="image" VALUE="iben.jpg">
    <PARAM NAME="dim" VALUE="6">
    <PARAM NAME="noise" VALUE="0">
    <PARAM NAME="mouse" VALUE="1">
    <PARAM NAME="bg" VALUE="ffffff">
    <PARAM NAME="reg" VALUE="43752326">
    </APPLET>
    Basically, its sercing on the free sites server for the files it needs, but they are all actually hosted at www.nimagineca.com/xanga/
    so I replaced all of the address feilds with ie: "http://www.nimagineca.com/xanga/DuriusWaterPic.jar"
    but that doesnt work...
    so basically, how do I point these address areas to the correct server, obviously what Im doing is wrong...

    Applets can only access the host that they came from. So unless you can install the applet from the server where the images are, you're out of luck.
    Well, actually one can change the security rules re: applets, so maybe the applet can access the host with the images. But I'd advise against this. It means that you'd have to make the users of the applet do extra work.

  • How to get data from an existing Excel file using report generation toolkit

    I'm trying to use the Excel Get Data vi from the report generation toolkit, but i can't figure out how to turn a browsable path into the right type for the VI.  I've tried using the New Report.vi, but that doesn't work unless you use a template.  It won't open an existing excel file and make it an open report to pull data from.
    Essentially, i have a bunch of excel files that have data in them and i want to use a VI to analyze the data.  So, i'm trying to pull in all the data directly from the excel file so i don't have to reproscess them all into text so i can use the more standard spreadsheet VIs.  But to even convert the excel file programtically in labview won't i still need to be able to open the excel file and get the data?
    Solved!
    Go to Solution.

    I C.
    Got it,
    the reason why I can view it using my Excel file because its in .CSV.
    I open Microsoft Excel to open .CSV file.
    But you can also open .csv file with notepad.
    So, you cannot open .xls with Read Spreadsheet File
    I learn something everyday
    Best regards,
    Krispiekream

  • Using Get Data From Aggregation event class in SQL Profiler - SSAS 2012

    Hi,
    I'd like to understand better the use of the Get data from aggregation event class in SQL Profiler to monitor a MDX query and which info provide. Fe, does it return the MDX query? Is it possible to use this event class in order to monitor MDX query vs a
    Tabular model?
    In the TechNet documentation, this event class is handled briefly.
    Thanks

    Hi pscorca,
    This event is raised when the storage engine reads data from an aggregation, it may have a negative impact on performance when turned on. If you need to monitor SSAS instance status, we can also use dynamic management view:
    Use Dynamic Management Views (DMVs) to Monitor Analysis Services:
    http://msdn.microsoft.com/en-us/library/hh230820.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • How to get data from external source

    Hi experts,
       I want to get data from a different source e.g. from oracle. How can i get the data in BW??
    Sam

    Hi Samir
    there are different interfaces are available according to the source system.
    For Oracle source system you can use DB connect interface.
    you can extract data from several data sources to BI
    File Interface:: Using this interface, you can access files in ASCII format or CSV format
    DB Connect :: You use DB Connect to open other database connections in addition to the default connection and use these connections to transfer data from tables or views into a BI system.
    UD Connect :: UD Connect (Universal Data Connect) uses the Application Server J2EE connectivity to enable the reporting and analysis of both SAP and non-SAP data. Using UD Connect, you can access all relational and multidimensional data sources. UD Connect transfers the data as flat data.
    BI Service API ::
    Web Service for Staging ::You use the Web service to write the data from the source into the PSA. The transfer of data is controlled externally, without placing demand on BI.
    You can use this interface in conjunction with real-time data acquisition.
    Please assign points if this info helps.
    Regards
    Vivek..

  • How to get data from CRM systems?

    Hi...
              How to use adapters to get data from external systems such as  CRM systems.

    It is totally depends what kind of message is or are coming out from CRM Systems.
    If it is sending IDoc then use Idoc adapter.
    If it is BSP and sending HTTP Post then use HTTP adapter.
    If you are using proxy then use XI adapter.
    thanks
    farooq

  • To get data from an equipment to SAP

    Hi,
    Is there any ways to get data from an external equipment to the SAP (say)  to a  MIGO screen as we have some COM port programming..
    I am aware that SAP can get data from a telnet server (in case of BARCODES and RFID)
    Is there any way to obtain from a Equipment (electronic weigh Bridge) TO SAP..
    Thanx in Advance..
    Arjun.G

    Hi,
    have a look at this threads:
    Re: Interface with Weigh Bridge
    Re: how to interface the Weigh Bridge System with ABAP thru' RS232 PORT
    Another one:
    http://66.102.9.104/translate_c?hl=en&sl=ru&u=http://www.sapnet.ru/viewtopic.php%3Ft%3D578%26start%3D0%26postdays%3D0%26postorder%3Dasc%26highlight%3D%26sid%3D0a8ec74af5df8dee55092ce47c36831d&usg=ALkJrhhBux0cndNF5aZVdnurkbtLUm0dcw
    Best regards.
    Edited by: Pablo Casamayor on Aug 8, 2008 10:42 AM

Maybe you are looking for

  • How can I get a full print screen of a website

    Hi, Is it possible to make a full printscreen of a webpage and insert this screenshot in Photoshop? I want to make a print screen of http://www.witshirtonline.nl and import the file into Photoshop so I can make some adjustments. Is this possible and

  • Java - php

    Hi Can I ask what's wrong with the following code? I got 2 area in a html page, I want to press a button, then it will pass some information to area 2 which is the php script to manipulate. public void actionPerformed(ActionEvent e) {      AppletCont

  • Sequence for order_number

    Hi Can any one tell me what is the sequence that generate the order_number in oe_order_headers_all table? I've checked in ETRM too. But no info about the order_number sequence. Can we change the series of the order_number from year to year? I mean fo

  • Database Authentication with CMP

    Hi all, I was curious if there was any way to have the login credentials for the underlying datasource that my CMP 2.0 entity bean uses be passed in somehow at "access" time (i.e. via some context object, properties, JAAS, etc). Basically I want to h

  • Validates apps schema

    Hi Guys, Why & when we validates apps schema.