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

Similar Messages

  • Error occurred while downloading files from Administration Server...

    Hi guys,
    If i already have my application deployed and exploded in ../tmp/_WL_user , when I restart the managed server it will try to download again the files from the upload directory in the Administration Servers? (I'm using stage mode).
    Sometimes I got the following error:
    Caused By: java.io.IOException: [DeploymentService:290066]Error occurred while downloading files from Administration Server for deployment request "0". Underlying error is: "null"
    and I already have the war exploded in /tmp/_WL_user
    the staging mode is not only for the first deployment? when i don't have the war exploded in /tmp/_WL_user?
    I've some confusion related to the process or deployment/startup of the managed servers.
    Thanks

    Hi,
    when you get following error * DeploymentService:290066 * then that means
    A service on the machine is preventing the WebLogic Server remote instance from downloading the configuration file. This can be Hosts Intrusion Prevention (HIPS) agents or any other agent causing this issue.
    Disable the agent interfering with the download process to fix this issue.
    Regards,
    Kal

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

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

  • 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

  • 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

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

  • Problem while downloading data from Application server.

    Hi
    I have create a file on the application server.
    When i tried to download the file from application server into Excel file , all the fields in the file appear in the same column.
    How can place the fields separately in different columns in the Excel.
    Thanks
    Subha
    Edited by: subhacp on Sep 5, 2011 8:32 AM

    Hi,
    Try to use below function module where you need not to do anything new, just give path of the directory where you want to store on your workstation in the parameter  I_FILE_FRONT_END  and give path of your application server from where you want to pick file which is in .XLS format in the FM parameter I_FILE_APPL  .
    It will simply copy the file from Apllication server to your workstation in the same format and with the same characters.
    CALL FUNCTION 'C13Z_FILE_DOWNLOAD_BINARY'
      EXPORTING
        I_FILE_FRONT_END          = pr_down
        I_FILE_APPL               = l_w_file
        I_FILE_OVERWRITE          = 'X'
    * IMPORTING
    *   E_FLG_OPEN_ERROR          =
    *   E_OS_MESSAGE              =
    EXCEPTIONS
       FE_FILE_OPEN_ERROR        = 1
       FE_FILE_EXISTS            = 2
       FE_FILE_WRITE_ERROR       = 3
       AP_NO_AUTHORITY           = 4
       AP_FILE_OPEN_ERROR        = 5
       AP_FILE_EMPTY             = 6
       OTHERS                    = 7
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Hope it will solve your query.

  • Dump while downloading data from Application Server File in 4.6 system

    Hi,
    When we are trying to upload data from Application Server to internal table using dataset statements, it is resulting in a dump. System we are using is 4.6c.
    When we faced similar kind of issue in ECC version, we have used the statement, Ignoring Conversion Errors.
    Please let me know how to handle this situation in 4.6 System.
    Thanks for your inputs.
    Regards,
    Phani

    Hi All,
    I am sorry. My question was wrong. It should be while uploading data from internal table to application server, if there are any special characters, it is going to dump.
    I will let you know the dump details and code at the earliesst.
    Sorry and Thanks again for your prompt response.
    Regards,
    Phani.

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

  • 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

  • Download file from application server to internal table in background

    hi all,
    i want to download a file from appliaction server into my internal table but in background.
    i had tryed CG3Z and CG3Y t-code but screen that is coming is asking for the parameters, and i want that screen should not appear and file should be saved in the predefined path by me.
    if there any way to do so,
    Points will be rewarded as per the Aswers.
    thaks in advance.

    Hi Sudeep,
       Use this code to get file data from application server.
    REPORT  ZE0232_BDC_APPLSERVER.
    DATA: FILE_PATH TYPE STRING.
    FILE_PATH = 'c:\bdc_mat.prn'.
    DATA: BEGIN OF ITAB OCCURS 0,
                END OF ITAB.
    OPEN DATASET FILE_PATH FOR INPUT IN TEXT MODE ENCODING DEFAULT.
      IF SY-SUBRC = 0.
    DO.
    READ DATASET FILE_PATH INTO ITAB.
    IF ITAB-RESNO NE SPACE.
       APPEND ITAB.
    ELSE.
    EXIT.
    ENDIF.
    ENDDO.
    ENDIF.
    CLOSE DATASET FILE_PATH.
    LOOP AT ITAB.
    WRITE:/ ITAB.
    ENDLOOP.
    FILE PATH IS  application server path.
    IF USEFULL REWARD

  • Download files from application server - unknown file name

    Hello everybody,
    I am working on a report allowing users to download XML files from the application server. All these XML files are created by the SAP system and their names can be found in a table. I can simply use OPEN DATASET for these files, put all file content to a buffer and send them to the GUI with CALL METHOD cl_gui_frontend_services=>gui_download.
    The problem is now that some files are touched by an external document management system. These files are moved to another directory and timestamped. The first is no problem since the folder name is always the same and can be replaced before the OPEN DATASET statement. But additionally, the file gets a timestamp, when the filename was xyz.xml before, it now gets xyz.xml.01012008123456123456. As I cannot try all possible values (mircoseconds!), I need a way to search for the right filename on the application server. Is there a function module for this available?
    It can always be stated that the former name (xyz.xml) is still a unique prefix, so I don't have to worry that xyz.xml.* will return multiple files.
    Thanks in advance for any suggestions.
    Christoph

    HI!
    I copy the function GET_DIRECTORY_FILE. In the eyelash of tables create one structures:
    DIR_FILES           LIKE                  ZDIR_FILES
    The single structure has component NAME (char 250).
    I code of the function that I use is:
    FUNCTION zget_directory_file.
    ""Interfase local
    *"  IMPORTING
    *"     REFERENCE(NAME_OF_DIR) TYPE  CHAR120
    *"     REFERENCE(NAME_OF_FILE) TYPE  CHAR120 OPTIONAL
    *"     REFERENCE(SP_CS) TYPE  CHAR120 OPTIONAL
    *"  TABLES
    *"      DIR_FILES STRUCTURE  ZDIR_FILES
      DATA: a_dir_name TYPE  char120,
            a_generic_name TYPE  char120,
            a_must_cs TYPE  char120.
      a_dir_name      = name_of_dir.
      a_generic_name  = name_of_file.
      a_must_cs       = sp_cs.
      DATA: errcnt(2) TYPE p VALUE 0.
      IF a_dir_name IS INITIAL.
       MESSAGE e220.     " 'Place cursor on valid line !'.
      ENDIF.
      CALL 'C_DIR_READ_FINISH'             " just to be sure
          ID 'ERRNO'  FIELD file_list-errno
          ID 'ERRMSG' FIELD file_list-errmsg.
      CALL 'C_DIR_READ_START' ID 'DIR'    FIELD a_dir_name
                              ID 'FILE'   FIELD a_generic_name
                              ID 'ERRNO'  FIELD file-errno
                              ID 'ERRMSG' FIELD file-errmsg.
      IF sy-subrc <> 0.
        sy-subrc = 4.
        EXIT.
      ENDIF.
      file-dirname = a_dir_name.
      DO.
        CLEAR file.
        file-name = '*.zip'.
        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.
        file-dirname = a_dir_name.
        MOVE sy-subrc TO file-subrc.
        CASE sy-subrc.
          WHEN 0.
            CLEAR: file-errno, file-errmsg.
            CASE file-type(1).
              WHEN 'F'.                 " normal file.
                PERFORM filename_useable USING file-name file-useable.
              WHEN 'f'.                 " normal file.
                PERFORM filename_useable USING file-name file-useable.
              WHEN OTHERS.              " directory, device, fifo, socket,...
                MOVE sap_no  TO file-useable.
            ENDCASE.
            IF file-len = 0.
              MOVE sap_no TO file-useable.
            ENDIF.
          WHEN 1.                     " end of directory
            EXIT.
          WHEN 4.                     " filename too long
            MOVE sap_no TO file-useable.
          WHEN OTHERS.
            ADD 1 TO errcnt.
            IF errcnt > 90.
              EXIT.
            ENDIF.
            IF sy-subrc = 5.
              MOVE: '???' TO file-type,
                    '???' TO file-owner,
                    '???' TO file-mode.
            ELSE.
            ULINE.
            WRITE: / 'C_DIR_READ_NEXT', 'SUBRC', SY-SUBRC.
            ENDIF.
            MOVE sap_no TO file-useable.
        ENDCASE.
       PERFORM p6_to_date_time_tz(rstr0400) USING file-mtime
                                                  file-mod_time
                                                  file-mod_date.
      * Does the filename contains the requested pattern?
      * Then store it, else forget it.
       MOVE-CORRESPONDING file TO file_list.
       APPEND file_list.
        MOVE file-name TO dir_files-name.
        APPEND dir_files.
       IF a_must_cs = no_cs.
         MOVE-CORRESPONDING file TO file_list.
         APPEND file_list.
       ELSE.
         IF file-name CS a_must_cs.
           MOVE-CORRESPONDING file TO file_list.
           APPEND file_list.
         ENDIF.
       ENDIF.
      ENDDO.
    ENDFUNCTION.
    *&      Form  filename_useable
          text
         -->A_NAME     text
         -->A_USEABLE  text
    FORM filename_useable USING a_name a_useable.
    *--================--
      DATA l_name(75).
      l_name = a_name.
      IF l_name(4) = 'core'.
        a_useable = sap_no.
      ELSE.
        a_useable = sap_yes.
      ENDIF.
    ENDFORM.                    "FILENAME_USEABLE
    With this I obtain all the archives XML of that route in a table
    DATA: zfiles LIKE STANDARD TABLE OF zdir_files WITH HEADER LINE.
    CALL FUNCTION 'ZGET_DIRECTORY_FILE'
      EXPORTING
        name_of_dir = dsn
      TABLES
        dir_files   = zfiles.
    IF sy-subrc = 0.
      LOOP AT zfiles .
        IF  zfiles-name+0(2) = 'O_' AND
            zfiles-name+2(3) = sy-mandt AND
            zfiles-name+5(1) = '_' AND
           zfiles-name+22(4) = '.xml'.
          file = zfiles-name.
    endloop.
    endif.
    I hope this helps you.
    Regards.

  • Problem in Downloading File from Application Server

    Hi All,
    We have an Requirement that, iam putting the Flat File
    ( Output Of a Report ) in to the
    Application Server(AL11) By using the OpendataSet, Transer , Close DataSet.
    When iam trying to Downloading the Flat File through the FM, GUI_DOWNLOAD, the Data is coming Correctly.
    But the Problem is , when trying to Downloading through AL11 i.e System -> List -> Local File  it is not coming Correctly.
    ( Java People is going to Connect with the Application Server for the Flat File )
    Kindly Clarify the Problem.
    Points will be Rewarded.
    Regards,
    Kiran.I

    Hi nl,
    1. this program will display
       selection screen
      and ask two things :
    a) application server filename
    b) local file name
    2. then it will download the file
    (the file name is CASE Sensitivie)
    3.  just try it (just copy paste )
    *& Report  YBCR_FILEDOWNLOAD                                           *
    REPORT  ybcr_filedownload                       .
    DATA
    DATA : file_name TYPE string.
    DATA : BEGIN OF itab OCCURS 0,
           ln(255) TYPE c,
           END OF itab.
    SCREEN
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : appfn(150) TYPE c LOWER CASE OBLIGATORY.
    PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION SCREEN
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      CLEAR p_file.
      CALL FUNCTION 'F4_FILENAME'
        IMPORTING
          file_name = p_file.
      file_name = p_file.
    START-OF-SELECTION
    START-OF-SELECTION.
      OPEN DATASET appfn FOR INPUT IN TEXT MODE  ENCODING DEFAULT .
      IF sy-subrc <> 0.
        MESSAGE s999(yhr) WITH 'COULD NOT OPEN FILE ON APP SERVER'.
        LEAVE LIST-PROCESSING.
      ENDIF.
      DO.
        READ DATASET appfn INTO itab.
        IF sy-subrc = 0.
          APPEND itab.
        ELSE.
          EXIT.
        ENDIF.
      ENDDO.
      file_name = p_file.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          filename                        = file_name
      FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
        TABLES
          data_tab                        = itab
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    regards,
    amit m.

