Special characters downloading file into application server

Dear Friends,
i have to download records into excel sheet through back ground job, while downloading records into applications server.
all records are downloading properly up to here fine but some special characters also downloading. i had downloaded same records in debugging mode from the same internal table here no special characters.
i found that the structure(standard ( /SCWM/S_LIME_ALL_MON )) which is being used in that some fields are defined as RAW data type this may be the problem.but i tried to convert them using some function modules no result getting dump only.
i am using data sets to download data into application server here gui_download will not work because it is back ground job.
can any one please help me in this. its urgent...
please please help me in this it has been pending since DEC-01-11.
extra characters like (  #v#M?LQia#####
#v#M?LQia#####
#v#)
my code
  open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
  IF sy-subrc EQ C_ZERO.
    LOOP AT LT_TAB INTO WA_TAB.
      transfer WA_TAB to LV_FLNAM.
    ENDLOOP.
    CLOSE DATASET LV_FLNAM.
  ENDIF.
Edited by: sairam.kusuma on Dec 16, 2011 6:26 AM
Edited by: sairam.kusuma on Dec 16, 2011 6:38 AM
Edited by: sairam.kusuma on Dec 16, 2011 6:39 AM

TYPES:BEGIN OF ty_stru,
      LGTYP  TYPE /SCWM/LGTYP,
      LGPLA  TYPE /SCWM/LGPLA,
      MATNR  TYPE /SCWM/DE_MATNR,
      MAKTX  TYPE /SCWM/DE_UI_MAKTX,
      QUAN(13)  TYPE C,"/SCWM/DE_UI_QUAN,
      UNIT  TYPE /SCWM/DE_BASE_UOM,
      CAT  TYPE /SCWM/DE_CAT,
      CAT_TXT  TYPE /SCWM/DE_CAT_TXT,
      CHARG  TYPE /SCWM/DE_CHARG,
      OWNER  TYPE /LIME/OWNER,
      ENTITLED  TYPE /SCWM/DE_ENTITLED,
      UI_WDATT  TYPE /SCWM/DE_UI_WDATT,
      UI_WDATU  TYPE /SCWM/DE_UI_WDATU,
      SKZSI  TYPE /SCWM/LQUA_SKZSI,
      QUANA(13)  TYPE C,"/SCWM/DE_UI_QUAN_PACKED,
      ALTME  TYPE /SCWM/DE_AUNIT,
      ITMNO  TYPE /SCDL/DL_ITEMNO,
      WEIGHT(15)  TYPE C,"/SCWM/DE_NWEIGHT,
      UNIT_W  TYPE /SCWM/DE_WGT_UOM,
      VOLUM(15)  TYPE C,"/SCWM/DE_NVOLUME,
      UNIT_V  TYPE /SCWM/DE_VOL_UOM,
      CAPA(15)  TYPE C,"/SCWM/DE_CAPAUSE,
      SN_STOCK  TYPE /SCWM/DE_SER_STOCK,
      END OF ty_stru.
DATA: LV_LGNUM TYPE /SCWM/LGNUM VALUE 'R10',
      LV_FLNAM TYPE rlgrap-filename VALUE '/tmp/RAMA.xls'.
CONSTANTS: C_ZERO TYPE I VALUE '0'.
DATA: LT_TAB TYPE STANDARD TABLE OF /SCWM/S_LIME_ALL_MON,
      WA_TAB TYPE /SCWM/S_LIME_ALL_MON,
      i_stru TYPE STANDARD TABLE OF ty_stru,"
      wa_stru TYPE ty_stru.
REFRESH LT_TAB.
CLEAR: WA_TAB.
*this is modified function module from /SCWM/S_LIME_ALL_MON
CALL FUNCTION 'ZEWM_F_PHYSICAL_INVENTORY_STOC'
  EXPORTING
    IV_LGNUM             = LV_LGNUM
  IV_VARIANT           =
  IV_MODE              = '1'
  IT_DATA_PARENT       =
  IMPORTING
    ET_DATA              = LT_TAB
  EV_RETURNCODE        =
  EV_VARIANT           =
CHANGING
  CT_TAB_RANGE         =
i have to download what are the fields defined as structure.
1)when ever i am using the internal table(LT_TAB) to download getting specials characters(####) with all records for the fields QUAN, QUANA, WEGHT,VOLUM and CAPA.
open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
IF sy-subrc EQ C_ZERO.
  CLEAR: WA_stru,
         wa_tab.
  LOOP AT LT_TAB INTO WA_TAB.
    transfer WA_TAB to LV_FLNAM.
    CLEAR: WA_TAB.
  ENDLOOP.
  CLOSE DATASET LV_FLNAM.
ENDIF.
2)if i take another internal table with converting them as char file is downloading with out special characters but it is downloading single line only but not the hole data.
if i have the below code getting only single line records not total records without special characters.
open DATASET LV_FLNAM for OUTPUT in LEGACY BINARY MODE .
IF sy-subrc EQ C_ZERO.
  CLEAR: WA_stru,
         wa_tab.
  LOOP AT LT_TAB INTO WA_TAB.
     wa_stru-LGTYP = wa_tab-LGTYP.
     wa_stru-LGPLA = wa_tab-LGPLA.
     wa_stru-MATNR = wa_tab-MATNR.
     wa_stru-MAKTX = wa_tab-MAKTX.
     wa_stru-QUAN = wa_tab-QUAN.
     wa_stru-UNIT = wa_tab-UNIT.
     wa_stru-CAT = wa_tab-CAT.
     wa_stru-CAT_TXT = wa_tab-CAT_TXT.
     wa_stru-CHARG = wa_tab-CHARG.
     wa_stru-OWNER = wa_tab-OWNER.
     wa_stru-ENTITLED = wa_tab-ENTITLED.
     wa_stru-UI_WDATT = wa_tab-UI_WDATT.
     wa_stru-UI_WDATU = wa_tab-UI_WDATU.     
     wa_stru-SKZSI = wa_tab-SKZSI.
     wa_stru-QUANA = wa_tab-QUANA.
     wa_stru-ALTME = wa_tab-ALTME.
     wa_stru-ITMNO = wa_tab-ITMNO.
     wa_stru-WEIGHT = wa_tab-WEIGHT.
     wa_stru-UNIT_W = wa_tab-UNIT_W.
     wa_stru-VOLUM = wa_tab-VOLUM.
     wa_stru-UNIT_V = wa_tab-UNIT_V.
     wa_stru-CAPA = wa_tab-CAPA.
     wa_stru-SN_STOCK = wa_tab-SN_STOCK.
    transfer WA_stru to LV_FLNAM.
    CLEAR: WA_stru.
  ENDLOOP.
  CLOSE DATASET LV_FLNAM.
