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: 

Table or function module from for complete physical file path?

Former Member
0 Kudos
3,993

Hi All,

I know the Logical file and Logical path name, i can see the complete path also from logical path name i.e. the physical file address through transaction FILE, e.g. /USR/TMP/ , but i want to display this path in one of the report output,

so please help me with the table or the function module which can give me the complete physical file path.

I checked the the table ADMI_FILES but it contains the file name or the Logical path name but the complete physical file address e.g /USR/TMP?, like this is not available. More over i tried function module file_get_name, still the physical address is not correct one, it is giving same address for all logical paths.

Kindly Guide me for this

Regards,

Nikesh Kumar

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos
1,075

try sth like this:

 

    CALL FUNCTION 'FILE_GET_NAME_AND_LOGICAL_PATH'
      EXPORTING
        LOGICAL_FILENAME = LDS_NAME
            IMPORTING
        FILE_NAME        = sfile
        LOGICAL_PATH     = pth
      EXCEPTIONS
        FILE_NOT_FOUND   = 01.
    IF SY-SUBRC NE 0.
      MESSAGE E300(BD) WITH LDS_NAME.                         " TODO MG
    ENDIF.
                                                                                SELECT single PATHEXTERN FROM path INTO expth
           where pathintern = pth.
    replace '<FILENAME>' with space into expth.

    concatenate expth '/' sfile into sfile.
    open dataset sfile for output in text mode encoding default.

A.

12 REPLIES 12

SuhaSaha
Advisor
Advisor
0 Kudos
1,075

Check the SDN forum for the FM: FILE_GET_NAME.

BR,

Suhas

GauthamV
Active Contributor
0 Kudos
1,075

Check the view V_FILEPATH.

Former Member
0 Kudos
1,075

Hi Gautham,

I already checked the view V_FILEPATH but it contains the only the Logical Path name, not the whole physical path.

For physical path we have to got to transaction FILE, then select the physical path and then Physical address.

But i want the exact file path, e.g. /USR/TMP/

0 Kudos
1,075

Did you check the finction module: FILE_GET_NAME ?

[http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm]

BR,

Suhas

GauthamV
Active Contributor
0 Kudos
1,075

You can use view V_PATH.

Former Member
0 Kudos
1,075

Hi Suhas,

yes i checked this function module but the problem is that, for all logical path it is giving same file nam /usr/sap/SBD/SYS/global/tempfile. But when i go in trasaction file and check the path provided in physical file address is entirely different. But this function module is giving this path only for all logical paths.

BR,

Nikesh

0 Kudos
1,075

Did you check the SAP help documentation for the func. module ?

You have to pass the logical filename & not the logical filepath

Alternatively for filepath you can use the view V_PATH.

BR,

Suhas

Former Member
0 Kudos
1,075

Hi Gautham,

I check this view V_PATH as well, but how can we extract the data from it and disply in the report?

Former Member
0 Kudos
1,075

Yes Suhas,

You are right we need to give Logical file name but the problem is that it is giving the same physical path for all file names which is different when we see in the trasanction FILE.

e.g. if i run for file name WORKFILE_TEMPORARY_DATA then the FM gives /usr/sap/SBD/SYS/global/tempfile as file path but if i go and check in transaction file then it is different

0 Kudos
1,075

Hello,

Excerpt from the SAP documentation:

Suppose we have a logical file name EMPTY with the physical file name TEST, connected to a logical path that has no specification of a physical path. ...

Call the FM: FILE_GET_NAME ....

The system created an emergency file name, whose path depends on the installation of the current R/3 System.

I think this might be the cause for this behavior. Check if the physical path of the logical path has been defined correctly & actually exists in the app server.

BR,

Suhas

andreas_mann3
Active Contributor
0 Kudos
1,076

try sth like this:

 

    CALL FUNCTION 'FILE_GET_NAME_AND_LOGICAL_PATH'
      EXPORTING
        LOGICAL_FILENAME = LDS_NAME
            IMPORTING
        FILE_NAME        = sfile
        LOGICAL_PATH     = pth
      EXCEPTIONS
        FILE_NOT_FOUND   = 01.
    IF SY-SUBRC NE 0.
      MESSAGE E300(BD) WITH LDS_NAME.                         " TODO MG
    ENDIF.
                                                                                SELECT single PATHEXTERN FROM path INTO expth
           where pathintern = pth.
    replace '<FILENAME>' with space into expth.

    concatenate expth '/' sfile into sfile.
    open dataset sfile for output in text mode encoding default.

A.

0 Kudos
1,075

@andreas, You are genious, Points awarded. Thanks a lot

@Suhas and Gautham thanks a lot, points awarded, your answer was helpful

Edited by: nikesh kumar on Mar 8, 2010 12:39 PM