Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Related to application server

Former Member
0 Kudos

Hi All,

When a file name with directory path is entered in the selection screen, ho w to check if the user actually has permissions to create an output file in the given directory(Application server) .Is there any function module or other logic to find out where user have permission to create a file in directory.Please do needful help.

Thanks

Abhi....

5 REPLIES 5

Former Member
0 Kudos

i think u have to check Authorization Object-

S_DATASET

Definition

Authorizations for accessing files from ABAP/4 programs.

You use this object to assign authorizations for accessing operating system files (with the ABAP/4 key word OPEN DATASET, READ DATASET, TRANSFER and DELETE ). This key word can also be used to assign the authorization for using operating system commands as a file filter.

In ABAP/4 programs, you perform the authorization check with the function module AUTHORITY_CHECK_DATASET.

Defined fields

The object consists of the following fields:

ABAP/4 program name: Name of the ABAP/4 program that contains the access. You can restrict the file access to a few known access programs.

Activity: Possible values:

33: Normal file read

34: Normal file write or deletion

A6: Read file with filter (operating system command)

A7: Write to a file with filter (operating system command)

File name: Name of the operating system file. Here, you can restrict the accessible files.

Regards

Prabhu

Former Member
0 Kudos

Hi shaik,

1. one thing is we can initially use open filename for output command.

2. if sy-subrc <> 0,

then based upon the value of sy-subrc (just see f1 help on this command and its return values),

we can know whether rights are there or not.

regards,

amit m.

Former Member
0 Kudos

when you use OPEN DATASET

The system automatically checks authorizations for the

operation. If the authorization check fails, a runtime

error occurs. You can prevent this by checking the

authorization in advance using the function module

AUTHORITY_CHECK_DATASET.

Former Member
0 Kudos

Hi Shaik,

You can do the same i.e. uploading the file in the application layer directly thru Transaction.

use the transactions.

CG3Y and CG3Z

Also,

there are two function modules you can use....

C13Z_FRONT_END_TO_APPL to go from presentation to application server

C13Z_APPL_TO_FRONT_END to go from app server to front end

And about verifying whether you have the authorization for that folder in the applocationlayer or not I thin is related with the authorization objects.

Regards,

Jayant.

Former Member
0 Kudos

Hi Abhi,

The easiest way is to use function module RZL_READ_DIR_LOCAL it full fills all your requirements. See example below.

  • check existence file path

CALL FUNCTION 'PFL_CHECK_DIRECTORY'

EXPORTING

directory = '/tmp'

WRITE_CHECK = 'X' "check for write access

FILENAME = 'filename'

EXCEPTIONS

PFL_DIR_NOT_EXIST = 1

PFL_PERMISSION_DENIED = 2

PFL_CANT_BUILD_DATASET_NAME = 3

PFL_FILE_NOT_EXIST = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • invalid directory

MESSAGE ID 'EA' TYPE 'E' NUMBER '334'

WITH p_path.

ENDIF.

Do not forget to tick the box "Uppercase/Lowercase" if you test the function module with transaction SE37 (Unix is case sensitive).

I hope this is what you are looking for.

Best Regards,

Dennis