cancel
Showing results for 
Search instead for 
Did you mean: 

Setting properties of a file

Former Member
0 Kudos

Hi,

I've used an ABAP program to transfer a file to the App server. However, i need to set the rwx properties of the file. I tried to use sm49 and create a command to perform chmod. It does'nt seem to work. Does any one know how i can set the attributes of a file.

Thanks,

Siddarth

Accepted Solutions (1)

Accepted Solutions (1)

eddy_declercq
Active Contributor
0 Kudos

Hi,

The chmod way should work. We do it a lot. Make sure that the SAP system user on your system has enough permissions and/or ownership.

Eddy

Former Member
0 Kudos

Hi Eddy,

Is sm49 the only way to execute this command. I'm not able to use FTP to this server. Is there any other way to do this? (perform the chmod)

Thanks,

Siddarth

eddy_declercq
Active Contributor
0 Kudos

Siddarth,

Can you ellaborate more on the file upload. Where does it come from, how are you uploading it, etc?

Eddy

Former Member
0 Kudos

I'm using this ABAP program to upload the file from my local workstation to the server.

REPORT ZSV_LOAD_FILE.

DATA : BEGIN OF i_tab OCCURS 0,

line TYPE string,

END OF i_tab.

DATA: vfname TYPE string.

PARAMETERS : pa_flein(100) TYPE c, "File from Frontend

pa_fleot(100) TYPE c LOWER CASE."File on APP. Server

***********************************************************************

  • START-OF-SELECTION *

***********************************************************************

START-OF-SELECTION.

vfname = pa_flein.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = vfname

filetype = 'ASC'

TABLES

data_tab = i_tab

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc <> 0.

BREAK-POINT. "Place appropriate message here

ENDIF.

  • Transfer File to appropriate Dest.

OPEN DATASET pa_fleot FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

IF sy-subrc NE 0.

BREAK-POINT. "Place appropriate message here

ELSE.

LOOP AT i_tab.

TRANSFER i_tab-line TO pa_fleot.

ENDLOOP.

ENDIF.

CLOSE DATASET pa_fleot.

eddy_declercq
Active Contributor
0 Kudos

Hi,

THe I would go for chmod for a system command in SM49. You don't need to execute it manually though.

In the same ABAP you can start the external command (defined in in sm49) via eg.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

commandname = 'Z_CHMOD'

ADDITIONAL_PARAMETERS = param

OPERATINGSYSTEM = SY-OPSYS

  • TARGETSYSTEM = SY-HOST

  • DESTINATION =

  • STDOUT = 'X'

  • STDERR = 'X'

TERMINATIONWAIT = 'X'

  • TRACE =

  • IMPORTING

  • STATUS =

  • EXITCODE =

tables

exec_protocol = tabel

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

Put the chmod in a shelk script and use params you give via the above additional params.

All this with enough permissions in mind.

Eddy

Answers (0)