REPORT YSMT018A
MESSAGE-ID YL.
* ABAP to append ribesnsl to ribes
* and remove input file using sxpg_command_execute
DATA: FILE1(25) VALUE '/vmedata/???/file1nsl'.
DATA: FILE2(25) VALUE '/vmedata/???/file2'.
DATA: W_MESSAGE(50).
DATA: RLBES LIKE RLBES.
FILE1+9(3) = SY-SYSID.
FILE2+9(3) = SY-SYSID.
* sxpg_command_execute parameters
DATA: REMOVE_FILE LIKE SXPGCOLIST-PARAMETERS.
DATA: PROTOCOL LIKE BTCXPM OCCURS 0.
*
OPEN DATASET FILE2 FOR APPENDING IN TEXT MODE MESSAGE W_MESSAGE.
IF SY-SUBRC NE 0 .
MESSAGE E114 WITH FILE2 W_MESSAGE.
ENDIF.
OPEN DATASET FILE1 FOR INPUT IN TEXT MODE MESSAGE W_MESSAGE.
IF SY-SUBRC NE 0.
MESSAGE E114 WITH FILE1 W_MESSAGE.
ENDIF.
DO.
READ DATASET FILE1 INTO RLBES.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
TRANSFER RLBES TO FILE2.
IF SY-SUBRC NE 0.
MESSAGE E009 WITH FILE2 SY-SUBRC.
ENDIF.
ENDDO.
MESSAGE I114 WITH FILE1 'appended'.
***----------------------------------------------------------------****
DATA: COMMAND3(60)
* VALUE 'rm /vmedata/???/rlbesnsl' .
VALUE 'rm /vmedata/???/file1nsl' .
COMMAND3+12(3) = SY-SYSID.
*submit the unix command remove file1
REMOVE_FILE = COMMAND3+3.
* create y_remove command in sm69
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
COMMANDNAME = 'Y_REMOVE'
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE = ' '
ADDITIONAL_PARAMETERS = REMOVE_FILE
* IMPORTING
* STATUS =
TABLES
EXEC_PROTOCOL = PROTOCOL
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
WRONG_ASYNCHRONOUS_PARAMETERS = 12
CANT_ENQ_TBTCO_ENTRY = 13
JOBCOUNT_GENERATION_ERROR = 14
OTHERS = 15.
IF SY-SUBRC = 0.
MESSAGE I114 WITH FILE1 'deleted'.
ENDIF.
Tuesday, May 6, 2008
Sample ABAP Program to Execute Unix command from within SAP
Labels:
Sample ABAP Code Programs
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2008
(300)
-
▼
May
(80)
- Object oriented programming (OOP) All Steps
- Object oriented programming (OOP) Step2
- Object oriented programming (OOP) Step-by-step
- Object oriented programming (OOP) explained with a...
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- The Other 50 ABAP Interview Faq's
- More than 100 ABAP Interview Faq's
- Events in Report
- Example: The IDoc Type ORDERS01
- Program for Outbound IDOC
- Basic Configuration in IDOC
- Sample ABAP Program to Upload table using new func...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Submitting report with sel...
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for giv...
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application...
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing scr...
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert ...
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from w...
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/downlo...
- Sample ABAP Program to download table using new fu...
- Sample ABAP Program to Download file to Presentati...
- Sample ABAP Program to display pop message to avoi...
- Sample ABAP Program of ALV Grid
- Sample ABAP Program of Dialogue Module Pool
- Sample ABAP Program to DIALOGUE FLOW LOGIC
- Sample ABAP Program to Delete a file from the appl...
- Sample ABAP Program to Compare to Unix or PC files...
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference betwee...
- Sample ABAP Program of BW User Exit
- Sample SAP ABAP Program to Browse a file on the ap...
- Sample SAP ABAP Program of ALV Grid control using ...
- SE30 - Runtime Analysis Tool
- List of System fields
- Write a report that displays the text 'Hello world...
- HR (Human Resource) Tutorials Free downloads
- FI (Financial) Tutorials Free downloads
- PM (Plant Maintenance) Tutorials Free downloads
- WM (Warehouse Management) Tutorials Free downloads
- QM (Quality Management) Tutorials Free downloads
- PP (Production Planning) Tutorials Free downloads
- SD (Sales and Distribution) Tutorials Free downloads
- MM (Material Management) Tutorials Free downloads
- IDOC INTRODUCTION & STRUCTURE
- Step-by-Step Guide for using LSMW to Update Custom...
- LIST of TABLES
- Transporting Objects and Standard Text from one cl...
- SAP R/3 INTERVIEW ARCHITECTURE QUESTIONS
- SAP TRANSACTIONS INTERVIEW QUESTIONS
- SAP MODULARIZATION INTERVIEW QUESTIONS
- SAP LOGICAL DATABASE INTERVIEW QUESTIONS
- SAP R/3 DATA DICTIONARY INTERVIEW QUESTIONS
- SAP BDC INTERVIEW QUESTIONS & ANSWERS
- SAP ABAP MENU PAINTER & SCREEN PAINTER Tutorials
- SAP ABAP WORKFLOW Tutorials PDF Free downloads
- SAP ABAP ITS Tutorials PDF Free downloads
- SAP ABAP EDI Tutorials PDF Free downloads
- SAP ABAP BAPI Tutorials PDF Free downloads
- SAP ABAP Change&Transport System Tutorials PDF Fre...
- SAP ABAP OBJECTS Tutorials PDF Free downloads
- SAP ABAP USER EXITS Tutorials PDF Free downloads
- SAP ABAP ALE Tutorials PDF Free downloads
- SAP ABAP IDOC Tutorials PDF Free downloads
- SAP ABAP LSMW Tutorials PDF Free downloads
- SAP ABAP BDC (Batch Data Communication) Tutorials ...
- SAP ABAP SAPSCRIPTS Tutorials Free downloads
- ALV Grid free download
- SAP ABAP INTERACTIVE REPORTING FAQs
- SAP ABAP REPORTING GENERAL
- SAP REPORTS FAQ
-
▼
May
(80)
No comments:
Post a Comment