I want to put header while stroing file in application server

Hi Guru,
   Can anybody tell how to put header while stroing file in application server.
in the below pgm data is coming i want to put heading .if we see in al11 transaction the header should come .plese give on eg in the code itself.its urgent
eg:
material number
100
200
declarations...................................................
tables: bkpf.                          " Accounting Document Header
*"Selection screen elements............................................
parameters:
  p_burks like bkpf-bukrs.             " Company Code
select-options:
  s_gjahr for bkpf-gjahr.              " Fiscal year
Type declaration of the structure to hold Accounting Document Header*
data:
  begin of fs_bkpf,
    bukrs type bkpf-bukrs,             " Company Code
    belnr type bkpf-belnr,             " Accounting Document Number
    gjahr type bkpf-gjahr,             " Fiscal year
    blart type bkpf-blart,             "        Document type
    bldat type bkpf-bldat,             " Document date in document
  end of fs_bkpf.
Internal table to hold Accounting Document Header                   *
data:
  t_bkpf like standard table
           of fs_bkpf.
Type declaration of the structure to hold file data                 *
data:
  begin of fs_table,
    str type string,
  end of fs_table.
Internal table to hold file data                                    *
data:
  t_table like standard table
            of fs_table.
field-symbols: <fs>.
*" Data declarations...................................................
Work variables                                                      *
data:
  w_char(50)      type c,
  w_file_name(50) type c value 'YH645_050103'.
select bukrs                           " Company Code
       belnr                           " Accounting Document Number
       gjahr                           " Fiscal year
       blart                           "        Document type
       bldat                           " Document date in document
  from bkpf
  into table t_bkpf
where bukrs eq p_burks
   and gjahr in s_gjahr.
if sy-subrc eq 0.
  loop at t_bkpf into fs_bkpf.
    do.
      assign component sy-index of structure fs_bkpf to <fs>.
      if sy-subrc ne 0.
        exit.
      else.
        move <fs> to w_char.
        if sy-index eq 1.
          fs_table-str = <fs>.
        else.
          concatenate fs_table-str ',' w_char into fs_table-str.
        endif.                         " IF SY-INDEX...
      endif.                           " IF SY-SUBRC...
    enddo.                             " DO...
    append fs_table to t_table.
  endloop.                             " LOOP AT T_KNA1...
endif.                                 " IF SY-SUBRC...
open dataset w_file_name for output in text mode encoding default.
loop at t_table into fs_table.
  transfer fs_table-str to w_file_name.
endloop.                               " LOOP AT T_TABLE...

Hi,
may i know what kind of heading you want to display?
like date, filename, time etc
then modify the below code:
*&      Form  send_statistic
     Create the status Report on application Server
   --->  pv_rlines  - Total No of Records in Internal table          *
   --->  pv_slines  - Total No of Successful records                 *
   --->  pv_elines  - Total No of Errornous  records                 *
   --->  pv_path    - File Path  where the file to be created        *
   --->  pv_flag    - Flag to check for A/c group                    *
FORM sub_send_statistic USING  pv_rlines  TYPE int4
                               pv_slines  TYPE int4
                               pv_elines  TYPE int4
                               pv_path    TYPE salfile-longname
                               pv_name    TYPE rlgrap-filename
                               pv_flag    TYPE char1.
  CLEAR : i_tab,
          wa_tab.
Convert date to MM/DD/YYYY format
  PERFORM date_convert.
Convert Time to HH:MM:SS format
  CONCATENATE sy-uzeit+0(2)
              c_colon
              sy-uzeit+2(2)
              c_colon
              sy-uzeit+4(2)
         INTO v_time1.
