File from the Application server

Hi gurus,
I am working on a scenario where I need to get a file from the application server and for this I need to ask user to enter the location and that too at the selection screen and then I need to read this location using open data set and read data set in my program , once I am done with this I need to do some other validations. so can you please help me out how to achieve this.
Thanks
Rajeev Gupta

Hi
Declare the selection screen with file as parameter so that the user enter the application server file..
the use the OPEND DATASET  as mentioned in below code and process
Refer this:
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ca6358411d1829f0000e829fbfe/frameset.htm
ABAP code for uploading a TAB delimited file into an internal table. See code below for structures.
*& Report  ZUPLOADTAB                                                  *                     &----
*& Example of Uploading tab delimited file                             *
REPORT  zuploadtab                    .
PARAMETERS: p_infile  LIKE rlgrap-filename
                        OBLIGATORY DEFAULT  '/usr/sap/'..
DATA: ld_file LIKE rlgrap-filename.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
    name1 like pa0002-VORNA,
    name2 like pa0002-name2,
    age   type i,
    END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
      wa_record TYPE t_record.
*Text version of data table
TYPES: begin of t_uploadtxt,
  name1(10) type c,
  name2(15) type c,
  age(5)  type c,
end of t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) type c.
constants: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then you will
*need to declare constants as follows:
*class cl_abap_char_utilities definition load.
*constants:
   con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
*START-OF-SELECTION
START-OF-SELECTION.
ld_file = p_infile.
OPEN DATASET ld_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc NE 0.
ELSE.
  DO.
    CLEAR: wa_string, wa_uploadtxt.
    READ DATASET ld_file INTO wa_string.
    IF sy-subrc NE 0.
      EXIT.
    ELSE.
      SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                      wa_uploadtxt-name2
                                      wa_uploadtxt-age.
      MOVE-CORRESPONDING wa_uploadtxt TO wa_upload.
      APPEND wa_upload TO it_record.
    ENDIF.
  ENDDO.
  CLOSE DATASET ld_file.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
  loop at it_record into wa_record.
    write:/     sy-vline,
           (10) wa_record-name1, sy-vline,
           (10) wa_record-name2, sy-vline,
           (10) wa_record-age, sy-vline.
  endloop.
Regards
Anji

