TCode : FILE

In my sap directory(AL11) , /usr/sap/<sysid> is already mapped and im creating notepad file (txt) at run time at this location. I could see the file created with the specified name successfully. But if i want to move my notepad file to another subfolder under this <sysid>, im unable to create the txt file even though i  assigned physical paths to logical path .
<P=DIR_INTERFACE>/<SYSID>/ZTEST/<FILENAME>

Hi,
First you read the file in output mode using Open dataset and Read dataset statement with the initial application server path.
Then write this data back to another file path by opening the file in Input mode and using Transfer statement.
Example.
open dataset <file1> mode output encding default.
if sy-subrc = 0.
do.
read dataset <file1> into wa_itab.
if sy-subrc = 0.
append wa_itab to itab.
else.
exit.
endif.
enddo.
open dataset <file2> mode input encding default.
if sy-subrc = 0.
loop at itab into wa_itab.
transfer wa_itab to <file2>.
endloop.
endif.
Regards.

Similar Messages

  • Change Logs for TCODE -- FILE

    Hi Friends,
        Please help me in finding the change logs  for the TCODE  FILE,
        i.e  The changes made to the Logical paths
       I had tried  Utilities---->change logs , but unfortunately i cannot find any changes logs
       But there are changes made to the logical paths in my system but i cannot see them in change logs
    thanks
    chandrasekhar j

    rec/client is a profile parameter, you can view the settings in transaction RZ10.  However I find program RSPARAM more useful, the report lists all system parameters with their default and altered value.  Also if you double-click on a parameter you can get to the full help text for its meaning.
    The parameter essentially switches on table change logging for configuration tables (based on the technical settings of the table) and has to be set before the changes are made.
    Hope this helps.
    Nick

  • Use of tcode file

    what is the use of tcode file????
    what is platform independent file name????

    Platform Independent File path: The actual (Physical) file name/path is always dependent on hardware and OS of the system. Now In this transaction define a Logical name of a file and map it to your specific system specific actual path.
    Now in your coding you can use the logical name. When you use the same come in a different system you need not change the logical name to everywhere you have coded. The Logical name will be same, only in FILE transaction you will change the mapping of Logical File name to actual file path.
    Check the following Link :
    http://help.sap.com/saphelp_erp2005/helpdata/EN/8d/3e4edc462a11d189000000e8323d3a/frameset.htm
    Example:
    Suppose in your application server you created a file and give a logical name as AIRS_PATH. But when you want to access the file you need to know the actual physical path to it. That path may be ‘c:\temp\<FILENAME>’. Now in FILE transaction you mapped AIRS_PATH to c:\temp\<FILENAME>.
    So whenever you try to access AIRS_PATH, the system know that you want to access the c:\temp\<FILENAME>.
    Now may be you want to run your code in a different system and different hardwre. And the file is stored there in ‘c:\temp\temp1\<FILENAME>’ path. So then in that system you need to map AIRS_PATH with ‘c:\temp\temp1\<FILENAME’.
    Now while coding you are not actually familiar or bother the actual file path. You will do your coding based on AIRS_PATH. And that is same in all the system only the mapping need to change. Thus you can achieve the system independence.

  • Tcode:File ,Tcode:sf01  understanding

    pls help me in understanding these tcode
    to create logical path,pls provide me the step by
    step to create a logical path

    Hi,
    Pls check threads like
    Application Server -File Upload
    How to create logical file name
    Eddy

  • Tcode FILE problem

    I am trying to use the Direct Input method in the LSMW (It is my first time using the Direct Input method) but I encounter a problem during the Specify File step saying that No Logical Path was specified. I look into the forums and they told me that I needed to define one with the FILE Tcode but when go to the FILE Tcode a message pops up saying Changes to Repository or cross-client Customization are not permitted.
    What would cause this? How should I deal with it?

    Hi Obie,
    I guess you are testing in Testing client .
    Do it in development client.
    Mohinder

  • LOGICAL FILENAME / TCODE FILE

    In a selection screen I have put a parameters called p_log type fileintern.
    I'd like to read this file, is there any function module that would help me to do this or should I use open dataset....
    what if the name look like this
    <system>\hello.txt
    thanks 4 the help

    Hi,
      If you looking a FM to get the physical file name for a logical file then use the FM FILE_NAME_GET..
      If you want to get the file value..Check this code..
    DATA: v_buffer(2047) TYPE c.
    DATA: BEGIN OF i_buffer OCCURS 0,
           line(2047) TYPE c,
          END OF i_buffer.
    Open the unix file..
    OPEN DATASET p_unix FOR INPUT IN TEXT MODE.
    IF sy-subrc NE 0.
      DO.
        CLEAR: v_buffer.
        READ DATASET p_unix INTO v_buffer.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        MOVE v_buffer TO i_buffer.
        APPEND i_buffer.
      ENDDO.
    ENDIF.
    Thanks,
    naren

  • Error in TCODE- FILE

    Hi,
    We are using OHTs with destination type file.
    We have created a logical path.when we are trying to assign this logical path to the file,we are getting a dump.
    Runti.e Errors ASSI6N_SUBSTRIN6-N0L.ALL0WED
    Date and T1ne 06/1i812009 22:56-:350
    Short text
    ASSI6N to a substring not allowed.
    What happened?
    Error in the A8AP Applicat1on Program
    The current ABAP progran SAPLOSFNu201D had to be terminated because it has
    cone across a statenent that unfortunately cannot be executed.
    Error analysis
    A field symbol should have been set to a substring.
    However, this is not alliowed..
    Maybe a substring was intended to be used 1n a paraneter transfer
    This Is not possible, either.
    Trigger Location of Runtine Error
    Progran SAPLOsFN
    Include LOSFNIO1
    Row 223
    Module type (M0DuLE PAI)ASSIGN_SUBSTRING_NOT_ALLOWED
    Please help with this.
    Thanks,Girish

    Please apply the SAP Note 1297989 and it will fix the issue.
    Thanks.

  • Run time error while saving values in File (Tcode)

    Hi,
    I am using FM   call function 'FILE_GET_NAME'
           exporting
                logical_filename = logical_filename
                parameter_1      = program_name
                parameter_2      = file_id_param
           importing
                file_name        = physical_filename
           exceptions
                file_not_found   = 1
                others           = 2.
    for this I am trying to maintain dynamic values(field symbols) in Tcode FILE Logical file name definition , physical path as.
    Physical file   =<PARAM_1>.<PARAM_2>
    But while saving it dumps, saying filed symbol assinment to substring is not allowed.
    Physical path for the same is /<V=Z_DIR_MAIN>/<SYSID>/<V=Z_DIR_OUT>/<FILENAME>.<CLIENT>.<DATE><TIME>.
    Regards
    Mohinder Singh Chauhan

    Hello Mohinder,
    the better way to analyse these kind of things is by entering the function module in se37 and providing the required test data.
    In your scenarion as you say its throwing a runtime dump related to field symbols better you concatenate the data param1 and param2 into a new variable and then pass that value into the function module.
    Thanks,
    M.Naveen kumar

  • Changing physical path in FILE TCODE using ABAP CODE

    Hi all ,
    I want to change physical path linked to logical path in TCODE FILE dynamically using ABAP program. Is it possible.
    If yes then how?
    Thanks for your help.
    Regards,
    Uday.

    s

  • GET FILE NAME C:\temp\ADIBO.txt

    Hi,
    How to get file name?
    I used Get_File_NAME, but I'am getting an error.
    lv_lfilename is not the type LOGICAL_FILENAME
    C:\temp\ADIBO.txt
    I need to get  ADIBO ??
    tnh, Adibo..:)
    I am using this code to download file and after that I need to get FILE_NAME:
    DATA:  lv_lfilename TYPE string.
    PARAMETERS:
      pa_lfile TYPE zlocalfile
               DEFAULT 'C:temp'.
        CONCATENATE pa_lfile ''INTO lv_lfilename.
        CALL FUNCTION 'GUI_DOWNLOAD'
             EXPORTING
                  filename = lv_lfilename
                  filetype = 'ASC'
             TABLES
                  data_tab = it_billit_down.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

    Hii..
    You have to Maintain the Logical filenames and their Physical Paths in Tcode FILE.
    Then create a program like this..
    REPORT  ZSEL_FILES1.
    DATA : V_LOGFILE TYPE STRING.
    DATA :V_PHYFILE TYPE STRING.
    DATA : ITAB TYPE TABLE OF SCARR.
    START-OF-SELECTION.
    SELECT * FROM SCARR INTO TABLE ITAB.
    **To get the Physical file based on the Logical file names - Maintained in Tcode FILE
    CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
       CLIENT                        = SY-MANDT
        LOGICAL_FILENAME              = VlOGFILE
      OPERATING_SYSTEM              = SY-OPSYS
      PARAMETER_1                   = ' '
      PARAMETER_2                   = ' '
      PARAMETER_3                   = ' '
      USE_PRESENTATION_SERVER       = ' '
      WITH_FILE_EXTENSION           = ' '
      USE_BUFFER                    = ' '
      ELEMINATE_BLANKS              = 'X'
    IMPORTING
      EMERGENCY_FLAG                =
      FILE_FORMAT                   =
       FILE_NAME                     = V_PHYFILE
    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.
    **To download the file to PC.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = V_PHYFILE
       FILETYPE                        = 'ASC'
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = ITAB
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>reward if helpful</b>

  • APD, filename for file data target

    Hello,
    i am designing a APD process  with a file as process target.
    I can hardcode the file path and name in the data target properties, however i would rather set the filename by user input or by a abap routine (eg. include the date of APD execution in the file name). Is that possible?
    Thanks in advance

    Hi,
    You can use the option 'Logical File Name' option to create a dyanmic file name.
    You can define a Logical File Name in tcode 'FILE', where you can append system date, time, varaible to a static file name.
    Hope this helps.

  • Creation of file

    Hi Abapers.
    Can any body tell me how create the a logical and physical file by using FILE tcose.
    Please tell me step by step.
    <Moved thread, has nothing to do with ABAP Objects. Please choose your forums more carefully in future>
    Edited by: Mike Pokraka on Aug 4, 2008 7:03 PM

    hi,
    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.
    hope this helps you.

  • Logical file destination in SPAD

    Can you direct print to a logical file destination with a definition in SPAD? I want to create a device in SPAD that will send print to a logical file that I'ved defined in tcode FILE. Can I do this?
    Thanks,
    Daniel

    The only solution I can think of is printing to a file:
    http://help.sap.com/saphelp_pserv472/helpdata/en/17/b01d3cf4a2e712e10000000a114084/content.htm
    is this what you are after?
    Regards,
    Chris

  • Logical flat file in SAP

    Can anybody help me with documents regarding logical flat file in SAP?
    I want to create a logical flat file . Moreover I want to load data which is stored in logical flat file path .Lastly if I want to make changes in that flat file ..
    How should I proceed?
    please help me as soon as possible with blogs or documents..

    Hi,
    ask your basis huys to define logical/physical path and assigments, use tcode FILE to create your logical filenames and definitions
    /manfred

  • How to create a logical file

    Hi,
    Please help me, i just want to know how to create a logical file and wht is the procedure to assign a physical file to the created logical file.

    Hi Abdul,
    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.
    Please check this links.
    Using Logical Files in ABAP Programs
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db95e635c111d1829f0000e829fbfe/content.htm
    Creating and Defining Logical Filenames
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3df8358411d1829f0000e829fbfe/content.htm
    Regards,
    Priyanka.

Maybe you are looking for

  • Common JNDI Tree

    We want to run 2 instances of WLS on one machine and 2 on other machine. Is there any way to setup a common jndi tree. so components on all 4 instances can access the same jndi URL. any help will be greatly appreciated. Thanks

  • 3.1.3, so far so good

    After one full day I can report at least for me (32GB 3Gs) I can definitely state that battery life is improved. I am not sure if it's due to taming of idle state processes or by improved battery use calibration, etc. Normal light-use day at this tim

  • Blinking Dialog box?

    Every so often a little accept/deny box pops up but it goes away so fast that i cant read a single word it says and its always at random times so i have no idea what it is asking me to do. I was wondering if there was a way to look at what it wants m

  • How to retain the button over state while scrolling over a Pop-up Menu

    Are there updated instruction for Fireworks 8? http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_15926&sliceId=1

  • How do you reset PRAM?

    I have followed the instructions on Apples support doc (http://docs.info.apple.com/article.html?artnum=2238), saying the CMD-OPT-P-R startup key combo should be pressed BEFORE the grey screen appears. Have tried this several times and Leopard just lo