*
* SAP FTP functions
*
* This sample program will logged into your Unix Server.
*
* Issue a Unix dir command
*
* Store the dir information in the Internal table and display it.
*
* Make sure you can telnet in to your SAP-UNIX FTP server first.
*
REPORT ZFTPSAP LINE-SIZE 132.
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
USER = 'userid'
PASSWORD = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
HOST = 'unix-host'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
WRITE: / 'Error in FTP Command'.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Showing posts with label Unix and FTP. Show all posts
Showing posts with label Unix and FTP. Show all posts
Friday, November 23, 2007
sap abap FTP programming
Labels:
Unix and FTP
sap abap program for Issuing an Unix Command from ABAP
*
* Issuing an Unix Command from ABAP
*
REPORT ZUNIX.
DATA UNIXCMD(50) TYPE C.
DATA: BEGIN OF ITAB occurs 0,
LINE(200),
end of ITAB.
PARAMETERS UNIXCOMM LIKE UNIXCMD
DEFAULT 'ls -ls /usr/sap/trans/data' LOWER CASE.
* Executing the system commands witin ABAP.
call 'SYSTEM' id 'COMMAND' field UNIXCOMM
id 'TAB' field ITAB-*SYS*.
EDITOR-CALL FOR ITAB DISPLAY-MODE.
Labels:
Unix and FTP
Subscribe to:
Posts (Atom)
Blog Archive
-
▼
2009
(81)
-
▼
June
(81)
- Lists in Unicode Systems
- The File Interface in Unicode Programs
- Character String and Byte String Processing in Uni...
- Structure Enhancements and Unicode Programs
- Structure Typing in Unicode Programs
- Conversion of Structures in Unicode Programs
- Access to memory sequences in Unicode programs
- Offset and Length Specifications in Unicode Programs
- Alignment in Unicode Systems
- Operand Types in Unicode Programs
- Names in Unicode Programs
- Comments and Literals in Non-Unicode Programs
- Differences between Unicode and Non-Unicode Programs
- Unicode - Overview
- Statements in Class and Interface Pools
- Statements for Defining Classes and Interfaces
- ABAP Objects - Keywords
- Inheritance Events
- Inheritance and Events
- Inheritance and Instantiation
- Inheritance and Constructors
- Inheritance and Static Components
- Inheritance and the Component Namespace
- Inheritance and Visibility
- Inheritance and Interfaces
- Inheritance and Polymorphism
- Abstract and Final Methods and Classes
- Redefining Methods
- Inheritance
- Definition of Classes and Interfaces
- Object Orientation
- CLASS-METHODS - FOR EVENT
- CLASS-METHODS - class_constructor
- CLASS-METHODS - RETURNING
- METHODS - IMPORTING, EXPORTING, CHANGING, RAISING
- CLASS-METHODS - IMPORTING, EXPORTING, CHANGING, RA...
- CLASS-METHODS
- Kernel Methods
- The C Destructor in Methods
- Interface Parameters in Methods
- Data Types and Constants
- Events In Components of classes
- Constructors In Components of Classes
- Methods in Components of classes
- Attributes
- Visibility Sections in Classes
- Components of Classes
- Classes
- ABAP Objects
- ABAP Programming Language - Overview
- Example of a Logical Database
- Logical Databases
- Position of the Basis System Within the R/3 System
- Running ABAP Programs
- Calling ABAP Dialog Modules
- Data Types in the ABAP Dictionary
- Pushbuttons on the Screen
- Processing Input/Output Fields
- Processing Screen
- Screens
- ABAP User Dialogs
- Reduce the Database Load
- Minimize the Search Overhead
- Minimize the Number of Data Transfers
- Minimize the Amount of Data Transferred
- Keep the Result Set Small
- Performance Notes
- Committing Database Changes
- Inserting or Changing Lines
- Deleting Lines
- Changing Line
- Inserting Lines into Tables
- Changing Data
- Reading Data
- Open SQL
- Checking User Authorizations
- Accessing the Database in the R/3 System
- ABAP Database Access
- ABAP HR Programming
- ABAP Tutorials for Beginners
- Download Abap certification material
-
▼
June
(81)



