tags:

views:

1335

answers:

4

you would think this would be obvious, but searching through documentation, SAP forums, Googling, etc., I've been spectacularly unsuccessful. I'm creating a file in ABAP on a solaris filesystem using the following code:

OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

the resulting file is owned and grouped according to a pre-defined admin user, which is fine, but the sticky wicket is that the permissions are set to 660/rw-rw----, meaning I can't examine the results. is there a way (possibly using that vaguely defined TYPE addition?) I can specify the resulting permissions on the new file?

thanks!

+2  A: 

Go to SM69, create a logical system command, you could call it ZCHMOD.

Map that command to chmod, then call with the proper parameter. ( man chmod on the command line is your friend )

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
  EXPORTING
    commandname                   = 'ZCHMOD'
    additional_parameters         = l_par
    operatingsystem               = l_os
  TABLES
    exec_protocol                 = it_log
  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.

Obviously, that would be a 2 step process, but it works.

T.

tomdemuyt
wow, weird hoop jumping, but yeah, this looks right.
wise
A: 

What's the umask of the running process? Can you alter it?

wnoise
+1  A: 

Hi,

this works in 4.6B:

        CONCATENATE 'chmod ugo=rw ' lc_filename
          INTO lc_chmod SEPARATED BY space.
        CALL 'SYSTEM' ID 'COMMAND' FIELD lc_chmod.

Hope this helps.

Cheers, Heiko

Dubious about public write; try 'ug=rw,o=r'.
Jonathan Leffler
A: 

Hi!

In RZ10 add parameter install/umask. Default value is 007, you can change it: 000, 002... So, the files created will be -rw-rw-rw-, -rw-rw-r--...