Build the Output File name
  IF   p_sold  = c_x
  AND  pv_flag = c_x.
    CONCATENATE c_objid
                c_us
                c_z001
                c_us
                sy-datum
                c_us
                sy-uzeit
           INTO v_file.
  ENDIF.  " IF   p_sold = c_x
  IF p_cons = c_x.
    CONCATENATE c_objid
                c_us
                c_z008
                c_us
                sy-datum
                c_us
                sy-uzeit
           INTO v_file.
  ELSEIF p_sold = c_x
  AND    pv_flag <> c_x.
    CONCATENATE c_objid
                c_us
                sy-datum
                c_us
                sy-uzeit
           INTO v_file.
  ENDIF.  " IF p_cons = c_x
Build the Complete Output File Path
  CONCATENATE pv_path
              c_slash
              v_file
         INTO v_outfile.
Populate the data required for output into an internal table and
then transfer the table contents to file on application server
DATA UPLOAD STATISTICS
  wa_tab-rec = text-001.
  APPEND wa_tab TO i_tab.
  CLEAR wa_tab.
TITLE
  IF   p_sold  = c_x
  AND  pv_flag <> c_x.
    sy-title = text-t17.
  ENDIF.  " IF   p_sold = c_x
  IF  p_sold  = c_x
  AND pv_flag = c_x.
    sy-title  = text-t16.
  ENDIF.  " IF  p_sold = c_x
  IF  p_cons  = c_x
  AND pv_flag = c_x.
    sy-title  = text-t19.
  ENDIF.  " IF  p_cons = c_x
  wa_tab-rec+0(7)   = text-002.
  wa_tab-rec+7(60)  = sy-title.
  APPEND wa_tab TO i_tab.
  CLEAR wa_tab.
Date & Time
  wa_tab-rec+0(5)   = text-012.
  CONDENSE v_date NO-GAPS.
  wa_tab-rec+6(10)  = v_date.
  wa_tab-rec+60(10) = text-003.
  wa_tab-rec+70(15) = v_time1.
  APPEND wa_tab TO i_tab.
  CLEAR wa_tab.
Folder Name
  wa_tab-rec+0(18)  = text-005.
  wa_tab-rec+19(72) = pv_path.
  APPEND wa_tab TO i_tab.
  CLEAR wa_tab.
File Name
  wa_tab-rec+0(18)  = text-006.
---Begin of addition -Shivakumar - 09-05-2007--
  wa_tab-rec+19(72) = pv_name.
---Begin of addition -Shivakumar - 09-05-2007--
  APPEND wa_tab TO i_tab.
  CLEAR wa_tab.
Records Read
  CLEAR v_count.
  v_data   = pv_rlines.
  v_count  = STRLEN( v_data ).
  CONDENSE v_data NO-GAPS.
  wa_tab-rec+0(46)  = text-007.
  wa_tab-rec+47(4)  = v_data.
  APPEND wa_tab TO i_tab.
  CLEAR : wa_tab,
          v_data.
Successfull Records
  CLEAR v_count.
  v_data   = pv_slines.
  v_count  = STRLEN( v_data ).
  CONDENSE v_data NO-GAPS.
  wa_tab-rec+0(46)  = text-008.
  wa_tab-rec+47(4)  = v_data.
  APPEND wa_tab TO i_tab.
  CLEAR : wa_tab,
        v_data.
Error Records
  CLEAR v_count.
  v_data   = pv_elines.
  v_count  = STRLEN( v_data ).
  CONDENSE v_data NO-GAPS.
  wa_tab-rec+0(46)  = text-009.
  wa_tab-rec+47(4)  = v_data.
  APPEND wa_tab TO i_tab.
  CLEAR : wa_tab,
          v_data.
  v_mesg = text-t04.
  IF   p_sold  = c_x
  AND  pv_flag <> c_x.
    MOVE i_tab  TO i_file.
  ENDIF.  " IF   p_sold = c_x
  IF  p_sold  = c_x
  AND pv_flag = c_x.
    MOVE i_tab  TO i_file1.
  ENDIF.  " IF  p_sold = c_x
  IF NOT i_tab IS INITIAL.