ENDIF.

Similar Messages

  • How to download file from application server

    Hi Experts,
                  I developed report and execute in background mode. for this i used Open dataset transfer and close dataset . i got the requried output . But in this case user want downloaded file on presentation server so can anyone tell me How to download file from application server?
    i know it is possible through Tcode CG3Y. but i want code in program.

    This code will download a file to your Client package by package, so it will also work for huge files.
    *& Report  ZBI_DOWNLOAD_APPSERVER_FILE
    REPORT  zbi_download_appserver_file.
    PARAMETERS: lv_as_fn TYPE sapb-sappfad
    DEFAULT '/usr/sap/WBP/DVEBMGS00/work/ZBSPL_R01.CSV'.
    PARAMETERS: lv_cl_fn TYPE string
    DEFAULT 'C:\Users\atsvioli\Desktop\Budget Backups\ZBSPL_R01.CSV'.
    START-OF-SELECTION.
      CONSTANTS blocksize TYPE i VALUE 524287.
      CONSTANTS packagesize TYPE i VALUE 8.
      TYPES ty_datablock(blocksize) TYPE x.
      DATA lv_fil TYPE epsf-epsfilnam.
      DATA lv_dir TYPE epsf-epsdirnam.
      DATA ls_data TYPE ty_datablock.
      DATA lt_data TYPE STANDARD TABLE OF ty_datablock.
      DATA lv_block_len TYPE i.
      DATA lv_package_len TYPE i.
      DATA lv_subrc TYPE sy-subrc.
      DATA lv_msgv1 LIKE sy-msgv1.
      DATA lv_processed_so_far TYPE p.
      DATA lv_append TYPE c.
      DATA lv_status TYPE string.
      DATA lv_filesize TYPE p.
      DATA lv_percent TYPE i.
      "Determine size
      SPLIT lv_as_fn AT '/' INTO lv_dir lv_fil.
      CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
        EXPORTING
          file_name      = lv_fil
          dir_name       = lv_dir
        IMPORTING
          file_size_long = lv_filesize.
      "Open the file on application server
      OPEN DATASET lv_as_fn FOR INPUT IN BINARY MODE MESSAGE lv_msgv1.
      IF sy-subrc <> 0.
        MESSAGE e048(cms) WITH lv_as_fn lv_msgv1 RAISING file_read_error.
        EXIT.
      ENDIF.
      lv_processed_so_far = 0.
      DO.
        REFRESH lt_data.
        lv_package_len = 0.
        DO packagesize TIMES.
          CLEAR ls_data.
          CLEAR lv_block_len.
          READ DATASET lv_as_fn INTO ls_data MAXIMUM LENGTH blocksize LENGTH lv_block_len.
          lv_subrc = sy-subrc.
          IF lv_block_len > 0.
            lv_package_len = lv_package_len + lv_block_len.
            APPEND ls_data TO lt_data.
          ENDIF.
          "End of file
          IF lv_subrc <> 0.
            EXIT.
          ENDIF.
        ENDDO.
        IF lv_package_len > 0.
          "Put file to client
          IF lv_processed_so_far = 0.
            lv_append = ' '.
          ELSE.
            lv_append = 'X'.
          ENDIF.
          CALL FUNCTION 'GUI_DOWNLOAD'
            EXPORTING
              bin_filesize         = lv_package_len
              filename             = lv_cl_fn
              filetype             = 'BIN'
              append               = lv_append
              show_transfer_status = abap_false
            TABLES
              data_tab             = lt_data.
          lv_processed_so_far = lv_processed_so_far + lv_package_len.
          "Status display
          lv_percent = lv_processed_so_far * 100 / lv_filesize.
          lv_status = |{ lv_percent }% - { lv_processed_so_far } bytes downloaded of { lv_filesize }|.
          CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
            EXPORTING          "percentage = lv_percent - will make it fash
              text = lv_status.
        ENDIF.
        "End of file
        IF lv_subrc <> 0.
          EXIT.
        ENDIF.
      ENDDO.
      "Close the file on application server
      CLOSE DATASET lv_as_fn.

  • 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

  • Downloading file to application server

    Hi,
    I have requirement of downlaoding some (.doc,.xls,.txt,.ppt) files into application server from sap r/3,the file will be picked by some other 3rd party application.
    I was able to achieve it using OPEN DATA SET and TRANSFER,but the data gets encrytped and the actual file is not copied to application server.(example if its .doc file the same file data should be copied to app server and not the encrypted file data like 5%%#.......6234726&&%212).
    The encrypted file again displays like exact file as its uploaded when downloaded from app server.
    But the file in app server is encrypted,my requirement is to copy the exact file to app server.
    This encryption is happening when is OPEN DATA SET and TRANSFER,even the FM ARCHIVFILE_CLIENT_TO_SERVER is also using  OPEN DATA SET and TRANSFER only.
    Please suggest me any other way to move file to app server other than OPEN DATA SET and TRANSFER.
    Thanks,
    Phani.

    Hi,
    If you are downloading the file from application server, you have to use OPEN DATASET CLOSE DATASET.
    I think you are making some mistake in your code.
    Refer to my code below and let me know if you have any doubt.
    *&      Form  APL_DOWNLOAD
          DOWNLOADING FILE TO APPLICATION SERVER.
    FORM apl_download .
      IF NOT i_output[] IS INITIAL.
    IF NOT p_pathdl is initial.
        IF v_flag <> c_chk.                          "IF search help was not called.
          CLEAR:     v_filename,
                        v_path.
    Building File Name.
          CONCATENATE c_mf018
                      v_date
                      v_time
                      c_extn
                 INTO v_filename.
    Conactenating File Name and File Path for Dataset parameter.
          CONCATENATE p_pathdl
                      c_slash
                      v_filename
                 INTO v_path.
        ELSE.                                        "IF search help was called.
          v_path = p_pathdl.
        ENDIF.
    Local Data Declaration.
        DATA v_string  TYPE string.
    Creating a file of given name at given path on apllication server.
        OPEN DATASET v_path FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
        IF sy-subrc = 0.
    Building header and transfering it to the file.
          CONCATENATE text-004 c_sep text-005 c_sep text-006 c_sep
                      text-007 c_sep text-008 c_sep text-009 c_sep
                      text-010 c_sep text-011 c_sep text-012 c_sep
                      text-013 c_sep text-014 c_sep text-015 c_sep
                 INTO v_string.
          TRANSFER v_string TO v_path.
          CLEAR v_string.
    Reading data from internal table & transfering to file.
          LOOP AT i_output INTO w_output.
            CONCATENATE w_output-lifnr      c_sep w_output-banksrec   c_sep
                        w_output-bankkrec   c_sep w_output-banknrec   c_sep
                        w_output-waers      c_sep w_output-bankssnd   c_sep
                        w_output-bankksnd   c_sep w_output-chainno    c_sep
                        w_output-chainbankt c_sep w_output-chainbanks c_sep
                        w_output-chainbankk c_sep w_output-chainbankn
                  INTO v_string.
            TRANSFER v_string TO v_path.
            CLEAR: v_string,
                   w_output.
          ENDLOOP.
        ELSE.
          MESSAGE i000 WITH text-040.
          EXIT.
        ENDIF.
        MESSAGE i000 WITH text-038 v_path.
      ELSE.
        MESSAGE i000 WITH text-048.
      ENDIF.
      ELSE.
        MESSAGE i000 WITH text-041.
      ENDIF.
    ENDFORM.                    " APL_DOWNLOAD

  • Downloading file from application server to presentation server

    Hi,
          We have a requirment to download file from application server to presentation server.  The problem is while down loading, some of the filds showing some junk values. Instead of that junk values we have some Russian texts there.  These Russian texts only coming as junk all other data is correct.  The file in the appplication server is in .dbf format. We are downloading using WS_DOWNLOAD. file type is BIN and code page we didn't specified.
    Thanks in Advance
    Jijeesh.P.G
    Message was edited by: Jijeesh.P.G
            Jijeesh P G

    hi jijeesh,
       Welcome to SDN.
    u can use to download file from application server to presentation server using the t/c CG3Y. in that it will ask the source file path and the target file path.
    if u want to find the source file path in the application server, u can use the transaction AL11 to find that one.
    Regards....
    Arun.
    Reward points if useful.

  • Background Job - Requirement to download file to application server

    Dear All,
    If I want to execute one function module in background and the FM is downloading file to application server, the FM is not downloading file to application server. Can you please suggest whether it is possible to download file to application server when it is in background mode? I know it is not possible to download file to presentation server.
    Thanks and regards,
    Atanu

    Hi,
    Yes, it is possible to download a file to application server in background mode. check the path ur sepcifying to the Function module to download the file...in T-Code AL11 check if the path exits.
    reward if helpful
    Regards,
    Rahul

  • How to Post a file(Flat File ) into Application server of the XI(AL11)?

    How to Post a file(Flat File ) into Application server of the XI(AL11)?
    Best Regards,
    Jose

    Hi,
    1) goto SXDA_TOOLS Transaction code
    2) Provide the Following details
    Object Type : DXPROJECT
    Program Type: BAPI
    Program/Method: CREATE
    3) Click on Copy Button
    4) Select the Source as Presentation Server
         a) Select  the File where you saved in your Local machine
    5) Select the Target as Application server
         a) Check the check box Remote Server
         b) Select the File type as Physical
         c) In File name give /usr/sap/SSD/DVEBMGS00/work\Your file name (This the Server path                                                                               
    Where the file is going to save)
    6) Click on Continue
    Go to AL11 and check whether the File has been create in the following path  /usr/sap/SSD/DVEBMGS00/work
    Provide this path in the Communication channel path when you select the Transport Protocol as NFS and you place the file in AL11 directory.
    Regards
    Seshagiri

  • 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

  • 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.

  • How to download files from Application Server of Unix o.s to local director

    Hi All,
    I am trying to download files from Apllication server of Unix operating Systems to local file in excel sheet format using a z-program.but whenever I am trying to use OPEN dataset ........
    it is showing sy-subrc = 8.
    Can I have any clew please.
    Thanks in advance,
    Regards,
    AMEER.

    Hi Sreekanth,
    Thanks a lot for quick reply.I have to download that files from z-program only. I am giving you my code below.
    *& Report  ZTRAK_DOWNLOAD                                         *
    REPORT  ZTRAK_DOWNLOAD  MESSAGE-ID ZCT                   .
    SELECTION-SCREEN BEGIN OF BLOCK DOWNLOAD WITH FRAME TITLE TEXT1.
      PARAMETERS :
           SERDIR LIKE RLGRAP-FILENAME DEFAULT '/usr/trak',
           LOCDIR LIKE RLGRAP-FILENAME DEFAULT 'C:\Trak'.
    SELECTION-SCREEN END OF BLOCK DOWNLOAD .
    SELECTION-SCREEN BEGIN OF BLOCK INFO2 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT2.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT3.
    SELECTION-SCREEN END OF BLOCK INFO2 .
    SELECTION-SCREEN BEGIN OF BLOCK INFO3 WITH FRAME.
           SELECTION-SCREEN COMMENT 1(79) TEXT4.
           SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT5.
            SELECTION-SCREEN SKIP.
           SELECTION-SCREEN COMMENT 1(79) TEXT6.
           SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT7.
           SELECTION-SCREEN SKIP 2.
           SELECTION-SCREEN COMMENT 1(79) TEXT8.
    SELECTION-SCREEN SKIP 1.
           SELECTION-SCREEN COMMENT 1(79) TEXT9.
    SELECTION-SCREEN END OF BLOCK INFO3.
    *- Internal Table to output data in Excel
    DATA: BEGIN OF tab_excel OCCURS 0,
            col1(50),
            col2(132),
            col3(255),
            col4(100),
            col5(100),
            col6(50),
            COL7(60),
            col8(30),
            col9(30),
            col10(30),
            col11(20),
            col12(15),
            col13(15),
          END OF tab_excel.
    DATA: FILE LIKE RLGRAP-FILENAME .
    DATA: W_DATASET(80).
    INITIALIZATION.
      TEXT1  = 'Download Reports'.
      TEXT2 = 'The Program downloads the reports generated by Trak'.
      TEXT3 = 'Utility from Server to Local PC.'.
      TEXT4 = 'Check the following before executing the Program.'.
      TEXT5 = '     1. A valid Server path is provided.'.
      TEXT6 = '     2. A valid Local PC path is provided.'.
      TEXT7 = '     3. Local PC has 10 MB free space.'.
      TEXT8 = 'The report can be executed in the forground.'.
    TEXT9 =
    'The report should be executed after execution of Transaction TRAK'.
    AT SELECTION-SCREEN.
    IF SERDIR EQ ''.
    MESSAGE E001(ZCT).
    ENDIF.
    IF LOCDIR EQ ''.
    MESSAGE E002(ZCT).
    ENDIF.
    START-OF-SELECTION.
    Download ABAP Development Summary Report
    FILE =  '\ABAP_Report_Developments.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAP_Report_Developments.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download BDC Development Report
    FILE =  '\BDC_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/BDC_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Development Summary Report
    FILE = '\Developments_Summary_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Developments_Summary_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Enhancement Development Report
    FILE =  '\Enhancement_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Enhancement_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download field exit Development Report
    FILE =  '\Field_Exit_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Field_Exit_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Frequency & Purpose Report
    FILE =  '\Frequency_And_Purpose_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Frequency_And_Purpose_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Group Developments Report
    FILE =  '\FunctionGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Function Module Developments Report
    FILE = '\FunctionModule_Developments_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionModule_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    FILE =  '\Include_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Include_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download UserGroup Developments Report
    FILE =  '\UserGroup_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserGroup_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Modified_Standard_SAP_Objects_Report
    FILE = '\Modified_Standard_SAP_Objects_Report.XLS' .
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Modified_Standard_SAP_Objects_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Include Developments Report
    *FILE =  '\Include_Developments_Report.XLS'.
    *CONCATENATE LOCDIR FILE INTO FILE.
    *W_DATASET = '/Include_Developments_Report.dat'.
    *CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    *PERFORM INIT.
    Download SAP Script Developments Report
    FILE =  '\SAP_Scipt_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/SAP_Scipt_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Transaction Developments Report
    FILE =  '\Transaction_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/Transaction_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download User Exits Developments Report
    FILE =  '\UserExits_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/UserExits_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download ABAP Query Developments Report
    FILE =  '\ABAPQuery_Developments_Reports.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/ABAPQuery_Developments_Reports.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    Download Functional Area Developments Report
    FILE =  '\FunctionalArea_Developments_Report.XLS'.
    CONCATENATE LOCDIR FILE INTO FILE.
    W_DATASET = '/FunctionalArea_Developments_Report.dat'.
    CONCATENATE SERDIR W_DATASET INTO W_DATASET.
    PERFORM INIT.
    MESSAGE S003(ZCT) WITH LOCDIR.
    END-OF-SELECTION.
    This routine checks whether file exists if yes downloads it to
    the Local PC
    FORM INIT.
    OPEN DATASET W_DATASET FOR INPUT IN TEXT MODE ENCODING DEFAULT.
    DO.
       IF SY-SUBRC <> 0.
          EXIT.
       ENDIF.
       READ DATASET W_DATASET INTO  tab_excel.
       APPEND tab_excel.
       CLEAR tab_excel.
    ENDDO.
         PERFORM DOWNLOAD_FILE.
    ENDFORM.
    This routine downloads the data in an XL format on local PC
    FORM Download_File .
      CALL FUNCTION 'WS_DOWNLOAD'
                EXPORTING
                     FILENAME                = FILE
                     FILETYPE                = 'DAT'
                TABLES
                     DATA_TAB                = tab_excel
                EXCEPTIONS
                     FILE_OPEN_ERROR         = 1
                     FILE_WRITE_ERROR        = 2
                     INVALID_FILESIZE        = 3
                     INVALID_TYPE            = 4
                     NO_BATCH                = 5
                     UNKNOWN_ERROR           = 6
                     INVALID_TABLE_WIDTH     = 7
                     GUI_REFUSE_FILETRANSFER = 8
                     CUSTOMER_ERROR          = 9
                     OTHERS                  = 10.
        IF sy-subrc <> 0.
         message ''.       " Error in file transfer
        ELSE.
          CLEAR TAB_EXCEL.
          REFRESH TAB_EXCEL.
          FILE = ''.
          W_DATASET = ''.
        ENDIF.
    ENDFORM.
    I have created those files in Application Server running in another z-program in background mode.Then I am trying to download those files using above the program.I am creating those trak/Trak files manually and I can able to see those files in A.S level.But when downloading the same files I am facing the problem.
    regards,
    Ameer

  • Uploading & Downloading Files into DMS Server using Web Dynpro Java

    Hello Friends,
          I want to Upload a file from Portal to Document Management Server and to Download a file from Document Management Server to Portal,  In short, I want to give the user the facility to Upload a File into DMS Sever via Portal and also to download the file from DMS Sever via Portal.
      Can anybody give me a Input for the same from Both Java Development End as well as ABAP End, more inputs are required from ABAP end, since i have a very less ABAP Experience on working with DMS. Few Questions i have in my mind?
    1. How to actually access the file contents with the help of Document Number?
    2. With the help of Doc-Number we can extract the file from DMS sever but to provide a option for downloading in portal, the   RFC should convert the File Contents into X-String or is there some other way?
    +3. While Uploading the Data should be given in Which format to RFC? Are there any limitation with respect to size or formats. Is there any Standard RFC i can use directly in WD4 Java application to upload the file into DMS Server and which will return me the Document Number? +
    Please give me your valuable inputs.
    Thank You.
    Edited by: TusharShinde on Feb 21, 2011 11:13 AM
    Now, I am able to download the File in Portal via my WD4 Java Application from DMS Server by passing the Document Number, but I am facing the problem in downloading the PDF files, Its not working for PDF files. Please give me inputs for the same.
    Thank You.
    Edited by: TusharShinde on Feb 22, 2011 10:13 AM

    HI,
    Thanks for reply.
    I am able to download the file From DMS server but I am still not able to Upload the File to DMS Server via Portal. For Download also it is working for all file formats but not for PDF any specific reason for the same.
    function zhrf_rfc_dms_download_document.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(LV_DOCUMENT) TYPE  DOKNR
    *"  EXPORTING
    *"     VALUE(LV_FADA) TYPE  XSTRING
    *"  TABLES
    *"      LT_DOC STRUCTURE  BAPI_DOC_FILES2
    *"      LT_OUT STRUCTURE  ZST_DMS_FILE_XSTRING
    data: ls_docfiles type bapi_doc_files2,
             ls_dms type dms_doc_files,
             lt_docfiles type standard table of bapi_doc_files2.
    *      data: LT_OUT  type table of  ZST_DMS_FILE_XSTRING.
      data :wa_out like line of lt_out.
      select single * from dms_doc_files
        into ls_dms
        where doknr = lv_document."Retrieve file
      if sy-subrc = 0.
        ls_docfiles-documenttype = ls_dms-dokar.
        ls_docfiles-documentnumber = lv_document.
        ls_docfiles-documentpart = ls_dms-doktl.
        ls_docfiles-documentversion = ls_dms-dokvr.
    *    ls_docfiles-documenttype = '321'.
    *    ls_docfiles-documentnumber = LV_DOCUMENT.
    *    ls_docfiles-documentpart = '000'.
    *    ls_docfiles-documentversion = 'A0'.
      endif.
      call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
        exporting
          documenttype    = ls_docfiles-documenttype
          documentnumber  = ls_docfiles-documentnumber
          documentpart    = ls_docfiles-documentpart
          documentversion = ls_docfiles-documentversion
          documentfile    = ls_docfiles
          getstructure    = '1'
          getcomponents   = 'X'
          getheader       = 'X'
    *      pf_http_dest    = 'SAPHTTPA'
          pf_ftp_dest     = 'SAPFTPA'
        tables
          documentfiles   = lt_docfiles.
      data: i_bin type standard table of sdokcntbin,
            i_info type standard table of scms_acinf,
            v_info type scms_acinf,
            v_id type sdok_phid,
            v_cat type sdok_stcat.
      if sy-subrc = 0.
        loop at lt_docfiles into ls_docfiles.
          v_id = ls_docfiles-docfile.
          v_cat = ls_docfiles-storagecategory.
          call function 'SCMS_DOC_READ'
            exporting
              stor_cat              = v_cat
              doc_id                = v_id
              phio_id               = ls_docfiles-file_id
            tables
              access_info           = i_info
              content_bin           = i_bin
            exceptions
              bad_storage_type      = 1
              bad_request           = 2
              unauthorized          = 3
              comp_not_found        = 4
              not_found             = 5
              forbidden             = 6
              conflict              = 7
              internal_server_error = 8
              error_http            = 9
              error_signature       = 10
              error_config          = 11
              error_format          = 12
              error_parameter       = 13
              error                 = 14
              others                = 15.
        endloop.
        if sy-subrc <> 0.
        else.
          data: v_xstring type xstring.
          read table i_info into v_info index 1.
          call function 'SCMS_BINARY_TO_XSTRING'
            exporting
              input_length = v_info-comp_size
            importing
              buffer       = v_xstring
            tables
              binary_tab   = i_bin
            exceptions
              failed       = 1
              others       = 2.
          if sy-subrc <> 0.
          endif.
        endif.
        wa_out-file_name =  ls_docfiles-docfile.
        wa_out-binary = v_xstring.
        lv_fada = v_xstring.
        append wa_out to lt_out.
      endif.
    endfunction.
    The above is the RFC Code,  I am using in my WD4Java app for downloading the file From DMS Server, Is there any Improvement suggested for above RFC to make it work in more efficient way. Please give me input for my Upload RFC.
    Thank You.

  • Downloading file from application server in Binary mode

    Hi,
    I am trying to read an application server file using open dataset in Binary Mode..
    While downloading using gui_download method the file is getting truncated because of its size.
    My questions are,
           How to increase the size of the internal table dynamically. Already tried using STRING type but it is not accepting.
           If I use the CHAR type with maximum length 65535 and if the length of the file is less than that then in the remaining spaces box like symbols are printed .
    How can I achieve it.
    Thanks & Regards,
    NJ

    TYPES: BEGIN OF type_download,
               data1 TYPE zchar20000,
               data2 TYPE zchar20000,
               data3 TYPE char3000,
               data4 TYPE char2000,
             END OF type_download.
      DATA: lt_download TYPE STANDARD TABLE OF type_download,
            lx_download TYPE string,
            lv_filename TYPE string.
    Read data from application server to internal table
      OPEN DATASET p_p_ftappl FOR INPUT IN BINARY MODE.
      IF sy-subrc = 0.
    Read file
        DO.
          CLEAR lx_download.
          READ DATASET p_p_ftappl INTO lx_download.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          APPEND lx_download TO lt_download.
        ENDDO.
    Download data to presentation server from internal table
        lv_filename = p_p_ftfron.
    Download data from application server to PC
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
       bin_filesize              =
            filename                  = lv_filename
            filetype                  = c_bin
       append                    = space
          write_field_separator     = space
       header                    = '00'
       trunc_trailing_blanks     = 'X' "space "commented
       trunc_trailing_blanks_eol = 'X' "added
    IMPORTING
       filelength                =
          CHANGING
            data_tab                  = lt_download.
    *Exceptions deleted            .
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Close file
        CLOSE DATASET p_p_ftappl.
    Edited by: NewJoinee123 on Mar 25, 2010 8:45 AM

  • Move pdf file into application server

    Hi ABAP Gurus,
    i want your valuable help in solving my problem.
       i tried to create PDF file in application server and its creating as
    PDF file in Application server..but i am unable to see the content in text ,
    instead it is displaying in binary content...but when i tried to create
    in presentation server i am able to see it as text in PDF file....
    Can u please let me know whats wrong in my work and how to create a PDF file
    in Application server with text content
    with regards,
    Gowri.

    Hi Gowri,
    Check this example....
    report ztest.
    data: begin of itab occurs 0,
    field(256),
    end of itab.
    data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
    length like sy-tabix,
    lengthn like sy-tabix.
    call function 'GUI_UPLOAD'
    exporting
    filename = 'c:\temp\test.pdf'
    filetype = 'BIN'
    importing
    filelength = length
    tables
    data_tab = itab.
    open dataset dsn for output in binary mode.
    loop at itab.
    transfer itab-field to dsn.
    endloop.
    close dataset dsn.
    clear itab.
    refresh itab.
    *- To crosscheck if it went well
    open dataset dsn for input in binary mode.
    do.
    read dataset dsn into itab-field.
    if sy-subrc = 0.
    append itab.
    else.
    exit.
    endif.
    enddo.
    call function 'GUI_DOWNLOAD'
    exporting
    filename = 'c:\temp\testn.pdf'
    filetype = 'BIN'
    bin_filesize = length
    importing
    filelength = lengthn
    tables
    data_tab = itab.
    Or
    Use the TCode
    CG3Z or CG3Y
    for downloading to Application Server.
    Thanks,
    Reward If helpful.

  • Urgent : Download file from Application Server via Process Chain.

    Hi Experts,
    My requirement is to download the file from Application Server to local work station using an ABAP Program .
    I want including the above ABAP program in a process chain to execute  the program daily,
    I tried to use ARCHIVFILE_SERVER_TO_CLIENT and GUI_DOWNLOAD but unfortunately both the above FM doesn't support to run through Process chain.
    Can any one of you help me to send the code which selects a file from application server, downloads to local system and deletes it.
    Thank you very much for spending your precious time in this regard.

    Hi Sailekha,
    Regarding your case ..
    I suggest you to create the program where it run this function: WS_DOWNLOAD.
    After it, the program is run by your process chain.
    Hopefully it can help you a lot.
    Regards,
    Niel.
    thanks for the points you choose to assign.

  • Regarding downloading file on application server ?

    i am using open data set and close data set to create file on application server.
    the program is compiling fine, but when i execute it, it throws a dump saying
    DATASET_NOT_OPEN  , it says that the file is not open.
    when i check value of sy-sub-rc it is 8. no file on server.
    i want to create a dynamic file name, like i want to append the sy-cdate to the file name, so that when i schedule my program every day, i will create a new file.
    what is the t-code to look at directories on app server. i tried al11, but couldnt find mine..but the basis said they had already created a folder for me there.
    - Points will be awarded for inputs.
    Message was edited by:
            ravi a

    Hi,
    May be you don't have write permission for the corresponding folder on the application server. thats why you could not create file on that folder.so ask you basis people for read/write permission on the that destination folder..
    For creating dynamic file , you can use logical file and physical file concept..
    for each interface maintain a logical file name in a ztable and ask your basis people to maintain a physical file path on application server for each logical file name.(using FILE Txn).
    first get the logical file name from ztable then get corresponding physical path onapplication server using FM 'FILE_GET_NAME' and finally concatenate the sydatun to physical file name...
    DATA: l_file_folder TYPE string,
            l_logical_file TYPE fileintern,
      CLEAR: file1.
    *<b> First get the logical file name from table zabc021</b>
      SELECT SINGLE log_file " Actual file location
                         INTO l_logical_file
      FROM zabc021
      WHERE interface = p_interface
        AND inorout = 'O'. "outbound interface
    <b>* Get the physical file name from the logical file name</b>
      CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
      CLIENT                        = SY-MANDT
          logical_filename              = l_logical_file
       IMPORTING
         file_name                     = l_file_folder
       EXCEPTIONS
         file_not_found                = 1
         OTHERS                        = 2
      IF sy-subrc = 0.
    <b>* In actual situation the file name should come from FILE txn</b>
        CONCATENATE l_file_folder
        p_interface '_' sydatum4(2) sydatum6(2) '.DAT' INTO file1.
      ELSE.
        CLEAR file1.
        MESSAGE s999 WITH 'No logical file maintained with name ' l_logical_file.
        EXIT.
      ENDIF.
    now file1 is the file name.
    I hope this info is useful to you...
    Reward if needful

Maybe you are looking for

  • PROTECT ENDPROTECT doesen't work sapscript

    hello, i would like to use protect becuase i want that this element stays in one entire page, but he continue to broke the element.... why? i use protect and endprotect...it's correct? /E           ITEM_LINE /:           PROTECT /:           SET DATE

  • The iPhone won't start anymore

    my iphone 4 wont start anymore

  • Error with €-character in pdf417 bar code

    Hey, we have a problem with the Euro-Sign (€) in the bar code type pdf417. The encoding is set to  "ISO-8859-15", but after creating the barcode and scan this, instead of the €-character the ?-character appears. Is this a bug in the encoding-routine?

  • Java and PDF

    Dear Gurus, I am a newbie in the field of JavaScript. My problem goes as follows. I have added links to one of my PDF documents through addWebLinks(). It worked great. This method added hyperlinks to my PDF document. However my user is a non-technica

  • Conversion of non - unicode ECC6 to unicode ECC6

    Hi, We are planning to upgrade/ convert the non unicode version of our current SAP system to an unicode version of ECC 6. Is there any standard guide line or road map which we can follow to make this conersion successful. Regards, Vadivelan.N.