Saving a CSV report output as TXT file

Hi,
We are generating reports on the web using Intenet Explorer. The report is a CSV report, i.e. the data displayed is comma separated. After generating the report, we need to save it as TXT file.
If the length of a line is long (let us say more than 80 chars) while saving it as TXT file, it is saving as 2 lines. If the length of a line is less, then it is saving in a single line.
How can I avoid this 2 line problem?
I am not facing this problem if I generate report with Netscape browser and save as TXT file.
We are using Reports 6i.
Thanks in Advance,
Srinivas

Hello,
I had the same problem. And I think what I did to fix it is I made the mode=charcter, batch=yes, and background=yes. Hope this helps.
Martin

Similar Messages

  • Conver a report in to txt file

    Hi all,
    I need to convert the report output into txt file .How can i do that?. can any one post some sample codes.
    Regards,
    Lisa.

    Here is a sample program which submits the report program, brings the output back from memory and downloads it to a text file.
    report zrich_0003 .
    data: begin of listout occurs 0,
          line(1024) type c,
          end of listout.
    * Submit the report and export list to memory
    submit your_report_program exporting list to memory
                and return.
    * Get list from memory and convert to ascii
    perform retrieve_list_from_memory tables listout.
    call function 'GUI_DOWNLOAD'
         exporting
              filename = 'C:Test.txt'
         tables
              data_tab = listout.
    * RETRIEVE_LIST_FROM_MEMORY
    form retrieve_list_from_memory tables reportlines.
      data: list like abaplist occurs 0 with header line.
      data: txtlines(1024) type c occurs 0 with header line.
      clear list.  refresh list.
      clear reportlines. refresh reportlines.
      call function 'LIST_FROM_MEMORY'
           tables
                listobject = list
           exceptions
                not_found  = 1
                others     = 2.
      check sy-subrc = 0.
      call function 'LIST_TO_ASCI'
           tables
                listobject         = list
                listasci           = txtlines
           exceptions
                empty_list         = 1
                list_index_invalid = 2
                others             = 3.
      check sy-subrc = 0.
      reportlines[] = txtlines[].
      call function 'LIST_FREE_MEMORY'.
    endform.
    Regards,
    Rich Heilman

  • REPORT output to possible files formats

    Hi Folks
    How can we tranasfer a REPORT output to any file like( .XLS, .XML, or to anyother possible file). Can u give all the possible file procedures.
    Thanks in advance.
    I wont forget to reward points.
    Regards,
    Ram

    Hi Ram,
    Use can very well use the function module 'GUI_DOWNLOAD'.
    The below code clarifies your doubt as how to mention the path in the selection screen.
    tables: mara.
    data: itab type standard table of mara.
    select-options: s_matnr for mara-matnr.
    parameters: filename like rlgrap-filename default 'C:\materail_details.xls'.        " download filename
    start-of-selection.
    select *
    from mara
    into table itab
    where matnr in s_matnr.
    perform file_download.
    *&      Form  file_download
          text
    -->  p1        text
    <--  p2        text
    form file_download .
    data: filename1 type string.
    filename1 = filename.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                        = filename1
       FILETYPE                        = 'DAT'
      tables
        data_tab                        = itab
    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.
    endform.                    " file_download
    Here C:\material_details.xls is the path to save your file. In the same way you can save a text file also.
    Hope this clarifies your doubt.
    Regards
    Sayee

  • Background processing of S_ALR_87013558 report with output in txt file

    Dear Friend's,
    Here I have a requirement of, to execute standard report S_ALR_87013558 (Budget/Actual/Commitment/Rem Plan/Assigned) in background processing mode. Here we have to run this report in background on daily basis at a particular given time.
    Once this report gets executed in background, output of this report should get converted automatically into txt file and this converted txt file must be downloaded in a respective folder automatically by giving desired path.
    After completion of this process, downloaded txt file they have to use for internal MIS reporting purpose.
    Is this possible via standard PS or else I have to go for the development.Please suggest, what should be the approach?
    Regards,
    Sandeep

    Hi Sandeep,
    Check if you can create batch job to run for S_ALR_87013558 using SM36
    The Program name is GP8YTY7TBR1TYRPCIPKAC6X9GZG
    Please check with ABAP.
    Regards,
    Nitin

  • Saving report output to a file on the server.

    Hi,
    We are using BI Publisher Standalone version 10.1.3.3.1.
    Is it possible to schedule a report to output to a file on the server?
    I want the whole report to be saved as a file on the server.
    This is somewhat similar to bursting to a file system, but, I don't want to split the output.
    Any help is appreciated.
    Thanks,
    Nanda

    Yes, use the scheduler and schedule the report,
    do the bursting into FTP or
    schedule the report to run and run it into FTP as a single FILE.
    First option, you need to provide the query , with FTP server name, username, password etcccc.

  • Saving JSP report output as a file on the application server

    I am trying to determine if it is possible to save a web based JSP report to the file system in the same way you can with a report generated via the rwservlet command. I am specifying DESTYPE=HTML and DESNAME=/home/mydirectory/abc.htm on the command line, but it seems to be ignored. The directory has 777 permissions on it.
    1. Is it possible to save the JSP output onto the file system just like paper based reports?
    2. Where, if any, is documentation addressing this issue? The reports deployment guide appendix lists all the URL parameters that are available to the various rw commands, but nowhere is discussed what params are relavent to JSP reports.
    3. If it is not possible to do this via the URL, does anyone know if I can somehow fetch out the inner HTML from the generated page at the bottom pf the JSP and then write it to the file system using JAVA? I know how to do it via JavaScript, but the reports are run on UNIX. Is there someway I can access the DOM inside the JSP?
    4. Why hasn't Oracle explained this better?
    Thanks,
    matt

    Thanks for getting back to me. But the documentation link below takes me to running rwservlet requests. This was not what I needed. The good news is my most excellent DBA, Manoj Gandhi, found an old TAR in Metalink that emphatically states that what I am trying to do is not possible. See Note:272401.1
    Well, sort of not possible...
    As it turns out it is possible, but you must schedule the report for immediate execution using the rwservlet's scheduling facility. Again, this came to me via my DBA. The TAR for this piece is Note:295420.1. Ignore the rwservlet urlparameter= part as best I can tell it's gibberish. Below is what I did. Substitute your info for the stuff in UPPER CASE and put it all on one contiguous line of course:
    http://SERVER:PORT/PATH/rwservlet
    ?server=REPORT_SERVER_NAME
    &destype=file
    &desname=A_PATH_AND_FILE_FILE_NAME_WITH_EXTENSION
    &jobtype=rwurl
    &schedule=
    &urlparameter=http://SERVER:PORT/PATH/JSP_NAME?userid=USERID&OTHER_PARAMETERS...
    I am not sure why cmdkey= fails when passed in the urlparameter= but I am working on a solution!

  • Report output as a file

    I am using report 6i to build a report. I am not creating this report on the database server but a client machine.
    I want the report output to be saved as a pdf file in the database directory. How can i do that? The database server is a unix server.
    I am using Client based reports.
    Edited by: LostWorld on Jan 19, 2011 4:27 AM
    Edited by: LostWorld on Jan 19, 2011 4:36 AM
    Edited by: LostWorld on Jan 19, 2011 4:37 AM

    How can I get the report output in the database directory? When i am trying to save the report output file in a database directory(oracle Database directory), it tis giving me the following error.
    REP-0081: Error during file I/O operation.
    REP-0110: Unable to open file '/tmp/Letter.pdf'.I am specifying the DESFORMAT=pdf, DESNAME='/tmp/Letter.pdf' and DESTYPE=File. Have also tried specifying the DESNAME as \\IPof the databse server \tmp.
    where '/tmp' is the path of the database directory.

  • Report output in TXT format BOXI3.1

    Our requirement is to save the report in txt format. Currently we are using BOXI 3.1and using the option of CSV to convert it into TXT format. This lead to addtional overhead of removing headers and modfiying the delimiters.
    Is there any option avaialble for saving the report directly in TXT format. Please suggest.

    Hi,
    Can you please tell me how to fetch the query in Txt format using crytal report designer?
    Is there any guideline (pdf) availabe? please let me know..
    Thanks in advance........
    Regards,
    Nick

  • How to download report output to excel file??

    Hi all,
    I have a problem with downloading a report output to an excel file? May i know is there any functions or methods to do it?
    My situation is like this. I used Write function to print out the report. After user click on the execute button. The report output will show to the user in a table format. And there is one button 'Save To Excel' in the report output dipslay screen for user to click to save it into excel format.
    Appreciate if you could help.
    Thanks.
    Regards,
    Rachel

    Hi Rachel,
           You can use FM GUI_DOWNLOAD for transferring the data from your report program into excel sheet.
    And while saving give the filename extension as .xls.
    Reward if helpful.
    With regards,
    Syed

  • How to export report output into excel file

    hi friends,
    i would like to get the solution from you for how to export the report output into a .xls file. i know how to convert it into .rtf and .txt files but i think it's difficult to do this .xls way, could you help me to comeover this problem?
    thankyou very much.

    The official answer is "delimited", which
    generates adequate comma or other delimited
    text. No formatting, and without extra
    effort no support for non-ASCII characters.
    Might be sufficient for you.
    Note that Excel can read html files - we
    built programs to generate html files with
    name of "blah.xls" and some Excel-ish
    extensions, so Excel is automatically opened
    and the document is all nice and pretty.
    (Oracle html output has some odd logic about
    choosing number of columns, we didn't use
    it.)
    -- Allan Plum

  • Report Output in Notepad File

    hi i'm using oracle ERP EBS R12
    Oracle database 10g
    i have a report . and i define the output in XML format
    when i click on view output and save in the xls file [excel] then it works
    i want the output in notepad file?
    is there any possiblity to view output in notepad file without any space between the columns?
    or
    is there any possibility to make a tab delimited text format report?

    Hi,
    Please see these docs.
    How To Export Form Or Report Data From Oracle Applications And Into Excel [ID 372353.1]
    How to Setup The Report Output to Different Viewer Types in Oracle Applications 11i [ID 184375.1]
    How to Control the Name and the Application that Opens the Concurrent Request Output File on the Client? [ID 316752.1]
    Thanks,
    Hussein

  • Report output to a file

    Hi All,
    My requirement is on execution of a report ,this report output should be downloaded as a file prompting the user to select the location.
    Can any one help me in downloading the output format to a file. I need some inputs on the  approach for doing this .
    Thanks in advance .
    Padma

    Hi
    See the sample code in which the download to file is used
    and do accordingly
    instaed of the OLE..fun module you can use the GUI_DOWNLOAD also
    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-table = p_table.
     

  • Help needed saving text members to TAB delimited txt file

    I have 7 text memebrs each containing several lines of text
    that were pulled in and sorted from a TAB delimited text file.
    What I'd like to know is, is there any way to convert those
    text members back into the TAB delimited format from which they
    came? I'd like to be able to pull in the data, let it be edited to
    some extent, then saved back out..... and I'm not too sure how to
    go about it.
    Example of txt file:
    ID_No Name Age
    1 Phil 26
    2 Sam 34
    3 Mary 21
    They're then sorted in to text files of ID_No, Name, and Age,
    with the lists of the relevent items in each.
    Like.....
    ID_No
    1
    2
    3
    Name
    Phil
    Sam
    Mary
    Age
    26
    34
    21
    Certain lines of these text members change, depending on what
    the user selects. I'd like to put these sections back in their
    original TAB delimited format, but with any changed data replacing
    the old, so next ime the app is opened the new data is pulled in
    from the txt file.
    I know I'm probably going about this the wrong way, but it's
    the only way I know so far lol
    Any ideas?

    global filex, idlst, namelst, agelst
    on readtabline (str)
    tmpstr = ""
    y = 1
    repeat with x = 1 to the number of chars in str do
    if str.char[x] = tab then
    case y of
    1 : idlst.add (tmpstr)
    2 : namelst.add (tmpstr)
    3 : agelst.add (tmpstr)
    end case
    tmpstr = ""
    y = y + 1
    else
    tmpstr = tmpstr & str.char[x]
    end if
    end repeat
    agelst.add (tmpstr)
    end
    on exitFrame me
    idlst = [] --set up some lists to hold that data we read in
    namelst = []
    agelst = []
    filex = new (xtra "fileio")
    filex.openfile ("t.txt", 1)
    indata = filex.readfile() -- read the data in
    filex.closefile()
    filex = void
    repeat with x = 1 to the number of lines in indata do
    readtabline(indata.line[x]) --seprate it into its diffrent
    elements
    end repeat
    -- you now have your data sorted in to three list of id, age
    and name
    -- so you would now do what ever editing you wanted to do
    --now to write it out to a new file
    filex = new (xtra "fileio")
    filex.createfile (the moviepath & "tout.txt")
    filex.openfile (the moviepath & "tout.txt", 2)
    repeat with x = 1 to idlst.count() do
    filex.writestring (idlst[x] & tab & namelst[x] &
    tab & agelst[x] & return)
    end repeat
    filex.closefile()
    end
    I tested this on your exact scenario and it worked a brezze
    hope it helps
    Regards
    David

  • Saving and Loading variables in a .txt file (Offline)

    I'm working a software we've done with Flash, but we'd want
    people to be able to save the variables they selected. We need them
    to be able to save the value of about 10 variables in a file on
    their desktop, and then be able to load that file again.
    Is it possible to do that without having to use php or stuff
    like that (that's why we want to make it an offline applications so
    we don't have to use php to be able to save files).
    I know Actionscript looks a lot like Javascript and with
    Javascript it's really easy to do, but all the saving functions are
    blocked in Flash for security reasons.
    If anyone knows how to do that, to simply save and load a
    .txt file, please let me know. If it would be possible also to
    change the .txt to whatever else it would be even better. The file
    can still be opened in Notepad but at least it looks a bit more
    professionnal to have our own extension. Again in Javascript or
    with a .bat file it's really easy to save variables to whatever
    type of file, even to non existing types, it simply creates a text
    file with an unknown ending.
    Thanks!

    I found a page that explains in a really easy way how to
    communicate with Javascript if the flash object is contained in an
    html page, but I couldn't find any page explaining how it works if
    it's not in an html page. On our side, before using the software
    we're creating we'll convert it to a .exe. How can we call a
    Javascript from that .exe since we can't incorporate the Javascript
    in the container since there isn't really a container... Is there a
    way to link to a Javascript (.js) that would be in the same folder
    as the .exe? Or would there be a way to incorporate the Javascript
    right into the .exe?
    Let me know if any of you have a solution for that.
    Thanks!
    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00000342.html#wp126566

  • Report output on excell file

    Hi,
    I am running a report as
    desformat=spreadsheet destype=file desname=c:\ssss.xls
    now after getting the message "SUCCESSFULLY RUN" this file is generating in server's c: drive, is there anyway to save it on the local PC from where the report is being run? or to open the .xls file just after running the report?
    Thanks
    I have got the solution.
    Thanks
    Edited by: Suman... on Mar 6, 2012 3:01 AM

    Run report with destype=cache and mimetype=application/vnd.ms-excel. Now your report output will open in MS Excel. Then you can save the output.

Maybe you are looking for

  • Pause for user click missing after Seamless Tabbing fix.

    I am upgrading a project from Captivate 5.0 to 5.5. Two of the lessons that worked fine in 5.0 have problems in 5.5. Both lessons use the Tab key to move from field to field in a data row and then the Enter key to calculate at the end of the row. Thi

  • I cant figure out why wont my Ipod touch wont show up in itunes?

    all the sudden 2 of our ipod touchs wont show up in itunes the ipod nano we have does tho it does show up im my computer as line 1 " apple ipod" line 2 "portable device" one ipod is a 2nd gen and one is a 3rd gen please read BEFORE YOU SUGGEST IPOD T

  • Please help urgently!!!! russian letters in request

    Hi peoples please help i put in request few parameters, but the values of these parameters are strings on russian language, so when i'm getting this parameters i can't properly get back values. how can i do this???

  • Password-lock layers in InDesign

    Here's the deal: You have a client asking to give them your native InDesign files so they can update and fix texts. Is there a way, like a plugin or something, that you could use to lock layers that contains elements you don't want them to edit? It h

  • How to do closed captions

    How do I do closed captions on my Final cut pro X ? OR, failing that, how do I write in MY text into these "title clouds" that I have placed, where the lyrics to my song, start ?  This Final cut proX that my brother in-law got for me SO-FAR is killin