Error in task -Downloading a file from report

Hi all,
This is my code to download the content of report to Excel,Problem i am getting when trying to put heading for numerical fields .Its getting '0' in the heading .For remaining  Fields which are non-numberic its displaying nicely.Could any one solve this for me.
report zt11.
  data :  itab type mard occurs 0 .
select  * from mard into table itab .
data: it_t001   type t001  occurs 0,
      it_fields type dfies occurs 0  with header line,
      begin of it_fnames occurs 0,
        reptext like dfies-reptext,
      end of it_fnames.
      CALL FUNCTION 'GET_FIELDTAB'
  EXPORTING
  LANGU                     = SY-LANGU
  ONLY                      = ' '
    TABNAME                   = 'MARD'
  WITHTEXT                  = 'X'
IMPORTING
  HEADER                    =
  RC                        =
  TABLES
    FIELDTAB                  = it_fields
  EXCEPTIONS
    INTERNAL_ERROR            = 1
    NO_TEXTS_FOUND            = 2
    TABLE_HAS_NO_FIELDS       = 3
    TABLE_NOT_ACTIV           = 4
    OTHERS                    = 5
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_fields.
  it_fnames-reptext = it_fields-reptext.
  append it_fnames.
endloop.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
  EXPORTING
    FILE_NAME                       = 'C:\T001'
  CREATE_PIVOT                    = 0
    DATA_SHEET_NAME                 = 'Companies'
  PIVOT_SHEET_NAME                = ' '
  PASSWORD                        = ' '
  PASSWORD_OPTION                 = 0
  TABLES
  PIVOT_FIELD_TAB                 =
    DATA_TAB                        = itab
   FIELDNAMES                      = it_fnames
  EXCEPTIONS
    FILE_NOT_EXIST                  = 1
    FILENAME_EXPECTED               = 2
    COMMUNICATION_ERROR             = 3
    OLE_OBJECT_METHOD_ERROR         = 4
    OLE_OBJECT_PROPERTY_ERROR       = 5
    INVALID_FILENAME                = 6
    INVALID_PIVOT_FIELDS            = 7
    DOWNLOAD_PROBLEM                = 8
    OTHERS                          = 9
IF SY-SUBRC <> 0.
  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
short dump :  unable to interpret the "..... " as number.

Hi,
You are not formatting the internal table for field labels correctly.
See the attached code and do accordingly.
This will help you.
Reward for useful answers.
report zesdr001
       line-size 215
       line-count 65
       no standard page heading
       message-id zv.
                      Tables Declaration
tables:vbrk,       " Sales Document: Billing Header Data
       mara,       " Material Master Data
       mbew,       " Material Valuation data
       mbewh,      " Material Valuation: History Data
       t001,       " Company Codes
       t001w,      " Plants/Branches
       konv,       " Pricing Conditions Data
       t179t,      " Materials: Product hierarchies: Texts
       tcurx,      " Currency Conversion Table
       vbuk,       " Sales Document: Header Status data
       tvko,       " Organizational Unit: Sales Organizations
       tvtw,       " Organizational Unit: Dist.Channels
       tspa,       " Organizational Unit: Divisions
       tvfk,       " Billing Document Types
       kna1.       " Customer Master Data
             Declaration of Data and Internal Tables
Internal table to store the Billing Details data.(VBRK,VBRP)
data: begin of itab_bill occurs 0,
        vbeln like vbrk-vbeln,            " Billing Document Number
        fktyp like vbrk-fktyp,            " Billing Category
        vbtyp like vbrk-vbtyp,            " Sales Doc Category
        fkdat like vbrk-fkdat,            " Billing doc date
        fkart like vbrk-fkart,            " Billing Doc type
        bukrs like vbrk-bukrs,            " Company Code
        kurrf like vbrk-kurrf,            " Exchange type
        knumv like vbrk-knumv,            " Condition Number
        waerk like vbrk-waerk,            " Currency
        kunag like vbrk-kunag,            " Sold to Party
        vrkme like vbrp-vrkme,            " sales Unit
        posnr like vbrp-posnr,            " Item Number
        charg like vbrp-charg,            " Batch Number
        fkimg like vbrp-fkimg,            " Billed quantity
        werks like vbrp-werks,            " Plant
        matnr like vbrp-matnr,            " Material Number
        netwr like vbrp-netwr,            " Net Value of the doc
        wavwr like vbrp-wavwr,            " Cost in Doc Currency
        kdmat like vbap-kdmat,            " Customer Material
      end of itab_bill.
Internal table to write the report output when Customer Mode
Radiobutton is selected
data: begin of itab_out occurs 0,
        kunag like vbrk-kunag,            " Customer No
        vbeln like vbrk-vbeln,            " Billing Document Number
        fkart like vbrk-fkart,            " Billing Doc type
        fktyp like vbrk-fktyp,            " Billing Category
        vbtyp like vbrk-vbtyp,            " Sales Doc Category
        fkdat like vbrk-fkdat,            " Billing doc date
        kunnr like kna1-kunnr,            " Customer
        bukrs like vbrk-bukrs,            " Company Code
        kurrf like vbrk-kurrf,            " Exchange Rate
        waerk like vbrk-waerk,            " Currency
        vrkme like vbrp-vrkme,            " Sales Unit
        posnr like vbrp-posnr,            " Item Number
        charg like vbrp-charg,            " Batch Number
        fkimg like vbrp-fkimg,            " Billed quantity
        werks like vbrp-werks,            " Plant
        matnr like vbrp-matnr,            " Material NUmber
        kdmat like vbap-kdmat,            " Customer Material
        bil_amt(16) type p decimals 2,    " Bill Amount
        mode(10),                         " Mode
        density(10),                      " Density
        sel_prc(16) type p decimals 2,    " Selling Price
        mvg_prs like mbew-verpr,          " Moving Price
        gp_mvp_amt like vbrp-netwr,       " GrossProfit Amount(MVP)
        gp_mvp_pr(6)  type p decimals 2,  "   ,, percentage
      end of itab_out.
Internal table to write the report output when Mode
Radiobutton is selected
data: begin of itab_out2 occurs 0,
        mode(10),
        vbeln like vbrk-vbeln,             " Billing Document Number
        fktyp like vbrk-fktyp,             " Billing Category
        vbtyp like vbrk-vbtyp,             " Sales Doc Category
        fkdat like vbrk-fkdat,             " Billing doc date
        kunag like vbrk-kunag,             " Sold to party
        kunnr like kna1-kunnr,             " Customer
        bukrs like vbrk-bukrs,             " Company Code
        kurrf like vbrk-kurrf,             " Exchange Rate
        waerk like vbrk-waerk,             " Currency
        vrkme like vbrp-vrkme,             " Sales UNit
        posnr like vbrp-posnr,             " Item No
        charg like vbrp-charg,             " Batch Number
        fkimg like vbrp-fkimg,             " Billed quantity
        werks like vbrp-werks,             " Plant
        matnr like vbrp-matnr,             " Material Number
        kdmat like vbap-kdmat,             " Customer Material No
        bil_amt(16)   type p decimals 2,   " Billing Amount
        density(10),                       " density
        sel_prc(16) type p decimals 4,     " Selling Price
        mvg_prs like mbew-verpr,           " Moving Price
        gp_mvp_amt like vbrp-netwr,        " GrossProfit Amount(MVP)
        gp_mvp_pr(6)  type p decimals 2,   "   ,, percentage
      end of itab_out2.
Internal table to write the report output when Density
Radiobutton is selected
data: begin of itab_out3 occurs 0,
        mode(10),
        density(10),
        vbeln like vbrk-vbeln,            " Billing Document Number
        fktyp like vbrk-fktyp,            " Billing Category
        vbtyp like vbrk-vbtyp,            " Sales Doc Category
        fkdat like vbrk-fkdat,            " Billing doc date
        kunag like vbrk-kunag,            " Sold to Party
        kunnr like kna1-kunnr,            " Customer
        bukrs like vbrk-bukrs,            " Company Code
        kurrf like vbrk-kurrf,            " Exchange Rate
        waerk like vbrk-waerk,            " Currency
        vrkme like vbrp-vrkme,            " Sales Unit
        posnr like vbrp-posnr,            " Item Number
        charg like vbrp-charg,            " Batch Number
        fkimg like vbrp-fkimg,            " Billed quantity
        werks like vbrp-werks,            " Plant
        matnr like vbrp-matnr,            " Material Number
        kdmat like vbap-kdmat,            " Customer Material
        bil_amt(16)   type p decimals 2,  " Bill Amount
        sel_prc(16) type p decimals 4,    " Selling Price
        mvg_prs like mbew-verpr,          " Moving Price
        gp_mvp_amt like vbrp-netwr,       " GrossProfit Amount(MVP)
        gp_mvp_pr(6)  type p decimals 2,  "   ,, percentage
      end of itab_out3.
