Application Development and Automation 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: 
Read only

validate file path

Former Member
0 Likes
2,665

i am sending a file to AL11, i need to validate file path which is in selection screen parameter

can u suggest any possabilities

Regards

Rassheed

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,492

Threre are some Function Modules which work on application server directory, try something like

* Read directories of an application server
  CALL FUNCTION 'RZL_READ_DIR'
       EXPORTING
            name           = directory
            nrlines        = 1
       TABLES
            file_tbl       = file_table
       EXCEPTIONS
            argument_error = 1
            not_found      = 2
            send_error     = 3
            OTHERS         = 4.

Which return the list of files in such a directory. Look also at Function Group SAL3

Regards

5 REPLIES 5
Read only

Former Member
0 Likes
1,492

Try adding the old open dataset to your AT-SELECTION-SCREEN event

Open dataset p_file for output in TEXT MODE.

IF SY-SUBRC <> 0.

MESSAGE E000...

ENDIF.

Read only

Former Member
0 Likes
1,492

Hi rasheed,

Try this Instead of using AL11,

CG3Y To Save a file From Application server to Presentation server directly.

CG3Z To Save a file From Presentation server to Application server directly.

Thanks.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,493

Threre are some Function Modules which work on application server directory, try something like

* Read directories of an application server
  CALL FUNCTION 'RZL_READ_DIR'
       EXPORTING
            name           = directory
            nrlines        = 1
       TABLES
            file_tbl       = file_table
       EXCEPTIONS
            argument_error = 1
            not_found      = 2
            send_error     = 3
            OTHERS         = 4.

Which return the list of files in such a directory. Look also at Function Group SAL3

Regards

Read only

Former Member
0 Likes
1,492

Hi ,

At u r selection screen if u r using FM : F4_FILENAME , then it will automatically opens the bwowser, then u dont have to worry abt file validation.

if u r sending file to AS, using opendataset......... then if file doesnt exists in the AS then it will automatically create it and if file already exists in AS then it will replace that one.

Reward points if useful..

Regards

Nilesh

Read only

Former Member
0 Likes
1,492

Hi

You could simply try opening it. If sy-subrc <> 0, then you know that the path/filename is not found.


parameters:
p_filename ....
at selection-screen.

OPEN DATASET p_filename FOR INPUT IN TEXT MODE.
 
if sy-subrc = 8.
  message 'file not found' type i.
endif.

and also

Check this code:


  DATA: dl_file TYPE ibipparms-path.    " File name
  CONSTANTS: c_dir       TYPE  rlgrap-filename.
 
* F4 filename for Application server
    CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
      EXPORTING
        directory        = c_dir
        filemask         = ' '
      IMPORTING
        serverfile       = dl_file
      EXCEPTIONS
        canceled_by_user = 1
        OTHERS           = 2.
    IF sy-subrc <> 0.
      MESSAGE e000 WITH 'Error while getting the file name'(006).
      EXIT.
    ELSE.
      p_file =  dl_file.
    ENDIF.
 

please check this FM DX_FILE_EXISTENCE_CHECK.

To validate the path

Just check these links

Regards Rk

Message was edited by:

Rk Pasupuleti