Re: FM File_Get_Name

Hi All,
Currently we are using the FM File_get_name to get the path from AS400 Operating System, each time when i give the directory name the result which we are getting is either "Data Set Error " or "File psecified not found".
We checked it using Breakpoint, in that the funxn Module is picking up the OS but when it comes to the directory path its returing SY-SUBRC = 4 (i.e.) file not found.
Below we have given the sample of the code for better understanding.
data : filename(128),
CONSTANTS : fileout(128) VALUE '/usr/sap/xyz/abc/ 080.txt'.
OPEN DATASET fileout FOR OUTPUT IN  TEXT MODE ENCODING DEFAULT.
CALL FUNCTION 'FILE_GET_NAME'
  EXPORTING
   CLIENT                        = SY-MANDT
    LOGICAL_FILENAME              = 'dir_abc'
   OPERATING_SYSTEM              = SY-OPSYS
  PARAMETER_1                   = '01'
  PARAMETER_2                   = ' '
  PARAMETER_3                   = ' '
  USE_PRESENTATION_SERVER       = ' '
   WITH_FILE_EXTENSION           = 'X'
  USE_BUFFER                    = ' '
  ELEMINATE_BLANKS              = 'X'
IMPORTING
  EMERGENCY_FLAG                =
  FILE_FORMAT                   = format
   FILE_NAME                     = filename
EXCEPTIONS
   FILE_NOT_FOUND                = 1
   OTHERS                        = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
BREAK-POINT.
OPEN DATASET filename FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF SY-SUBRC = 0.
LOOP AT  IG_DATA into WG_DATA.
       MOVE-CORRESPONDING L_XML_TABLE TO WA_XML_TABLE.
        TRANSFER WG_DATA-XMLDATA TO fileout.
        CLEAR  WG_DATA.
      ENDLOOP.
      CLOSE DATASET fileout.
ELSE.
MESSAGE E008(ZIN01_MM).
ENDIF.
We used AL11 T-code to chk whether the Dir exsists or not, and we found that the directory is exisiting in the specified area. but we are not getting the output in the filed "filename".
Help and Suggestions will be much appreciated.
Regards.
Ramesh.

Hi Ramesh,
Just check out with the logical fiel name and path configuration in your system.
Here is the process to create Logical File Path.
1)Go to tcode FILE.
2) Click on Logical File Path Definition. Give name "ZTEST" and some description.
3) Click on Assignment of Physical Path to Logical Path. and provide Syntax Group and physical path.
4) Click on Logical File Name Definition and give descrition, physical filename, Data format as ASC, Application area and logical path which you have created.
Creating and Defining Logical Filenames
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3df8358411d1829f0000e829fbfe/content.htm
Using Logical Files in ABAP Programs
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm
Check this links.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3deb358411d1829f0000e829fbfe/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm
Regards,
Priyanka.