*-Internal Table to Hold data to be downloaded to file
data: begin of itab_out1 occurs 0,
        kunag(10),                       " Customer
        vbeln(10),                       " Billing Doc No
        fkdat(10),                       " Bill Date
        posnr(6),                        " Item No
        mode(6),                         " Mode
        density(6),                      " Density
        matnr(18),                       " Material
        charg(10),                       " Batch Number
        fkimg like vbrp-fkimg,           " Billed quantity
        vrkme(4),                        " Sales Unit
        sel_prc(14),                     " Selling Price
        bil_amt(15)  type p decimals 2,  " Billing Amount
        waerk(4),                        " Currency
        mvg_prs(15),                     " Moving Price
        gp_mvp_amt like vbrp-netwr,      " Gross profit Amount(MVP)
        gp_mvp_pr(15),                   "    ,,  percentage
        kdmat(35),                       " Customer Material
      end of itab_out1.
*Internal Table
data: begin of fieldnames occurs 0,
        title(25) type c,
        table(5)  type c,
        field(5)  type c,
        type(1)   type c,
      end of fieldnames.
Declaration Of Variables
data: w_period like bapi0002_4-fiscal_period,
      w_year   like bapi0002_4-fiscal_year,
      w_date   like bsad-budat,
      w_lin type i.       "No.of lines in Internal Table
data: t_fkimg             like vbrp-fkimg,
      t_bil_amt(8)        type p decimals 2,
      t_gp_mvp_amt(8)     type p decimals 2,
      t_gr_fkimg          like vbrp-fkimg,
      t_gr_bil_amt(8)     type p decimals 2,
      t_gr_gp_mvp_amt(8)  type p decimals 2,
      t_efkimg            like vbrp-fkimg,
      t_ebil_amt(8)       type p decimals 2,
      t_egp_mvp_amt(8)    type p decimals 2.
data:f_flg .
                   Select-Options
selection-screen: begin of block b with frame.
selection-screen : begin of block b1 with frame title text-001.
select-options:s_bukrs for t001-bukrs no intervals no-extension
                                                     obligatory,
               s_vkorg for tvko-vkorg no intervals no-extension,
               s_vtweg for tvtw-vtweg no intervals no-extension,
               s_spart for tspa-spart no intervals no-extension,
               s_werks for t001w-werks no intervals no-extension,
               s_kunag for kna1-kunnr,
               s_vbeln for vbuk-vbeln,
               s_fkart for tvfk-fkart,
               s_fkdat for vbrk-fkdat obligatory.
selection-screen begin of line.
selection-screen comment 1(20) text-008.
selection-screen end   of line.
selection-screen begin of line.
parameters p_cust type c radiobutton group cust.
selection-screen comment 3(20) text-004 for field p_cust.
selection-screen end of line.
selection-screen begin of line.
parameters p_mode type c radiobutton group cust.
selection-screen comment 3(20) text-006 for field p_mode.
selection-screen end of line.
selection-screen begin of line.
parameters p_dens type c radiobutton group cust.
selection-screen comment 3(20) text-007 for field p_dens.
selection-screen end of line.
selection-screen: end of block b1.
selection-screen : begin of block b2 with frame title text-002.
parameters:  p_dwnlod as checkbox,
             p_file like rlgrap-filename. " default 'C:\zesdr001'.
selection-screen: end of block b2.
selection-screen: end of block b.
*******At Selection Screen********************************************
at selection-screen.
At Selection Screen on Value Request
at selection-screen on value-request for p_file.
  perform f4_help.
Checking for the input values of selection screen.
  perform screen_check.
Top Of Page***************************************************
top-of-page.
  perform rep_headers.
*******Start of Selection*********************************************
start-of-selection.
Selecting data from the database tables
  perform invoice_selection.
  describe table itab_bill lines w_lin.
  if w_lin = 0.
    message i008.   " No Data Found for the Given Selection Criteria
  else.
Moving the data records into output internal table
    perform bill_details.
When Customer Radio button is selected
    if p_cust eq 'X'.
      perform invoice_output_cust.
When Mode Radio button is selected
    elseif p_mode eq 'X'.
      perform invoice_output_mode.
When density Radio button is selected
    elseif p_dens eq 'X'.
      perform invoice_output_dens.
    endif.
  endif.
*******End of Selection***********************************************
end-of-selection.
  perform init_fieldnames.
  if p_dwnlod = 'X'.
    perform read_data_for_dowlload.
  perform down_load_to_file using p_file.
    perform download_excel using p_file.
  endif.
*&      Form  screen_check
   Ckecking for Selection Screen fields Validation
form screen_check.
Validation of Sales Organization
  clear tvko.
  if not s_vkorg-low is initial.
    select vkorg from tvko up to 1 rows
           into tvko-vkorg
           where vkorg in s_vkorg.
    endselect.
    if sy-subrc ne 0.
      message e009.  " Invalid Sales Organization
    endif.
  endif.
Validation of Distribution Channel
  clear tvtw.
  if not s_vtweg-low is initial.
    select vtweg from tvtw up to 1 rows
           into tvtw-vtweg
           where vtweg in s_vtweg.
    endselect.
    if sy-subrc ne 0.
      message e010.  " Invalid Distribution Channel
    endif.
  endif.
Validation of Division
  clear tspa.
  if not s_spart-low is initial.
    select spart from tspa up to 1 rows
           into tspa-spart
           where spart in s_spart.
    endselect.
    if sy-subrc ne 0.
      message e011.  " Invalid Division
    endif.
  endif.
Validation for company code
  clear t001.
  if not s_bukrs-low is initial.
    select single bukrs from t001
         into t001-bukrs
         where bukrs in s_bukrs.
    if sy-subrc <> 0.
      message e007.   " Enter valid Company Code
    endif.
  endif.
Validation of billing Document Type
  clear tvfk.
  if not s_fkart is initial.
    select fkart from tvfk up to 1 rows
           into tvfk-fkart
           where fkart in s_fkart.
    endselect.
    if sy-subrc ne 0.
      message e012.  " Invalid Billing Document Type
    endif.
  endif.
Validation of Billing Document Number
  clear vbuk.
  if not s_vbeln is initial.
    select vbeln from vbuk up to 1 rows
           into vbuk-vbeln
           where vbeln in s_vbeln and
                 vbtyp = 'M'.
    endselect.
    if sy-subrc ne 0.
      message e013.   " Invalid Billing Doc Number
    endif.
  endif.
Validation of Customer
  clear kna1.
  if not s_kunag is initial.
    select kunnr from kna1 up to 1 rows
           into kna1-kunnr
           where kunnr in s_kunag.
    endselect.
    if sy-subrc ne 0.
      message e014.    " Invalid Customer Number
    endif.
  endif.
Validation of Plant
  clear t001w.
  if not s_werks is initial.
    select werks from t001w up to 1 rows
           into t001w-werks
           where werks in s_werks.
    endselect.
    if sy-subrc ne 0.
      message e004.    " Invalid Plant Number
    endif.
  endif.
Validation for File path to download
  if p_dwnlod = 'X'.
    if p_file is initial.
      message e006.  " Enter the Valid file path to Download
    endif.
  endif.
endform.             "screen_check
      FORM invoice_selection                                        *