Maybe you are looking for

  • CLASS ACTION SUIT..SIGN UP!...*REPOSTING ON POSTERS BEH

    Lots of us are very fed up with the x-fi. I am. It cost me a lot of dosh, and hours and frustrating hours, days, weeks, months of my precious time to discover it wouldn't work. QUOTE: "Anyone interested in a Class Action Suite against Creative for th

  • How do I Fix DDS Generated Sine Wave That Produces a Periodic Square Wave?

    Hello, I'm an undergraduate researcher with almost no experience dealing with FPGA semantics and other National Instruments hardware in general.  Part of my project revolves around creating a sine wave signal via the FPGA on an sbRIO-9632 that is out

  • Why does the program panel fail to match magnification of source panel?

    The magnification and resolution settings for both program & source panels are identical. However, the magnification on the program panel is much higher than the source. The rendered video, of course, is produced with the higher magnification thereby

  • PSE10 Remove Duplicate Photos

    I am running PSE10 on Win 7, and have found myself with a bit of a mess I'd like to clean up.  My Catalog has many hundred duplicate photos.  These are pairs of items that point to the same physical photo via a different path.  All follow the pattern

  • MDT 2012 UNC Deployment Failure with static IP.

    I am having trouble getting my UNC deployment to run the State Restore phase. I am operating on a network without DHCP and have successfully connected to the network share and ran the Task Sequence. After the reboot, however, the static ip doesn't ge