Similar Messages

  • Can't create a file using fm 'File_Get_Name'

    hi gurus,
    Can you please help me with this issue. There's a program that have to create a file using the said fm. It was working before when it was set in OS NT. But when the settings and codes have been changed to UNIX, the program was able to generate the program. But the file doesn't exist. It seems it  doesn't create a file in that server.
    What else do I need to check?
    Points will be rewarded. Thanks
    Here's the code for your reference:
    CALL FUNCTION 'FILE_GET_NAME'
           EXPORTING
    *         CLIENT                  = SY-MANDT
                logical_filename        = 'Z_SYSBRIDGE' 
             OPERATING_SYSTEM        = SY-OPSYS
    *         PARAMETER_1             = ' '
    *         PARAMETER_2             = ' '
    *         USE_PRESENTATION_SERVER = ' '
    *         WITH_FILE_EXTENSION     = ' '
    *         USE_BUFFER              = ' '
           IMPORTING
    *         emergency_flag          =
    *         file_format             =
                file_name               = ltfile-out_path
           EXCEPTIONS
                file_not_found          = 1
                OTHERS                  = 2.

    Hi Maui,
    Did you check SM69, where the code that ties to this FM creates a file after it execute your FM...
    SM69 are os commands that does UNIX execution or other OS commands...
    or maybe you have missed another FM like FM 'SXPG_OS_COMMAND' or of some sort.
    Thanks
    William Wilstroth

  • FILE_GET_NAME FM

    if i enter wrong name as input for this Parameter E_FILE (instead of selecting using F4)
    it goes to DATASET_CANT_OPEN short dump.
    how can i avoid this shortdump..eventhough i check for SY-subrc.
    OR HOW TO CHECK THAT INPUT LOGICAL NAME IS VALID NAME OR NOT?
    could you pls help me..
    DATA FOUT(90) type C.
    DATA FPATH(200) TYPE C.
    DATA FORMAT LIKE FILENAME-FILEFORMAT.
    PARAMETERS : E_FILE LIKE FILENAME-FILEINTERN OBLIGATORY.
    DATA FLAG(20) TYPE C.
    CONCATENATE FNAME FTXT INTO FOUT SEPARATED BY '.'.
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
       CLIENT                        = '800'
       LOGICAL_FILENAME              = E_FILE
       OPERATING_SYSTEM              = 'NT'
       PARAMETER_1                   = FOUT
      PARAMETER_2                   = ' '
      PARAMETER_3                   = ' '
      USE_PRESENTATION_SERVER       = ' '
      WITH_FILE_EXTENSION           = ' '
      USE_BUFFER                    = ' '
    IMPORTING
       EMERGENCY_FLAG                = FLAG
       FILE_FORMAT                   = FORMAT
       FILE_NAME                     = FPATH
    EXCEPTIONS
       FILE_NOT_FOUND                = 1
       OTHERS                        = 2
    IF SY-SUBRC <> 0.
    WRITE :/ text-ex6.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Message was edited by: ambi chan
    Message was edited by: ambi chan

    Hi Check this link
    Re: Parameters used for file input
    Check with the parameter u r passing and
      call function 'FILE_GET_NAME'
           exporting
                logical_filename = 'Z_IS_ZVA'
                parameter_1      = '/prot/'
           importing
                file_name        = prot_path
           exceptions
                file_not_found   = 1
                others           = 2.
      CONCATENATE PROT_PATH 'mail_' MAILN '.dat' INTO DATNAM.
        PROT_PATH  LIKE RLGRAP-FILENAME,
        DATNAM     LIKE RLGRAP-FILENAME
    http://www.baseportal.de/cgi-bin/baseportal.pl?htx=/matkoenig/abap4/abap4_ein&id=190
    Message was edited by: Judith Jessie Selvi

  • Problem with ...FILE_GET_NAME ??

    hi,
    I am using function FILE_GET_NAME to return me the physical path for the supplied Logical Path.
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
    IMPORTING
    FILE_NAME = FILE
    Now the function returns a path /tmp/XXXXXXX in FILE,
    But when i go and check in AL11 there is no such directory XXXXXXX in /tmp .
    DO i need to do something else ??

    Please use the FM
    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
           EXPORTING
             logical_path = 'MONTHLY_SALES_FILE'
             file_name = l_file
           IMPORTING
             file_name_with_path = l_file.
    Initialise your filename in the variable l_file.

  • Function FUNCTION FILE_GET_NAME and table FILENAMECI

    I have an ABAP program that calls FUNCTION 'FILE_GET_NAME' with only the logical_filename and operating_system parameters.  ex:
    CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = 'Z_SAP_TO_GAINS'
          operating_system = 'NT'
        IMPORTING
          file_name        = g_output
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
    This gets the physical file name correctly when run / debugged in DEV/TST and PRD.
    ex:
    DEV :
    serverT01\GAINS2\test\
    TST : 
    serverT01\GAINS2\test\
    PRD : 
    serverP01\GAINS01\
    I can see that FILENAMECI has different entries for Physical file (FILEEXTERN) in DEV and TST than it does in PRD.  I have read that transaction FILE can be used to maintain this Physical path, but it seems that best practice is to transport that from DEV.  How then, is our file path in FILENAMECI different in PRD?  Moreover, what is the best way to change this so that the function will retrieve the correct server name path when run in each environemnt.  Apparently the parameters to replace nodes in the physical path name were not used when this was designed.
    Is there a way to maintain the path without making ABAP changes to the application program?
    Thanks for your help!
    Jeremy

    Hi Shailesh,
    Thank you for the response.  I understand, and have found, that the way to change the FILENAMECI entries in TST and PRD is to migrate them.  Unfortunately, since the file paths need to be different in those environments, migrating a static file path from DEV all the way to PRD doesn't meet the need for DEV and TST once it is migrated.  I can see how this would be great if the substitution design had been in place for this file path/name, but it was static and didn't allow for "variable substitution".
    I did not have time with the project to rework this, so I did what the previous developer must have done and migrated it to PRD static for PRD and will rename FILENAMECI again afterwards, and re-migrate that file name as far as TST.
    When time allows, after this project is closed, I'm committed to cleaning this mess up.
    Thanks
    Jeremy

  • How do I use FILE_GET_NAME and make my resulting dataset name unique?

    Okay, here's a case where I have a bunch of pieces to the puzzle -- a little knowledge here, a little knowledge there -- but I'm having trouble putting them together.
    I am working on an RFC that is called by XI as part of an interface.  This interface will execute every 15 minutes.  As part of the RFC's execution (which is very simple and straight-forward) I would like to write out a dataset of the processing results.  I have already learned how to use the OPEN DATASET, TRANSFER, and CLOSE DATASET commands, so I'm good to go there.
    Here's what I'd like to do:  Because this can run every 15 minutes, I don't want to keep overwriting my dataset file with the latest version.  I'd like to keep the dataset name unique so it doesn't happen.  Obviously, the first thought that comes to mind is adding a date/time stamp to the file name, but I'm not sure how -- or the best way -- to do this.
    Also, I was told I should put the file -- for now -- into the DIR_DATA directory.  I had no idea what this meant until I was told about t-code "FILE" and that this was the logical file name.  Someone in-house thought I'd need to use a function called FILE_GET_NAME to make things easier.
    Okay, so I need to use FILE_GET_NAME apparently, somehow plugging in DIR_DATA as the directory I need, and I want the resulting file name to have the date/time added at run time.  I'm thinking when it comes to batch processing and writing out datasets, this has to be something that someone's already "paved the road" doing.  Has anyone done this?  Do you have a little slice of code doing just this that you could post?  This would go a long way toward helping me understand how this "fits" together, and I would greatly appreciate any help you can provide.
    As always, points awarded to all helpful answers.  Thank you so much!

    hey,
    here is the brief description of logical & physical path.
    in the physical path, we will give total path of the file,where the file is located actually in the server.
    for example : /INT/D01/IN/MYFILE.
    this is the physical path in my client for a particular file.
    some times this have problems like D01 above in the path,
    is development system. if we move to quality, it will be Q01 etc..
    to make every file independent of the server location, we use logical path concept, which is nothing but, instead of giving the total physical path like above,we will give this logical path & file name. before that we will create a logical path in sap & assign some physical path to it.
    the below function module is used to get the actual physical path by giving the logical path name & file name
    *&      Form  GET_PHYSICAL_PATH
          text This form used to get the Physical Filepath by giving the Logical path & the File name.
    FORM GET_PHYSICAL_PATH.
      DATA : LV_FILE(132) TYPE C,
             V_LENGTH TYPE I   ,
             LV_LOGNAME LIKE FILEPATH-PATHINTERN.
      LV_LOGNAME = P_LPATH.
    *--this P_LPATH is a parameter in the selection screen
    *--this P_FNAME is the actual file name as below
    *--PARAMETERS : P_LPATH TYPE RLGRAP-FILENAME,
                    P_fname TYPE RLGRAP-FILENAME.
      CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
           EXPORTING
                CLIENT                     = SY-MANDT
                LOGICAL_PATH               = LV_LOGNAME
                OPERATING_SYSTEM           = SY-OPSYS
                FILE_NAME                  = p_fname
           IMPORTING
                FILE_NAME_WITH_PATH        = LV_FILE
           EXCEPTIONS
                PATH_NOT_FOUND             = 1
                MISSING_PARAMETER          = 2
                OPERATING_SYSTEM_NOT_FOUND = 3
                FILE_SYSTEM_NOT_FOUND      = 4
                OTHERS                     = 5.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
    *--ur total physical(absolute) path will be in LV_FILE.
        V_FILEPATH = LV_FILE.
      ENDIF.
    ENDFORM.                    " GET_PHYSICAL_PATH
    unique naming for ur file names;
    after getting the physical path from the above function module, append date& time stamp to the file as below.
    CONCATENATE V_FILEPATH
                SY-DATUM
                SY-UZEIT
                INTO V_FILEPATH.
    This way you can make your file name unique always
    regards
    srikanth
    Message was edited by: Srikanth Kidambi

  • Need help for FILE_get_name

    1) For my senario I have to use the function module FILE_GET_NAME. Before using this function module do I configure any thing in 'FILE' transaction. If it is required please let me know the procedure to use this function module

    Hello Nani,
    You need to change any settings in 'FILE' transaction. This transaction is used to set up Logical file paths. ( In general it will be set already for your system).
    You can use the following code.
      DATA: LC_LOGICAL_FILENAME_EXPSRC LIKE RCGIEDIAL-IEFILE
                                                    VALUE 'EHS_IMP_SOURCES'.
      DATA:      L_EMERGENCY_FLAG            TYPE C.
      DATA:      L_FILE_FORMAT               LIKE FILENAME-FILEFORMAT.
      data : X_RCGIEDIAL LIKE  RCGIEDIAL occurs 0 with HEADER LINE.
      read the default pathname on application server
        CALL FUNCTION 'FILE_GET_NAME'
             EXPORTING
                CLIENT                  = SY-MANDT
                  LOGICAL_FILENAME        = LC_LOGICAL_FILENAME_EXPSRC
                  OPERATING_SYSTEM        = SY-OPSYS
                parameter_1             = ' '
                PARAMETER_2             = ' '
                USE_PRESENTATION_SERVER = ' '
                WITH_FILE_EXTENSION     = ' '
                USE_BUFFER              = ' '
             IMPORTING
                  EMERGENCY_FLAG          = L_EMERGENCY_FLAG
                  FILE_FORMAT             = L_FILE_FORMAT
                  FILE_NAME               = X_RCGIEDIAL-IEFILE
             EXCEPTIONS
                  FILE_NOT_FOUND          = 1
                  OTHERS                  = 2.
        write :/ 'file format', L_FILE_FORMAT,
               / 'file name', X_RCGIEDIAL-IEFILE.
    Thanks,
    Jyothi

  • FILE_GET_NAME and FILE

    Hi Experts,
          Can any one explain the use of Function moudule File_Get_name and the use of Transaction Code FILE.

    Hi Sir,
    Below is the complete details of FM's you have been lookin for with code also.
    Plz go through it.
    Plz do reward if useful.
    Thankx.
    Transaction code FILE allows you to create a logical path name and the fiel
    name.
    Platform-independent file names are used in applications programs by the function module FILE_GET_NAME. For a given logical file name, the function module generates the corresponding platform-specific file name at runtime, based on definitions stored in customizing tables for converting platform-independent file names.
    The following table gives an overview of its import and export parameters and of its exceptions.
    Table: Interface of function module FILE_GET_NAME
    IMPORT parameter
    Function
    CLIENT
    Logical file names can be client-specific. Here you can specify the client to be used. The current client as stored in the system field SY-MANDT is used as default.
    LOGICAL_FILENAME
    Here you specify the logical filename. (Uppercase letters must be used!)
    OPERATING_SYSTEM
    Here you can specify the operating system for which to generate the appropriate file name. The application server's operating system as stored in the system field SY-OPSYS is used as default.
    PARAMETER_1
    PARAMETER_2
    Here you can specify values that substitute the placeholders <PARAM_1> and <PARAM_2> in physical file names and paths.
    USE_PRESENTATION
    _SERVER
    Specifies that the presentation server's operating system be used as the basis for generating a platform-specific file name.
    WITH_FILE_EXTENSION
    Specifies that the logical file name's data format be used as filename extension.
    USE_BUFFER
    Specifies that the customizing tables for converting platform-independent file names be buffered in main memory.
    EXPORT parameter
    Function
    EMERGENCY_FLAG
    If the returned value is not SPACE, then no physical path has been found for the logical filename under the current operating system. In this case the path specified in the profile parameter DIR_GLOBAL will be used as physical path.
    FILE_FORMAT
    Returns the data format defined for the logical file name. You can use this parameter to decide in which mode to open the file. It is also required as a parameter for DOWNLOAD of files to the presentation server.
    FILE_NAME
    Returns the fully instantiated platform-specific file name and path.
    Exceptions
    Function
    FILE_NOT_FOUND
    Raised if logical file name is not defined.
    OTHERS
    Raised if other errors occur.
    If the function module cannot find a physical path for the current operating system (see parameter EMERGENCY_FLAG), this may have various causes:
    the operating system is not defined in the customizing tables
    the operating system is not assigned to a syntax group
    no physical path is assigned to the logical path for the relevant syntax group
    no logical path is assigned to the logical file name.
    Assume that in the customizing tables for platform-independent file names the following definitions exist for the logical file name DATA_FILE and the logical path DATA_PATH:
    DATA_FILE phys. file: file<PARAM_1>
    data format: BIN
    logical path: DATA_PATH
    DATA_PATH syntax group: UNIX phys. path: /tmp/<FILENAME>
    syntax group: DOS phys. path: c:\tmp\<FILENAME>
    Assume also that the application server's operating system has been assigned to syntax group UNIX while the presentation server's operating system has been assigned to syntax group DOS.
    The following two calls of the function module will then return the respective values.
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'DATA_FILE'
    PARAMETER_1 = '01'
    IMPORTING
    EMERGENCY_FLAG = FLAG
    FILE_FORMAT = FORMAT
    FILE_NAME = FNAME
    EXCEPTIONS
    FILE_NOT_FOUND = 1
    OTHERS = 2.
    Returned values:
    FLAG:
    FORMAT: BIN
    FNAME: /tmp/file01
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'DATA_FILE'
    USE_PRESENTATION_SERVER = X
    WITH_FILE_EXTENSION = X
    IMPORTING
    EMERGENCY_FLAG = FLAG
    FILE_FORMAT = FORMAT
    FILE_NAME = FNAME
    EXCEPTIONS
    FILE_NOT_FOUND = 1
    OTHERS = 2.
    Returned values:
    FLAG:
    FORMAT: BIN
    FNAME: c:\tmp\FILE.BIN

  • FILE_GET_NAME

    What is the purpose of FILE_GET_NAME function module?

    hi mathew,
    this is some information on this FM.
    he Function Module FILE_GET_NAME
    Platform-independent file names are used in applications programs by the function module FILE_GET_NAME. For a given logical file name, the function module generates the corresponding platform-specific file name at runtime, based on definitions stored in customizing tables for converting platform-independent file names.
    The following table gives an overview of its import and export parameters and of its exceptions.
    Table: Interface of function module FILE_GET_NAME
    IMPORT parameter
    Function
    CLIENT
    Logical file names can be client-specific. Here you can specify the client to be used. The current client as stored in the system field SY-MANDT is used as default.
    LOGICAL_FILENAME
    Here you specify the logical filename. (Uppercase letters must be used!)
    OPERATING_SYSTEM
    Here you can specify the operating system for which to generate the appropriate file name. The application server's operating system as stored in the system field SY-OPSYS is used as default.
    PARAMETER_1
    PARAMETER_2
    Here you can specify values that substitute the placeholders <PARAM_1> and <PARAM_2> in physical file names and paths.
    USE_PRESENTATION
    _SERVER
    Specifies that the presentation server's operating system be used as the basis for generating a platform-specific file name.
    WITH_FILE_EXTENSION
    Specifies that the logical file name's data format be used as filename extension.
    USE_BUFFER
    Specifies that the customizing tables for converting platform-independent file names be buffered in main memory.
    EXPORT parameter
    Function
    EMERGENCY_FLAG
    If the returned value is not SPACE, then no physical path has been found for the logical filename under the current operating system. In this case the path specified in the profile parameter DIR_GLOBAL will be used as physical path.
    FILE_FORMAT
    Returns the data format defined for the logical file name. You can use this parameter to decide in which mode to open the file. It is also required as a parameter for DOWNLOAD of files to the presentation server.
    FILE_NAME
    Returns the fully instantiated platform-specific file name and path.
    Exceptions
    Function
    FILE_NOT_FOUND
    Raised if logical file name is not defined.
    OTHERS
    Raised if other errors occur.
    If the function module cannot find a physical path for the current operating system (see parameter EMERGENCY_FLAG), this may have various causes:
              o the operating system is not defined in the customizing tables
              o the operating system is not assigned to a syntax group
              o no physical path is assigned to the logical path for the relevant syntax group
              o no logical path is assigned to the logical file name.
    Assume that in the customizing tables for platform-independent file names the following definitions exist for the logical file name DATA_FILE and the logical path DATA_PATH:
    DATA_FILE phys. file: file<PARAM_1>
    data format: BIN
    logical path: DATA_PATH
    DATA_PATH syntax group: UNIX phys. path: /tmp/<FILENAME>
    syntax group: DOS phys. path: c:\tmp\<FILENAME>
    Assume also that the application server's operating system has been assigned to syntax group UNIX while the presentation server's operating system has been assigned to syntax group DOS.
    The following two calls of the function module will then return the respective values.
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'DATA_FILE'
    PARAMETER_1 = '01'
    IMPORTING
    EMERGENCY_FLAG = FLAG
    FILE_FORMAT = FORMAT
    FILE_NAME = FNAME
    EXCEPTIONS
    FILE_NOT_FOUND = 1
    OTHERS = 2.
    Returned values:
    FLAG:
    FORMAT: BIN
    FNAME: /tmp/file01
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'DATA_FILE'
    USE_PRESENTATION_SERVER = X
    WITH_FILE_EXTENSION = X
    IMPORTING
    EMERGENCY_FLAG = FLAG
    FILE_FORMAT = FORMAT
    FILE_NAME = FNAME
    EXCEPTIONS
    FILE_NOT_FOUND = 1
    OTHERS = 2.
    Returned values:
    FLAG:
    FORMAT: BIN
    FNAME: c:\tmp\FILE.BIN
    <REMOVED BY MODERATOR>
    kushagra
    Edited by: Alvaro Tejada Galindo on Jan 31, 2008 9:22 AM

  • FM 'FILE_GET_NAME'  in background

    Hi all,
    I am using FM 'FILE_GET_NAME' to retrieve path from application server and then i read and write on that file.
    Further my problem is this when i execute program in forground it is running fine but when i am scheduling it to background so
    I get the message in the joblog
    "Object Z_AZISHPM_DOWNLOAD_DATA of class RE and language EN does not exist".
    Z_AZISHPM_DOWNLOAD_DATA is the program name.
    Further I use the OPEN DATASET and CLOSE DATASET.
    Please help me in this regards
    Thanks
    Rita

    Hi,
    Just a Guess:  May be its authorisation problem, not sure.
    Another way is try Debug the Background Job using JDBG and you may figure out the issue.
    Revrt back if any issues,
    Regards,
    Naveen

  • Function module file_get_name

    functionality of FILE_GET_NAME.

    hi Venu,
    Check this out
    http://help.sap.com/saphelp_45b/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
    FU FILE_GET_NAME
    Text
    Assign the Physical File Name Using a Logical File Name
    Functionality
    R/3 applications run on various platforms with various file systems. This function module enables you to use platform-independent logical file names in your application programs.
    Based on definitions maintained in customizing tables for platform-independent file names, the function module converts a logical file name to the corresponding physical file name and path for the hardware platform concerned.
    For this conversion to work for different platforms, the definition of a logical file name must include a logical file path, which in turn is converted to different physical file paths, depending on the particular platform. The platform-specific file name returned by the function module is composed of the physical file path for the current platform and the physical file name associated with the logical file name. Placeholders in physical file and path names are substituted at runtime by the corresponding current values.
    Example
    logical file name: MONTHLY_SALES_FILE
    physical file name: VALUES<PARAM_1>
    logical path: SALES_DATA_PATH
      physical path (UNIX): /usr/<SYSID>/<FILENAME>
      physical path (Windows): C:\SALES\<FILENAME>
    Example 1
    Get file name for UNIX platform
    (current system: K11)
    CALL                                                                                FUNCTION                                                                                'FILE_GET_NAME'
       EXPORTING
          LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
       IMPORTING
          FILE_NAME = FILE
          FILE_FORMAT = FORMAT.
    Result:
    FILE = /usr/K11/VALUES
    FORMAT = WK1
    Example 2
    Get file name for UNIX platform, passing a parameter
    (current system: K11)
    CALL                                                                                FUNCTION                                                                                'FILE_GET_NAME'
       EXPORTING
          LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
          PARAMETER_1 = '_TST'
       IMPORTING
          FILE_NAME = FILE
          FILE_FORMAT = FORMAT.
    Result:
    FILE = /usr/K11/VALUES_TST
    FORMAT = WK1
    Example 3
    Get file name for WINDOWS platform, with file name extension
    CALL                                                                                FUNCTION                                                                                'FILE_GET_NAME'
       EXPORTING
          LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
          WITH_FILE_EXTENSION = 'X'
       IMPORTING
          FILE_NAME = FILE
          FILE_FORMAT = FORMAT.
    Result:
    FILE = C:\SALES\VALUES.WK1
    FORMAT = WK1
    Notes
    All definitions needed for the platform-independent assignment of file names are maintained client-independently with transaction FILE. Logical file names (but not logical file paths) can also be defined specifically for the current client with transaction SF01. Transaction SF07 generates a list of current definitions.
    The following concepts are used in the platform-independent assignment of file names:
    Logical file name
    A descriptive name for a file which is associated with these values:
    physical file name
    file format
    logical file path.
    If no logical file path is specified, the function module returns the physical file name only; placeholders are substituted by current values.
    Physical file name
    The physical file name may contain placeholders.
    Logical file path
    A descriptive name for a path which is associated with these values:
    syntax groups (groups of operating systems)
    physical file paths.
    Physical file path
    The physical file path is defined for a particular syntax group. It must contain the reserved word <FILENAME> as a placeholder for the file name. It may also contain other placeholders.
    Operating system
    Presentation server and application server can run under different operating systems. The current value for the application server can be obtained from the system field SY-OPSYS, the value for the presentation server by calling function module WS_QUERY.
    Both operating systems must be defined and assigned to a syntax group.
    Syntax group
    Group of operating systems with a common syntax for file and path names (e.g. HP-UX and SINIX).
    Placeholder
    Reserved words, set in angle brackets, which can be included in physical file and path names (e.g. <DATE>, <FILENAME>). You can find information on possible reserved words in the online help (F1 help) for the fields physical file name and physical file path when maintaining platform-independent file names with transaction FILE.
    If the logical path associated with a logical file name does not specify a physical path for the current operating system (syntax group), the path stored in the profile parameter DIR_GLOBAL of the current system is used for generating a complete platform-specific file name.
    Parameters
    CLIENT
    LOGICAL_FILENAME
    OPERATING_SYSTEM
    PARAMETER_1
    PARAMETER_2
    PARAMETER_3
    USE_PRESENTATION_SERVER
    WITH_FILE_EXTENSION
    USE_BUFFER
    ELEMINATE_BLANKS
    EMERGENCY_FLAG
    FILE_FORMAT
    FILE_NAME
    Exceptions
    FILE_NOT_FOUND
    Function Group
    SFIL
    Regards,
    santosh
    Message was edited by: Santosh Kumar P

  • Can't create file using FM File_Get_Name

    Hi guru,
    I have a program that creates a file to the system using fm fiel_get_name. Someone changed the OS in the SY-OPSYS from AIX(Application) to NT(file server). But the file seems is not there.
    Is there something wrong from changing the SY-OPSYS?
    Points will be rewarded...Thank you

    Hi gurus,
    what else should I look at..i dont think there's nothin wrong about the code of my program.. It's about how it is deifne in the logical path and other settings... Would you know in what tcode can I see it? I only new in this kind of issue.
    Points will be given ..thanks!

  • Logical Filename

    Hi all,
    We have a Z-transaction used to perform requests by using a DTP process and send them to a file (SAP schedules jobs automatically for doing this).
    The name of this file should determined at runtime using a variable from the Z program.
    We followed the instructions in this link: [/people/kumarrvr.seemakurti/blog/2009/03/06/dynamic-physical-file-path-creation-passing-selection-screen-variables-for-archive-job-file-names|/people/kumarrvr.seemakurti/blog/2009/03/06/dynamic-physical-file-path-creation-passing-selection-screen-variables-for-archive-job-file-names]
    The configuration in FILE transaction is as follows:
    Logical file: DAILY_AMDOCS_OUPUT
    Physical file: ar.Sap_Day.<DATE>.output.<Y=POSTDT>
    Logical path: ZDAILY_AMDOCS_FILE
    Then we created a FM for populating the last part of the file name:
    FUNCTION Y_FILENAME_EXIT_POSTDT.
    *"*"Local Interface:
    *"  EXPORTING
    *"     VALUE(OUTPUT)
      DATA:
       g_pstdt type d,                   " posting date
       g_output  type char20.                " output
    * posting date from the main program
      FIELD-SYMBOLS: <FS_PSTDT> type d.
      ASSIGN: ('(ZFIAMDYNAMICDTP_MAIN)WA_POSTDATE-POST_DATE') TO <FS_PSTDT>.
      g_pstdt =  <FS_PSTDT>.
    *Pass posting date to the output if not initial
       if g_pstdt is not initial.
        g_output = g_pstdt.
        OUTPUT = g_output.
       endif.                              "
    ENDFUNCTION.
    Once the DTP is saved, the filename exit is triggered and set correctly the output value from the main program.
    Then the job for generating physically the file is canceled. Looking into the dump log it states that the we are attempting to access an unassigned field symbol, making reference to the assignment from our main program in the above FM.
    Therefore it looks like the job cannot access to our program+variable... and so far no way to find a solution.
    If any of you have a clue about what we are missing, it would be very much appreciated.
    Many thanks in advance.

    Hi Suhas,
    Thanks for your answer.
    I remember that I already had given a try to that way but I have just tried again.
    We modified accordingly the physical name in FILE transaction and called the FM like this:
    CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = 'DAILY_AMDOCS_OUPUT'
          parameter_1      = input_date
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
      ENDIF.
    The result now is ar.Sap_Day.20110825.output.
    Posting date set as parameter 1 is not being appended to the filename.

  • Not Able to Generate Out of the Report by adding the new 2 fields

    Hi,
    I'm Very new to ABAP. I have created one report. after 2 new fields added they are EKNAM and EKGRP.
    The Thing is the remaining fields are displaying in the output. The Newly added fields are not displaying the out. I was able to add this 2 fields in the head of the report. But issue is not able to get the data on these 2 fields.
    Please see the below program and any one please help me out to display the data in this report for the fields eknam and ekgrp.
    TABLES: eban,
            lfa1,
            ekko,
            t024,
            v_username.
    DATA: BEGIN OF i_req_items OCCURS 10,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            ebeln LIKE eban-ebeln,         "PO Number
            ebelp LIKE eban-ebelp,         "PO Item
            eknam LIKE t024-eknam,         "Pur.Grp Name
            ekgrp LIKE t024-ekgrp,         "Pur.Grp Number
            flief LIKE eban-flief,         "Fixed vendor
            name1 LIKE lfa1-name1,         "Vendor name
            badat LIKE eban-badat,         "Creation date
            erdat LIKE eban-erdat,         "Change date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            bsart LIKE eban-bsart,         "Document type
            knttp LIKE eban-knttp,         "Acct.assgmt category
            txz01 LIKE eban-txz01,         "PO item description
            menge LIKE eban-menge,         "Quantity
            preis LIKE eban-preis,         "Price
            peinh LIKE eban-peinh,         "Price unit
            value(14) TYPE p DECIMALS 2,   "Item Value
          END OF i_req_items.
    DATA: BEGIN OF i_reqs OCCURS 10,
            ernam LIKE eban-ernam,         "Created by
            persn LIKE usr21-persnumber,   "Person number
            uname LIKE adrp-name_text,     "User name
            lifnr LIKE eban-lifnr,         "Vendor
            name1 LIKE lfa1-name1,         "Vendor name
            badat LIKE eban-badat,         "Creation date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            bsart LIKE eban-bsart,         "Document type
            knttp LIKE eban-knttp,         "Acct.assgmt category
            txz01 LIKE eban-txz01,         "PO item description
            eknam like t024-eknam,         "Purchase Grp Name
            ekgrp like t024-ekgrp,         "Purchase Grp Number
            value(14) TYPE p DECIMALS 2,   "Item Value
          END OF i_reqs.
    DATA: BEGIN OF i_req_keys OCCURS 0,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            erdat LIKE eban-erdat,         "Create or Change date
            banfn LIKE eban-banfn,         "Requisition no.
            bnfpo LIKE eban-bnfpo,         "Req. item no.
            eknam like t024-eknam,         "Purchase Grp Name
            ekgrp like t024-ekgrp,         "Purchase Grp number
          END OF i_req_keys.
    DATA: BEGIN OF i_req_keeper OCCURS 0,
            ernam LIKE eban-ernam,         "Created by
            lifnr LIKE eban-lifnr,         "Desired vendor
            banfn LIKE eban-banfn,         "Requisition no
          END OF i_req_keeper.
    DATA: wa_reqitems LIKE i_req_items.
    DATA: BEGIN OF i_export OCCURS 10,
           record(150) TYPE c,
          END OF i_export.
    CONSTANTS
    CONSTANTS:
          c_doccat       LIKE eban-bstyp  VALUE 'B',
          c_creind       LIKE eban-estkz  VALUE 'R',
          c_delflag      LIKE eban-loekz  VALUE 'L',
          c_write(5)     TYPE c   VALUE 'WRITE',
          c_slash(1)     TYPE c   VALUE '/',
    *start ESPZC U8DK900439
         c_delimiter    TYPE x   VALUE '09',
           c_delimiter    TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
    *end ESPZC U8DK900439
          c_sc(1)        TYPE c   VALUE ';',
          c_x(1)         TYPE c   VALUE 'X',
          c_usd(1)       TYPE c   VALUE '2',
          c_export LIKE authb-filename VALUE '/BAY2/UBEM_SPLIT_REQS'.
    WORKING VARIABLES
    DATA: w_report_id   LIKE syst-repid,
          w_sttime      LIKE syst-uzeit,
          w_rpt_pagno   LIKE syst-pagno,
          w_rc          LIKE sy-subrc,
          w_datelow     LIKE eban-badat,
          w_datehigh    LIKE eban-badat,
          w_export      LIKE c_export,
          w_records     TYPE i,
          w_message(50) TYPE c.
    TYPES number TYPE i.
    SELECTION SCREEN / PARAMETERS
    SELECTION-SCREEN BEGIN OF BLOCK org WITH FRAME TITLE text-001.
    PARAMETERS: p_purorg LIKE eban-ekorg OBLIGATORY DEFAULT 'US02'.
    SELECT-OPTIONS: s_doctyp FOR eban-bsart,
                    s_date FOR eban-badat.
    PARAMETERS: p_timper(2) TYPE n.
    SELECTION-SCREEN: COMMENT 37(37) text-002.
    SELECTION-SCREEN END OF BLOCK org.
    SELECTION-SCREEN BEGIN OF BLOCK outp WITH FRAME TITLE text-003.
    PARAMETERS: p_onlin  RADIOBUTTON GROUP outp DEFAULT 'X',
                p_servr  RADIOBUTTON GROUP outp.
    SELECTION-SCREEN END OF BLOCK outp.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN.
      IF p_servr = c_x.
        CLEAR w_rc.
        PERFORM authority_check_dataset USING    w_export
                                        CHANGING w_rc.
        IF w_rc <> 0.
          MESSAGE e532 WITH text-006 w_export.
        ENDIF.
        CLEAR w_rc.
        PERFORM verify_unix_path_and_file CHANGING w_rc.
        IF w_rc <> 0.
          MESSAGE e531 WITH w_message.
        ENDIF.
      ENDIF.
      INITIALIZATION EVENT
    INITIALIZATION.
      PERFORM get_filename.
      MOVE  syst-uzeit  TO   w_sttime.
      MOVE  syst-repid  TO   w_report_id.
      CLEAR: w_rpt_pagno.
    START-OF-SELECTION.
      PERFORM get_data.
      IF p_onlin = c_x.
        IF w_records GT 0.
          PERFORM print_report_header.
          PERFORM write_report.
        ELSE.
          MESSAGE i531 WITH text-007.
        ENDIF.
      ELSEIF p_servr = c_x.
        PERFORM write_export.
      ENDIF.
    END-OF-SELECTION.
    ---- F O R M   R O U T I N E S -
    *&     FORM get_filename
    FORM get_filename.
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          logical_filename = c_export
        IMPORTING
          file_name        = w_export
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
      ENDIF.
    ENDFORM.                    " get_filename
      FORM authority_check_dataset
    FORM authority_check_dataset USING    p_filename
                                 CHANGING p_rc.
      CALL FUNCTION 'AUTHORITY_CHECK_DATASET'
        EXPORTING
          activity         = c_write
          filename         = p_filename
        EXCEPTIONS
          no_authority     = 1
          activity_unknown = 2
          OTHERS           = 3.
      p_rc = sy-subrc.
    ENDFORM.                    "authority_check_dataset
        FORM verify_unix_path_and_file
    FORM verify_unix_path_and_file CHANGING p_rc.
    *start ESPZC U8DK900439
    OPEN DATASET w_export FOR OUTPUT IN TEXT MODE
         MESSAGE w_message.
      OPEN DATASET w_export FOR OUTPUT IN TEXT MODE ENCODING DEFAULT
          MESSAGE w_message.
    *end ESPZC U8DK900439
      p_rc = sy-subrc.
    ENDFORM.                    "verify_unix_path_and_file
      FORM get_data
    FORM get_data.
      CLEAR w_datelow.
      CLEAR w_datehigh.
      w_datelow = s_date-low - p_timper.
    w_datehigh = s_date-high + p_timper.
      w_datehigh = s_date-high.
      SELECT ernam lifnr ebeln ebelp flief badat erdat banfn bnfpo bsart
            knttp menge preis peinh txz01
       FROM eban
       INTO CORRESPONDING FIELDS OF TABLE i_req_items
          WHERE bstyp = c_doccat
            AND estkz = c_creind
            AND knttp <> space
            AND bsart IN s_doctyp
            AND loekz <> c_delflag
            AND ekorg EQ p_purorg
           AND ( ( badat BETWEEN w_datelow and w_datehigh ) OR
            ( erdat BETWEEN w_datelow AND w_datehigh ) ).
            AND  erdat BETWEEN w_datelow AND w_datehigh.
      IF sy-subrc = 0.
        LOOP AT i_req_items.
          IF i_req_items-lifnr IS INITIAL.
            IF NOT i_req_items-flief IS INITIAL.
              MOVE i_req_items-flief TO i_req_items-lifnr.
              MODIFY i_req_items.
            ENDIF.
            IF NOT i_req_items-ebeln IS INITIAL.
              SELECT lifnr FROM ekko
                  INTO i_req_items-lifnr
                  WHERE ebeln = i_req_items-ebeln.
              ENDSELECT.
              MODIFY i_req_items.
            ENDIF.
          ENDIF.
          IF i_req_items-erdat GT i_req_items-badat.
            MOVE i_req_items-erdat TO i_req_items-badat.
            MODIFY i_req_items.
          ENDIF.
        ENDLOOP.
        PERFORM weed_out_unique_records.
        PERFORM apply_time_period.
        SORT i_req_items BY ernam lifnr banfn bnfpo.
        LOOP AT i_req_items.
          i_req_items-value = ( i_req_items-menge *
               ( i_req_items-preis / i_req_items-peinh ) ).
          MODIFY i_req_items.
        ENDLOOP.
    Getting vendor name from table LFA1 -
        CLEAR i_req_items.
        LOOP AT i_req_items.
          SELECT SINGLE name1 FROM lfa1
            INTO i_req_items-name1
              WHERE lifnr = i_req_items-lifnr.
          MODIFY i_req_items.
        ENDLOOP.
        LOOP AT i_req_items.
          MOVE-CORRESPONDING i_req_items TO i_reqs.
    Getting user name from view v_username -
          SELECT SINGLE name_text
           FROM v_username INTO i_reqs-uname
          WHERE bname = i_reqs-ernam.
          APPEND i_reqs.
        ENDLOOP.
      ENDIF.
      DESCRIBE TABLE i_reqs LINES w_records.
    ENDFORM.                        "Get_data
      FORM print_report_header
    FORM print_report_header.
      ADD  1   TO   w_rpt_pagno.
      CALL FUNCTION '/BAY2/UBEXBH_BAYER_HEADR_FUN'
        EXPORTING
          f_jobname        = text-020
          f_business_group = text-021
          f_report_title   = text-022
          f_repid          = w_report_id
          f_sysid          = syst-sysid
          f_linsz          = syst-linsz
          f_pagno          = w_rpt_pagno
          f_mandt          = syst-mandt
          f_datum          = syst-datum
          f_uzeit          = w_sttime.
      FORMAT COLOR COL_HEADING.
      WRITE:  /1     text-010,      "Created by CWID & user name
              29     text-011,      "Vendor #
              38     text-012,      "Vendor Name
              69     text-013,      "Req Number
              79     text-014,      "/Item
              87     text-015,      "Created On
              98     text-017,      "A (AcctAssgmtCat)
             100(14) text-019 RIGHT-JUSTIFIED,  "Item Value
             116(30) text-018,      "Item Description
             148     text-030,      "Pur.Grp Name
             170     text-031.      "Pur.Grp Number
      FORMAT COLOR OFF.
      ULINE.
    ENDFORM.                             "print_report_header
    *&      Form  WRITE_REPORT
    FORM write_report.
      LOOP AT i_reqs.
        WRITE: /1 i_reqs-ernam,
                9(18) i_reqs-uname,
               29 i_reqs-lifnr,
               38(30) i_reqs-name1,
               69 i_reqs-banfn,
               79 c_slash,
               80 i_reqs-bnfpo,
               87 i_reqs-badat,
               98 i_reqs-knttp,
              100(14) i_reqs-value CURRENCY c_usd,
              116(30) i_reqs-txz01,
              145 i_reqs-eknam,
              160 i_reqs-ekgrp.
      ENDLOOP.
    ENDFORM.                    "write_report
    *&      Form  WRITE_EXPORT
    FORM write_export.
      DATA: l_value(14)    TYPE c,
            l_bsart(100)   TYPE c,
            l_uname(7)     TYPE c,
            l_records(5)   TYPE c,
            l_header(150)  TYPE c,
            l_params(150)  TYPE c,
            i_char         TYPE i.
      LOOP AT i_reqs.
        CLEAR l_value.
        CLEAR l_uname.
        l_value = i_reqs-value.
        l_uname = sy-uname.
        CONCATENATE: i_reqs-uname
                     i_reqs-ernam
                     i_reqs-lifnr
                     i_reqs-name1
                     i_reqs-banfn
                     i_reqs-bnfpo
                     i_reqs-badat
                     i_reqs-knttp
                     l_value
                     i_reqs-txz01 INTO i_export
                                  SEPARATED BY c_delimiter.
        APPEND i_export.
      ENDLOOP.
      CONCATENATE: text-008   "Created By Name
                   text-009   "CWID
                   text-011   "Vendor No
                   text-012   "Vendor Name
                   text-013   "Req Number
                   text-023   "Item
                   text-015   "Created On
                   text-017   "A
                   text-019   "Item Value
                   text-018   "Item Description
                   text-030   "Purchase Grp name
                   text-031   "Purchase Grp number
                   INTO l_header SEPARATED BY c_delimiter.
      INSERT l_header INTO i_export INDEX 1.
      IF sy-batch IS INITIAL.
        MOVE sy-uname TO l_uname.
      ELSE.
        MOVE text-024 TO l_uname.
      ENDIF.
      PERFORM collect_bsart CHANGING l_bsart
                                     i_char.
      l_records = w_records.
      CONCATENATE: sy-sysid
                   p_purorg
                   l_bsart(i_char)
                   s_date-low
                   s_date-high
                   p_timper
                   l_uname
                   sy-datum
                   l_records INTO l_params
                             SEPARATED BY c_delimiter.
      INSERT l_params INTO i_export INDEX 1.
      LOOP AT i_export.
        CONDENSE i_export NO-GAPS.
        TRANSFER i_export TO w_export.
      ENDLOOP.
      CLOSE DATASET w_export.
      MESSAGE s533 WITH text-028 w_export text-029.
    ENDFORM.                    "write_export
    *&      FORM collect_bsart
    FORM collect_bsart CHANGING p_bsart
                                p_char.
      CLEAR p_bsart.
      LOOP AT s_doctyp.
        IF sy-tabix = 1.
          p_bsart = s_doctyp-low.
        ELSE.
          CONCATENATE: p_bsart c_sc s_doctyp-low INTO p_bsart.
        ENDIF.
      ENDLOOP.
      CONDENSE p_bsart NO-GAPS.
      p_char = strlen( p_bsart ).
    ENDFORM.                      "collect_bsart
    *&      Form  WEED_OUT_UNIQUE_RECORDS
    FORM weed_out_unique_records.
      DATA: i_l_req_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
      DATA: i_l_req_final_items LIKE i_req_items OCCURS 0 WITH HEADER LINE.
      DATA: l_count TYPE i,
            l_sy_tabix LIKE sy-tabix,
            l_banfn    LIKE eban-banfn.
      REFRESH i_l_req_items.
      REFRESH i_l_req_final_items.
      CLEAR l_banfn.
      i_l_req_items[]       = i_req_items[].
      i_l_req_final_items[] = i_req_items[].
      SORT i_req_items         BY ernam lifnr.
      SORT i_l_req_items       BY ernam lifnr.
      SORT i_l_req_final_items BY ernam lifnr.
      LOOP AT i_l_req_items.
        l_banfn = i_l_req_items-banfn.
        CLEAR l_count.
        LOOP AT i_req_items
            WHERE ernam = i_l_req_items-ernam
              AND lifnr = i_l_req_items-lifnr.
          IF i_req_items-banfn <> l_banfn.
            ADD +1 TO l_count.
          ENDIF.
        ENDLOOP.
        IF NOT ( l_count > 0 ).
          LOOP AT i_l_req_final_items
            WHERE ernam = i_l_req_items-ernam
              AND lifnr = i_l_req_items-lifnr.
            DELETE i_l_req_final_items.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
      REFRESH i_req_items.
      i_req_items[] = i_l_req_final_items[].
    ENDFORM.                    " WEED_OUT_UNIQUE_RECORDS
    *&      Form  APPLY_TIME_PERIOD
    FORM apply_time_period.
      DATA: l_i_req_keys LIKE i_req_keys.
      DATA: l_days_diff          TYPE p,
            l_no_of_key_recs     TYPE i,
            l_next_item          LIKE sy-tabix,
            l_finished_with_keys TYPE c VALUE 'N',
            l_add_line           TYPE c VALUE 'N',
            l_count              TYPE i,
            l_req_ernam          LIKE eban-ernam,
            l_req_lifnr          LIKE lfa1-lifnr,
            l_req_banfn          LIKE eban-banfn,
            l_save_tabix         like sy-tabix.
      REFRESH: i_req_keys, i_req_keeper.
      LOOP AT i_req_items.
        MOVE-CORRESPONDING i_req_items TO
                           i_req_keys.
        IF i_req_items-erdat IS INITIAL.
          i_req_keys-erdat = i_req_items-badat.
        ENDIF.
        APPEND i_req_keys.
      ENDLOOP.
      SORT i_req_keys BY ernam lifnr erdat.
      CLEAR l_no_of_key_recs.
      DESCRIBE TABLE i_req_keys LINES l_no_of_key_recs.
      LOOP AT i_req_keys.
        IF l_add_line = 'Y'.
          MOVE-CORRESPONDING i_req_keys
                          TO i_req_keeper.
          APPEND i_req_keeper.
          l_add_line = 'N'.
        ENDIF.
        IF l_finished_with_keys = 'Y'.
          EXIT.
        ENDIF.
        CLEAR l_next_item.
        l_save_tabix = sy-tabix.
        COMPUTE l_next_item = sy-tabix + 1.
        IF l_next_item = l_no_of_key_recs.
          l_finished_with_keys = 'Y'.
        ENDIF.
        clear: l_i_req_keys.
        READ TABLE i_req_keys INDEX l_next_item
            INTO l_i_req_keys.
        sy-tabix = l_save_tabix.
        CLEAR l_days_diff.
        l_days_diff = l_i_req_keys-erdat -
                      i_req_keys-erdat.
        IF l_i_req_keys-ernam  =
           i_req_keys-ernam                  AND
           l_i_req_keys-lifnr  =
           i_req_keys-lifnr                  AND
           l_i_req_keys-banfn  <>
           i_req_keys-banfn                  AND
           l_days_diff         <= p_timper.
          MOVE-CORRESPONDING i_req_keys
                          TO i_req_keeper.
          APPEND i_req_keeper.
          l_add_line = 'Y'.
        ENDIF.
      ENDLOOP.
      DELETE ADJACENT DUPLICATES FROM i_req_keeper
                            COMPARING ALL FIELDS.
      SORT i_req_keeper BY ernam lifnr banfn.
      LOOP AT i_req_items.
        CLEAR l_count.
        CLEAR: l_req_ernam,
               l_req_lifnr,
               l_req_banfn.
        l_req_ernam = i_req_items-ernam.
        l_req_lifnr = i_req_items-lifnr.
        l_req_banfn = i_req_items-banfn.
        LOOP AT i_req_keeper
            WHERE ernam = i_req_items-ernam
              AND lifnr = i_req_items-lifnr
              AND banfn = i_req_items-banfn.
          ADD +1 TO l_count.
        ENDLOOP.
        IF NOT ( l_count > 0 ).
          LOOP AT i_req_items
            WHERE ernam = l_req_ernam
              AND lifnr = l_req_lifnr
              AND banfn = l_req_banfn.
            DELETE i_req_items.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " APPLY_TIME_PERIOD

    Rajesh,
    Put a breakpoint and try to debug the report step by step.
    You will findout the reason very easily.
    Whenever you have a select and are trying to append into an internal table, keep checking your internal table if it is been populated with the correct records.
    This way, you will findout the cause and can correct is accordingly.
    Thanks,
    Suresh Ganti

  • What is a  Logical and Physical file path in sap?

    what is a  Logical and Physical file path in sap?

    Hi,
    Physical file is what you see from the OS level.
    Logical file is what ABAP code can call certain functions to read/write.
    Transaction FILE would link them together. Typically the logical path ends with "<FILENAME>", and the logical file refers to the logical path.
    To extract the physical path from the logical path name
    DATA: lf_mandt TYPE sy-mandt,
            lf_opsys TYPE sy-opsys.
      lf_mandt = sy-mandt.
      lf_opsys = sy-opsys.
    To extract the physical path from the logical path name
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
          client           = lf_mandt
          logical_filename = p_unix
          operating_system = lf_opsys
        IMPORTING
          file_name        = gwa_input
        EXCEPTIONS
          file_not_found   = 1
          OTHERS           = 2.
      IF sy-subrc EQ 0.
      Concatenating the physical path and the input unix file name
        CONCATENATE gwa_input p_file INTO gf_file .
      ENDIF.
    Reward if helpful.
    Regards,
    Ramya

Maybe you are looking for