Selecting data from the database tables
form invoice_selection.
  select
        a~vbeln                   " Billing Doc Number
        a~fktyp                   " Billing Category
        a~vbtyp                   " Sales Doc category
        a~fkdat                   " Billing doc date
        a~fkart                   " Billing doc type
        a~bukrs                   " Company code
        a~kurrf                   " Exchange rate
        a~knumv                   " Condition record Number
        a~waerk                   " Currency
        a~kunag                   " Sold to Party
        b~vrkme                   " Sales Unit
        b~posnr                   " Item Number
        b~charg                   " Batch Number
        b~fkimg                   " Billed quantity
        b~werks                   " Plant
        b~matnr                   " Material Number
        b~netwr                   " Net Value of Bill Doc
        b~wavwr                   " Cost in Doc Currency
        c~kdmat                   " Customer Material
                 into table itab_bill
                 from vbrk as a join vbrp as b
                        on bvbeln = avbeln
                        join vbap as c
                        on baubel = cvbeln and
                           baupos = cposnr
                  where a~vbeln in s_vbeln and
                        a~fkdat in s_fkdat and
                        a~bukrs in s_bukrs and
                        a~vtweg in s_vtweg and
                        a~vkorg in s_vkorg and
                        a~spart in s_spart and
                        a~fkart in s_fkart and
                        b~werks in s_werks and
                        a~kunag in s_kunag and
                        a~sfakn eq ' ' and
                        a~fksto eq ' ' .
endform .
      FORM bill_details                                             *
appending data into itab_out internal table
form bill_details.
  sort itab_bill by vbeln.
  select single waers from t001 into t001-waers
                          where bukrs in s_bukrs.
  data:f_txt1(10),f_txt2(10),f_txt3(10).
  loop at itab_bill.
    itab_out-vbeln   = itab_bill-vbeln.
    itab_out-fktyp   = itab_bill-fktyp.
    itab_out-vbtyp   = itab_bill-vbtyp.
    itab_out-fkdat   = itab_bill-fkdat.
    itab_out-fkart   = itab_bill-fkart.
    itab_out-bukrs   = itab_bill-bukrs.
    itab_out-kurrf   = itab_bill-kurrf.
    itab_out-waerk   = itab_bill-waerk.
    itab_out-kunag   = itab_bill-kunag.
    itab_out-vrkme   = itab_bill-vrkme.
    itab_out-posnr   = itab_bill-posnr.
    itab_out-charg   = itab_bill-charg.
    itab_out-fkimg   = itab_bill-fkimg.
    itab_out-werks   = itab_bill-werks.
    itab_out-matnr   = itab_bill-matnr.
    itab_out-kdmat   = itab_bill-kdmat.
   select single currdec from tcurx into tcurx-currdec
          where currkey eq itab_out-waerk.
    if sy-subrc eq '0' .
      if tcurx-currdec eq '0'.
        itab_bill-netwr = itab_bill-netwr * 100.
        itab_bill-wavwr = itab_bill-wavwr * 100.
      endif.
    endif.
    itab_out-bil_amt = itab_bill-netwr.
    clear : konv.
Pricing data from KONV table
    select single kbetr kwert kpein from konv into
                                  (konv-kbetr,konv-kwert,konv-kpein)
                                   where knumv = itab_bill-knumv and
                                         kposn = itab_bill-posnr and
                                         kschl eq 'ZSP1' and
                                         krech eq 'C' and
                                         kinak eq ' '.
Currency conversion
    select single currdec from tcurx into tcurx-currdec
                       where currkey eq itab_out-waerk.
    if sy-subrc eq '0' .
      if tcurx-currdec eq '0'.
        konv-kbetr = konv-kbetr * 100.
      endif.
    endif.
Unit Price
    itab_out-sel_prc = konv-kbetr.
Unit Price Calculation
    if not konv-kpein is initial.
      itab_out-sel_prc = itab_out-sel_prc / konv-kpein .
    endif.
Call Function to get the Period for the given Billing date
and Company Code
    perform get_period.
Selecting Material Valuation Data
    clear:mbew.
    if itab_out-fktyp eq 'L'.
      select single
          lfmon lfgja verpr stprs vmver vmstp
             from mbew
             into (mbew-lfmon,mbew-lfgja,mbew-verpr,
                   mbew-stprs,mbew-vmver,mbew-vmstp)
                      where matnr = itab_out-matnr
                      and   bwkey = itab_out-werks.
      if mbew-lfmon = w_period and mbew-lfgja = w_year.
        select single currdec from tcurx into tcurx-currdec
              where currkey eq t001-waers.
        if sy-subrc eq '0' .
          if tcurx-currdec eq '0'.
            mbew-stprs = mbew-stprs * 100.
            mbew-verpr = mbew-verpr * 100.
          endif.
        endif.
        if itab_out-waerk eq t001-waers.
          itab_out-mvg_prs = mbew-verpr  ."/ itab_out-kurrf.
        else.
          itab_out-mvg_prs = mbew-verpr  / itab_out-kurrf.
        endif.
      else.
        clear:mbewh.
        select single
         lfmon lfgja verpr stprs
            from mbewh
            into (mbewh-lfmon,mbewh-lfgja,mbewh-verpr,
                  mbewh-stprs)
                     where matnr = itab_out-matnr
                     and   bwkey = itab_out-werks
                     and   lfmon = w_period
                     and   lfgja = w_year.
        select single currdec from tcurx into tcurx-currdec
                where currkey eq t001-waers.
        if sy-subrc eq '0' .
          if tcurx-currdec eq '0'.
            mbewh-verpr = mbewh-verpr * 100.
          endif.
        endif.
        if itab_out-waerk eq t001-waers.
          itab_out-mvg_prs = mbewh-verpr ."/ itab_out-kurrf.
        else.
          itab_out-mvg_prs = mbewh-verpr  / itab_out-kurrf.
        endif.
        if itab_out-mvg_prs is initial.
          select single
                  lfmon lfgja verpr stprs vmver vmstp
                     from mbew
                     into (mbew-lfmon,mbew-lfgja,mbew-verpr,
                           mbew-stprs,mbew-vmver,mbew-vmstp)
                              where matnr = itab_out-matnr
                              and   bwkey = itab_out-werks.
          select single currdec from tcurx
             into tcurx-currdec
             where currkey eq t001-waers.
          if sy-subrc eq '0' .
            if tcurx-currdec eq '0'.
              mbew-verpr = mbew-verpr * 100.
            endif.
          endif.
          if itab_out-waerk eq t001-waers.
            itab_out-mvg_prs = mbew-verpr  ."/ itab_out-kurrf.
          else.
            itab_out-mvg_prs = mbew-verpr  / itab_out-kurrf.
          endif.
        endif.
      endif.
    endif.
To find Density and Mode from MARA and T179T tables
    clear :mara,t179t.
    select single prdha from mara
          into mara-prdha
          where matnr = itab_out-matnr.
    select single vtext from t179t
           into t179t-vtext
           where spras = 'EN' and
           prodh = mara-prdha(4).
    split t179t-vtext at ' ' into f_txt1 f_txt2 f_txt3.
    itab_out-mode = f_txt2.
    itab_out-density = f_txt3.
    if not itab_out-mvg_prs is initial.
      if itab_out-fktyp eq 'L'.
        itab_out-gp_mvp_amt = itab_out-bil_amt - itab_out-mvg_prs *
                                                   itab_out-fkimg.
      else.
        itab_out-gp_mvp_amt = '0'.
      endif.
    endif.
    if not itab_out-mvg_prs is initial
       and not itab_out-sel_prc is initial.
      itab_out-gp_mvp_pr = ( itab_out-sel_prc - itab_out-mvg_prs )
                                     / itab_out-sel_prc * 100.
    endif.
    append itab_out.
    clear itab_out.
  endloop.
  loop at itab_out.
    if itab_out-vbtyp eq 'N' or itab_out-vbtyp eq 'O'.
      itab_out-fkimg   = itab_out-fkimg * -1.
      itab_out-sel_prc = itab_out-sel_prc * -1.
      itab_out-bil_amt = itab_out-bil_amt * -1.
      itab_out-mvg_prs = itab_out-mvg_prs * -1.
      itab_out-gp_mvp_amt = itab_out-gp_mvp_amt * -1.
      itab_out-gp_mvp_pr = itab_out-gp_mvp_pr * -1.
If the bill amount is 0 then the quantity should also be 0.
      if itab_out-bil_amt = 0.
        itab_out-fkimg = 0.
      endif.
