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.
ABAP/4,ABAP report,Interactive Report Example,ALV grid Example,ALV list,IDOC,User Exit,RFC,Smartform,sapscript,ABAP Performance,Remote Function Module( RFC ),Function Module,ABAP Sample Code,ABAP tools,ALV report Generator,ABAP Interview Questions,BDC,BAPI,ALE,BADI,EDI,InternalTable,Data Structure,LSMW,Domain,DataElement,Basis and Administration,ABAP HR development,ABAPDebugger,BW,Exception Handling,Download FI, CO, MM, PP, SD, PM, PS, QM, SM, HR, BW, APO,ABAP Tutorial
Thursday, October 18, 2007
Subscribe to:
Post Comments (Atom)
Sample ABAP Code
- Sample ABAP Program to Upload table using new function GUI_UPLOAD
- Sample ABAP Program for Submitting report with selection table
- Sample ABAP Program for Sending SAP Mail
- Sample ABAP Program for Search Layout sets for given String
- Sample ABAP Program for Sapscript PerForm Module
- Sample ABAP Program for Create IDOC
- Sample ABAP Program for Output file to application server then send mail with Download details
- Sample ABAP Program for Module Pool Skeleton
- Sample ABAP Program for Module Pool containing screen loop processing
- Sample ABAP Program for MB1B Call Transaction
- Sample ABAP Program of Function Module to Convert Work Center into Personnel Number
- Sample ABAP Program of FTP Function Module
- Sample ABAP Program to EXPORT LIST TO MEMORY
- Sample ABAP Program to Execute Unix command from within SAP
- Sample ABAP Program to Get Output in EXCEL
- Sample ABAP Program to Implement EDI
- Sample Program to dynamically change upload/download program for any Table
- Sample ABAP Program to download table using new function GUI_DOWNLOAD
- Sample ABAP Program to Download file to Presentation Server
- Sample ABAP Program to display pop message to avoid abort
- 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 application server
- Sample ABAP Program to Compare to Unix or PC files and print differences
- Sample ABAP Program to Colour cells in ALV
- Sample ABAP Program to Calculate difference between date/times in hours
- Sample ABAP Program of BW User Exit
- Sample ABAP Program of ALV Grid control using OO methods
- Browse a file on the application server
No comments:
Post a Comment