Open the file on Application server to write the report
    OPEN DATASET v_outfile
             FOR OUTPUT IN TEXT MODE
        ENCODING DEFAULT MESSAGE v_mesg.
    IF sy-subrc <> 0.
      MESSAGE e000(zconversions) WITH v_mesg.
    ELSE.  " IF sy-subrc <> 0
Transfer details to the file on application server
      CLEAR wa_tab.
      LOOP AT  i_tab INTO wa_tab.
        TRANSFER wa_tab-rec TO v_outfile.
        CLEAR wa_tab.
      ENDLOOP.  " LOOP AT  i_tab INTO wa_tab
Close the file
      CLOSE DATASET v_outfile.
    ENDIF.  " IF sy-subrc <> 0
  ENDIF.  " IF NOT i_tab IS INITIAL
ENDFORM.                    " Create_Report

Similar Messages

  • Error in PDF Conversion while downloading file from application server

    Hi,
    I am facing a problem in which i have to download file from application server which is a PDF file (output of SAP Script). I am downloading this file using following code in BSP technology:
    * event handler for data retrieval
    EMPCD = REQUEST->GET_FORM_FIELD( 'emp' ).
    MONTH = REQUEST->GET_FORM_FIELD( 'mn' ).
    YEAR  = REQUEST->GET_FORM_FIELD( 'yr' ).
    W_IND = 'N' .
    DATA : wa_zform16 type  zform16.
    DATA : file_path type string.
    DATA : l_pdf_len type string.
    DATA STR TYPE STRING.
    DATA: OUTPUT    TYPE STRING ,
          L_XSTRING TYPE XSTRING ,
          APP_TYPE  TYPE STRING.
    DATA: PDF_TABLE TYPE  RCL_BAG_TLINE.
    DATA PHY_NAME_OUT     TYPE SAPB-SAPPFAD.
    concatenate '/usr/sap/put/form16/' EMPCD '_' YEAR '.PDF'  into file_path
    *PHY_NAME_OUT = '/usr/sap/put/form16/01000200_2007.PDF'.
    PHY_NAME_OUT = file_path.
    OPEN DATASET PHY_NAME_OUT FOR INPUT IN TEXT MODE ENCODING default.
    IF SY-SUBRC IS INITIAL.
      DO.
        READ DATASET PHY_NAME_OUT INTO STR.
        IF SY-SUBRC IS INITIAL.
          CONCATENATE
              OUTPUT
              STR
              CL_ABAP_CHAR_UTILITIES=>CR_LF
          INTO OUTPUT.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      APP_TYPE = 'APPLICATION/PDF'.
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          TEXT     = OUTPUT
                MIMETYPE = 'APPLICATION/PDF'
    *            MIMETYPE = 'APPLICATION/PDF;charset=utf-16le'
        IMPORTING
          BUFFER   = L_XSTRING.
      CALL METHOD CL_BSP_UTILITY=>DOWNLOAD
        EXPORTING
          OBJECT_S            = L_XSTRING
          CONTENT_TYPE        = APP_TYPE
          CONTENT_DISPOSITION = 'attachment;filename=webforms.pdf'
          RESPONSE            = _M_RESPONSE
          NAVIGATION          = NAVIGATION.
    Result of this code is : there is a pop up asking to open or save pdf format and process is complete, but i have problem in downloaded file.
    At the time of creation i have put BMP image for signature in PDF file and it is working fine but when i upload that file in Application server and then download it with above used code it save the PDF file but when i open that file so whereever i have used signature that page gives error and could not display that scanned signature.
    Can anyone please help me in this regard.
    or is there any possibility from which i can download that file just like File transfer from BSP.
    Keep in mind that i am using BSP technology so all GUI based function module to download file are not working.
    waiting for your reply.....
    Regards,
    Gagan

    Hi Raja,
    I have standard sap form for TDS Certificate on which i have include an BMP image for digital signature and download that script into pdf format.While i download that PDF looks ok but it is not working in BSP.
    Regards,
    Gagan

  • Japanese character problem while downloading file to application server

    Hello All,
    We are facing a strange problem while downloading a file to application server when file contains japanese text.
    We are downloading vendor and customer information in a flat file format on application server. When the login language is EN program show ouput in a properly formatted manner.
    When the login language is JA (japanese) program does download file with customer vendor data. I can see the description is japanese language but the formatting is gone for a toss.
    We are facing similar issue with other programs downloading files on the application server.
    I am using OPEN DATASET........ENCODING DEFAULT. and working on unicode enabaled ECC 6.0 system
    Quick help appriciated.
    Thanks!

    Hi
    Sometimes this also happens because of your desktop setting.Make sure that your OS also supports the JAPANESSE language.
    Ask your technical support team to enable them in your desktop.
    Thanks & Regards
    Jyo

  • Problem while uploading file from application server to internal tab in BG

    Hi all,
    When i see the file  in application server.data is like this
    #################00\);_(#####}#-#}###############################00\);_(#####}#-#}###############################00\);_(*#####}#-#}#########
    ###################}###}#############A#############???#00\);_(*#################;_(@_)  ########???#        ########???#        ########???###
    #######???#########}###}#############)##############}##00\);_(*#################;_(@_)  ############        ############        ##############
    ###################}#A#}#############:##############}##00\);_(#################;_(@_)  }###}##############################00\);_(*##########
    #######???#########}#-#}#############F#################00\);_(#####}###}#############@#################00\);_(#################;_(@_)  #####
    ###################}#-#}#############3#################00\);_(#####}#U#}#############E#################00\);_(#################;_(@_)  #####
    Because the csv which is uploaded has dropdowns and some formattings.
    when download from tcode cg3y i am getting correct file
    When try to use open(binary mode) and read dataset i getting data as it is (junk).
    i need to process in background.
    Any help.
    Rhea.

    upload file to string format
    begin of ty_tab,
    string type char200,
    end of ty_tab.
    loop at ty_tab into string
    use statement replace string into tab deliminated fromat(particular occurance in string)
    now call class to break string at tab into fields
    endloop.
    DATA : BEGIN OF i_data OCCURS 0,
            data(200)    TYPE c,       "To hold Upload file data
           END OF i_data.
    OPEN DATASET v_str FOR INPUT
                              IN TEXT MODE
                              ENCODING DEFAULT IGNORING CONVERSION ERRORS.
        IF sy-subrc EQ 0.
          DO.
    *Read a line from input file
            READ DATASET v_str INTO i_data-data.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
    *Append record to an internal table
            APPEND i_data.
            CLEAR: i_data.
          ENDDO.
    *Close the file
          CLOSE DATASET v_str.
    *---Start of inserti
    LOOP AT i_data.
            REPLACE ALL OCCURRENCES OF '"' IN i_data WITH '#'.
            SPLIT i_data AT cl_abap_char_utilities=>horizontal_tab
                                INTO i_doc-pvaudt
                                     i_doc-pvpate
                                     i_doc-vecatc
                                     i_doc-vhvend
                                     i_doc-vhidt8
                                     i_doc-vhinvn
                                     i_doc-vhhexp
                                     i_doc-vhiref.

  • While downloading file to application server its overwriting the earlier fi

    hi if i am using below code with date time stamp the file is downloaded to the application server correctly and each time i execut eht program a difference file is generated as date time stamp differs each time but
    whne i remove the date time stamp ie sy-datum and sy-uzeit as we dont need to display the date time stamp with the file each time i execute the program a file is generated but it overwrites the ealier existing file please suggest as each time it shoul generate a new file....
    Concatenate file name sy-datum sy-uzeit '.txt' into v_datetimefile
    file on Appplication Server is selected
      CALL FUNCTION 'FILE_GET_NAME'
         EXPORTING
                CLIENT                        = SY-MANDT
               logical_filename              = 'ZFILE'

    Hi,
    first of all decide you have to overwrite the existing file or you want to create the new, i think the answer is there in your query itself, if you want to create new then concatenate the date and time, else don't do that.
    below are the additions we can use while opening the data set.
    FOR INPUT
    FOR OUTPUT
    FOR APPENDING
    IN BINARY MODE
    IN TEXT MODE
    AT POSITION p
    TYPE ctrl
    MESSAGE mess
    FILTER f
    Reward if useful.
    Thanks,
    Sreeram.

  • Problem with Dataset While downloading file to Application server

    Hi friends,
      My report downloading some data to Application server in Unix Environment. When i am seeing that dataset, contents of the last field getting truncated. I specified length of the file which is greater than the record length, but still values are truncated. Its very urgent please send me the solution ASAP.
    Thanks & Regrads,
    Ramesh.

    Please provide me a solution

  • How to Provide search Help for files on Application Server

    Hi Guys,
                   Can anyone tell me How to Provide search Help for files on Application Server. I have put a file name on selection screen. I want to give search help for files on application server.
    Thanks & Regards.
    Harish.

    Hi Harish,
    Use the following code,
    tables sxpgcotabe.
    data: lt_execprot LIKE btcxpm OCCURS 0 WITH HEADER LINE,
            w_filepath(60)       TYPE c, --> length depending on your Directory path.
      SELECT SINGLE *
        FROM sxpgcotabe
             WHERE name = 'LIST_DB2DUMP'
               AND opsystem = sy-opsys.
      IF sy-subrc <> 0.
        SELECT SINGLE *
          FROM sxpgcotabe
               WHERE name = 'LIST_DB2DUMP'
                 AND opsystem = 'UNIX'.
        IF sy-subrc <> 0.
          MESSAGE e000 WITH 'External operating system command '
                            'LIST_DB2DUMP not found'.
        ENDIF.
      ENDIF.
      sxpgcotabe-parameters = p_filepath. --> provide the directory path.
      CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
           EXPORTING
                commandname                   = sxpgcotabe-name
                additional_parameters         = sxpgcotabe-parameters
                operatingsystem               = sxpgcotabe-opsystem
           TABLES
                exec_protocol                 = lt_execprot 
           EXCEPTIONS
                no_permission                 = 1
                command_not_found             = 2
                parameters_too_long           = 3
                security_risk                 = 4
                wrong_check_call_interface    = 5
                program_start_error           = 6
                program_termination_error     = 7
                x_error                       = 8
                parameter_expected            = 9
                too_many_parameters           = 10
                illegal_command               = 11
                wrong_asynchronous_parameters = 12
                cant_enq_tbtco_entry          = 13
                jobcount_generation_error     = 14
                OTHERS                        = 15.
      IF sy-subrc <> 0.
        MESSAGE e000 WITH text-e01 p_filepath.  "Directory failed
      ENDIF.
    Loop round the directory list, split each line up into a line table
    and get the last data for each line, should be the filename
    Then build the dirlist.
      REFRESH t_dirlist.
      LOOP AT lt_execprot.
        REFRESH t_dirline.
        SPLIT lt_execprot-message AT space INTO TABLE t_dirline.
        DESCRIBE TABLE t_dirline LINES w_nolines.
        READ TABLE t_dirline INDEX w_nolines.
        MOVE t_dirline-data TO t_dirlist-filename.
        APPEND t_dirlist.
      ENDLOOP.
    Here you will get all the files in the directory mentioned in Application server.
    For displaying them as a Search help use the FM '/BMC/ZPOPUP_GET_VALUE'
    Pass the Internal table to this FM.
    Regards,
    Paul.

  • Read Tab delimited File from Application server

    Hi Experts,
    I am facing problem while reading file from Application server.
    File in Application server is stored as follows, The below file is a tab delimited file.
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    i have downloaded this file from Application server using Transaction CG3Y. the Downloaded file is a tab delimited file and i could not see "#' in the file,
    The code is as Below.
    c_split  TYPE abap_char1 VALUE cl_abap_char_utilities=>horizontal_tab.
    here i am using IGNORING CONVERSION ERRORS in order to avoid Conversion Error Short Dump.
    OPEN DATASET wa_filename-file FOR INPUT IN TEXT MODE ENCODING DEFAULT IGNORING CONVERSION ERRORS.
          IF sy-subrc = 0.
            WRITE : /,'...Processing file - ', wa_filename-file.   
           DO.
          Read the contents of file
              READ DATASET wa_filename-file INTO wa_file-data.
              IF sy-subrc = 0.
                SPLIT wa_file-data AT c_split INTO wa_adrc_2-kunnr
                                                   wa_adrc_2-title
                                                   wa_adrc_2-name1
                                                   wa_adrc_2-name2
                                                   wa_adrc_2-name3
                                                   wa_adrc_2-name4
                                                   wa_adrc_2-name_co
                                                   wa_adrc_2-city1
                                                   wa_adrc_2-city2
                                                   wa_adrc_2-regiogroup
                                                   wa_adrc_2-post_code1
                                                   wa_adrc_2-post_code2
                                                   wa_adrc_2-po_box
                                                   wa_adrc_2-po_box_loc
                                                   wa_adrc_2-transpzone
                                                   wa_adrc_2-street
                                                   wa_adrc_2-house_num1
                                                   wa_adrc_2-house_num2
                                                   wa_adrc_2-str_suppl1
                                                   wa_adrc_2-str_suppl2
                                                   wa_adrc_2-country
                                                   wa_adrc_2-langu
                                                   wa_adrc_2-region
                                                   wa_adrc_2-sort1
                                                   wa_adrc_2-sort2
                                                   wa_adrc_2-deflt_comm
                                                   wa_adrc_2-tel_number
                                                   wa_adrc_2-tel_extens
                                                   wa_adrc_2-fax_number
                                                   wa_adrc_2-fax_extens
                                                   wa_adrc_2-taxjurcode.
    WA_FILE-DATA is having below values
    ##K#U#N#N#R###T#I#T#L#E###N#A#M#E#1###N#A#M#E#2###N#A#M#E#3###N#A#M#E#4###S#O#R#T#1###S#O#R#T#2###N#A#M#E#_#C#O###S#T#R#_#S#U#P#P#L#1###S#T#R#_#S#U#P#P#L#2###S#T#R#E#E#T###H#O#U#S#E#_#N#U#M#1
    And this is split by tab delimited and moved to other variables as shown above.
    Please guide me how to read the contents without "#' from the file.
    I have tried all possible ways and unable to get solution.
    Thanks,
    Shrikanth

    Hi ,
    In ECC 6 if all the unicode patches are applied then UTF 16 will defintly work..
    More over i would suggest you to ist replace # with some other  * or , and then try to see in debugging if any further  # appears..
    and no # appears then try to split now.
    if even now the # appears after replace statement then try to find out what exactly is it... wheather it is a horizantal tab etc....
    and then again try to replace it and then split..
    Please follow the process untill all the # are replaced...
    This should work for you..
    Let me know if you further face any issue...
    Regards
    Satish Boguda

  • How best store files on application server: Tables vs File system

    Hi Experts,
    We want to let users to upload files to application server. The number of files can potencially grow over time (1000 files every month) though I whould like to limit size of each file not more than 1-2 MB.
    Also files should be classified (having custom attributes) so later on we need to search, select files according to attributes.
    So what are the best options in long run (for performance, reliability etc)?
    We have NW system 7.0 with MaxDB
    I can think of the following options:
    1. Store files in TRANSPARENT table in RAWSTRING. Easiest variant (to select files etc) Here I have concerns how this table and database behave after some period of time and what will happen if size will grow to let say 50 GB. Will it work? What are normal size limits for transparent tables?
    2. Store files in CLUSTER table in RAWSTRING. Less convenient to work with (joins are not allowed etc). Will cluster table help to handle big size of table? What are practical size limits for cluster tables?
    3. Store files on file system (on application server) and write info (attributes etc) into ztable. Select from ztable and read content file from file system (dataset commands?). So files will be written to one directory just one after another.
    What are the best option to follow? I would personally prefer option 1 as easiest but have servious concerns regarding size of one transparent table.
    What do you recommend?
    Regards,
    Dmitry.
    Edited by: Dmitry Kalmykov on Jul 28, 2009 8:58 AM

    Hi,
    I too feel that option 1 would be best choice.
    For your ref: Check the Transp.table REPOSRC and the field name DATA
    Also Check the technical settings (Size category).

  • Write PDF file into application server.

    Hi Gurus,
    I have created a smartform and converted into PDF using function module as given below. Now I want to write this generated PDF file into application server. I am not generating any spool request too. How can I proceed from here?  Pls advice..
    CALL FUNCTION 'CONVERT_OTF_2_PDF'
        IMPORTING
          bin_filesize                 = lv_bin_filesize
        TABLES
          otf                              = ls_job_output_info-otfdata
          doctab_archive         = lt_docs
          lines                           = lt_lines
        EXCEPTIONS
          err_conv_not_possible  = 1
          err_otf_mc_noendmarker = 2
          OTHERS                 = 3.
    Thanks..
    Saj

    transfer all the data from ur itabs to one final itab declared as follow
    DATA: BEGIN OF final_itab OCCURS 0,
                     document  TYPE string,
               END OF final_itab.
    then finally,
    OPEN DATASET 'yourfile.pdf' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
      len = strlen( final_itab-DOCUMENT ).
      TRANSFER final_itab-DOCUMENT  TO 'yourfile.pdf'  LENGTH len.
    CLOSE DATASET 'yourfile.pdf'.
    This ends the coding mate.
    Enjoy it n have a good day.
    Cheers

  • How to save CSV file in application server while making infospoke

    How to save CSV file in application server to be used as destination while making infospoke.
    Please give the steps.........

    Hi
    If you want to load your flatfile from Application server,then you need to trasfer your file from your desktop(Computer) to Application server by using FTP.
    Try using ARCHIVFILE_CLIENT_TO_SERVER Function module.
    You Just need to give thesource path and the target path
    goto SE37 t-code , which is Function module screen, give the function name ARCHIVFILE_CLIENT_TO_SERVER, on click F8 Execute button.
    for path variable give the file path where it resides like C:\users\xxx\desktop\test.csv
    for target path give the directory path on Application server: /data/bi_data
    remember the directory in Server starts with /.
    U have to where to place the file.
    Otherwise use 3rd party tools to connect to ur appl server like : Core FTP and Absolute FTP in google.
    Otherwise...
    Goto the T.code AL11. From there, you can find the directories available in the Application Server.
    For example, if you wanna save the file in the directory "DIR_HOME", then you can find the path of the directories in the nearby column. With the help of this, you can specify the target path. Specify the target path with directory name followed by the filename with .CSV extension.
    Hope this helps
    regards
    gaurav

  • Putting Flat file on Application Server

    Hi,
    I am using following report to transfer a flat file to application server.
    REPORT  Z_DOWNLOAD.
    PARAMETERS: P_FILE       LIKE IBIPPARMS-PATH,
               P_FILE1(100) default '/usr/sap/put' lower case.
    DATA: WS_FILE TYPE STRING.
    DATA: BEGIN OF T_DATA OCCURS 0,
           RECORD(200),
         END OF T_DATA.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
    IMPORTING
      FILE_NAME           = P_FILE
    START-OF-SELECTION.
    WS_FILE = P_FILE.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
       FILENAME                      = WS_FILE
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    TABLES
       DATA_TAB                      = T_DATA
    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.
    Creating the file at Appl ...........
    OPEN DATASET P_FILE1 FOR OUTPUT IN TEXT MODE encoding utf-8.
    if sy-subrc ne 0.
    message e000(--) with 'Error in opening file'.
    endif.
    Trasfer the records to file.............
    loop at t_data.
    transfer t_data to p_file1.
    endloop.
    close dataset p_file1.
    if sy-subrc eq 0.
    write: / 'Written the files at ', p_file1.
    Now when I am uploading Flat file1 with following data it gets updated but when I use Flat file2, it does not work.
    Please help me out..
    I am posting the data of both flat files.
    Flat file1:(File getting transferred successfully to application server)
    1,NPOBL,ABC
    1,NPOBL,CDE
    1,NPOBL,FGH
    Flat file2: (Getting error when trying to transfer this file on application server)
    DS04,1,NPOBL,200,CREATE1,NEW YORK,X
    DS04,1,NPOBL,200,CREATE2,NEW YORK,X
    DS04,1,NPOBL,200,CREATE3,NEW YORK,X
    <b>Please help me out...</b>
    -Tushar

    hi Rajesh,
    I guess your in ternal table is not able to hold the data as is of 200 characters ... try increasing the length ..
    DATA: BEGIN OF T_DATA OCCURS 0,
    RECORD(2000),
    END OF T_DATA.
    Regards,
    Santosh

  • Problem while dowloading the file from Application Server

    Dear Experts,
                 I am facing the Problem while downloading the file from Application server.
    We done the automatic function while saving the invoice, this will create an idoc, and this idoc is written in the Application Server.
    I am running the Transaction AL11 and select the record, and from menu --> List, i am downloading into TXT format.
    But for some segments, the length is long, and so the last 3 to 4 fields values are not appearing in the File. Even though i am unable to view the values in the file before downloading. But i can view in IDOC.
    Please help me to solve this issue.
    Thanks & Regards,
    Srini

    but our user will use the Txn. AL11 and they will download from there
    Educate the user On a serious note, tell him this is not how data from app server should be downloaded. You can ask him to talk to the basis team to provide him access to the app server folder where the file is being stored.
    I can set the Variant and put this in background, But always the file name will be change, Like we use Time stamp in the File name.
    You can't automate this process by scheduling in BG mode. This is because the in BG mode you can't dwld the file to presentation server.
    Hope i'm clear.
    BR,
    Suhas

  • Connection refused Error while writing file to FTP server.

    Hi All,
    We got below error while writing file to FTP server. Any one have any idea on this?
    sABCS_1.0_8e88588d4fb54ebd2ac7ef66c8421d52.tmp/writeEncryptedFile.wsdl [ Put_ptt::Put(opaque) ] - Could not invoke operation 'Put' against the 'FTP Adapter' due to:
    ORABPEL-11429
    Error sending file to FTP Server.
    Unable to send file to server. [Caused by: Connection refused]
    Please ensure 1. Specified remote output Dir has write permission 2. Output filename has not exceeded the max chararters allowed by the OS and 3. Remote File System has enough space.

    Hmmm ...
    Same issue as your post from three months' earlier?
    Re: Error while putting file in sftp location.

  • Not recognizing # while reading the file from application server

    Hi
    I am reading a file from application server. While reading into internal table with read statement the last field in each record is filling with hash symbol in the last digit. If I write any if condition with HASH symbol its not going inside the if condition, means its not recognizing as hash may be its internally treating as some other. I need to remove the hash from that field. How I can do that.
    Thanks,
    kishore

    I faced exact situation. Yes, internally its treated as some other special character. What i did was, becuase hash symbol was always coming at the end...i created a dummy field in my internal table so that it will not interfere with my actual data. When i see the data in my internal table, the hash always falls in the last field (dummy) which i will ignore. I could not get solution to remove this hash so i adopted this approach and it worked!!
    Hope it helps,
    SKJ

Maybe you are looking for