Check if the Bill amount is Credit memo amount, then the gross profit
should also be the same bill amount irrespecitve of +ve or -ve.
      if itab_out-gp_mvp_amt = 0.
        move: itab_out-bil_amt to itab_out-gp_mvp_amt.
      endif.
      modify itab_out.
      clear itab_out.
    endif.
  endloop.
endform.
*&      Form  get_period
Getting Document Period
form get_period.
  clear :w_period,w_year,w_date.
  concatenate itab_out-fkdat(4)
               itab_out-fkdat+4(2)
               itab_out-fkdat+6(2)
               into w_date.
  call function 'BAPI_COMPANYCODE_GET_PERIOD'
       exporting
            companycodeid = itab_out-bukrs
            posting_date  = w_date
       importing
            fiscal_year   = w_year
            fiscal_period = w_period.
endform.                    " get_period
*&      Form  invoice_output_cust
      Report Output when customer is selected
form invoice_output_cust.
  write at /1(214) sy-uline.
  sort itab_out  by kunag vbeln fkart posnr fkdat.
  loop at itab_out.
    if f_flg = 'X'.
      format color col_normal intensified off.
      f_flg = ' '.
    else.
      format color col_normal intensified on.
      f_flg = 'X'.
    endif.
    at new kunag.
      read table itab_out index sy-tabix.
    endat.
    write:  /01 sy-vline,  2(10) itab_out-kunag,
             12 sy-vline, 13(10) itab_out-vbeln,
             23 sy-vline, 24(6)  itab_out-posnr,
             30 sy-vline, 31(10) itab_out-fkdat,
             41 sy-vline, 42(6)  itab_out-mode,
             48 sy-vline, 49(7)  itab_out-density,
             56 sy-vline, 57(18) itab_out-matnr,
             75 sy-vline, 76(10) itab_out-charg,
             86 sy-vline,
             87(13) itab_out-fkimg unit itab_out-vrkme no-sign,
             102(3) itab_out-vrkme,
            105 sy-vline,
            106(14) itab_out-sel_prc currency konv-waers no-sign,
            120 sy-vline,
            121(15) itab_out-bil_amt currency vbrk-waerk no-sign,
            138(3) itab_out-waerk,
            141 sy-vline,
            142(15) itab_out-mvg_prs currency vbrk-waerk no-sign,
            157 sy-vline,
            158(15) itab_out-gp_mvp_amt currency vbrk-waerk no-sign,
            173 sy-vline,174(6)  itab_out-gp_mvp_pr no-sign ,
            180 sy-vline,181(33) itab_out-kdmat,
            214 sy-vline.
    t_fkimg = t_fkimg + itab_out-fkimg.
    t_bil_amt = t_bil_amt + itab_out-bil_amt.
    t_gp_mvp_amt = t_gp_mvp_amt + itab_out-gp_mvp_amt.
    t_gr_fkimg      = t_gr_fkimg         + itab_out-fkimg.
    t_gr_bil_amt    = t_gr_bil_amt       + itab_out-bil_amt.
    t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out-gp_mvp_amt.
    at end of kunag.
      format reset.
      format color col_total intensified off.
      write:/1(214) sy-uline.
      write:/01 sy-vline,
             02 'Sub Total of Customer:'(035), itab_out-kunag,
             87(13) t_fkimg unit itab_out-vrkme no-sign,
            121(15) t_bil_amt no-sign,
            158(15) t_gp_mvp_amt no-sign,
            214 ' ',
            /1(214)  sy-uline.
      clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
    endat.
    at last.
      write:/01 sy-vline,
             02 'Grand Total :'(032),
             87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
            121(15) t_gr_bil_amt no-sign,
            158(15) t_gr_gp_mvp_amt no-sign,
            214 ' '.
    endat.
    format color off.
  endloop.
  write at /1(214) sy-uline.
endform.    "invoice_output_cust
*&      Form  invoice_output_mode
      Report Output
form invoice_output_mode.
  loop at itab_out.
    move-corresponding itab_out to itab_out2.
    append itab_out2.
    clear: itab_out2.
  endloop.
  write at /1(214) sy-uline.
  sort itab_out2  by mode vbeln posnr fkdat.
  loop at itab_out2.
    if f_flg = 'X'.
      format color col_normal intensified off.
      f_flg = ' '.
    else.
      format color col_normal intensified on.
      f_flg = 'X'.
    endif.
    at new mode.
      read table itab_out2 index sy-tabix.
    endat.
    write: /01 sy-vline,  2(10) itab_out2-kunag,
            12 sy-vline, 13(10) itab_out2-vbeln,
            23 sy-vline, 24(6)  itab_out2-posnr,
            30 sy-vline, 31(10) itab_out2-fkdat,
            41 sy-vline, 42(6)  itab_out2-mode,
            48 sy-vline, 49(7)  itab_out2-density,
            56 sy-vline, 57(18) itab_out2-matnr,
            75 sy-vline, 76(10) itab_out2-charg,
            86 sy-vline,
            87(13) itab_out2-fkimg unit itab_out2-vrkme no-sign,
            102(3) itab_out2-vrkme,
            105 sy-vline,
            106(14) itab_out2-sel_prc currency vbrk-waerk no-sign,
            120 sy-vline,
            121(15) itab_out2-bil_amt currency vbrk-waerk no-sign,
                         138(3)  itab_out2-waerk,
            141 sy-vline,
            142(15) itab_out2-mvg_prs currency vbrk-waerk no-sign,
            157 sy-vline,
            158(15) itab_out2-gp_mvp_amt currency vbrk-waerk no-sign,
            173 sy-vline,174(6)  itab_out2-gp_mvp_pr no-sign,
            180 sy-vline,181(33) itab_out2-kdmat,
            214 sy-vline.
    t_fkimg = t_fkimg + itab_out2-fkimg.
    t_bil_amt = t_bil_amt + itab_out2-bil_amt.
    t_gp_mvp_amt = t_gp_mvp_amt + itab_out2-gp_mvp_amt.
    t_gr_fkimg      = t_gr_fkimg         + itab_out2-fkimg.
    t_gr_bil_amt    = t_gr_bil_amt       + itab_out2-bil_amt.
    t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out2-gp_mvp_amt.
    at end of mode.
      format reset.
      format color col_total intensified off.
      write:/1(214) sy-uline.
      write:/01 sy-vline,
             02 'Sub Total of Mode :'(033), itab_out2-mode,
             87(13) t_fkimg unit itab_out-vrkme no-sign,
            121(15) t_bil_amt no-sign,
            158(15) t_gp_mvp_amt no-sign,
            214 ' ',
            /1(214)  sy-uline.
      clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
    endat.
    at last.
      write:/01 sy-vline,
             02 'Grand Total :'(032),
             87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
            121(15) t_gr_bil_amt no-sign,
            158(15) t_gr_gp_mvp_amt no-sign,
            214 ' '.
    endat.
    format color off.
  endloop.
  write at /1(214) sy-uline.
endform.    "invoice_output_mode
*&      Form  invoice_output_dens
      Report Output
form invoice_output_dens.
  loop at itab_out.
    move-corresponding itab_out to itab_out3.
    append itab_out3.
    clear: itab_out3.
  endloop.
  write at /1(214) sy-uline.
  sort itab_out3  by mode density vbeln posnr fkdat.
  loop at itab_out3.
    if f_flg = 'X'.
      format color col_normal intensified off.
      f_flg = ' '.
    else.
      format color col_normal intensified on.
      f_flg = 'X'.
    endif.
    at new mode.
    endat.
    at new density.
      read table itab_out3 index sy-tabix.
    endat.
    write:  /01 sy-vline,  2(10) itab_out3-kunag,
             12 sy-vline, 13(10) itab_out3-vbeln,
             23 sy-vline, 24(6)  itab_out3-posnr,
             30 sy-vline, 31(10) itab_out3-fkdat,
             41 sy-vline, 42(6)  itab_out3-mode,
             48 sy-vline, 49(7)  itab_out3-density,
             56 sy-vline, 57(18) itab_out3-matnr,
             75 sy-vline, 76(10) itab_out3-charg,
             86 sy-vline,
             87(13) itab_out3-fkimg unit itab_out3-vrkme no-sign,
             102(3) itab_out3-vrkme,
             105 sy-vline,106(14) itab_out3-sel_prc no-sign,
             120 sy-vline,
             121(15) itab_out3-bil_amt currency vbrk-waerk no-sign,
                          138(3)  itab_out3-waerk,
             141 sy-vline,142(15) itab_out3-mvg_prs no-sign
                                  currency vbrk-waerk,
             157 sy-vline,158(15) itab_out3-gp_mvp_amt no-sign
                                  currency vbrk-waerk,
             173 sy-vline,174(6)  itab_out3-gp_mvp_pr no-sign,
             180 sy-vline,181(33) itab_out3-kdmat,
             214 sy-vline.
    t_efkimg      = t_efkimg      + itab_out3-fkimg.
    t_ebil_amt    = t_ebil_amt    + itab_out3-bil_amt.
    t_egp_mvp_amt = t_egp_mvp_amt + itab_out3-gp_mvp_amt.
    t_fkimg = t_fkimg + itab_out3-fkimg.
    t_bil_amt = t_bil_amt + itab_out3-bil_amt.
    t_gp_mvp_amt = t_gp_mvp_amt + itab_out3-gp_mvp_amt.
    t_gr_fkimg      = t_gr_fkimg         + itab_out3-fkimg.
    t_gr_bil_amt    = t_gr_bil_amt       + itab_out3-bil_amt.
    t_gr_gp_mvp_amt = t_gr_gp_mvp_amt    + itab_out3-gp_mvp_amt.
    at end of density.
      format reset.
      format color col_total intensified off.
      write:/1(214) sy-uline.
      write:/01 sy-vline,
             02 'Sub Total of Density :'(034), itab_out3-density,
            87(13) t_efkimg unit itab_out-vrkme no-sign,
           121(15) t_ebil_amt currency vbrk-waerk no-sign,
           158(15) t_egp_mvp_amt currency vbrk-waerk no-sign,
           214 ' ',
            /1(214) sy-uline.
      clear: t_efkimg, t_ebil_amt,t_egp_mvp_amt.
    endat.
    at end of mode.
      format reset.
      format color col_total intensified off.
      write:/01 sy-vline,
             02 'Sub Total of Mode :'(033), itab_out3-mode,
             87(13) t_fkimg unit itab_out-vrkme no-sign,
            121(15) t_bil_amt no-sign,
            158(15) t_gp_mvp_amt no-sign,
            214 ' ',
            /1(214) sy-uline.
      clear: t_fkimg, t_bil_amt, t_gp_mvp_amt.
    endat.
    at last.
      write:/01 sy-vline,
             02 'Grand Total :'(032),
            87(13) t_gr_fkimg unit itab_out-vrkme no-sign,
           121(15) t_gr_bil_amt no-sign,
           158(15) t_gr_gp_mvp_amt no-sign,
           214 ' '.
    endat.
    format color off.
  endloop.
  write at /1(214) sy-uline.
endform.    "invoice_output_dens
*&      Form  f4_help
      To Get F4 Help to Select File Name
form f4_help.
  call function 'F4_FILENAME'
       exporting
            program_name  = sy-cprog
            dynpro_number = syst-dynnr
            field_name    = 'P_FILE'
       importing
            file_name     = p_file.
endform.                                                    " f4_help
*&      Form  rep_headers
      Report Header
form rep_headers.
  format color col_heading on.
  format color col_heading on.
  select single butxt from t001 into t001-butxt
                                where bukrs = s_bukrs-low.
  skip 2.
  write: /2 t001-butxt, 92 'BILLING ANALYSIS'(003),
         190 'Date :'(010),sy-datum.
  write :/2 'Company Code :'(011), s_bukrs-low ,
        85 'Billing Date :'(012) , s_fkdat-low , '-' ,s_fkdat-high ,
        190 'Page :'(013), sy-pagno,
        214 ' '.
  write at /1(214) sy-uline.
  write: /1 sy-vline,  2(10) 'Customer'(004) centered,
         12 sy-vline, 13(10) 'Billing'(009) centered,
         23 sy-vline, 24(6)  'Billing'(009) centered,
         30 sy-vline, 31(10) 'Billing'(009) centered,
         41 sy-vline, 42(6)  'Mode'(006) centered,
         48 sy-vline, 49(7)  'Density'(014) centered,
         56 sy-vline, 57(18) 'Material'(015) centered,
         75 sy-vline, 76(10) 'Batch'(016) centered,
         86 sy-vline, 87(13) 'Quantity'(017) centered,102(3) 'UOM'(027),
         105 sy-vline, 106(14) 'Selling'(018) centered ,
         120 sy-vline, 121(15) 'Billing'(009) centered,
                       138(3) 'Cur'(028),
         141 sy-vline, 142(15) 'Mvg.Avg.Price'(020) centered,
         157 sy-vline, 158(22) 'Gross Profit(MVP)'(022) centered,
         180 sy-vline, 181(33) 'Customer Material'(023) centered,
         214 sy-vline.
  write: /1 sy-vline,  2(10) 'Code'(024) centered,
         12 sy-vline, 13(10) 'Document'(025) centered,
         23 sy-vline, 24(6)  'Item'(026) centered,
         30 sy-vline, 31(10) 'Date'(036) centered,
         41 sy-vline,
         48 sy-vline,
         56 sy-vline,
         75 sy-vline,
         86 sy-vline,
        105 sy-vline, 106(14) 'Price'(030) centered ,
        120 sy-vline, 121(15) 'Amount'(031) centered,
        141 sy-vline, 142(15) '(per Unit)'(019) centered,
        157 sy-vline, 158(15) 'Amount'(031) centered,
        173 sy-vline, 174(6) ' % '(029) centered,
        180 sy-vline,
        214 sy-vline.
  format color off.
endform.                    " rep_headers
*&      Form  init_fieldnames
Initialise all the fields to download in Excel Data File
form init_fieldnames.
  perform append_fieldname using text-004 'itab_out1'
                                 'KUNAG'    'X'.
  perform append_fieldname using text-037 'itab_out1'
                                 'VBELN'   'X'.
  perform append_fieldname using text-036 'itab_out1'
                                 'FKDAT'  'X'.
  perform append_fieldname using text-038 'itab_out1'
                                 'POSNR'    'X'.
  perform append_fieldname using text-006 'itab_out1'
                                 'MODE' 'X'.
  perform append_fieldname using text-014 'itab_out1'
                                 'DENSITY' 'X'.
  perform append_fieldname using text-015 'itab_out1'
                                 'MATNR'    'X'.
  perform append_fieldname using text-016 'itab_out1'
                                 'CHARG' 'X'.
  perform append_fieldname using text-017 'itab_out1'
                                 'FKIMG'    'X'.
  perform append_fieldname using text-039 'itab_out1'
                                 'VRKME' 'X'.
  perform append_fieldname using text-040 'itab_out1'
                                 'SEL_PRC' 'X'.
  perform append_fieldname using text-041 'itab_out1'
                                 'BIL_AMT' 'X'.
  perform append_fieldname using text-028 'itab_out1'
                                 'WAERK' 'X'.
  perform append_fieldname using text-020 'itab_out1'
                                 'MVG_PRS' 'X'.
  perform append_fieldname using text-044 'itab_out1'
                                 'GP_MVP_AMT' 'X'.
  perform append_fieldname using text-045 'itab_out1'
                                 'GP_MVP_PR' 'X'.
  perform append_fieldname using text-023 'itab_out1'
                                 'KDMAT'         'X'.
endform.
*&      Form  append_fieldname
Appending field Names
form append_fieldname using p_title p_table p_field p_type.
  clear: fieldnames.
  fieldnames-title = p_title.
  fieldnames-ta