Similar Messages

  • Upload tab-delimited file from the application server to an internal table

    Hello SAPients.
    I'm using OPEN DATASET..., READ DATASET..., CLOSE DATASET to upload a file from the application server (SunOS). I'm working with SAP 4.6C. I'm trying to upload a tab-delimited file to an internal table but when I try load it the fields are not correctly separated, in fact, they are all misplaced and the table shows '#' where supposedly there was a tab.
    I tried to SPLIT the line using as separator a variable with reference to CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB but for some reason that class doesn't exist in my system.
    Do you know what I'm doing wrong? or Do you know a better method to upload a tab-delimited file into an internal table?
    Thank you in advance for your help.

    Try:
    REPORT ztest MESSAGE-ID 00.
    PARAMETER: p_file LIKE rlgrap-filename   OBLIGATORY.
    DATA: BEGIN OF data_tab OCCURS 0,
          data(4096),
          END   OF data_tab.
    DATA: BEGIN OF vendor_file_x OCCURS 0.
    * LFA1 Data
    DATA: mandt  LIKE bgr00-mandt,
          lifnr  LIKE blf00-lifnr,
          anred  LIKE blfa1-anred,
          bahns  LIKE blfa1-bahns,
          bbbnr  LIKE blfa1-bbbnr,
          bbsnr  LIKE blfa1-bbsnr,
          begru  LIKE blfa1-begru,
          brsch  LIKE blfa1-brsch,
          bubkz  LIKE blfa1-bubkz,
          datlt  LIKE blfa1-datlt,
          dtams  LIKE blfa1-dtams,
          dtaws  LIKE blfa1-dtaws,
          erdat  LIKE  lfa1-erdat,
          ernam  LIKE  lfa1-ernam,
          esrnr  LIKE blfa1-esrnr,
          konzs  LIKE blfa1-konzs,
          ktokk  LIKE  lfa1-ktokk,
          kunnr  LIKE blfa1-kunnr,
          land1  LIKE blfa1-land1,
          lnrza  LIKE blfa1-lnrza,
          loevm  LIKE blfa1-loevm,
          name1  LIKE blfa1-name1,
          name2  LIKE blfa1-name2,
          name3  LIKE blfa1-name3,
          name4  LIKE blfa1-name4,
          ort01  LIKE blfa1-ort01,
          ort02  LIKE blfa1-ort02,
          pfach  LIKE blfa1-pfach,
          pstl2  LIKE blfa1-pstl2,
          pstlz  LIKE blfa1-pstlz,
          regio  LIKE blfa1-regio,
          sortl  LIKE blfa1-sortl,
          sperr  LIKE blfa1-sperr,
          sperm  LIKE blfa1-sperm,
          spras  LIKE blfa1-spras,
          stcd1  LIKE blfa1-stcd1,
          stcd2  LIKE blfa1-stcd2,
          stkza  LIKE blfa1-stkza,
          stkzu  LIKE blfa1-stkzu,
          stras  LIKE blfa1-stras,
          telbx  LIKE blfa1-telbx,
          telf1  LIKE blfa1-telf1,
          telf2  LIKE blfa1-telf2,
          telfx  LIKE blfa1-telfx,
          teltx  LIKE blfa1-teltx,
          telx1  LIKE blfa1-telx1,
          xcpdk  LIKE  lfa1-xcpdk,
          xzemp  LIKE blfa1-xzemp,
          vbund  LIKE blfa1-vbund,
          fiskn  LIKE blfa1-fiskn,
          stceg  LIKE blfa1-stceg,
          stkzn  LIKE blfa1-stkzn,
          sperq  LIKE blfa1-sperq,
          adrnr  LIKE  lfa1-adrnr,
          mcod1  LIKE  lfa1-mcod1,
          mcod2  LIKE  lfa1-mcod2,
          mcod3  LIKE  lfa1-mcod3,
          gbort  LIKE blfa1-gbort,
          gbdat  LIKE blfa1-gbdat,
          sexkz  LIKE blfa1-sexkz,
          kraus  LIKE blfa1-kraus,
          revdb  LIKE blfa1-revdb,
          qssys  LIKE blfa1-qssys,
          ktock  LIKE blfa1-ktock,
          pfort  LIKE blfa1-pfort,
          werks  LIKE blfa1-werks,
          ltsna  LIKE blfa1-ltsna,
          werkr  LIKE blfa1-werkr,
          plkal  LIKE  lfa1-plkal,
          duefl  LIKE  lfa1-duefl,
          txjcd  LIKE blfa1-txjcd,
          sperz  LIKE  lfa1-sperz,
          scacd  LIKE blfa1-scacd,
          sfrgr  LIKE blfa1-sfrgr,
          lzone  LIKE blfa1-lzone,
          xlfza  LIKE  lfa1-xlfza,
          dlgrp  LIKE blfa1-dlgrp,
          fityp  LIKE blfa1-fityp,
          stcdt  LIKE blfa1-stcdt,
          regss  LIKE blfa1-regss,
          actss  LIKE blfa1-actss,
          stcd3  LIKE blfa1-stcd3,
          stcd4  LIKE blfa1-stcd4,
          ipisp  LIKE blfa1-ipisp,
          taxbs  LIKE blfa1-taxbs,
          profs  LIKE blfa1-profs,
          stgdl  LIKE blfa1-stgdl,
          emnfr  LIKE blfa1-emnfr,
          lfurl  LIKE blfa1-lfurl,
          j_1kfrepre  LIKE blfa1-j_1kfrepre,
          j_1kftbus   LIKE blfa1-j_1kftbus,
          j_1kftind   LIKE blfa1-j_1kftind,
          confs  LIKE  lfa1-confs,
          updat  LIKE  lfa1-updat,
          uptim  LIKE  lfa1-uptim,
          nodel  LIKE blfa1-nodel.
    DATA: END   OF vendor_file_x.
    FIELD-SYMBOLS:  <field>,
                    <field_1>.
    DATA: delim          TYPE x        VALUE '09'.
    DATA: fld_chk(4096),
          last_char,
          quote_1     TYPE i,
          quote_2     TYPE i,
          fld_lth     TYPE i,
          columns     TYPE i,
          field_end   TYPE i,
          outp_rec    TYPE i,
          extras(3)   TYPE c        VALUE '.,"',
          mixed_no(14) TYPE c        VALUE '1234567890-.,"'.
    OPEN DATASET p_file FOR INPUT.
    DO.
      READ DATASET p_file INTO data_tab-data.
      IF sy-subrc = 0.
        APPEND data_tab.
      ELSE.
        EXIT.
      ENDIF.
    ENDDO.
    * count columns in output structure
    DO.
      ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      columns = sy-index.
    ENDDO.
    * Assign elements of input file to internal table
    CLEAR vendor_file_x.
    IF columns > 0.
      LOOP AT data_tab.
        DO columns TIMES.
          ASSIGN space TO <field>.
          ASSIGN space TO <field_1>.
          ASSIGN COMPONENT sy-index OF STRUCTURE vendor_file_x TO <field>.
          SEARCH data_tab-data FOR delim.
          IF sy-fdpos > 0.
            field_end = sy-fdpos + 1.
            ASSIGN data_tab-data(sy-fdpos) TO <field_1>.
    * Check that numeric fields don't contain any embedded " or ,
            IF <field_1> CO mixed_no AND
               <field_1> CA extras.
              TRANSLATE <field_1> USING '" , '.
              CONDENSE <field_1> NO-GAPS.
            ENDIF.
    * If first and last characters are '"', remove both.
            fld_chk = <field_1>.
            IF NOT fld_chk IS INITIAL.
              fld_lth = strlen( fld_chk ) - 1.
              MOVE fld_chk+fld_lth(1) TO last_char.
              IF fld_chk(1) = '"' AND
                 last_char = '"'.
                MOVE space TO fld_chk+fld_lth(1).
                SHIFT fld_chk.
                MOVE fld_chk TO <field_1>.
              ENDIF.       " for if fld_chk(1)=" & last_char="
            ENDIF.         " for if not fld_chk is initial
    * Replace "" with "
            DO.
              IF fld_chk CS '""'.
                quote_1 = sy-fdpos.
                quote_2 = sy-fdpos + 1.
                MOVE fld_chk+quote_2 TO fld_chk+quote_1.
              ELSE.
                MOVE fld_chk TO <field_1>.
                EXIT.
              ENDIF.
            ENDDO.
            <field> = <field_1>.
          ELSE.
            field_end = 1.
          ENDIF.
          SHIFT data_tab-data LEFT BY field_end PLACES.
        ENDDO.
        APPEND vendor_file_x.
        CLEAR vendor_file_x.
      ENDLOOP.
    ENDIF.
    CLEAR   data_tab.
    REFRESH data_tab.
    FREE    data_tab.
    Rob

  • Error while extracting XML file from the application server

    Hi ,
    I am writing a XML file into the application server, after which when i try to extract the file to the local server using the report - RFASLDPC ,
    the file is extracted, but with a '#' symbol at the first position.
    Because of which the XML File does not open. But after i open the file in notepad and manually delete the '#' symbol and then reopen the file, it works fine.
    Is there any way to remove the '#' symbol while extracting itself ??
    Thanks in advance,
    Vikas.

    Select the option "No Character Set Conversion" in stead of Code page 1100.
    However, I still have troubles -> the downloaded xml file misses a space on several places. This causes errors too.

  • Moving of flat file from the application server after upload.

    Hi All,
    I am uploading data from a flat file placed on the application server by a BDC program.
    After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
    Can any one suggest the best way of doing this particular scenario?
    Thanks in advance.
    Regards
    Satish Nair.

    Here is a sample program.
    report zrich_0001.
    data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
          d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
    data: begin of itab occurs 0,
          rec(20) type c,
          end of itab.
    data: wa(20) type c.
    start-of-selection.
      open dataset d1 for input in text mode.
      if sy-subrc = 0.
        do.
          read dataset d1 into wa.
          if sy-subrc <> 0.
            exit.
          endif.
          itab-rec = wa.
          append itab.
        enddo.
      endif.
      close dataset d1.
      open dataset d2 for output in text mode.
      loop at itab.
        transfer itab to d2.
      endloop.
      close dataset d2.
      delete dataset d1.
    Regards,
    Rich Heilman

  • How to delete  File from the Application Server,ABAP

    Hi Gurus,
    I'm using  DELETE  DATASET  Statement ,
    Based on Date  how can i delete files with in the period in the Application server
    Any BAPI/FM  for this Delete file based  on some Date Period
    Thanks in Advance.

    DATA: BEGIN OF file,
            dirname(75) TYPE c, " name of directory. (possibly truncated.)
            name(75)    TYPE c, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file.
    DATA: BEGIN OF file_list OCCURS 100,
            dirname(75) TYPE c, " name of directory. (possibly truncated.)
            name(75)    TYPE c, " name of entry. (possibly truncated.)
            type(10)    TYPE c,            " type of entry.
            len(8)      TYPE p,            " length in bytes.
            owner(8)    TYPE c,            " owner of the entry.
            mtime(6)    TYPE p, " last modification date, seconds since 1970
            mode(9)     TYPE c, " like "rwx-r-x--x": protection mode.
            useable(1)  TYPE c,
            subrc(4)    TYPE c,
            errno(3)    TYPE c,
            errmsg(40)  TYPE c,
            mod_date    TYPE d,
            mod_time(8) TYPE c,            " hh:mm:ss
            seen(1)     TYPE c,
            changed(1)  TYPE c,
          END OF file_list.
      DO.
        CLEAR file.                           
        CALL 'C_DIR_READ_NEXT'
          ID 'TYPE'   FIELD file-type
          ID 'NAME'   FIELD file-name
          ID 'LEN'    FIELD file-len
          ID 'OWNER'  FIELD file-owner
          ID 'MTIME'  FIELD file-mtime
          ID 'MODE'   FIELD file-mode
          ID 'ERRNO'  FIELD file-errno
          ID 'ERRMSG' FIELD file-errmsg.
       if sy-subrc eq 0.
          MOVE-CORRESPONDING file TO file_list.
          APPEND file_list.
       else.
          exit.
       endif.
    enddo.
    sort file_list based on date and time ie, MOD_DATE and MOD_TIME fields
    and delete the entries

  • How to select all files from the application server.

    Hi all,
    I have  a requirement to select all files with the same file format I.e i have created no of files with same name but different time stamps addition , now i want to select all the fiels and read the data into an internal table and sort them on the user requirement,  I am using FM -
    /SAPDMC/LSM_F4_SERVER_FILE to get single file name, i should also give the option on the  selection screen for the user to select the file range I.e form which to which the sorting should be done.
    could anybody suggest me the function module which selects all the file names .
    Regards,
    Sre.
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:49 PM

    Hi,
    PARAMETER: p_fdir type pfeflnamel DEFAULT '/usr/sap/tmp'.
    data: begin of it_filedir occurs 10.
    include structure salfldir.
    data: end of it_filedir.
    *START-OF-SELECTION
    START-OF-SELECTION.
    Get Current Directory Listing for OUT Dir
    call function 'RZL_READ_DIR_LOCAL'
    exporting
    name = p_fdir
    tables
    file_tbl = it_filedir.
    List of files are contained within table it_filedir
    loop at it_filedir.
    write: / it_filedir-NAME.
    endloop.
    Regards,
    Omkaram.

  • Upload and download of  excel file in the application server in background

    Hi all,
    i want to download the excel file from application server into internal table and after processing i have to upload to excel file in the application server in the background mode..
    i mean i'll schedule the program in background.
    im using FM ALSM_EXCEL_TO_INTERNAL_TABLE its working fine in fore ground but not in back ground.
    what method i have to follow ?

    Hi Ankit,
    I think this is not possible to open a Excel-File from the application server because the Excel format before Office 2007 where a binary format (Suffix: .xls). The newer Office file format (Suffix: xlsx) is a zipped XML Format. To read the binary Excel-Format you need an OLE Connection between SAP GUI and Office. But at the application server in background you doesn't have this OLE Connection.
    In my opinion you have two possibilities:
    1. Convert all files in the CSV format. This file format can be read with open dataset.
    2. Upload the files from the presentation server in forground. There are some funktion modules in the standard which can read the xls format. But they have some limits regarding the length of cells content.
    My recommendation is solution no. 1. If you know an VBA expert, he can write an Excel-macro which converts all Excel Files in the CSV-Fomat.
    Regards
    Dirk

  • Regarding reading data from a file in the application server.

    Hello Everyone,
    My question is:
    The file in the application server consists of data with header, detail and trail out of which the detail contains the main information. The detail again contains the data in the form of a continuous string and again some spaces corresponding to a single record. I need to split the data in the internal table in such a way so that the first few characters get into field-1 of the target internal table. Again I need to consider the spaces for accessing the data for filling up in field-2. How do I decide on the 'Split' statement and specially when the whole string has to be taken care of as contatining data in a single string format without space and again some data after some spaces corresponding to a single record.
    Your help is very much needed. Thanks to all the experts in advance.

    Hi
      This is the sample code I was used for the similar requirement.
    DATA: single_line TYPE string .
    v_file_listings = pa_filn1.
    IF v_file_listings IS INITIAL .
    MESSAGE e039 WITH v_file_listings.
    ENDIF.
    *-- read file, split lines into fields and put data into table
    OPEN DATASET v_file_listings FOR INPUT IN TEXT MODE ENCODING NON-UNICODE. "Opening the files
    IF sy-subrc EQ 0.
    DO.
    READ DATASET v_file_listings INTO single_line. "Reading the content of file into line
    IF sy-subrc = 0.
    IF sy-index > 1. "skip header-line
    SPLIT "Split the content of line into work area
    single_line
    AT k_split
    INTO
    wa_listings-kschl " Condition type
    wa_listings-tabname16 " Condition table name
    wa_listings-vkorg " Sales organisation
    wa_listings-kunnr " sold-to party numberor ship-to party number
    wa_listings-matnr " Material Number
    wa_listings-kodatab " Valid-from date
    wa_listings-kodatb1. " Valid-to date
    APPEND wa_listings TO itab_listings. "Appending Work Area to internal table
    ENDIF.
    ELSE.
    EXIT.
    ENDIF.
    v_count1 = sy-tabix.
    ENDDO.
    Regards,
    Sreeram

  • How to see the file at the application server

    HI TO ALL SDNERS ,
                                 THIS IS MY CODE WHERE TO CHECK THE DOWNLOADED FILE AT THE APPLICATION SERVER.IN TCODE AL11 I HAVE SEEN THERE IS NO FILE GETTING CREATED.WHEN TRANSFERRING THE SY-SUBRC VALUE IS ZERO.
    Program Name        : ZME11_BDC.
    Title               : PURCHASE INFORMATION RECORD LOAD PROGRAM
    Program Objective   : THIS PROGRAM READS IN THE PURCHASE
                          INFORMATION FILE. IT CREATES A BDC SESSION TO
                          USE TO LOAD THE PURCHASE INFORMATION RECORDS
                          INTO SAP using the ME11 Transaction.
    REPORT  ZME11_BDC no standard page heading MESSAGE-ID ZHNC line-size 55.
                constants declaration
    constants: c_x value 'X',
               c_sess type apqi-groupid value 'zcustomer',
               c_xd01 type tstc-tcode value 'ME11'.
                  DECLARING VARIABLES
    DATA: V_MSG(255),
          V_ERREC TYPE I,"NO OF FAILED RECORDS
          V_LINES."NO OF RECORDS
           FLAG DECLARATIONS
    DATA: FG_DATA_EXIST VALUE 'X',"CHECK FOR DATA
          FG_SESSION_OPEN VALUE ''.
          STRUCTURES AND INTERNAL TABLE DECLARATIONS
    TYPES :BEGIN OF TY_PIR,
             LIFNR TYPE EINA-LIFNR,
             MATNR TYPE EINA-MATNR,
             EKORG TYPE EINE-EKORG,
             WERKS TYPE EINE-WERKS,
             VERKF TYPE EINA-VERKF,"sales person
             TELF1 TYPE EINA-TELF1,"telephone
             URZLA TYPE EINA-URZLA,"country
             REGIO TYPE EINA-REGIO,"region
             APLFZ(5),"plan deleivery time
             EKGRP TYPE EINE-EKGRP,"purchase group
             NORBM(13),
             NETPR(13),
         END OF TY_PIR.
    DATA : IT_PIR TYPE TABLE OF TY_PIR,
           WA_PIR LIKE LINE OF IT_PIR.
    DATA: BEGIN OF IT_BDCDATA.
    INCLUDE STRUCTURE BDCDATA.
    DATA END OF IT_BDCDATA.
    DATA : BEGIN OF IT_BDCMSG.
    INCLUDE STRUCTURE BDCMSGCOLL.
    DATA END OF IT_BDCMSG.
                      SELECTION SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : FNAME TYPE RLGRAP-FILENAME.
    SELECTION-SCREEN END OF BLOCK B1.
                           AT SELECTION ON VALUE REQUEST
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR FNAME.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
       PROGRAM_NAME        = SYST-CPROG
       DYNPRO_NUMBER       = SYST-DYNNR
       FIELD_NAME          = ' '
    IMPORTING
       FILE_NAME           = FNAME.
                             START OF SELECTION
    START-OF-SELECTION.
    PERFORM F_GET_DATA USING FNAME
                       CHANGING IT_PIR.
    PERFORM F_GENERATE_DATASET USING FNAME
                               CHANGING IT_PIR WA_PIR.
    *&      Form  F_GET_DATA
          text
         -->P_V_FNAME  text
         <--P_IT_PIR  text
    FORM F_GET_DATA  USING    P_FNAME LIKE FNAME
                     CHANGING P_IT_PIR LIKE IT_PIR.
    DATA: LV_FILE TYPE STRING.
    LV_FILE  = FNAME.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        FILENAME                      = LV_FILE
       FILETYPE                      = 'DAT'
      HAS_FIELD_SEPARATOR           = 'X'
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      TABLES
        DATA_TAB                      = P_IT_PIR
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
       INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
       HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
       ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
       DP_TIMEOUT                    = 16
       OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    IF P_IT_PIR IS INITIAL.
    FG_DATA_EXIST = ''.
    ENDIF.
    ENDFORM.                    " F_GET_DATA
    *&      Form  F_GENERATE_DATASET
          text
         -->P_V_FNAME  text
         <--P_IT_PIR  text
    FORM F_GENERATE_DATASET  USING    P_V_FNAME LIKE FNAME
                             CHANGING P_IT_PIR LIKE IT_PIR
                                      P_WA_PIR LIKE WA_PIR.
    MESSAGE I001(ZHNC).
    *OPENING FILE AT THE APPLICATION SERVER FOR WRITING
    OPEN DATASET FNAME FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF SY-SUBRC  EQ 0.
    MESSAGE I002(ZHNC).
    LOOP AT P_IT_PIR INTO P_WA_PIR.
    SPLIT P_WA_PIR AT '*' INTO P_WA_PIR-LIFNR
                               P_WA_PIR-MATNR
                               P_WA_PIR-EKORG
                               P_WA_PIR-WERKS
                               P_WA_PIR-VERKF
                               P_WA_PIR-TELF1
                               P_WA_PIR-URZLA
                               P_WA_PIR-REGIO
                               P_WA_PIR-APLFZ
                               P_WA_PIR-EKGRP
                               P_WA_PIR-NORBM.
    *TRANSFER THE FILE FROM INTERNAL TABLE TO APPLICATION SERVER
    MESSAGE I003(ZHNC).
    TRANSFER P_WA_PIR TO FNAME.
    ENDLOOP.
    *CLOSING THE FILE AT THE APPLICATION SERVER
    CLOSE DATASET FNAME.
    ENDIF.

    Hello,
    I made a similar program. You can have a look at it.
    *&      Form  write_to_app_server
          text
    -->  p1        text
    <--  p2        text
    FORM write_to_app_server.
    To get filename
      PERFORM get_filename.
    To write into the application server
      OPEN DATASET g_filename_with_path FOR OUTPUT IN TEXT MODE.
      IF sy-subrc = 0.
        LOOP AT <l_table> INTO <l_line>.
          TRANSFER <l_line> TO g_filename_with_path.
        ENDLOOP.
        CLOSE DATASET g_filename_with_path.
      ELSE.
        CLOSE DATASET g_filename_with_path.
      ENDIF.
    To send mail
      PERFORM send_mail.
    ENDFORM.                    " write_to_app_server
    *&      Form  get_filename
          text
    -->  p1        text
    <--  p2        text
    FORM get_filename.
      DATA : l_log_path TYPE  filepath-pathintern
                          VALUE 'Y28M_DOWNLOADS_BACKGROUND' .
      CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
           EXPORTING
                client                     = sy-mandt
                logical_path               = l_log_path
                operating_system           = sy-opsys
                file_name                  = p_fname
           IMPORTING
                file_name_with_path        = g_filename_with_path
           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 ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                    " get_filename
    You may find it useful.
    Regards,
    Karuna.

  • Looking for file in the application server.

    Hello expert,
              I want to download a file from SAP application server, but when I get into file system for application server by AL11 , I can't find out the folder for my file, why?  is that authority issue or I did the wrong way to get into the system?  appreciate very much for your help.
    Many Thanks,

    Hi,
    At AL11, if you have the proper authorizations, you should see a Configure button.  After that, enter:
    - Directory Name:
    server-name\directory
    - Param. Name: Z_<directory>
    - ServerName: all
    Then, click on Save.
    Take into account that SAPServiceSID user should have read access to the share.
    Regards,
    Maximiliano

  • Maximum length of header in the file on the application server?

    Hi there,
               I am uploading a file on the application server. I am writing the header separately which is column heading in char format. Then I am writing the data to that file.
               Now the problem is, I am unable to get more than 256 chars for each line in the file, including header, in <b>AL11 file view</b> and while I am <b>downloading that file on to my desktop</b>, I am <b>not</b> getting more than 256 chars from <b>header </b> line in my excel sheet however I am getting all the chars i.e. more than 256 chars of all the <b>data line</b>.
               Please can you tell,what could be the problem or let me know any way to see and download all the header line fields.

    I am using more than 256 chars at both the places i.e. header and data line. Still I am not getting more than 256 chars in the file.
    However while downloading that file onto the desktop, it is not showing more than 256 chars for the header part, but it showing all the values of data line, exceeding 256 chars.

  • Save PDF-file on the application server

    Hello experts,
    I convert my Smartform to a PDF-File. I copied the code from  Suresh Kumar Parvathaneni (REPORT zsuresh_test). At first, thank you Suresh Kumar for that!
    Now, I would like to save the PDF-File on the application server and not local.
    Could you tell me how to do this. Especially, where do I have to put the abap-code in the given code from Suresh Kumar.
    I thank you very much for your help in advance.
    With kind regards.
    gokselin

    Hi,
    You can use the OPEN DATASET statment.
    Probably you must be having an output table which you are downloading to the local machine.You can use the same and loop at it. and if the OPEN dataset returned sy-subrc 0, use the TRANSFER statment.
    Remember the data will be binary for pdf. So you have to open the dataset in binary mode.
    regards,
    Advait

  • CL_GUI_PDFVIEWER and files from the App server

    Hi,
    I would liek to use the class CL_GUI_PDFVIEWER  to read files from the app server (transaction AL11) and then to present them.
    it is easy to use the local machine files.
    how can I use the method open_document with a file from there?
    Thanks,
    Itay

    Thanks for the help.
    I tried what you suggested but I get a dump for some reason.
    Can you help?
    This is the dump:
    Exception condition "SYSTEM_FAILURE" raised.
         Program                                      SAPLOLEA                    
         Include                                      LOLEAU10                    
         Row                                          358                         
         Module type                                  (FUNCTION)                  
         Module Name                                  AC_FLUSH_CALL_INTERNAL      
    This is the program:
    REPORT zpdftest .
    DATA: g_html_viewer     TYPE REF TO cl_gui_html_viewer,
          my_main_container TYPE REF TO cl_gui_custom_container,
          entry1(100) TYPE c,
          entry2(100) TYPE c.
    DATA: okcode TYPE sy-ucomm,
          gt_pdf TYPE STANDARD TABLE OF string,
          wa_pdf TYPE string,
          g_url(2048)  TYPE c
    START-OF-SELECTION.
      SET SCREEN 100.
    *&      Module  pbo_0100  OUTPUT
    MODULE pbo_0100 OUTPUT.
      SET PF-STATUS 'STATUS100'.
      SET TITLEBAR  'TITLE100'.
      IF my_main_container IS INITIAL.
        CREATE OBJECT my_main_container
          EXPORTING
            container_name = 'CUSTOM_CNTL'
          EXCEPTIONS
            cntl_error     = 1
            OTHERS         = 2.
        CHECK sy-subrc IS INITIAL.
        CREATE OBJECT g_html_viewer
          EXPORTING
            parent             = my_main_container
          EXCEPTIONS
            cntl_error         = 1
            cntl_install_error = 2
            dp_install_error   = 3
            dp_error           = 4
            OTHERS             = 5
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        DATA: lv_filename TYPE rlgrap-filename.
        lv_filename = '/PBMGUS/UXA/ABAP/TEST.PDF'.
        OPEN DATASET lv_filename FOR INPUT
                     IN BINARY MODE
        WHILE sy-subrc IS INITIAL.
          READ DATASET  lv_filename  INTO wa_pdf.
          IF NOT sy-subrc IS INITIAL.
            EXIT.
          ENDIF.
          APPEND wa_pdf TO gt_pdf.
        ENDWHILE.
        CLOSE DATASET lv_filename.
        CALL METHOD g_html_viewer->load_data
          EXPORTING
            type                 = 'application'
            subtype              = 'pdf'
          IMPORTING
            assigned_url         = g_url
          CHANGING
            data_table           = gt_pdf
          EXCEPTIONS
            dp_invalid_parameter = 1
            dp_error_general     = 2
            cntl_error           = 3
            OTHERS               = 4
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        CALL METHOD g_html_viewer->show_url
          EXPORTING
            url                    = g_url
          EXCEPTIONS
            cntl_error             = 1
            cnht_error_not_allowed = 2
            cnht_error_parameter   = 3
            dp_error_general       = 4
            OTHERS                 = 5
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDMODULE.                 " pbo_0100  OUTPUT
    *&      Module  pai_0100  INPUT
    MODULE pai_0100 INPUT.
      CASE okcode.
        WHEN 'BACK'.
          LEAVE to screen 0.
        WHEN OTHERS.
          CALL METHOD cl_gui_cfw=>dispatch.
      ENDCASE.
      CLEAR okcode.
    ENDMODULE.                 " pai_0100  INPUT

  • Problem downloading from the application server

    Hey Folks,
    I am using datasets to write a file onto the application server. but when i tried to download it on the dsktop its giving me a dump saying the file cannot handle more than 75mb of data. What wuld be the solution for this problem.
    Regards
    Rock.

    hi ,
    use this it will exactly run,
    report  ztestprogramfordownload.
    tables:zupload.
    data:it_pa0002(200).
    types: begin of ty_pa0002 ,
           pernr like pa0002-pernr,
           begda like pa0002-begda,
           endda like pa0002-endda,
           vorna like pa0002-vorna,
           nachn like pa0002-nachn,
           end of ty_pa0002.
    data:begin of it_error  occurs 0 ,
         pernr like pa0000-pernr,
         end of it_error .
    data:it_final type standard table of ty_pa0002 with header line.
    data:it_temp type standard table of ty_pa0002 with header line.
    parameters:p_file like rlgrap-filename default 'F:\usr\sap\EC6\DVEBMGS00\work\entiraledu1'.
    start-of-selection.
    open dataset p_file for input in text mode   encoding default.
    do.
      read dataset p_file into it_pa0002.
    if sy-subrc = 0.
    it_final-pernr = it_pa0002+0(8).
    it_final-begda = it_pa0002+18(8).
    it_final-endda = it_pa0002+36(8).
    it_final-vorna = it_pa0002+54(40).
    it_final-nachn = it_pa0002+104(40).
    append it_final.
    clear it_final.
      else.
      exit.
      endif.
    enddo.
    if not it_final[] is initial.
    sort it_final by pernr begda descending.
    delete adjacent duplicates from it_final comparing pernr .
    select pernr
           begda
           endda
           vorna
           nachn
           from pa0002
           into table it_temp
           for all entries in it_final
           where pernr = it_final-pernr.
    endif.
    loop at it_temp.
    zupload-pernr = it_temp-pernr.
    zupload-begda = it_temp-begda.
    zupload-endda = it_temp-endda.
    zupload-vorna = it_temp-vorna.
    zupload-nachn = it_temp-nachn.
    insert zupload.
    clear it_temp.
    clear zupload.
    endloop.
    close dataset p_file.
    reward points if useful,
    venkat.

  • How do upload a file to the application server into a directory?

    hi to all,
    i want to upload file into the database..i need upload the file into the application server and save it to a directory..is there any way?where i can read about this?any information?
    ashwiny

    Hello,
    First, we need to determine the terms we are using, in order to avoid confusion. We (including the documentation) are using "upload" to describe storing the file on the server, and "download" to pull it from the server into local machine.
    You can use the "File Browse" item to upload any file you need from your local machine and into a database table. The default APEX configuration (in the dads.conf file) stored the uploaded file in a table called wwv_flow_file_objects$. In your application, you can access this table using a view called APEX_APPLICATION_FILES.
    After you uploaded a file, any user can access it, using the download procedure described in the reference I gave you. The download procedure gives you an option to store the download file anywhere you need, using the "Open/Save" dialog box.
    I believe this is covering everything you need. If you still having problems, please consider posting the relevant application pages on apex.oracle.com. It will be easier to understand and help you.
    Regards,
    Arie.

Maybe you are looking for

  • CL_GUI_DIALOGBOX_CONTAINER

    Hi, I use cl_gui_dialogbox_container to write a help on-line for a project. In this dialog box I can display an help file. How I can make invisible the screen in background ? I need only a dialog box.

  • Little help needed with the installation of apps...

    Before the I was told to update to 3.0 I purchased and downloaded a few apps, using my iphone. Where can I download them without being charged again? The 'Application' tab in iTunes isn't there :S

  • Dump error while running tcode

    Hi When i am running my payroll with standard tcode pc00_m10_calc that tcode is going into abap runtime error., I even checked with abap and basis but can able to solve the prob so kindly help me Error in the ABAP Application Program The current ABAP

  • Why do I have to "set up" Airport Connect. after "sleep" or logging off?

    I installed OS 10.5.4 a couple of months ago. Ever since then each time I log on to the internet or just get my mail (from Apple Mail) I get a message that I'm not connected. I then have to punch a multitude of buttons to get on again. I've found no

  • MB51- list output and layout question

    Dear experts, I have a quick question about MB51 layout. When I run the report the output by default is not ALV list output. In order to get that I have to click the "detail" view button. I am trying to set this job in the background and send the "li