FTP_Connect error
Hello Everyone,
I have been trying to get a solution (I already posted earlirer regarding same issue ) to connect to ftp using FTP_connect FM. FTP server is a local and i am trying to fetch the files from that.
I have tested the connection using rsftp002 program n everything is looking ok. But while using the the FM in the program it throws an error tht
"user xyz has no access authorization for computer x-server" where in x-server is the FTP server name and xyz is user name to server. I have even encrypted the password of the ftp server and sending it inthe program.
What might be the probelm. Can anyone explain
Regards
Hi Rahul,
We had the same problem. FTP works fine from command prompts but not from SAP. The solution was to reduce the ftp password.
Within ABAP there is some character translation for the password and it won't handle more than about 8 characters.
Regards,
Similar Messages
-
Error in background job while running FTP_CONNECT
Dear Friends,
When I try to run the FTP_CONNECT FM in background,
the ftp server is not connected throwing an error message ''Attempt to set up connection to <ftpserver> failed''.
I am using the RFC destination SAPFTPA and still it is not working!
My program was successfully executing in fore ground with SAPFTP.
Please help.
Thanks and Regards,
Vidya Sagar.Hi,
The below program is to create file on FTP server by taking the data from internal table
To see whether the file is created on the FTP server
use the function module FTP_SERVER_TO_R3.
Check the below code.
You write a same program with the function module FTP_SERVER_TO_R3 instead of
FTP_R3_TO_SERVER to check the existence of the file which is already created.
tables: t777a. "Building Addresses
Internal Table for Building table.
data: begin of it_t777a occurs 0,
build like t777a-build, "Building
stext like t777a-stext, "Object Name
cname like t777a-cname, "Address Supplement (c/o)
ort01 like t777a-ort01, "City
pstlz like t777a-pstlz, "Postal Code
regio like t777a-regio, "Region (State, Province, County)
end of it_t777a.
Internal Table for taking all fields of the above table in one line
separated by u2018|u2019(pipe).
data: begin of it_text occurs 0,
text(131),
end of it_text.
Constants: c_key type i value 26101957,
c_dest type rfcdes-rfcdest value 'SAPFTPA'.
data: g_dhdl type i, "Handle
g_dlen type i, "pass word length
g_dpwd(30). "For storing password
Selection Screen Starts
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
parameters: p_user(30) default 't777a' obligatory,
p_pwd(30) default 't777a' obligatory,
p_host(64) default 'XXX.XXX.XX.XXX' obligatory.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
parameters: p_file like rlgrap-filename default 't777a_feed.txt'.
SELECTION-SCREEN END OF BLOCK blk2.
Password not visible.
at Selection-screen output.
loop at screen.
if screen-name = 'P_PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
g_dpwd = p_pwd.
Start of selection
start-of-selection.
To fetch the data records from the table T777A.
select build stext cname ort01 pstlz regio
from t777a
into table it_t777a.
Sort the internal table by build.
if not it_t777a[] is initial.
sort it_t777a by build.
endif.
Concatenate all the fields of above internal table records in one line
separated by u2018|u2019(pipe).
loop at it_t777a.
concatenate it_t777a-build it_t777a-stext it_t777a-cname
it_t777a-ort01 it_t777a-pstlz it_t777a-regio
into it_text-text separated by '|'.
append it_text.
clear it_text.
endloop.
To get the length of the password.
g_dlen = strlen( g_dpwd ).
Below Function module is used to Encrypt the Password.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = g_dpwd "Actual password
SOURCELEN = g_dlen
KEY = c_key
IMPORTING
DESTINATION = g_dpwd. "Encyrpted Password
*Connects to the FTP Server as specified by user.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Connecting to FTP Server'.
Below function module is used to connect the FTP Server.
It Accepts only Encrypted Passwords.
This Function module will provide a handle to perform different
operations on the FTP Server via FTP Commands.
call function 'FTP_CONNECT'
EXPORTING
user = p_user
password = g_dpwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = g_dhdl
EXCEPTIONS
NOT_CONNECTED.
if sy-subrc ne 0.
format color col_negative.
write:/ 'Error in Connection'.
else.
write:/ 'FTP Connection is opened '.
endif.
**Transferring the data from internal table to FTP Server.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = g_dhdl
FNAME = p_file
CHARACTER_MODE = 'X'
TABLES
TEXT = it_text
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.
ELSE.
write:/ 'File has created on FTP Server'.
ENDIF.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'File has created on FTP Server'.
To Disconnect the FTP Server.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = g_dhdl.
To Disconnect the Destination.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
others = 1.
Regards,
Kumar Bandanadham -
Urgent: Error in FM FTP_CONNECT
Hello Experts,
I am trying to connect SAP server with external FTP server using FM FTP_CONNECT.
I'm passing following parameters to the FM:
user = p_user
password = p_password
host = ip address of FTP server
rfc_destination = SAPFTPA
p_user and p_password are blank, since no userid and password are required
to access the FTP server.
The FM is giving the following error:
Attempt to setup connection to FTP server failed.
I can access the FTP server directly from my machine through run.
I have tried programs RSFTP002 and RSFTP004. They are giving the same error.
Basically, inside the FM FTP_CONNECT, the system again calls the FM.
CALL FUNCTION 'FTP_CONNECT' DESTINATION RFC_DESTINATION
EXPORTING USER = USER PWD = PASSWORD ACCT = ACCOUNT HOST = HOST
TRACE = FTP_TRACE GUSER = GATEWAY_USER
GPWD = GATEWAY_PASSWORD GHOST = GATEWAY_HOST
IMPORTING HANDLE = HANDLE ERROR = CERROR
EXCEPTIONS SYSTEM_FAILURE = 1 COMMUNICATION_FAILURE = 2.
Here it is returning CERROR = 2.
sy-subrc is 0.
Can anybody please help? Its really urgent.HI SANTOSH,
I had changed according what u said and it is not giving runtime error .
but it is not giving the value as if i send the value of batch and the prd orderr. plz tell me how do it get the output.
i had written the code of program like this:-
TABLES : CHVW.
Parameters : P_CHARG like CHVW-CHARG,
P_AUFNR like CHVW-AUFNR.
DATA: PRD LIKE CHVW-AUFNR.
CALL FUNCTION 'ZFIND_PRDORD'
EXPORTING
QP_CHARG = P_CHARG
P_AUFNR = P_AUFNR
IMPORTING
P_RETVAL = PRD.
WRITE : / PRD .
PLZ HELPMEOUT HOW TO DO THIS. -
Gertting error msg 'no access authorization' while using FM FTP_CONNECT
HI All,
I'm using FTP_CONNECT FM to connect to FTP server and i'm getting the message User has no access authorization for computer. When i try to connect from command prompt using the same ip address, user name and password ..i can connect successfully. From SAP i getting the no authorization message.
Please let me know do we need to maintain the IP address of the FTP server in sap ?Hello,
Check this programs how they are using the FM
RSFTP002 Execute FTP Command
RSFTP003 FTP put / get Test
RSFTP004 FTP Copy
RSFTP006 FTP command list
RSFTP007 Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
RSFTP009 Test FTP put with Verify
RSIRCCON KPro: Test of data connections to memory repositories -
I have tried re-setting firefox. I had downloaded a plug in to back up my WordPress blog and received this error message when I tried to use this plug in to back up my files.
I think this might be a server-side issue. Do you see the same message in other browsers such as internet explorer?
If the problem is uploading a WordPress plugin to your blog, try installing it from the administrative panel instead. This article describes what I mean:
http://codex.wordpress.org/Managing_Plugins#Installing_Plugins -
ALV issue: when save list using Local File command will get run time error!
help!!!!
report list using ALV method when to save this list using Local File.
i will get GETWA_NOT_ASSIGNED run time error information.
how resolve it?
source code :
REPORT ZIFT0103.
TABLES : MARA,MARC,CDHDR,CDPOS,MAKT.
******DEVK909212****************
****利用工厂来区分不同的SERVER的FTP ADDRESS ,user ,PASSWORD
DATA: FTP_WERKS LIKE MARC-WERKS.
********定义一个RANGE用来抓取MARC的信息
RANGES:R_MATNR FOR MARA-MATNR OCCURS 0.
********定义一个INTERNAL TABLE 来抓取MARC 的信息
DATA:BEGIN OF IT_MARC OCCURS 0,
MATNR LIKE MARC-MATNR,
WERKS LIKE MARC-WERKS,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
FLAG_UI TYPE C,
END OF IT_MARC.
*******定义存放北京的数据的变量
DATA : BEGIN OF FTP_BEIJING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_BEIJING .
******定义福清的数据变量
DATA : BEGIN OF FTP_FUQING OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_FUQING .
*******DEVK909212*****************
DATA : BEGIN OF FTP_ITEMDOC1 OCCURS 0 ,
MATNR(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC1 .
DATA : BEGIN OF FTP_ITEMDOC OCCURS 0 ,
MATNR(25) ,
MATNR1(25) ,
MAKTX(30) ,
END OF FTP_ITEMDOC .
DATA: WA_ZMSGTA TYPE ZMSGTA ,
l_ersda like MARA-ERSDA .
***********DEVK909553********************
****用来决定执行FTP还是显示LIST**********
DATA:g_tcode_flag.
***********DEVK909553********************
Error message process ******************************
DEFINE EXPLAIN_MSG.
break soe_richard.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = &1 "SY-MSGID
NUMBER = &2 "SY-MSGNO
LANGUAGE = SY-LANGU
TEXTFORMAT = &3
LINKPATTERN =
MESSAGE_V1 = &4 "SY-MSGV1
MESSAGE_V2 = &5 "SY-MSGV2
MESSAGE_V3 = &6 "SY-MSGV3
MESSAGE_V4 = &7 "SY-MSGV4
IMPORTING
MESSAGE = &8 "WA_ZMSGTA-MSE1
RETURN =
TABLES
TEXT =
END-OF-DEFINITION.
DEFINE ERROR_MSG_UPDATA.
CALL FUNCTION 'ZINSERT_MSG' "IN UPDATE TASK
EXPORTING
XZMSGTA = &1 "WA_ZMSGTA
EXCEPTIONS
UPDATE_ERROR = 1
OTHERS = 2.
END-OF-DEFINITION.
IF SY-TCODE = 'ZIFT103' .
g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 0
TEXT = '请耐心等候,系统正在抓数据'.
ENDIF.
l_ersda = sy-datum - 1 . "取前一天产生的物料号码。
DATA:BEGIN OF it_change OCCURS 0,
OBJECTID TYPE CDHDR-OBJECTID,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
TABKEY TYPE CDPOS-TABKEY,
END OF it_change.
DATA:BEGIN OF it_cDhdr OCCURS 0,
OBJECTID type CDHDR-OBJECTID,
CHANGENR TYPE CDHDR-CHANGENR,
USERNAME TYPE CDHDR-USERNAME,
UDATE TYPE CDHDR-UDATE,
END OF it_cdhdr.
DATA:search_len TYPE I.
DATA:BEGIN of it_insert OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
END OF it_insert.
DATA:BEGIN OF it_MAKT OCCURS 0,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX,
END OF it_makt.
DATA IT_MARA TYPE TABLE OF MARA WITH HEADER LINE.
DATA:BEGIN OF IT_OUT OCCURS 0,
MATNR TYPE MARA-MATNR,
WERKS TYPE MARC-WERKS,
MTART TYPE MARA-MTART,
MEINS TYPE MARA-MEINS,
MATKL TYPE MARA-MATKL,
MAKTX TYPE MAKT-MAKTX,
PSTAT TYPE MARA-PSTAT,
BRGEW TYPE MARA-BRGEW,
NTGEW TYPE MARA-NTGEW,
GEWEI TYPE MARA-GEWEI,
FERTH TYPE MARA-FERTH,
KZUMW TYPE MARA-KZUMW,
ERNAM TYPE MARA-ERNAM,
ERSDA TYPE MARA-ERSDA,
END OF IT_OUT.
*-- DECLARE DATA FOR ALV
TYPE-POOLS: slis.
DATA : g_variant LIKE disvariant,
g_save(1) TYPE c,
g_exit(1) TYPE c,
gx_variant LIKE disvariant.
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE, "
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
gs_print TYPE slis_print_alv,
gs_layout TYPE slis_layout_alv .
******只能抓出系统有做更改的数据***************
******而第一次INSERT MARA的数据抓不出来********
START-OF-SELECTION.
SELECT AOBJECTID AUSERNAME AUDATE BTABKEY
INTO TABLE it_change
FROM ( CDPOS AS B INNER JOIN CDHDR AS A ON
AOBJECTCLAS = BOBJECTCLAS AND
AOBJECTID = BOBJECTID AND
ACHANGENR = BCHANGENR )
WHERE A~OBJECTCLAS = 'MATERIAL'
AND A~UDATE = l_ersda
AND B~TABNAME = 'MARC'
AND B~CHNGIND = 'I'.
LOOP AT it_change.
search_len = STRLEN( it_change-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = it_change-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = it_change-objectid+0(18).
IT_MARC-USERNAME = it_change-username.
IT_MARC-UDATE = It_change-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
****CDPOS is Cluster TABLE 所以没有办法用INNER JOIN******
SELECT OBJECTID CHANGENR USERNAME UDATE
INTO TABLE it_cdhdr
FROM CDHDR
WHERE OBJECTCLAS = 'MATERIAL'
AND UDATE = l_ersda.
AND TCODE = 'MM02'.
LOOP AT IT_cdhdr.
SELECT * FROM CDPOS
WHERE OBJECTCLAS = 'MATERIAL'
AND OBJECTID = IT_CDHDR-OBJECTID
AND CHANGENR = IT_CDHDR-CHANGENR
AND TABNAME = 'MARC'
AND CHNGIND = 'I'.
search_len = STRLEN( CDPOS-TABKEY ).
search_len = search_len - 4.
IF search_len > 0.
IT_MARC-WERKS = CDPOS-TABKEY+search_len(4).
ENDIF.
IT_MARC-MATNR = IT_cdhdr-objectid+0(18).
IT_MARC-USERNAME = IT_cdhdr-username.
IT_MARC-UDATE = IT_cdhdr-udate.
IT_MARC-FLAG_UI = 'U'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
CLEAR IT_MARC.
ENDSELECT.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 20
TEXT = '处理好当天CHANGE的数据'.
ENDIF.
*******抓当天做了INSERT的数据*************
*******不需要***********************
SELECT BMATNR BWERKS INTO TABLE IT_INSERT
FROM MARC AS B JOIN MARA AS A
ON AMATNR = BMATNR
WHERE A~ERSDA = l_ersda.
LOOP AT IT_INSERT.
IT_MARC-MATNR = IT_INSERT-MATNR.
IT_MARC-WERKS = IT_INSERT-WERKS.
IT_MARC-FLAG_UI = 'I'.
APPEND IT_MARC.
CLEAR IT_MARC.
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = IT_MARC-MATNR.
APPEND R_MATNR.
ENDLOOP.
IF g_tcode_flag = 'L'.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 40
TEXT = '处理好当天INSERT的数据'.
ENDIF.
IF g_tcode_flag = 'L'.
PERFORM get_MAKTX.
PERFORM get_mara.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = 100
TEXT = '处理好数据,并开始显示数据'.
PERFORM do_data.
PERFORM display_alv.
ELSE.
PERFORM get_MAKTX.
PERFORM do_ftp.
ENDIF.
*& Form get_marktx
text
FORM get_maktx.
SELECT MATNR MAKTX INTO TABLE IT_MAKT FROM MAKT
WHERE MATNR IN R_MATNR AND SPRAS = '1'.
ENDFORM. "get_marktx
*& Form get_mara
text
FORM get_mara.
SELECT * INTO TABLE it_mara FROM MARA
WHERE MATNR IN R_MATNR.
ENDFORM. "get_mara
*& Form do_data
text
FORM do_data.
SORT IT_MARC BY MATNR WERKS.
DELETE ADJACENT DUPLICATES FROM IT_MARC COMPARING MATNR WERKS.
LOOP AT IT_MARC.
CLEAR IT_MAKT.
CLEAR IT_MARA.
READ TABLE IT_MAKT WITH KEY MATNR = IT_MARC-MATNR.
READ TABLE IT_MARA WITH KEY MATNR = IT_MARC-MATNR.
MOVE-CORRESPONDING IT_MARA TO IT_OUT.
IT_OUT-MAKTX = IT_MAKT-MAKTX.
IT_OUT-WERKS = IT_MARC-WERKS.
IF IT_MARC-FLAG_UI = 'U'.
IT_OUT-ERNAM = IT_MARC-USERNAME.
ENDIF.
APPEND IT_OUT.
CLEAR IT_OUT.
ENDLOOP.
ENDFORM. "do_data
*SELECT AMATNR BMAKTX INTO CORRESPONDING
*FIELDS OF FTP_ITEMDOC1 FROM MARA AS A JOIN MAKT AS B
*ON AMATNR = BMATNR WHERE A~ERSDA = l_ersda
*AND B~SPRAS = '1' . "代表为中文说明。
APPEND FTP_ITEMDOC1.
*******DEVK909212****************
*******添加RANGE*****************
CLEAR R_MATNR.
R_MATNR-SIGN = 'I'.
R_MATNR-OPTION = 'EQ'.
R_MATNR-LOW = FTP_ITEMDOC1-MATNR.
APPEND R_MATNR.
CLEAR FTP_ITEMDOC1.
*******DEVK909212****************
*ENDSELECT.
*******DEVK909212****************
****get WERKS information from MARC*******
*SELECT MATNR WERKS INTO TABLE IT_MARC
*FROM MARC
*WHERE MATNR IN R_MATNR.
*******DEVK909212****************
******DEVK909212****************
**MARK**************************
*LOOP AT FTP_ITEMDOC1 .
MOVE : FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_ITEMDOC-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_ITEMDOC-MAKTX.
APPEND FTP_ITEMDOC.
CLEAR FTP_ITEMDOC.
*ENDLOOP.
******DEVK909212****************
******DEVK909212***********************************
**根据IT_MARC中信息,往北京和福清的TABLE写数据*****
FORM do_ftp.
LOOP AT IT_MARC.
***福清的
IF IT_MARC-WERKS = '1010' OR IT_MARC-WERKS = '1020'
OR IT_MARC-WERKS = '1023' .
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_FUQING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_FUQING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_FUQING-MATNR,
IT_MARC-MATNR TO FTP_FUQING-MATNR1,
IT_MAKT-MAKTX TO FTP_FUQING-MAKTX.
APPEND FTP_FUQING.
CLEAR FTP_FUQING.
ENDIF.
***北京的
IF IT_MARC-WERKS = '1041' OR IT_MARC-WERKS = '1042'.
READ TABLE FTP_ITEMDOC1 WITH KEY MATNR = IT_MARC-MATNR.
MOVE : FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR,
FTP_ITEMDOC1-MATNR TO FTP_BEIJING-MATNR1,
FTP_ITEMDOC1-MAKTX TO FTP_BEIJING-MAKTX.
CLEAR IT_MAKT.
READ TABLE IT_MAKT WITH KEY = IT_MARC-MATNR.
MOVE : IT_MARC-MATNR TO FTP_BEIJING-MATNR,
IT_MARC-MATNR TO FTP_BEIJING-MATNR1,
IT_MAKT-MAKTX TO FTP_BEIJING-MAKTX.
APPEND FTP_BEIJING.
CLEAR FTP_BEIJING.
ENDIF.
ENDLOOP.
****清楚重复的数据**********
SORT FTP_FUQING.
DELETE ADJACENT DUPLICATES FROM FTP_FUQING.
SORT FTP_BEIJING.
DELETE ADJACENT DUPLICATES FROM FTP_BEIJING.
***传送数据********
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_FUQING[].
FTP_WERKS = '1010'.
PERFORM ftp_work.
REFRESH FTP_ITEMDOC.
FTP_ITEMDOC[] = FTP_BEIJING[].
FTP_WERKS = '1041'.
PERFORM ftp_work.
******DEVK909212***********************************
ENDFORM. "do_ftp
*& Form ftp_work
把以前FTP的工作做一个FORM
*******DEVK909212**************************
FORM ftp_work.
*******DEVK909212**************************
CHECK FTP_ITEMDOC[] IS NOT INITIAL.
FTP function *****************************************************
DATA : HDL TYPE I,
L_SLEN TYPE I ,
ERROR,
KEY TYPE I VALUE 26101957,
DEST TYPE RFCDES-RFCDEST VALUE 'SAPFTPA'.
DATA: FTP_RESULT TYPE TABLE OF TEXT.
DATA: P_FILE TYPE RLGRAP-FILENAME.
DATA: L_USER(16) TYPE C VALUE 'SFIS',
L_PWD(16) TYPE C VALUE 'SFIS',
L_HOST(16) TYPE C VALUE '172.16.31.17'.
*******DEVK909212**************************
*****根据不同的工厂来抓FTP的信息
CALL FUNCTION 'Z_FTP_SFIS'
EXPORTING
BLART = 'S'
WERKS = FTP_WERKS
IMPORTING
HOST = L_HOST
USER1 = L_USER
PASS1 = L_PWD.
*******DEVK909212**************************
CONCATENATE l_ersda '.KP' INTO P_FILE.
SET EXTENDED CHECK OFF.
ERROR = 0.
CHECK HDL IS INITIAL.
Connect to server
L_SLEN = STRLEN( L_PWD ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = L_PWD
SOURCELEN = L_SLEN
KEY = KEY
IMPORTING
DESTINATION = L_PWD.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
TEXT = 'Connect to FTP Server'.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = L_USER
PASSWORD = L_PWD
HOST = L_HOST
RFC_DESTINATION = DEST
IMPORTING
HANDLE = HDL
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = HDL
COMMAND = 'ascii'
TABLES
DATA = FTP_RESULT
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = HDL
FNAME = P_FILE
CHARACTER_MODE = 'X'
TABLES
TEXT = FTP_ITEMDOC
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
EXPLAIN_MSG SY-MSGID SY-MSGNO ' ' SY-MSGV1 SY-MSGV2 SY-MSGV3
SY-MSGV4 WA_ZMSGTA-MSE1.
MOVE: 'B' TO WA_ZMSGTA-BLART,
l_ersda TO WA_ZMSGTA-REFNUMBER,
SY-MSGTY TO WA_ZMSGTA-MSGTY,
'MARA' TO WA_ZMSGTA-TBMA_VAL.
ERROR_MSG_UPDATA WA_ZMSGTA.
EXIT.
ENDIF.
*******DEVK909212**************************
*******CLOSE FTP******************
CHECK NOT HDL IS INITIAL.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = HDL.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
DESTINATION = DEST
EXCEPTIONS
OTHERS = 1.
CLEAR HDL.
ENDFORM. "ftp_work
*******DEVK909212**************************
FORM DISPLAY_ALV .
*-- PREPARE ALV DATA
PERFORM EVENTTAB_BUILD USING GT_EVENTS[].
PERFORM COMMENT_BUILD USING GT_LIST_TOP_OF_PAGE[].
*-- LAYOUT SETTING
PERFORM PREPARE_ALV_FIELD USING GT_FIELDCAT[].
*-- ALV DISPLAY
PERFORM CALL_REUSE_ALV_GRID_DISPLAY.
ENDFORM. " display_alv
*& Form eventtab_build
text
-->P_GT_EVENTS[] text
FORM EVENTTAB_BUILD USING PT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = PT_EVENTS.
READ TABLE PT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
LS_EVENT-FORM = 'TOP_OF_PAGE'.
MODIFY PT_EVENTS FROM LS_EVENT INDEX SY-TABIX.
ENDIF.
ENDFORM. " eventtab_build
*& Form comment_build
text
-->P_GT_LIST_TOP_OF_PAGE[] text
FORM COMMENT_BUILD USING PT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: LS_LINE TYPE SLIS_LISTHEADER,
L_DATE(30),
l_v_BWKEY like T001W-BWKEY, "Valuation area
l_v_BUKRS like T001K-BUKRS. "Firm/Company
Listenerschrift: Typ H
CLEAR LS_LINE.
LS_LINE-TYP = 'H'.
LS_LINE-KEY: not used for this type
select single BWKEY
into l_v_BWKEY
from t001w
where WERKS IN s_WERKS.
select single BUKRS
into l_v_BUKRS
from t001k
where BWKEY = l_v_BWKEY.
SELECT SINGLE butxt INTO LS_LINE-INFO
FROM t001
WHERE bukrs = l_v_BUKRS.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
Kopfinfo: Typ S
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '报表名称:'.
LS_LINE-INFO = SY-TITLE.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印日期:'.
WRITE SY-DATUM TO LS_LINE-INFO.
ls_line-info = sy-datum.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '打印時間:'.
WRITE SY-UZEIT TO LS_LINE-INFO.
ls_line-info = sy-uzeit.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
CLEAR LS_LINE.
LS_LINE-TYP = 'S'.
LS_LINE-KEY = '使用者:'.
LS_LINE-INFO = SY-UNAME.
APPEND LS_LINE TO PT_TOP_OF_PAGE.
ENDFORM. " comment_build
*& Form prepare_alv_field
text
-->P_GT_FIELDCAT[] text
FORM PREPARE_ALV_FIELD USING P_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
DATA: LS_LINE TYPE SLIS_FIELDCAT_ALV.
*-- DEFINE MARCO
DEFINE APPEND_ALV_FIELD.
CLEAR LS_LINE.
LS_LINE-FIELDNAME = &1.
LS_LINE-TABNAME = &2.
LS_LINE-REPTEXT_DDIC = &3.
LS_LINE-SELTEXT_L = &3.
LS_LINE-SELTEXT_M = &3.
LS_LINE-SELTEXT_S = &3.
LS_LINE-QFIELDNAME = &4.
LS_LINE-QTABNAME = &5.
LS_LINE-NO_OUT = &6.
LS_LINE-NO_ZERO = &7.
LS_LINE-OUTPUTLEN = &8.
APPEND LS_LINE TO P_FIELDCAT.
END-OF-DEFINITION.
APPEND_ALV_FIELD: 'MATNR' 'IT_OUT' '料号'
'O' 'X' ''.
APPEND_ALV_FIELD: 'WERKS' 'IT_OUT' '工厂'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MTART' 'IT_OUT' 'MTyp'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MEINS' 'IT_OUT' 'BUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKL' 'IT_OUT' '物料组\分群码'
'O' 'X' ''.
APPEND_ALV_FIELD: 'MATKX' 'IT_OUT' '物料描述'
'O' 'X' ''.
APPEND_ALV_FIELD: 'PSTAT' 'IT_OUT' '维护状态'
'O' 'X' ''.
APPEND_ALV_FIELD: 'BRGEW' 'IT_OUT' '毛重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'NTGEW' 'IT_OUT' '净重'
'O' 'X' ''.
APPEND_ALV_FIELD: 'GEWEI' 'IT_OUT' 'WUn'
'O' 'X' ''.
APPEND_ALV_FIELD: 'FERTH' 'IT_OUT' '对外机种名'
'O' 'X' ''.
APPEND_ALV_FIELD: 'KZUMW' 'IT_OUT' '高关税标识'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERNAM' 'IT_OUT' '创建者'
'O' 'X' ''.
APPEND_ALV_FIELD: 'ERSDA' 'IT_OUT' '创建日期'
'O' 'X' ''.
ENDFORM. " prepare_alv_field
*& Form call_reuse_alv_grid_display
text
--> p1 text
<-- p2 text
FORM CALL_REUSE_ALV_GRID_DISPLAY .
gs_layout-f2code = 'DISPLAY'.
gs_print-no_print_listinfos = 'X'.
gs_layout-colwidth_optimize = 'X'. "列宽度自动根据内容优化
gs_layout-f2code = '&ETA'. "double check弹出详细信息
gs_layout-zebra = 'X'. "清单条纹显示
gs_layout-no_vline = ''. "是否显示列间隔线
gs_layout-box_fieldname = ''. "是否显示checkbox
gs_layout-confirmation_prompt = ''. "推出清单是否提示
gs_layout-detail_titlebar = '详细信息'."详细清单的标题
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-CPROG
I_BACKGROUND_ID = 'ALV_BACKGROUND'
I_CALLBACK_PF_STATUS_SET = 'ALV_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'ALV_USER_COMMAND'
I_CALLBACK_TOP_OF_PAGE = GT_LIST_TOP_OF_PAGE[]
IT_FIELDCAT = GT_FIELDCAT[]
IT_EVENTS = GT_EVENTS[]
I_STRUCTURE_NAME = 'IT_OUT'
I_SAVE = 'A'
IS_LAYOUT = GS_LAYOUT
IS_PRINT = GS_PRINT
TABLES
T_OUTTAB = IT_OUT
EXCEPTIONS
PROGRAM_ERROR = 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. " call_reuse_alv_grid_display
*& Form PREPARE_ALV_FIELD
FORM TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = GT_LIST_TOP_OF_PAGE.
ENDFORM. "TOP_OF_PAGEHi,
Please check your field catalog and refer field names once again.
Check spelling, or Check strucutre properly.
There are something wrong in your catalog definition
aRs. -
RFC Error in Webdynpro Abap...
Hi,
Im Using one FM SRM_DOCUMENT_CHECKIN_VIA_FILE...Inside that Fm it is usng some RFC Connection..while debugging Im getting an internal error in the FM as 'RFC server sapftp cannot be started - 1: Program no longer started via RFC'...
Can Any1 Suggest ME How to resolve it...Hi Vasavi,
I think this is normal FM, not Remote Enable FM. Check this once. and you are calling from different system.
Thatswhy that error. check your RFC connections once(sm59).
and make sure your FM no where used any GUI related statements like call transaction or call screen.
also check this...
Re: FTP_CONNECT failed for SAPFTP from WD4A to external Server
Re: RFC in Web Dynpro
Cheers,
Kris. -
I'm trying to set up a script task in SSIS (my first attempt at doing so, so bear with me). Part of this is code I have pulled from other examples I found on the internet.
Dts.TaskResult = Dts.Results.Success
on the above line, I'm getting error
'Results' is not a member of 'Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel'
Can you tell me what's wrong?
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
<System.AddIn.AddIn("ScriptMain", Version:="1.0", Publisher:="", Description:="")> _
<System.CLSCompliantAttribute(False)> _
Partial Public Class ScriptMain
Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
Enum ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
Public Sub Main()
Dim mgr As ConnectionManager
mgr = Dts.Connections("FTP_Connect")
Dim conn As FtpClientConnection
conn = New FtpClientConnection(mgr.AcquireConnection(DBNull.Value))
Dim fileNames(0) As String
fileNames(0) = "LEVEL01.TESTFILE" 'user can avoid using / in file name here
Try
conn.Connect()
conn.ReceiveFiles(fileNames, "c:\holddata", True, True)
Catch ex As Exception
Finally
conn.Close()
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
End ClassI think error is here - Dts.TaskResult = Dts.Results.Success, it can't find the enumerator
name "Results". The enumerator name that you gave (or by default) "ScriptResults"
Enum
ScriptResults
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
End Enum
So, try with this statement
Dts.TaskResult = Dts.ScriptResults.Success
//this is last 3rd line from bottom
Narsimha -
FTP Adapter errors out while writing a file
Hi ,
I am facing this problem while using FTP adapter tries to write a file on a specific remote machine.The Adapter throws this following error:
Missing class: oracle.tip.adapter.api.TranslationAware
Dependent class: oracle.tip.adapter.file.outbound.FileInteractionSpec
Loader: global.libraries:1.0
Code-Source: /XXX/ias/product/asmt_10131/j2ee/oc4j_soa/applib/fileAdapter.jar
Configuration: <code-source> in /XXX/ias/product/asmt_10131/j2ee/oc4j_soa/config/server.xml
The missing class is available from the following locations:
1. Code-Source: /XXX/ias/product/asmt_10131/bpel/lib/orabpel.jar (from <code-source> in /XXX/ias/product/asmt_10131/j2ee/oc4j_soa/config/server.xml)
This code-source is available in loader oracle.bpel.common:10.1.3.
</summary>
Any Suggestions will be helpful.
Thanks
PSHi Rama Krishna
Are you saying that you are transferring data of your
internal table to another server using a FM??? Am not
sure if that can be done.
How about trying this way????
Download the data to a file on your application
server, using open dataset statement. Then transfer this
file to the other server using FM's FTP_CONNECT, FTP_COMMAND ....
Kind Regards
Eswar -
Hi All,
I am trying to populate pdf from sap server to different server. when i am trying to open that pdf in target system , getting the error " root object is missing or invalid " here is my code :
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = p_pwd
sourcelen = lv_pwd_len
key = lc_key
IMPORTING
destination = p_pwd.
* connect to FTP server
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = p_pwd
* ACCOUNT =
host = p_ip
rfc_destination = lc_rfc_dest
* GATEWAY_USER =
* GATEWAY_PASSWORD =
* GATEWAY_HOST =
IMPORTING
handle = lv_handle
* EXCEPTIONS
* NOT_CONNECTED = 1
* OTHERS = 2
IF sy-subrc <> 0.
l_fail = 'X'.
WRITE : / 'FTP Connection failed'.
EXIT.
ENDIF.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_handle
command = 'cd /Payadvice '"lv_cmd
compress = 'N'
* RFC_DESTINATION = lc_rfc_dest "sapftpa
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
TABLES
data = it_output
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ENDIF.
CLEAR l_fail.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = 'binary'
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CLEAR wa_result.
CONCATENATE v_name '.pdf' INTO wa_result.
DATA: l_count TYPE i.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = lv_handle
fname = wa_result
* blob_length = l_count
character_mode = 'X'
TABLES
* BLOB =
text = it_lines"it_tmp
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
endif.
clear insfile.
CONCATENATE 'put' wa_result INTO insfile SEPARATED BY space.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = lv_handle
command = insfile
* COMPRESS = 'N'
* RFC_DESTINATION =
* VERIFY =
* IMPORTING
* FILESIZE =
* FILEDATE =
* FILETIME =
tables
data = it_lines
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4 .
IF sy-subrc NE 0.
l_fail = 'X'.
EXIT.
ELSE.
UPDATE zwork_to_sapvenp SET flag1 = 'X' WHERE inv_act_doc = lv_name.
IF sy-subrc = 0.
ENDIF.
ENDIF.
*ftp disconnect
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_handle.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = lc_rfc_dest
* TASKNAME =
* EXCEPTIONS
* DESTINATION_NOT_OPEN = 1
* OTHERS = 2
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
here "put" command is not working properly getting command error . please help.it_lines TYPE STANDARD TABLE OF tline WITH HEADER LINE.
insfile TYPE text , -
File open error at ftp even the file is not open.....
Hi,
i get the error File open with the fm GUI_UPLOAD while uploading the XML file from FTP server.
What is interesting is that i did not open the file, furthermore i closed all the windows else that sap window,
but still i get the file open error.
We create the xml file when created a new delivery. And this xml file is sent to a bukrs's ftp and they also sent the same xml after some validations done.
When it arrives to our ftp server i make it post goods issue automatically but from yesterday i got the file open error, it was working fine just before today.
What could be the problem?
Hint: Yesterday and previous day files still work fine but files created today are faulty.
Thanks.Thanks for replies.
My code is that:
call function 'HTTP_SCRAMBLE'
EXPORTING
source = gv_password
sourcelen = slen
key = gv_key
IMPORTING
destination = gv_password.
describe field gv_password length gv_pwd_len in character mode.
call function 'FTP_CONNECT'
exporting
user = 'HHH\GrupMMM'
password = gv_password
host = '10.10.10.10' "assume that is the host
rfc_destination = 'SAPFTPA'
importing
handle = gv_handle
exceptions
not_connected = 1
others = 2.
if sy-subrc eq 0.
"concatenate 'put' ld_full_path '[' ld_full_path ']'
*gv_com = 'lcd C:\MMM\RETURN_FILES'.*
clear mtab_data.
free mtab_data.
call function 'FTP_COMMAND'
exporting
handle = gv_handle
command = gv_com
tables
data = mtab_data
exceptions
tcpip_error = 1
command_error = 2
data_error = 3
others = 4.
if sy-subrc eq 0.
endif.
When i get the list of the return files i get data of each file via gui_upload.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = filename
filetype = 'BIN'
IMPORTING
filelength = totalsize
TABLES
data_tab = xml_table[]
EXCEPTIONS
FILE_READ_ERROR = 1
FILE_OPEN_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16.
However i get the open error for all files created today.
By the way, how can i use open dataset instead of ftp commands? How can i see the files at apllication server?
i get the files via IP of the FTP but how can i get files from application server?
Thanks. -
Hi Friends,
I am using the FM "FTP_CONNECT". The coding is given below.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = 'user'
PASSWORD = 'pass$word'
ACCOUNT =
HOST = 'chn-cisser'
RFC_DESTINATION = 'SAPFTPA'
GATEWAY_USER =
GATEWAY_PASSWORD =
GATEWAY_HOST =
IMPORTING
HANDLE = h
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.
else.
write: 'success'.
ENDIF.
in Host Field i am giving ip address also but i amgetting the following error.
"User sapedi has no access authorization for computer chn-cisser
Message no. 04202"
but in command prompt i am open the server.
Thanks & Regards,
Vallamuthu.M
Edited by: vallamuthu madheswaran on Jun 3, 2008 12:06 PMCan you please let me know how did you solved it?
I am als facing the same issue?
regards,
Kunal -
Hi,
i am trying to use FTP_CONNECT to establisht he connection but its giving error Attempt to set up connection to failed.
i am passing the scrambled paswd . Could you plz tell me what is the issue..
step followed.
1. p_user = 'ABCD'.
l_pwd = 'mx12345'.
c_dest = 'SAPFTP'.
p_host = '1123.31.1.12'.
l_slen = STRLEN( l_pwd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = l_pwd
sourcelen = l_slen
key = c_key
IMPORTING
destination = l_pwd.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = p_user
password = l_pwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = w_hdl
EXCEPTIONS
OTHERS = 1.
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 = w_hdl
fname = '
mx-fs01\ftp\ABMCPL\Minacs'
character_mode = 'X'
TABLES
text = it_outfile
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
RAISING invalid_output_file.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = w_hdl.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
OTHERS = 1.Hi Praveen,
I checked the the SAPFTP in SM 59 also tested the connection it is working fine but still when i execute the FTP_CONNECT it is not connecting. Is there anything else from programmming side to be added?
Thanks -
Command Error in FTP_COPY function module
I need to transfer file to non-sap server and I am using function modules FTP_CONNECT and FTP_COPY to do the same. FTP_CONNECT establishes connection to server but FTP_COPY fails with raising exception COMMAND_ERROR (CERROR = 2). We are unable to trace why exactly this exception is raised and what is the root cause for it.
Has anybody used these function modules to transfer file? Any experience or hints on mentioned error? Any kindly is very much appreciated. Thank you.
-AbhijitHello,
Did you use SAPFTP as RFC destination ?
What you also can do is take a look at the following SAP test programs who use the same function modules (FTP_CONNECT, FTP_COPY, ...):
RSFTP003 FTP put / get Test
RSFTP004 FTP Copy
RSFTP006 FTP command list
RSFTP007 Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
RSFTP009 Test FTP put with Verify
RSFTP011 FTP Copy
I have always used these programs as a reference for FTP programmation with success.
Good luck.
Wim -
LKM SAP ERP to Oracle (SQLLDR) - ERROR!!!
Hi ,
I have error on the step Extract Data with this error
oracle.odi.sdk.opentools.OpenToolExecutionException: Error occured in open tool execute methodError in executing ABAP programUnable to connect FTP. Check ABAP program
at oracle.odi.sap.km._OdiSapAbapExecute.execute(_OdiSapAbapExecute.java:466)
at com.sunopsis.dwg.function.SnpsOpenToolFunction.actionExecute(SnpsOpenToolFunction.java)
at com.sunopsis.dwg.function.SnpsOpenToolFunction.execute(SnpsOpenToolFunction.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execIntegratedFunction(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.j(e.java)
at com.sunopsis.dwg.cmd.g.z(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Thread.java:619)
and the description of ABAB code is ( cut from the whole ABAB code to show you the part of FTP Coding on ABAB language)
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'odiadmin'
password = 'odiadmin'
host = '10.8.61.200'
rfc_destination = 'SAPFTPA'
IMPORTING
handle = lv_hdl
EXCEPTIONS
not_connected = 1
OTHERS = 2.
IF sy-subrc <> 0.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'Unable to connect FTP.'.
Append et_file_return.
ELSE.
IF NOT lc_pasv IS INITIAL.
REFRESH lt_result.
lv_cmd = lc_cmd1.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_hdl
command = lv_cmd
TABLES
data = lt_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
IF sy-subrc <> 0.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'Error in passing FTP .'.
Append et_file_return.
ENDIF.
CALL FUNCTION 'FTP_R3_TO_CLIENT'
EXPORTING
fname = iv_filename
rfc_destination = lc_dest
character_mode = lc_pasv
TABLES
text = gt_result
EXCEPTIONS
command_error = 1
data_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'Error passing data to FTP .'.
Append et_file_return.
ENDIF.
free : gt_result.
CONCATENATE lc_cmd2 iv_filename
INTO lv_cmd SEPARATED BY ' '.
REFRESH lt_result.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = lv_hdl
command = lv_cmd
TABLES
data = lt_result
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3.
IF sy-subrc NE 0.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'Error in passing FTP .'.
Append et_file_return.
EXIT.
ELSE.
clear et_file_return.
et_file_return-TYPE = gc_success.
et_file_return-message = 'Data Transfer Successful'.
Append et_file_return.
ENDIF.
ELSE.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'No data Available.'.
Append et_file_return.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_hdl.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = lc_dest
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message = 'Error in RFC connection.'.
Append et_file_return.
ENDIF.
ENDIF.
ENDIF.
ELSE.
clear et_file_return.
et_file_return-TYPE = gc_error.
et_file_return-message =
'Installed ABAP program does not match interface definition'.
Append et_file_return.
ENDIF."
it seem that the error stop on the first exception that will return the message "Unable to connect FTP Server"
I don't know why ,
This SAP is 4.6C
Thanks
Edited by: somchai on Sep 16, 2009 11:27 PMHi Somchai,
r U able to resolve ur issue ..........i'm also struck there at the same point.
I am using shared folder for file transfer and my error message is
java.lang.RuntimeException: Error occured in open tool execute method...Error in executing ABAP program...Error in executing ABAP program...Error occurred when creating dataset\\<hostname>\bi-interface$\ZODI_11001_12001_GLOBAL.txt
Thanks.
Edited by: Drona on Mar 26, 2012 7:25 AM
Maybe you are looking for
-
GL account automatically cleared by the bank statemetn document
Hello all, I would like to ask you a question. We have done the payments by payment run to the vendor , FI document 2000008482 has been created, Then we received the bank statement which created the document 101481822 and the GL account used for thi
-
Visualizer with update not working in fullscreen mode
I just did the most recent itunes download and now the visualizer won't go into fullscreen mode! Even if I press command + F. Please help!
-
Firefox will not load in my account, but loads on the other accounts on the same computer. Internet Explorer loads ok in my account == This happened == Every time Firefox opened == User Agent == Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trid
-
Personal Information iViews missing in Business Package for E.S.S.
Hi all, we have imported the business package for Employee Self-Service (ERP2005, Release 1.0 for nw2004s) in our portal. The iViews for the application 'Personal Information' (like 'Address', 'Bank Information',...) are language dependent and in the
-
Downloading and installing Lightroom 4 on Mac
I have purchased LR 4 on the Adobe site and received the e-mail with the link to download. I have downloaded the Mac version onto my computer but the installer cannot open it. I keep getting the error: Operation could not be completed (com.apple.in