Similar Messages

  • One field is missing in downloading the file from report

    Hi Friends,
    I have a problem with downloading the file from SAP.
    Actually the report has to download 6 fields from the list of the report to a .txt file on the presentation server. But it is downloading only 5 fields. The missing field is DEA#. Actually now i have to fix that problem.
    I found that in the download process they have not inlcuded the DEA# field.
    Here in this 1 field is not getting dowloading from the list of the report to the text file.
    I'm giving a portion of the code.
    Like this they r calling the FM:
    FORM DOWNLOAD_FILE.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                FILENAME = P_OUTFIL
           TABLES
                DATA_TAB = I_OUTPUT.
      IF SY-SUBRC <> 0.
        WRITE:/ 'Error downloading file'.
      ENDIF.
    in code we have,
    data: v_output type t_output,
    data: i_output type t_output occurs 0.
    and,
    BEGIN OF T_OUTPUT,
           RECORD(200),
           END OF T_OUTPUT.
    when i debug the program,
    the record field is showing only the 5 fields not the missing 6th filed)DEA#).
    and we have another FORM :
    *&      Form  FORMAT_FILE_WITH_TABS
          Insert tabs between fields so when uploaded in Excel, the
          record will be separated into columns where a tab is found.
    FORM FORMAT_FILE_WITH_TABS.
      LOOP AT I_KNA1 INTO V_KNA1.
        CONCATENATE: V_KNA1-KUNNR
                     V_KNA1-NAME1
                     V_KNA1-NAME2
                     V_KNA1-STRAS
                     V_KNA1-ORT01
                     V_KNA1-REGIO
                     V_KNA1-PSTLZ
           INTO V_OUTPUT SEPARATED BY C_TAB.
        APPEND V_OUTPUT TO I_OUTPUT.
        CLEAR V_OUTPUT.
      ENDLOOP.
    ENDFORM.                               " FORMAT_FILE_WITH_TABS
    If you look into this FM, there is no mention of DEA# field,
    i hve tried to correct it by adding the "v_likp_dea" in the FM. when i did like this it is showing the DEA# field in the downloaded .txt file but only 1 value for all the records.
    My question is for each record i have to show its unique DEA#.
    I guess i could do this by putting it in loop, could anybody tell me how i can i do that, Please
    Thank you very much.
    Raj.

    In the subroutine format_file_with_tabs ,
    You should read  it_likp with the key that uniquely identifies for dea# . This should be done in the loop at i_kna1.
    Suppose kunnr identifies a unique dea# in it_likp internal table , then you should write
    FORM FORMAT_FILE_WITH_TABS.
    LOOP AT I_KNA1 INTO V_KNA1.
    clear v_likp.
    read table it_likp into v_likp
       with key kunnr = v_kna1-kunnr binary search.   (should sort the itab to use binary search with read. )
    CONCATENATE: V_KNA1-KUNNR
    V_KNA1-NAME1
    V_KNA1-NAME2
    V_KNA1-STRAS
    V_KNA1-ORT01
    V_KNA1-REGIO
    V_KNA1-PSTLZ
    v_likp-dea
    INTO V_OUTPUT SEPARATED BY C_TAB.
    APPEND V_OUTPUT TO I_OUTPUT.
    CLEAR V_OUTPUT.
    ENDLOOP.
    ENDFORM. " FORMAT_FILE_WITH_TABS
    Message was edited by: Kalidas Cheroolil

  • Error message when downloading photo files  from memory card  and camera  c0000005    , address e8d3c7a , with PS Elements 12 and program closes

    Can anyone help please.
    had similar problem with previous version  of PS.

    Hi jeanmichel2,
    Requesting you to please provide following info:
    - OS configuration you are using?
    - Please elaborate your scenario. I mean what are the exact steps you are doing? Also is this catalog specific (try creating a new catalog, repeat your steps and see if you face this issue).
    - I am assuming you are using Adobe Photodownloader (APD) for import (Import->From Camera or card reader). Am I correct here?
    - For Importing it seems that you are using a card reader. Is this issue reproducible with other devices also (like camera, iDevices, Android devices or pen-drives)?
    ~Surendra

  • Error while downloading PDF file from FTP Server

    Hi Friends,
    I have sent a PDF file with data to FTP , Then i want to check that uploaded pdf file , whether that is correct or not?
    for that , i have downloaded that file from FTP and i am trying to open the file . but it is giving this problem .
    "There was an error opening the document . The file is damaged and could not be repaired."
    will you suggest me regarding this.
    thanks in advance.
    balaji.T.

    CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
              EXPORTING
           SRC_SPOOLID                    = spoolno
                src_spoolid                    = wa_file-rqident
                no_dialog                      = ' '
          DST_DEVICE                     =
          PDF_DESTINATION                =
              IMPORTING
                pdf_bytecount                  = numbytes
                pdf_spoolid                    = pdfspoolid
          OTF_PAGECOUNT                  =
                btc_jobname                    = jobname
                btc_jobcount                   = jobcount
              TABLES
                pdf                            = pdf
              EXCEPTIONS
                err_no_otf_spooljob            = 1
                err_no_spooljob                = 2
                err_no_permission              = 3
                err_conv_not_possible          = 4
                err_bad_dstdevice              = 5
                user_cancelled                 = 6
                err_spoolerror                 = 7
                err_temseerror                 = 8
                err_btcjob_open_failed         = 9
                err_btcjob_submit_failed       = 10
                err_btcjob_close_failed        = 11.
    because of this one PDF internal table is obtained.
           OPEN DATASET L_FILENAME  FOR OUTPUT in text mode  MESSAGE MSG.
      LOOP AT pdf.
        CONCATENATE pdf-tdformat       "Material group
                     pdf-TDLINE       "Basic Material
               INTO ITEXT-TLINE ..
        APPEND ITEXT.
        TRANSFER ITEXT TO L_FILENAME.
      ENDLOOP.

  • Corrupted content error when trying to download .pdf file from one website.

    Unable to download .pdf file from a website, but IE8 provided the download without hesitation.
    Both v7 and v8 produced the same message:
    "Corrupted content error"
    The page you are trying to view cannot be shown because an error in the data transmission was detected.
    This may be a particular website problem, or it may be common to the particular industry segment and their protocols.
    I have followed the help leads and examined the profile for Firefox as used in this instance. Nothing untoward seemed to pop out as a causal factor.

    Reworked some of the javascript for our webserver and fixed the problem.

  • Problems in Downloading a file from a web site using HttpClient

    Hi,
    My requirement is to download a file from a website using a java program. I have written a program using HttpClient API but I am unable to do so. Reality is that I don't know how to proceed with the HttpClient API to get the file downloaded. Same file can also be downloaded manually by login to that website, below mentioned steps are to be followed to download the file manually.
    1. Login to the website using Login/Password (I have valid login/password)
    2. Two options (links) are there (a) Report (b) Search [I am chosing report option]
    3. Newly opened window shows two tabs (a) Today (b) From & To [I am selection Today tab]
    4. Every tab has two radio button (a) File (b) Destination [Destination is selected by me]
    5. When Search button is pressed. A link gets created when that link is clicked file download popup is opened which allows facility to open/save the file.
    All these 5 step are to be followed in a java program to download the file. Please help in doing the same.

    // first URL which is used to open the website, this will have two text fields userName and password
    String finalURL = "http://www.xyz.in/mstatus/index.php";
    SMSGatewayComponentImpl obj = new SMSGatewayComponentImpl();
    obj.sendMessage(finalURL);
    public void sendMessage(String finalURL) {
    String ipAddrs = "a.b.c.d";
    int port = 8080;
    boolean flag = false;
    try {
    // Create an instance of HttpClient.
    HttpClient client = new HttpClient();
    HostConfiguration hostConfig = new HostConfiguration();
    hostConfig.setProxy(ipAddrs,port);
    client.setHostConfiguration(hostConfig);
    // Create a method instance.
    String cookieName=null;
    String cookieValue=null;
    // Here URL for the login page is passed and passing the user/password
    PostMethod method = new PostMethod(finalURL);
    method.setRequestHeader("userid","userName");
    method.setRequestHeader("passwd","pwd");
    // Execute the method.
    int statusCode = client.executeMethod(method);
    Cookie[] cookies = client.getState().getCookies();
    for (int i = 0; i < cookies.length; i++) {
    Cookie cookie = cookies;
    cookieName = cookie.getName();
    cookieValue = cookie.getValue();
    System.err.println(
    "Cookie: " + cookie.getName() +
    ", Value: " + cookie.getValue() +
    ", IsPersistent?: " + cookie.isPersistent() +
    ", Expiry Date: " + cookie.getExpiryDate() +
    ", Comment: " + cookie.getComment());
    NameValuePair[] respParameters = method.getResponseHeaders();
    String cookie = "";
    for(NameValuePair o : respParameters){
         System.out.println("Name : "+o.getName());
         System.out.println("Value : "+o.getValue());
         if("Set-Cookie".equalsIgnoreCase(o.getName()))
              cookie = o.getValue();
    NameValuePair[] footParameters = method.getResponseFooters();
    System.out.println("****************** Footer Values *******************");
    for(NameValuePair o1 : footParameters){
    System.out.println("Name : "+o1.getName());
    System.out.println("Value : "+o1.getValue());
    // This is jthe URL which comes when login/passowrd is entered and Login button is pressed.
    // I am trying to get the cookie from the first URL and pass this cookie for the second URL so that the session can be maintained
    // Here I may be wron..don't know is this the right way to download the file like this.....????
    finalURL = "http://www.xyz.in/mstatus/mainmenugrsms.php";
         method = new PostMethod(finalURL);
         method.setRequestHeader(cookieName,cookieValue);
         method.setRequestHeader("userid","userName");
         method.setRequestHeader("passwd","pwd");
         method.setRequestHeader("Set-Cookie",cookie);
         statusCode = client.executeMethod(method);
         respParameters = method.getResponseHeaders();
    for(NameValuePair o : respParameters){
    System.out.println("Name : "+o.getName());
         System.out.println("Value : "+o.getValue());
    // and this is the final URL which i got when that final link which enabled file download from the website have been copied as a shortcut and
    // pasted in a notepad. I was thinking that this will return the file as an input stream. but its not happening.
         finalURL = "http://www.xyz.in/mstatus/dlr_date.php#";
         method = new PostMethod(finalURL);
         method.setRequestHeader("Set-Cookie",cookie);
         method.setRequestHeader("userid","userName");
    // userid and passwd field are obtained when login/password page contents are seen using view source of that html
         method.setRequestHeader("type","1");
         // trying to set the cookie so that session can be maintained
    method.setRequestHeader(cookieName,cookieValue);
         method.setRequestHeader("passwd","pwd");
         statusCode = client.executeMethod(method);
         ObjectInputStream objRetInpuStream = new ObjectInputStream(method.getResponseBodyAsStream());
         System.out.println("objRetInpuStream : "+objRetInpuStream);
         if(objRetInpuStream!=null)
         System.out.println("objRetInpuStream available bytes : "+objRetInpuStream.available());
         String returnFile=(String)objRetInpuStream.readObject();
         System.out.println("Returned value \n : "+returnFile);
         respParameters = method.getResponseHeaders();
         for(NameValuePair o : respParameters){
         byte[] responseBody = method.getResponseBody();
         System.out.println("Response Body : "+new String(responseBody));
         if (statusCode != HttpStatus.SC_OK) {
              System.out.println("Error: " + method.getStatusLine());
         } else {
              System.out.println(method.getStatusLine());     
         } catch(Exception nfe) {
                   System.out.println("Exception " + nfe);
    Output
    =====
    /home/loguser/batch> sh run.sh SMSGatewayComponentImpl
    Classname : SMSGatewayComponentImpl
    run.sh[4]: test: 0403-004 Specify a parameter with this command.
    final URL : http://www.xyz.in/mstatus/index.php
    client is :org.apache.commons.httpclient.HttpClient@190e190e
    Cookie: PHPSESSID, Value: anqapu83ktgp8hlot06jtbmdf1, IsPersistent?: false, Expiry Date: null, Comment: null
    Name : Date
    Value : Thu, 06 May 2010 09:08:47 GMT
    Name : Server
    Value : Apache/2.2.3 (Red Hat)
    Name : X-Powered-By
    Value : PHP/5.1.6
    Name : Set-Cookie
    Value : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
    Name : Expires
    Value : Thu, 19 Nov 1981 08:52:00 GMT
    Name : Cache-Control
    Value : no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Name : Pragma
    Value : no-cache
    Name : Content-Length
    Value : 4792
    Name : Content-Type
    Value : text/html; charset=UTF-8
    Name : X-Cache
    Value : MISS from dcp.pas.abc.in
    Name : X-Cache-Lookup
    Value : MISS from dcp.pas.abc.in:8080
    Name : Via
    Value : 1.0 dcp.pas.abc.in:8080 (squid/2.6.STABLE21)
    Name : Proxy-Connection
    Value : keep-alive
    Cookie Value : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
    ****************** Footer Values *******************
    Name-2 : Date
    Value-2: Thu, 06 May 2010 09:08:47 GMT
    Name-2 : Server
    Value-2: Apache/2.2.3 (Red Hat)
    Name-2 : X-Powered-By
    Value-2: PHP/5.1.6
    Name-2 : Expires
    Value-2: Thu, 19 Nov 1981 08:52:00 GMT
    Name-2 : Last-Modified
    Value-2: Thu, 06 May 2010 09:08:47 GMT
    Name-2 : Cache-Control
    Value-2: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Name-2 : Pragma
    Value-2: no-cache
    Name-2 : Location
    Value-2: index.php
    Name-2 : Content-Length
    Value-2: 0
    Name-2 : Content-Type
    Value-2: text/html; charset=UTF-8
    Name-2 : X-Cache
    Value-2: MISS from dcp.pas.abc.in
    Name-2 : X-Cache-Lookup
    Value-2: MISS from dcp.pas.abc.in:8080
    Name-2 : Via
    Value-2: 1.0 dcp.pas.abc.in:8080 (squid/2.6.STABLE21)
    Name-2 : Proxy-Connection
    Value-2: keep-alive
    Cookie Value second time : PHPSESSID=anqapu83ktgp8hlot06jtbmdf1; path=/
    **Exception java.io.EOFException**
    Is my approach to download the file fromthe website ok????? please help me.

  • How can i download many file from server one times.

    Hi,
    I want to create the service to download multi-files from web server one time
    from browser. It seems no way to do it. My soulition is compressing the files
    to zip before download it. The problem is that when the user uncompresses the
    files,full path of downloaded files are setted. Look like this:
    /usr/tmp/test/file1
    /usr/tmp/test/file2
    /usr/tmp/test/file3
    My question is :
    1. Is there any way not to specify the full path of a file when
    add the file to zip.
    Here is the source
    BufferedInputStream bis
    = new BufferedInputStream(
    new FileInputStream( file ) );
    //if not full path . can is works?????
    ZipEntry target = new ZipEntry( file.getPath() );
    // zos is ZipOutputStream
    zos.putNextEntry( target );
    int c;
    while( ( c = bis.read() ) != EOF ) {
    zos.write( (byte)c );
    2. Is there any way to get and change the current work directory of my server ?
    Please help!!

    If i use file.getName(). I will lost the struct of path.
    I means that,if i compress the list of files:
    /usr/tmp/test1/file1
    /usr/tmp/test1/file2
    /usr/tmp/test2/file3
    can i keep the part of path's strcut. (usr/tmp/../.. etc.)
    I tried to do as this:
    target = new ZipEntry( file.getPath.substring(1));
    an error be reported when uncompressed the zip file.
    error message:
    warning [zt000002.zip]: extra 28 bytes at beginning or within Zip file (attempting to process anyway)
    Error in file #1: bad Zip file offset (Error local header signature not found): 0
    (attempting to re-compensate)
    Extracting 20030109.xls
    Error: unexpected end of file encountered
    Error: invalid compressed data to inflate
    Why? can i set "any" entry name??

  • How to download a file from server machine to client machine using jsp

    Hi,
    In my application, I have an excel file stored on my server machine. How can I download that excel file on to my client machine using jsp. Is there any other way I can open that file from my machine and save it in my machine using jsp/java?
    Its an emergency for me to do this.
    Can anyone provide me the full code to download a file from server machine as I don't have
    time to browse through various sites.
    thanks in advance,
    Tiijnar

    Please post your code using code tags (click on CODE above the text area, when posting)
    response.setContentType("application/octet-stream");Why octet-stream? Set the correct mime-type.
    String disHeader = "Attachment; Filename=\"filename\"";The filename should just be the file's name. Not the complete path to the file! This will tell anyone where the file is located on the server. It's also inconvenient because by default,the browser will suggest it as the name for the download.
    Your way of writing to the output stream is just plain wrong. See this snippet (picked from [http://balusc.blogspot.com/2007/07/fileservlet.html])
            BufferedInputStream input = null;
            BufferedOutputStream output = null;
            try {
                // Open streams.
                input = new BufferedInputStream(new FileInputStream(file), DEFAULT_BUFFER_SIZE);
                output = new BufferedOutputStream(response.getOutputStream(), DEFAULT_BUFFER_SIZE);
                // Write file contents to response.
                byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                int length;
                while ((length = input.read(buffer)) > 0) {
                    output.write(buffer, 0, length);
                // Finalize task.
                output.flush();
            } finally {
                // Gently close streams.
                close(output);
                close(input);
            }

  • How to download a file from database

    Hi,
    My flex application contains a form that uploads a file into the server. This file is however saved in the database, and not on the disk. Most of the tutorials in the database explains how to download a file by passing the file's url to the "download" function of the fileReference Object. That dsnt work for me as my file is saved in the database.
    How do I download this file from the server ?
    For example, in php, we would do smthing like this :
    $content = $file_to_download['content'];
    $size = $file_to_download['content_size'];
    $type = $file_to_download['content_type'];
    $name = $file_to_download['filename'];
    header("Content-type:$type");
    header("Content-length:$size");
    header("Content-Disposition:attachment;filename=$name");
    header("Content-Description:PHP Generated Data");
    echo $content;
    When executing this file, it opens up the "download file" dialog box. How do i get the same effect in flex 4 ?

    You need the bytes use FileReference.download() and after download you can save
    it on disk with FileReference.save(); You also need FP 10 at least I think. Use
    the docs they are less error pron than mi memory :).
    C

  • Getting Exception in JWS while downloading jar files from server

    Hi All,
    I am running JWS on j2re1.4.2_10(build 03). while JWS is trying to download jar files from web server, I am getting the following Exception.
    All the jar files are signed. Any idea ?
    JNLPException[category: Download Error : Exception: null : LaunchDesc: null ]
         at com.sun.javaws.cache.DownloadProtocol.doDownload(Unknown Source)
         at com.sun.javaws.cache.DownloadProtocol.getDownloadSize(Unknown Source)
         at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
         at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
         at com.sun.javaws.Launcher.downloadResources(Unknown Source)
         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
         at com.sun.javaws.Launcher.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)

    Are you able to download your *.jar files directly from server
    For example say,
    http://127.0.0.1:8080/test/testme.jarIf yes,
    Then problem should be with your *.jnlp file. Check all your *.jar with respect to context location of your url from where you are downloading *.jnlp file

  • When i download a file from the web i get "Anti-Virus Program not found " message. This has been happening since I change anti-virus programs for CA etrust to Sophos. How do I get Firefox to recognise my new Anti-virus program?

    every time i download a file from the web (ie. a PDF file) i get "Anti-Virus Program not found " message. This has been happening since I changed anti-virus programs for CA etrust to Sophos. How do I get Firefox to recognise my new Anti-virus program?

    That is a very good warning provided by the Download Statusbar extension. Something like that should been built into Firefox. I filed this Bug report a couple of years ago, about the lack of a warning like that. <br />
    https://bugzilla.mozilla.org/show_bug.cgi?id=480855 <br />
    I have looked everywhere that I can think of to find a list of '''IOfficeAntiVirus providers''' ''(as mentioned in the Bug report)'' that will work with Firefox, so I can't answer that for you.
    You might want to ask the developer of the Download Statusbar extension about it. He might know which AV programs are compatible with the Windows API that Firefox uses for the download scan. <br />
    http://dlstatusbar.proboards.com/index.cgi? <br />

  • I cannot download any files from the internet

    Hi-
    I am operating on Windows 7 Home Premium
    IE 9.1
    Model PSKA8U-02900R
    Norton AntiVirus
    I get an error message every time I try to download a file from the internet. All types,This has been happening for about 6 months, but I've used my work computer instead..getting kinda old.
    The  message simply states "This file could not be downloaded"
    I've seen similiar posts, but no resolution posted. Anyone out there able to help me solve this issue?
    Thanks Jane

    Satellite L855-S5240
    reset IE settings to defaults and turn on smart screen filter.
    Control panel, internet options, advanced, restore advanced settings, apply.
    If that does not take care of it reset all settings to defaults:
    Control panel, internet options, advanced, reset.
    Then select tools from your toolbar, smart screen filter, turn on smart screen filter.
    Satellite L855-S5240 support page is here - http://support.toshiba.com/support/modelHome?freeT​ext=PSKA8U-02900R
    S70-ABT2N22 Windows 7 Pro & 8.1Pro, C55-A5180 Windows 8.1****Click on White “Kudos” STAR to say thanks!****

  • Can I download RAW Files from Canon5D (Mk1) in LR4 ?

    I have heard reports that LR4 cannot be used to download files from Canon 5D (Mk1).....is this true ?
    Also why do I have to upgrade from LR3.6 to LR4 just so I can download RAW files from Canon G1X camera?......  for one who obtains no income from photography the continual costly upgrades are ridiculous !!!

    Some people seem to like making Adobe the villain in this dilemma/issue. You don't have to have any version of Lightroom to download or work on your raw files. Software was included with your camera that will do that. The problem is that the camera maker wants to sell cameras, not software. So they don't devote the time to making the software everything that it could be. And since most camera makers insist on using proprietary file formats, it imposes a hardship on Adobe and other third-party developers to keep up with the demand.
    Providing support for new cameras isn't the only development that goes on with the Lightroom team. They are constantly looking for ways to improve the process. When a major version of Lightroom is released there has to be an expense to upgrading. Otherwise, there would be no development, no improvement, just stagnation.
    But, as has been mentioned, if your camera is not supported in Lightroom 3.6, Adobe provides free of charge the DNG converter. It will convert your images to DNG (Digital negative) files that can be opened in the software that you already have. When a new major version of Lightroom is released, development on the previous version ceases. Support for cameras that are introduced has to be done on a model basis, not just the file format. So if you purchase a new camera and want support from software that you are accustomed to using, you should expect to upgrade to get that support. The move from Lightroom 3.6 to 4.1 will provide you with a lot more than just added support for new cameras. The new process is much more refined and can produce superior results. If that isn't of value to you then simply use the DNG converter.

  • IE 9 can't download/open files from https site.

    We have application which runs in IE9 using https:\\
    IE 9 can't download/open files from https site.
    Please help....
    error1-
    Microsoft Excel - could not open 'https:\\.......\viewxlsformatshow.xls'
    error2-
    Microsoft Excel - Microsoft Excel cannot access the file 'https:\\.......\viewxlsformatshow.xls'. There are several possible reason:
        -The file name or path does not exist.
        - the file is being used by another program.
         - the workbook you are trying to save has the same  name as a currently open workbook.

    Hi,
    Have you tried to use "HTTP"?
    Have you the correct office program installed on your computer?
    Could you provide the corresponding credential to access them?
    If so, please make sure you have the proper right.
    Please let other user try to download(not open) the resource to confirm the original resource is without problem.
    After that, refer to the following article to change the settings:
    Error message when you download files by using Internet Explorer 9 from secure websites: "<filename> couldn’t be downloaded"
    http://support.microsoft.com/en-us/kb/2549423
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Applet question, how to download resource files from server

    hi,
    i am new at applet world.
    i have an applet that reads some resource, data and configuration files. so i need to download these files from server to client. i did some resarch and could not find how to download files from server in an applet application.
    how can i do this task?
    thank you for your answers.

    You may want to distinguish between 'resources' and data/configuration files.
    'Resources' are non-class files that are part of your application, i.e without them the application would simply not work, just like class files.
    Those are typically images, sounds or resource bundles (GUI elements translated to different languages) that nobody except you, the developer, would touch (when releasing an upgrade or a patch).
    Those should just go into the applet jar or additional jars named in the applet tag.
    Data/configuration files, that may be changed by others than the developers, should be made available through HTTP, just like the applet jar itself. The applet will have (read) access to them using java.net.URLConnection.

Maybe you are looking for