2010 Sep 21 7:59 AM
Dear Gurus
this is my code but i am not able to make an rfc connectivity. give me a way to connect rfc
&----
*& Report ZTARA *
*& *
&----
*& *
*& *
&----
REPORT ZTARA.
data: m_pasword(20) type c,
mi_key type i ,
mi_pwd_len type i,
mi_handle type i,
m_usr(30),
m_hst(20).
m_pasword = ''.
m_usr = ''.
mi_pwd_len = '14'.
m_hst = ''.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = m_pasword
sourcelen = mi_pwd_len
key = mi_key
IMPORTING
destination = m_pasword.
translate m_usr to lower case.
*do 3 times.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = m_usr
PASSWORD = m_pasword
HOST = m_hst
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = mi_handle
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
if sy-subrc = 0.
write : / 'FTP Connection Ok...'.
exit.
else.
write : / 'FTP Connection failed...'.
endif.
enddo.
2010 Sep 23 4:30 PM
Hi,
Increase your m_password length to more than 30 or 35 characters it will definitly work.
As your FTP server's password length must be of more characters so after HTTP_scrambel, length will be more than 20 characters than you have declared.
So scrambled password is getting only 20 characters.
<removed by moderator>
All the best.
Edited by: Thomas Zloch on Sep 23, 2010 5:32 PM - do not ask for ...
Hi,
Increase your m_password length to more than 30 or 35 characters it will definitly work.
As your FTP server's password length must be of more characters so after HTTP_scrambel, length will be more than 20 characters than you have declared.
So scrambled password is getting only 20 characters.
<removed by moderator>
All the best.
Edited by: Thomas Zloch on Sep 23, 2010 5:32 PM - do not ask for ...
2010 Sep 23 4:30 PM
Hi,
Increase your m_password length to more than 30 or 35 characters it will definitly work.
As your FTP server's password length must be of more characters so after HTTP_scrambel, length will be more than 20 characters than you have declared.
So scrambled password is getting only 20 characters.
<removed by moderator>
All the best.
Edited by: Thomas Zloch on Sep 23, 2010 5:32 PM - do not ask for ...
2010 Sep 23 4:35 PM
Use below code for your reference
DATA : e_commands TYPE ty_commands.
DATA : t_commands TYPE TABLE OF ty_commands,
t_results TYPE TABLE OF ty_results.
DATA :
w_ftp_handle TYPE i,
w_length TYPE i.
CONSTANTS : w_key TYPE i VALUE 26101957,
w_rfcdest TYPE rfcdes-rfcdest VALUE 'SAPFTPA'.
w_hostname = w_host.
Get the length of the password
w_length = STRLEN( w_password ).
DATA : l_pwd TYPE c LENGTH 30.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = w_password
sourcelen = w_length
key = w_key
IMPORTING
destination = l_pwd.
Establish FTP Connection
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = w_userid
password = l_pwd
host = w_hostname
rfc_destination = w_rfcdest
IMPORTING
handle = w_ftp_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc EQ 0.
e_spool_data-text = 'FTP Connection successful'.
ELSE.
e_spool_data-text = 'FTP Connection failed'.
ENDIF.
2010 Sep 24 6:52 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |