10-01-2014 7:10 AM
Hi ,
I am trying to move a file from one location to another location on the application server. I have used FM ' ARCHIVFILE_SERVER_TO_SERVER' which is actually copying the file but not moving.
then I have tried using external commands in Windows NT.
SM49 :
Command name ZMV
Operating system WINDOWS NT
Operating system command CMD
Parameters for operating system command /C MOVE E:\sapio\import\psp e:\sapio\import\psp\archive
and using FM :
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMV'
additional_parameters = l_para
IMPORTING
status = l_stat
but it is giving an error message saying command not found. I do not want to use OPEN DATASET concept.
would you please help me?
Murali
10-01-2014 7:47 AM
Hi Murali,
After the file is copied with FM ARCHIVFILE_SERVER_TO_SERVER, can't you just delete it? (delete dataset)
Regards,
Custodio
10-01-2014 7:47 AM
Hi Murali,
After the file is copied with FM ARCHIVFILE_SERVER_TO_SERVER, can't you just delete it? (delete dataset)
Regards,
Custodio
10-01-2014 10:29 AM
Hi Custodio,
Thank you for your reply ,I can delete using delete dataset. but how can we use external commands ?
Murali
10-09-2014 10:23 AM
Hi,
I am using DELETE DATASET and this statement is working fine in Development and not in Quality ( Sy-subrc = 4) . do we require to use OPEN DATASET before DELETE DATASET? I am not sure about this, but I have used the OPEN DATASET statement and strangely it is working in Developement and not in Quality ( SY-SUBRC = 😎 . But authorization check was successful in both the systems. any idea why it is happening?
Code:
OPEN DATASET SOURCE_PATH FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. – giving sy-subrc value ‘0’ in TRD and ‘8’ in TRQ.
CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
EXPORTING
PROGRAM = sy-repid
ACTIVITY = SABC_ACT_DELETE
FILENAME = LV_AUTHFILE
EXCEPTIONS
NO_AUTHORITY = 1
ACTIVITY_UNKNOWN = 2
* OTHERS = 3
.
IF SY-SUBRC = 1. – Authorization check is successful in both the systems.
* Implement suitable error handling here
MESSAGE E011(ZBRIM) with WA_FILES-NAME RAISING NO_AUTHORITY.
ENDIF.
Murali
07-18-2016 7:54 PM
Hi, you can try system function calls.
This way you can call OS commands.
PARAMETERS: command TYPE string LOWER CASE.
DATA: commtext(120) ,
itab(255) OCCURS 10 WITH HEADER LINE.
commtext = command.
CALL 'SYSTEM' ID 'COMMAND' FIELD commtext ID 'TAB' FIELD itab[].
LOOP AT itab.
WRITE itab.
ENDLOOP
10-01-2014 10:45 AM
Pl check in SM49 if your command has Op System as WINDOWS NT or Windows NT. If it is the 2 one change the same to all caps and try again.