Application Development 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: 

FTP connection

Former Member
0 Kudos

Hi all,

I need to connect SAP to PDM server.

my issue is to transfer internal table data or csv file from SAP to PDM server.

how should i do it.

i am trying to use FM FTP_CONNECT and FTP_COMMAND. If it is currect way, please provide me what are the input parameters need to pass and how to transfer the file from SAP to PDM server.

Thanks & Regards

margani

5 REPLIES 5

Former Member
0 Kudos

Hi

It depends on if PDM server allows ftp transfer.

So you should have user, password and ip address of PDM server for ftp, anyway you can't transfer an internal table direclty, but just a file.

So yuo need to download the internal table to SAP sever file and then transfer this tile from SAP to PDM server via ftp

Do yuo need to do this?

If it's so, you need to ask help to your basis for ftp user of PDM server

Max

0 Kudos

Hi max bianchi,

I got the user name, pasward and host from client. it was connecting to PDM server by using WINSCP. But if i am using the FTP_CONNECT It is not connecting i got sy-subrc = 1.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = lv_user

password = lv_pwd

host = HOST

rfc_destination = 'SAPFTP' ""'SAPFTPA'

IMPORTING

handle = mi_handle

EXCEPTIONS

not_connected = 1

OTHERS = 2.

"' i got sy-subrc = 1.

Please help me on this issue.

Thanks & Regards

margani

0 Kudos

Obviously, there's a problem in input values, if FTP is allowed to/from the servers involved. In my case, I have to have a scrambled password, which I created with FM HTTP_SCRAMBLE...for my situation, here'x what I did with a user-supplied password (v_pass) on selection panel. In a subsequent step, the lv_password value is stored in a paramters table like tvarvc for future use.

data: lv_len      type i,
        lv_key      type i value 26101957,
        lv_password type tvarv_val.

  lv_len = strlen( lv_pass ).

  call function 'HTTP_SCRAMBLE'
    exporting
      source      = lv_pass
      sourcelen   = lv_len
      key         = lv_key
    importing
      destination = lv_password.

In addition, I created a custom FM shell, which does the open, get/put, etc., and close/disconnect based upon values supplied through interface, which supplies FTP commands, using repetitive calls of fm FTP_COMMAND, changing the command text as needed.

0 Kudos

Hi ,

I used this HTTP_SCRAMBLE function module. even it is connecting. Please give me the details about FTP_COMMAND function module.

Thanks & Regards

margani

0 Kudos

look at the FM interface...it's simple....

you construct the command (maybe get, mget *, put, mdel, etc.) and call the FM and check the return code. Google for FTP commands if you don't know them....essentially, FTP is performed by sending a stack of commands, one at a time....

code}call function 'FTP_COMMAND'

exporting

handle = p_handle "returned from FTP_CONNECT

command = p_cmd "(200) type c, contains commands like ascii, get <fn>, ls, etc.

tables

data = gt_ftp_ret "results of the command (appended)

exceptions

tcpip_error = 1

command_error = 2

data_error = 3

others = 4.

In addition, after I have issued all my FTP commands, I call FTP_DISCONNECT, then RFC_CONNECTION_CLOSE.