HowTo read file from app. server and store it in binary format (SDOKCNTBIN)

Hi
I need to upload Documents to Document Repository by using to function module RSOD_DOC_MAST_CHANGE.
My question is: How can I fill the "parameter" i_t_file_content_binary from a file which is stored on an application server.
br, michael

Hi
I need to upload Documents to Document Repository by using to function module RSOD_DOC_MAST_CHANGE.
My question is: How can I fill the "parameter" i_t_file_content_binary from a file which is stored on an application server.
br, michael

Similar Messages

  • Problem with READ DATASET when reading file from app server

    Hi,
    wondering if anyone can help, I'm using the following code to read from a file on app server, the file is of type .rtf
    OPEN DATASET file_rtf FOR INPUT IN TEXT MODE
                                 ENCODING DEFAULT
                                 WITH SMART LINEFEED.
    DO.
    READ DATASET file_rtf INTO string.
    IF SY-SUBRC = 0.
    EXIT.
    ENDIF.
    ENDDO.
    the open dataset part works sy-subrc = 0, but the read returns sy-subrc = 8 and no data is passed to string.
    Any ideas as to what is causing this problem appreciated, <removed>
    Thanks
    Edited by: Thomas Zloch on Mar 17, 2010 3:57 PM - please don't offer p...

    Hi Adam,
    The source code in the below link has details about how to read/write to application server.
    [Application server file operartions|http://www.divulgesap.com/blog.php?p=NDk=]
    Please let us know if you have any issues.
    Regards,
    Ravi

  • How to get text file from app server and process it.

    Hello experts,
    I created a test data based form my recording. Now, I do not know where can I find it.
    Also, I want to create a program that lets users input the file name in the input parameter
    (selection screen) and it would automatically process/split that file. Again, thank you guys
    and take care!

    hi viray,
    im sorry i thought it was reading from presentation server....:-)
    >>I want to create a program that lets users input the file name in the input parameter
    (selection screen)
    at selection-screen on value-request for p_file.
    perform file_help using p_file.
    form file_help  using  p_p_file.
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_dir
    tables
    file_tbl = t_filetab
    EXCEPTIONS
    ARGUMENT_ERROR = 1
    NOT_FOUND = 2
    OTHERS = 3
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform.                    " file_help
    Splitting File and path.
    use the FM <b>SO_SPLIT_FILE_AND_PATH</b>
    hope this helps,
    do reward if it helps,
    priya.
    Message was edited by: Priya

  • Reading file from ftp server and importing data into table

    Hi experts,
    Well basically i have text files with different layout that have been uploaded on an ftp server. Now i have to write a procedure to fetch those files, read them and insert data in a table... can that be done?
    your precious help would be greatly helpful.
    Thanks

    declare
    file1 UTL_FILE.FILE_TYPE;
    filename varchar2(1000) := 'GTECHFILES';
    str long;
    begin
    file1 := UTL_FILE.FOPEN (filename,'agent_dump_csv.rep','r',32767);
    loop
    UTL_FILE.GET_LINE ( file1, str );
    --dbms_output.put_line('Value is :'||to_char(str));
    end loop;
    UTL_FILE.FCLOSE( file1 );
    exception
    when no_data_found then
    dbms_output.put_line('END OF FILE');
    UTL_FILE.FCLOSE( file1 ) ;
    when others then
    UTL_FILE.FCLOSE( file1 ) ;
    dbms_output.put_line('ERROR: '||sqlcode||':'||sqlerrm) ;
    end;
    i have managed to write this piece of code and all lines are being read and now i need to insert data into my table and the fields are seperated by a `|` i am strill trying to figure how to do that now. help ...
    Edited by: Kevin CK on 17-Jan-2010 22:40

  • What are the commands available to read a file from application server and

    What are the commands available to read a file from application server and store the file into an internal table?

    Hi,
    To read a file from an Application Server to an Object there is a command in ABAP called <b>READ DATASET</b>. After that file is transported to that object you have to do a loop and put that data in an Internal Table.
    This statement exports data from the file specified in dset into the data object dobj. For dobj, variables with elementary data types and flat structures can be specified. In Unicode programs, dobj must be character-type if the file was opened as a text file.
    For dset, a character-type data object is expected - that is, an object that contains the platform-specific name of the file. The content is read from the file starting from the current file pointer. After the data transfer, the file pointer is positioned after the section that was read. Using the MAXIMUM LENGTH addition, the number of characters or bytes to be read from the file can be limited. Using ACTUAL LENGTH, the number of characters or bytes actually used can be determined.
    In a Unicode program, the file must be opened with an arbitrary access type; otherwise, an exception that cannot be handled will be triggered.
    If the file has not yet been opened in anon-Unicode program, it will be implicitly opened as a binary file for read access using the statement
    OPEN DATASET dset FOR INPUT IN BINARY MODE.
    . If a non-existing file is accessed, an exception that can be handled can be triggered.
    Influence of Access Type
    Files can be read independently of the access type. Whether data can be read or not depends solely on the position of the file pointer. If the latter is at the end of the file or after the file, no data can be read and sy-subrc will be set to 4.
    Influence of the Storage Type
    The import function will take place irrespective of the storage type in which the file was opened with the statement OPEN DATASET.
    If the file was opened as a text file or as a legacy text file, the data is normally read from the current position of the file pointer to the next end-of-line marking, and the file pointer is positioned after the end-of-line marking. If the data object dobj is too short for the number of read characters, the superfluous characters and bytes are cut off. If it is longer, it will be filled with blanks to the right.
    If the file was opened as a binary file or as a legacy-binary file, as much data is read that fits into the data object dobj. If the data object dobj is longer than the number of exported characters, it is filled with hexadecimal 0 on the right.
    If the specified storage type makes conversion necessary, this is executed before the assignment to the data object dobj. Afterwards, the read data is placed, byte by byte, into the data object.
    System Fields
    sy-subrc Meaning
    0 Data was read without reaching end of file.
    4 Data was read and the end of the file was reached or there was an attempt to read after the end of the file.
    Thanks,
    Samantak.
    <b>Rewards points for useful answers.</b>

  • Problem in downloading file from app server using CG3Y in to .XLS fomat

    hi All,
    I have uploaded file in to application server through a program using open data set with the separater as "|" ( pipe ) . Now the user should be able to download the file from apps server to presenataion server in .XLS format using txn CG3Y. but when we download, the format appears wierd and the data is not consistent across columns in excel. i.e the data which is supposed to be in one column in the excel is in the other column. what precautaions should i take  before moving data to apps server so that it will be downloaded in a good format.
    Appreciate your help...
    Regards,
    Sreekanth.

    Separate each values with TAB space present in the application server .
    Currently u r using | pipe character. Instead of that use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB as delimiter.
    Each value will displayed in separate cells in excel sheet when u download it frm app.server
    Regards,
    Lakshman.

  • Download PDF file from APP server!

    Hi!
    Has anyone tried uplaoding and downloding a PDF table from app server as I tried from a normal method by Open dataset, Transfer but it wont work.
    Please provide any inputs.
    Thanks.

    Hi park,
    1. Using open data set, transfer , close etc,
       also it will work.
       ( it will download / upload any kind of file from app server)
    2. Just make sure the
       FULL PATHNAME and the FILENAME
       are mentioned in EXACT CASE
      (small/CAPITAL).
    3. U can check thru transaction AL11, to see the file and path.
    regards,
    amit m.

  • How to read file from prsntn server in Inbound idoc FM.

    Hi Experts,
    I am new to idoc.
    I have requirment that i need to read a file from presentation and application server and put in inbound idoc FM.Idoc will be processed in batch.
    How can i put selection screen in FM and read the file?or how can i proceed  with the solution?
    Please help..
    Umesh

    Hi Umesh,
    My understanding on your requirement is to read a file from pres. server and pass the data to an IDoc function module. Am I correct?
    If this is the case then you can create a report which picks up the file from pres. server and then read data from the file and pass it to the parameters of the required function module.
    Hope this helps.
    Regards,
    -Sandeep

  • Reading File from Application Server using Read Dataset

    Hi,
    i am trying to read excel file from Application Server and has multiple records in that based on structure below. but when i execute its giving me error message.here is the code, can sumone suggest me on this please ??
    FORM f_data_upload .
      DATA:
         l_filename TYPE string,   "file name
         l_wa_string TYPE string.  "file record
        l_filename = p_inp_as. "File path from Application Server
        OPEN DATASET l_filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
        DO.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
    Read the data from the file in Application server.
          READ DATASET l_filename INTO l_wa_string.
          IF sy-subrc = 0.
            SPLIT l_wa_string AT cl_abap_char_utilities=>horizontal_tab
                  INTO w_data-tcode
                       w_data-matnr
                       w_data-mtart
                       w_data-werks
                       w_data-vkorg
                       w_data-vtweg
                       w_data-lgort
                       w_data-meins
                       w_data-maktx
                       w_data-spart
                       w_data-kosch
                       w_data-mstae
                       w_data-brgew
                       w_data-ntgew
                       w_data-groes
                       w_data-matkl
                       w_data-prdha
                       w_data-mstde
                       w_data-mtpos_mara
                       w_data-gewei
                       w_data-spart
                       w_data-mstav
                       w_data-mstdv
                       w_data-dwerk
                       w_data-taxkm
                       w_data-versg
                       w_data-kondm
                       w_data-ktgrm
                       w_data-mtpos
                       w_data-mtvfp
                       w_data-tragr
                       w_data-ladgr
                       w_data-herkl
                       w_data-ekgrp
                       w_data-webaz
                       w_data-dismm
                       w_data-beskz
                       w_data-prctr
                       w_data-bklas
                       w_data-bwtty
                       w_data-vprsv
                       w_data-verpr
                   IN CHARACTER MODE.
            APPEND w_data TO i_data.
            CLEAR w_data.
           ENDIF.
        ENDDO.
        CLOSE DATASET l_filename.
    Error Message while executing
    What happened?
        At the conversion of a text from codepage '4110' to codepage '4102':
        - a character was found that cannot be displayed in one of the two
        codepages;
        - or it was detected that this conversion is not supported
        The running ABAP program 'ZHDI_LOMM_VEHI_MAT_MASS_CREATE' had to be terminated
         as the conversion
        would have produced incorrect data.
        The number of characters that could not be displayed (and therefore not
        be converted), is 449. If this number is 0, the second error case, as
        mentioned above, has occurred.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_CONVERSION_CODEPAGE', was not
         caught in
        procedure "F_DATA_UPLOAD" "(FORM)", nor was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        Characters are always displayed in only a certain codepage. Many
        codepages only define a limited set of characters. If a text from a
        codepage should be converted into another codepage, and if this text
        contains characters that are not defined in one of the two codepages, a
        conversion error occurs.
        Moreover, a conversion error can occur if one of the needed codepages
        '4110' or '4102' is not known to the system.
        If the conversion error occurred at read or write of  screen, the file
        name was '/usr/sap/interfaces/conversion/pioneer/ddm/data/test_data1.xls'.
         (further information about the file: "X 549
         24064rw-rw----200812232135082008122307293120081223072931")
    Please help me
    Thank You

    Woah ... perfect guru
    but data looks like all junk characters ? its filling with special characters, hashes # and other characters but not with Excel data.. any idea ??
    Temesh
    Edited by: New2Sap Abap on Dec 24, 2008 6:42 AM

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • System exception while deleting the file from app server in background job

    Hi All,
    I have a issue while the deleting the file from application server.
    I am using the statement DELETE DATASET in my program to delete the file from app server.
    I am able to delete the file from the app server when i run the program from app server.
    When i run the same report from background job i am getting the message called System exception.
    Is there any secuirity which i need to get the issue.
    Thank You,
    Taragini

    Hi All,
    I get all the authorization sto delete the file from application serever.
    Thing is i am able to run the program sucessfully in foreground but not in the background .
    It i snot giving any short dump also just JOB is cancelled with the exception 'Job cancelled after system exception ERROR_MESSAGE'.
    Can anybody please give me suggestion
    Thanks,
    Taragini

  • Transfer a file from App Server to a FTP site.

    Hi, Abapers.
    I need your help. Probably, this topic has already been posted in a similar way, but we need an answer to solve our problem.
    We have to sent a PDF file from a directory of our app server (AIX) to a FTP directory... which would the FM sequence we should use to goal it?
    Best Regards.

    Hi Santiago,
    create fm to send file from APP server to FTP site.
    if you want to Post file from desktop to Appl use Transaction - CG3Y
    if you want to Post file from Appl to Desktop use Transaction - CG3Z
    copy the code below....
    *  Author: Prabhudas                            Date:  02/21/2006  *
    *  Name: Z_FTP_FILE_TO_SERVER                                          *
    *  Title: FTP File on R/3 Application Server to External Server        *
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(DEST_HOST) TYPE  C
    *"     REFERENCE(DEST_USER) TYPE  C
    *"     REFERENCE(DEST_PASSWORD) TYPE  C
    *"     REFERENCE(DEST_PATH) TYPE  C
    *"     REFERENCE(SOURCE_PATH) TYPE  C
    *"     REFERENCE(FILE) TYPE  C
    *"     REFERENCE(BINARY) TYPE  CHAR1 OPTIONAL
    *"     REFERENCE(REMOVE_FILE) TYPE  CHAR1 OPTIONAL
    *"  TABLES
    *"      FTP_SESSION STRUCTURE  ZMSG_TEXT OPTIONAL
    *"  EXCEPTIONS
    *"      CANNOT_CONNECT
    *"      SOURCE_PATH_UNKNOWN
    *"      DEST_PATH_UNKNOWN
    *"      TRANSFER_FAILED
    *"      COMMAND_FAILED
      DATA: w_password     TYPE zftppassword,
            w_length       TYPE i,
            w_key          TYPE i                  VALUE 26101957,
            w_handle       TYPE i,
            w_command(500) TYPE c.
      REFRESH ftp_session.
    * Scramble password (new Unicode-compliant routine)
      w_length = STRLEN( dest_password ).
      CALL FUNCTION 'HTTP_SCRAMBLE'
        EXPORTING
          SOURCE      = dest_password
          sourcelen   = w_length
          key         = w_key
        IMPORTING
          destination = w_password.
    * Connect to FTP destination (DEST_HOST)
      CALL FUNCTION 'FTP_CONNECT'
        EXPORTING
          user            = dest_user
          password        = w_password
          host            = dest_host
          rfc_destination = 'SAPFTPA'
        IMPORTING
          handle          = w_handle
        EXCEPTIONS
          not_connected   = 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
          RAISING cannot_connect.
      ENDIF.
    * Optionally, specify binary file transfer
      IF binary = 'X'.
        w_command = 'bin'.
        CALL FUNCTION 'FTP_COMMAND'
          EXPORTING
            handle        = w_handle
            command       = w_command
          TABLES
            data          = ftp_session
          EXCEPTIONS
            command_error = 1
            tcpip_error   = 2.
        IF sy-subrc <> 0.
          CONCATENATE 'FTP command failed:' w_command
            INTO w_command SEPARATED BY space.
          MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
              WITH w_command
              RAISING command_failed.
        ENDIF.
      ENDIF.
    * Navigate to source directory
      CONCATENATE 'lcd' source_path INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING source_path_unknown.
      ENDIF.
    * Navigate to destination directory
      CONCATENATE 'cd' dest_path INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING dest_path_unknown.
      ENDIF.
    * Transfer file
      CONCATENATE 'put' file INTO w_command SEPARATED BY space.
      CALL FUNCTION 'FTP_COMMAND'
        EXPORTING
          handle        = w_handle
          command       = w_command
        TABLES
          data          = ftp_session
        EXCEPTIONS
          command_error = 1
          tcpip_error   = 2.
      IF sy-subrc <> 0.
        CONCATENATE 'FTP command failed:' w_command
          INTO w_command SEPARATED BY space.
        MESSAGE ID 'ZW' TYPE 'E' NUMBER '042'
            WITH w_command
            RAISING transfer_failed.
      ENDIF.
    * Disconnect from destination host
      CALL FUNCTION 'FTP_DISCONNECT'
        EXPORTING
          handle = w_handle.
    * Optionally, remove file from source directory
      IF remove_file = 'X'.
       CONCATENATE source_path '/' file INTO w_command.
      CONCATENATE 'rm' w_command INTO w_command SEPARATED BY space.
       OPEN DATASET '/dev/null' FOR OUTPUT FILTER w_command.
       CLOSE DATASET '/dev/null'.
    ENDIF.
    Regards,
    Prabhudas

  • Oracle read files from FTP Server

    Hi,
    Somebody knowns Oracle how to read files from FTP Server ? Which package I can use?

    Duplicate post
    Oracle read files from FTP Server

  • How to download a file from the net and save it into .txt format in a datab

    Can some one show me a tutorial on how to download a file from the net and save it into .txt format in a database?
    Thank you,

    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • Reading uploaded file from app. server

    Hi All,
    I am trying to upload a .csv format file to app. server thru txn CG3Z....
    When i try to open the file in my code thru open dataset and read dataset ...it is giving it in the form of 
    30002058,1000#50055501,2000#
    Now i want it to be in
    30002058,1000
               50055501,2000
    format...
    pleas suggest..
    thnx
    Rk

    Hi Rahul,
    have you tried reading it in BINary format?
    Kind regards,
    Alvaro

Maybe you are looking for

  • Officejet Pro 8500 printed colours not true colours

    All of a sudden my printed documents are printing using the incorrect colours - photos are 'greyish' (with muted colours); reds print as browny, etc.  We always use genuine HP inks and documents previously printed fine from a colour perspective.  Whe

  • Very slow internet (Dekalb county Indiana)

    I am having problems with my internet speed. on thursday my internet connection speed was over 1000kbs but when i came home friday night my connection speed was only 168kbs. this has been going on for three days now. My modem is a westell 7500. if an

  • How I can identify business objects in a table?

    Hi, Can someone advise me how to identify business objects and events created in a Ar Customers ( ARXCUDCI) table? Many thanks, regards Ilinka

  • Worklist - Usernames + Underscores

    When trying to edit flex field mappings, or creating custom views I am having trouble with one user. Due to enterprise naming conventions, all service type users such as bpeladmin need to have svc_ appended to the front of their logins. However, when

  • Photoshop Elements 13 will not install.

    After downloading Elements 13, I get the following error message when attempting to install the program. Installer failed to initialize. I have tried everything to install this program but nothing seems to work.