Rfc To Program Sapftp Failed
RFC to program sapftp failed when check in the document Dear Experts, I am facing an error while checking in the document in transaction CV01N / CV02N. The error is. Shaiya underworld patch.
'Hi all, my program is working fine when i execute it in SAP GUI. In this program i need to send some local file to FTP server from presentation server. Actually we have a scanner through which we can scan the barcode data from barcode label.this scanner is connected to sap test server through web console.
So,i can see the sap screen on the screen of scanner for this perticular transaction. After scanning a barcode,the barcode data comes to scanner.when i execute this report on the scanner, it is showing the error- RFC to SAPFTP failed. Where as this same report is working very fine on the SAP server.it can send my file from presentation server to FTP server located at some other place. Web console is installed so i can connect scanner to SAP for this perticular transaction through web.i think, to execute on scanner is same as execute on sap server. This error comes while executing a Function module FTPCONNECT which is present in my program.
Can u please tell where is the problem?it is very urgent as they need in 1 day of time. Code is as follows. FORM ftpsend using printer dir. Data: user(64) type c value 'man', pwd(64) type c value 'post', host(64) type c value '172.160.122.30', cmd1(80) type c, cmd2(150) type c, cmd3(80) type c, dest like rfcdes-rfcdest value 'SAPFTP', compress type c value 'N'. Data: hdl type i, key type i value 26101957, dstlen type i.
Data: begin of result occurs 0, line(100) type c, end of result. Data:begin of taboline occurs 0, oline(200) type c, end of taboline.
Describe field pwd length dstlen. CLEAR taboline. CONCATENATE bt-userid bt-zdate bt-seq bt-charg bt-batch bt-matnr bt-menge bt-lgpla bt-lifnr bt-lotcode bt-datecode bt-leadnolead INTO taboline-oline SEPARATED BY ','. Append taboline. CALL FUNCTION 'WSDOWNLOAD' EXPORTING. BINFILESIZE = ' '. CODEPAGE = ' ' FILENAME = 'c: pabi29.txt ' FILETYPE = 'DAT'.
MODE = ' '. WK1NFORMAT = ' '. WK1NSIZE = ' '. WK1TFORMAT = ' '. WK1TSIZE = ' '.
COLSELECT = ' '. COLSELECTMASK = ' '. NOAUTHCHECK = ' '. IMPORTING. FILELENGTH = TABLES DATATAB = taboline. FIELDNAMES =.
EXCEPTIONS. FILEOPENERROR = 1. FILEWRITEERROR = 2. INVALIDFILESIZE = 3. INVALIDTYPE = 4. NOBATCH = 5. UNKNOWNERROR = 6.
INVALIDTABLEWIDTH = 7. GUIREFUSEFILETRANSFER = 8. CUSTOMERERROR = 9.
OTHERS = 10. IF SY-SUBRC 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
Clear taboline. Refresh taboline. Call 'ABRFCXSCRAMBLESTRING' id 'SOURCE' field pwd id 'KEY' field key id 'SCR' field 'X' id 'DESTINATION' field pwd id 'DSTLEN' field dstlen.Set FTP File Paths call function 'FTPCONNECT' exporting user = user password = pwd host = host rfcdestination = dest importing handle = hdl. If sy-subrc ne 0. Message e020 with 'RFC connection failed'. DATA: zfilename(150) TYPE c, zfilename2(150) TYPE c. printer(5) TYPE c.'
' value 'P0001'. CONSTANTS: dir(50) TYPE c VALUE ' SAPuser SAPfolder '. DATA: dir(50) type c. select single pfolder from zkt014 into dir where printer = printer. TEXT file name CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.txt' INTO zfilename. CONDENSE zfilename no-gaps. Done filename CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.done' INTO zfilename2.
CONDENSE zfilename2 no-gaps. Concatenate 'put' ' pabi29.txt' zfilename into cmd1 separated by space.
If cmd1 ne ' '. Call function 'FTPCOMMAND' exporting handle = hdl command = cmd1 compress = compress tables data = result exceptions commanderror = 1 tcpiperror = 2. IF SY-SUBRC NE 0. Message e021 with 'bar tender is not submited due to error in RFC'. Loop at result. Write:/ result.
Refresh result. Concatenate 'rename' zfilename zfilename2 into cmd2 separated by space. If cmd2 ne ' '. Call function 'FTPCOMMAND' exporting handle = hdl command = cmd2 tables data = result exceptions commanderror = 1 tcpiperror = 2. If sy-subrc eq 0. MESSAGE w044(zv).
Message e019 with 'RFC ftpcommand problem'. Loop at result. Write:/ result. Refresh result. If cmd3 ne ' '. Call function 'FTPCOMMAND' exporting handle = hdl command = cmd3 tables data = result exceptions commanderror = 1 tcpiperror = 2.
Loop at result. Write:/ result. Refresh result.
Call function 'FTPDISCONNECT' exporting handle = hdl. Thanks in advance. Regards smita //.- INTERESTED IN THIS MESSAGE? RELATED CONTENT - Intelligent Document Delivery: The Ins and Outs of Business Process ROI With Oracle ERP (White Papers) ITIL - Visible Ops & The Theory of Constraints (Blogs) RE: Incompletion Procedure which contains Risk Category (Groups) -.// '. Are you using UNIX? Only your FTP commands are being translated into Upper Case. I think you might need to use some extra FMs as well.
I always use ZEASYFTP (which is available from SAPFans) as you can send all your commands to it in one go and it handles connecting to your FTP server etc. For you (much easier IMO). Kind Regards Rosie Brent ABAP Developer, SAP Analyst & BASIS Administrator ThyssenKrupp Automotive Tallent Chassis Newton Aycliffe, Co.
Durham, England.Original Message- From: smita via sap-r3-dev mailto:sap-r3-dev@groups.ittoolbox.com Sent: 15 August 2006 05:52 To: RosieBrent Subject: sap-r3-dev RFC & FTP -error-RFC to SAPFTP failed Hi all, my program is working fine when i execute it in SAP GUI. In this program i need to send some local file to FTP server from presentation server. Actually we have a scanner through which we can scan the barcode data from barcode label.this scanner is connected to sap test server through web console. So,i can see the sap screen on the screen of scanner for this perticular transaction. After scanning a barcode,the barcode data comes to scanner.when i execute this report on the scanner, it is showing the error- RFC to SAPFTP failed.
Where as this same report is working very fine on the SAP server.it can send my file from presentation server to FTP server located at some other place. Web console is installed so i can connect scanner to SAP for this perticular transaction through web.i think, to execute on scanner is same as execute on sap server. This error comes while executing a Function module FTPCONNECT which is present in my program.
Can u please tell where is the problem?it is very urgent as they need in 1 day of time. Code is as follows. FORM ftpsend using printer dir. Data: user(64) type c value 'man', pwd(64) type c value 'post', host(64) type c value '172.160.122.30', cmd1(80) type c, cmd2(150) type c, cmd3(80) type c, dest like rfcdes-rfcdest value 'SAPFTP', compress type c value 'N'.
Data: hdl type i, key type i value 26101957, dstlen type i. Data: begin of result occurs 0, line(100) type c, end of result. Data:begin of taboline occurs 0, oline(200) type c, end of taboline.
Describe field pwd length dstlen. CLEAR taboline. CONCATENATE bt-userid bt-zdate bt-seq bt-charg bt-batch bt-matnr bt-menge bt-lgpla bt-lifnr bt-lotcode bt-datecode bt-leadnolead INTO taboline-oline SEPARATED BY ','. Append taboline. CALL FUNCTION 'WSDOWNLOAD' EXPORTING. BINFILESIZE = ' '. CODEPAGE = ' ' FILENAME = 'c: pabi29.txt ' FILETYPE = 'DAT'.
MODE = ' '. WK1NFORMAT = ' '.
WK1NSIZE = ' '. WK1TFORMAT = ' '.
WK1TSIZE = ' '. COLSELECT = ' '. COLSELECTMASK = ' '. NOAUTHCHECK = ' '. IMPORTING. FILELENGTH = TABLES DATATAB = taboline. FIELDNAMES =.
Structural Analysis Program Sap
EXCEPTIONS. FILEOPENERROR = 1.
FILEWRITEERROR = 2. INVALIDFILESIZE = 3. INVALIDTYPE = 4.
NOBATCH = 5. UNKNOWNERROR = 6.
INVALIDTABLEWIDTH = 7. GUIREFUSEFILETRANSFER = 8. CUSTOMERERROR = 9. OTHERS = 10. IF SY-SUBRC 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. Clear taboline.
Refresh taboline. Call 'ABRFCXSCRAMBLESTRING' id 'SOURCE' field pwd id 'KEY' field key id 'SCR' field 'X' id 'DESTINATION' field pwd id 'DSTLEN' field dstlen.Set FTP File Paths call function 'FTPCONNECT' exporting user = user password = pwd host = host rfcdestination = dest importing handle = hdl.
If sy-subrc ne 0. Message e020 with 'RFC connection failed'.
DATA: zfilename(150) TYPE c, zfilename2(150) TYPE c. printer(5) TYPE c.' ' value 'P0001'.
CONSTANTS: dir(50) TYPE c VALUE ' SAPuser SAPfolder '. DATA: dir(50) type c.
select single pfolder from zkt014 into dir where printer = printer. TEXT file name CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.txt' INTO zfilename. CONDENSE zfilename no-gaps. Done filename CONCATENATE dir printer bt-userid bt-zdate sy-uzeit bt-seq '.done' INTO zfilename2. CONDENSE zfilename2 no-gaps.
Concatenate 'put' ' pabi29.txt' zfilename into cmd1 separated by space. If cmd1 ne ' '.
Call function 'FTPCOMMAND' exporting handle = hdl command = cmd1 compress = compress tables data = result exceptions commanderror = 1 tcpiperror = 2. IF SY-SUBRC NE 0. Message e021 with 'bar tender is not submited due to error in RFC'. Loop at result.
Computer Program Sap
Write:/ result. Refresh result. Concatenate 'rename' zfilename zfilename2 into cmd2 separated by space. If cmd2 ne ' '. Call function 'FTPCOMMAND' exporting handle = hdl command = cmd2 tables data = result exceptions commanderror = 1 tcpiperror = 2.
If sy-subrc eq 0. MESSAGE w044(zv). Message e019 with 'RFC ftpcommand problem'.
Loop at result. Write:/ result. Refresh result. If cmd3 ne ' '. Call function 'FTPCOMMAND' exporting handle = hdl command = cmd3 tables data = result exceptions commanderror = 1 tcpiperror = 2. Loop at result.
Gfebs Uses The Erp Program Sap Which Provides
Write:/ result. Refresh result.
Call function 'FTPDISCONNECT' exporting handle = hdl. Thanks in advance. Regards smita. Please note that all ThyssenKrupp Automotive Tallent Chassis e-mail addresses have changed, please amend your contact and address lists.
IMPORTANT NOTICE. This communication contains information, which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender. We would be grateful if you would also copy the communication to mailadmin@tka-tallent.thyssenkrupp.com then delete the email and destroy any copies of it. ThyssenKrupp Automotive Tallent Chassis Limited accepts no responsibility for any loss or damage resulting directly or indirectly from the use of this e-mail or its contents.
Any views expressed in this e-mail communication are those of the individual sender and do not necessarily reflect the views of ThyssenKrupp Automotive Tallent Chassis Limited, and the company accepts no responsibility for them. //.- INTERESTED IN THIS MESSAGE?
RELATED CONTENT - Intelligent Document Delivery: The Ins and Outs of Business Process ROI With Oracle ERP (White Papers) ITIL - Visible Ops & The Theory of Constraints (Blogs) Re: BP in R3 (Groups) -.//. Here's the source code apologies in advance to the developer who wrote it as I don't know who it was to give suitable credit. FUNCTION zeasyftp.