TEXT_IO.PUT_LINE Restrictions?

Hi,
The spec for TEXT_IO.PUT_LINE is:
PROCEDURE Text_IO.Put_Line
(file file_type,
item VARCHAR2);
Does anyone know what the maximum size of the varchar2 is? It appears to be 1000 characters.
Thanks,
Simon.

Don't think it's 1000.
As Database Table Column the limitation is 4000 Byte, In PL/SQL VARCHAR2 can be 32767 byte if memory serves:
declare
     xFile text_io.file_type;
     vText varchar2(32000);
begin
     for i in 1..32000 loop
          vText := vText || '1';
     end loop;
     xFile := text_io.fopen('c:\temp.txt', 'w');
     text_io.put_line(xFile, vText);
     text_io.fclose(xFile);
end;I have 32000 '1' in my file...

Similar Messages

  • TEXT_IO.PUT_LINE resulting in partial file at a consistant size of 40KB

    Overview:
    In client server mode the report opens a file on the desktop, writes a tab delimited text line for a specific repeating frame and then closes the file. However, the resulting file is incomplete but the previewer displays the compete report with no error. The first 40K contains text lines that are OK and then the output just stops at one line at the 40K threshold even if I change the data model query to select different data. This appears to be a max size buffer size but I'm not sure. I know that the UTL_FILE on the database contains a FFLUSH function but no such function exists for TEXT_IO. Hum...
    Any ideas?
    Report Text_io steps:
    1. After Form trigger:
    s_file.out_file := TEXT_IO.FOPEN('c:\temp\output_file.tab', 'W');
    2. Repeating frame format trigger:
    buf:='';
    buf:=to_char(nvl(:QTY,0))||CHR(9);
    buf:=buf || to_char(nvl(:M_PRICE1,0))||CHR(9);
    TEXT_IO.PUT_LINE(s_file.out_file,buf);
    3. After Report trigger:
    TEXT_IO.FCLOSE(s_file.out_file);

    I seem to recall having a similar problem. I thought it was that the after report trigger was not firing properly (i.e. at all).
    I solved it by putting a field at the end of the report (outside the topmost repeating frame) and attaching the code to that

  • Text_IO.put_Line

    Hi,
    Forms 6i.
    I used:
    Text_IO.put_Line(out_file,'blablabla...');
    Text_IO.put_Line(out_file,'blablabla...');
    Always that i used "Text_IO.put_Line" it creates caracter new line.
    How I make it not to create this to caracter in the end?
    Regards
    Jomar

    Hello,
    Simply use PUT() instead of PUT_LINE()
    Francois

  • TEXT_IO ...  replace first line

    Hello,
    i have a small Problem with the TEXT_IO.PUT_LINE builtin
    I want to write and read a .txt file with TEXT_IO
    It workes fine but if i use put_line to write something in, it replace all inside my .txt file
    My Question: Is it possible to replace only the first line inside my txt file
    Example Forms:
    Declare
         filename           varchar2(30) := 't:\test\Laufzettel.txt';
         file_handle TEXT_IO.FILE_TYPE;
         umrechnung number;
    BEGIN
    If :parameter.intervall is not null then
         file_handle := TEXT_IO.FOPEN(filename, 'W');
         umrechnung := :button.intervall;
         umrechnung := round(((umrechnung*60)*1000));
         TEXT_IO.PUT_LINE(file_handle,umrechnung);     
         TEXT_IO.FCLOSE(file_handle);
    end if;
    END;
    and the .txt file looks like this:
    6000
    CT
    CT2
    Mammo
    MR
    US
    Bestrahlung
    MRT
    NUK
    SD
    i want to replace the 6000 with another number without rewriting all the other entrys?!
    Sorry for my bad English :)
    Message was edited by:
    user628271

    If you are unix use grep command to replace the string. And this grep command can be called using host.
    If you are in Windows , create a new file from the original and while creating you
    can replace which ever line you needed.
    Once you create the new file , delete the original file using host command.
    Once you delete the old file, copy the new file to the original file name using host command.
    Rajesh Alex

  • Eliminate word wrap in TEXT_IO

    Dear All
    We are inserting data into DB using form6i text field which is enabled multi-line property.
    If I generate excel or text file using TEXT_IO using that data will be (word) wrapped. (Multi-line enabled fields only)
    Please let me know how can eliminate word wrapped (eliminate enter value)
    Thanking You
    Regards
    Lakmal Marasinghe

    Hello,
    Replace the carriage return from the text
    TEXT_IO.PUT_LINE( file, Replace( text_item, CHR(10), '' ) ) ;Francois

  • TEXT_IO in forms

    Hi
    I am using TEXT_IO in Forms 6i client/server.
    1. I get the location of a particular directory by using: tool_env.getvar('TEMP', v_tmp_file_loc);
    This returns C:\DOCUME~1\TEST~1.TST\LOCALS~1\Temp into variable v_tmp_file_loc
    3. Then concatenate this to a .dat file and assign this to a field in the form: *:p_item:= v_tmp_file_loc||'\testfile.dat'*
    4. Then open the file: out_file := text_io.fopen(:p_item, 'w');
    5. Insert line into the file: text_io.put_line(out_file, 'This is a test');
    6. and then close the file: text_io.fclose(out_file);
    When this is run, no file is created in the TEMP directory.
    However, when I change the directory to 'C:\' (hardcoded) and not 'C:\DOCUME~1\TEST~1.TST\LOCALS~1\Temp' , the file is written out to the 'C:\' directory.
    How do I get the file written out to C:\DOCUME~1\TEST~1.TST\LOCALS~1\Temp.
    Thanks

    Hi!
    May try:
    tool_env.getvar( 'TEMP', :p_item );Then copy the value from :p_item, open the windows explorer,
    paste the value into the address field and try to change to that folder.
    Are you able to change to the folder?
    Regards

  • Questio about TEXT_IO package

    dear friends
    I've created a procedure that copy the data from database like this:
    PROCEDURE P_LOAD2TEXT(P_STOCK GN_STOCKS.STOCK_CODE%TYPE)
    IS
    CURSOR DAILY_TRADE_CUR IS
    SELECT TO_CHAR(THE_TIME,'HH24:MI:SS') TRADE_TIME,PRICE,QTY
    FROM LV_DAILY_TRADES
    WHERE STOCK_CODE = P_STOCK;
         vFILE           TEXT_IO.FILE_TYPE;
         vFILENAME      VARCHAR2(255);
    BEGIN
              Vfilename := 'X:\SE\chart\intraday_ascii\'||:trade.stock_code||'.txt';
              vFILE := TEXT_IO.FOPEN(vFILENAME ,'W');
              FOR I IN DAILY_TRADE_CUR LOOP
              TEXT_IO.PUT_LINE(vFILE,I.TRADE_TIME||','||I.PRICE||','||I.QTY);          
              END LOOP;
              TEXT_IO.FCLOSE(vFILE);
    END;
    the procedure works fine .
    But i need to validated first if the file exists, delete this file first.
    my question is
    Is it possible to delete file from hard disk from within form builder?
    I can tried to make a batch file that clears all files with in the folder but the problem is the the command prompt window is displyed and asking me the following question
    x:\del*.*
    x:\*.*, are you sure(Y,N)
    and i must press Y to delete the files
    my knowedge in making batch file is limited and i do not know how to pass 'Y' to the command prompt.
    please help

    There are two choices:
    - Add the /q switch to the del command, i.e. del *.* /q
    Or use the delete_file procedure from the win_api_utility package available from the d2kwutil library (if using Forms 6i).
    Be carefull howver when using the del *.* to make sure you are in the proper folder.

  • Text_io problem

    Hi everyone,
    I have a problem which I would like to share here.
    I want to make a text file from a table in Form 5.0.
    spool is not acceptable. I have made a procedure for
    that but it is working up ok point. If I left the rest
    columns then it is ok. otherwise it gives a window
    message "F50dbg32 Illigal operation" and terminates.
    PROCEDURE make_text IS
    in_file Text_IO.File_Type;
    out_file Text_IO.File_Type;
    linebuf VARCHAR2(132);
    cursor c1 is
    select * from emp;
    begin
    out_file := Text_IO.Fopen('echo.txt', 'w');
    for c1rec in c1
    LOOP
    Text_IO.New_Line(out_file,1);
    Text_IO.Putf(out_file,to_char(c1rec.empno));
    Text_IO.Putf(out_file,' '); -- for gap between columns
    Text_IO.Putf(out_file,c1rec.ename);
    Text_IO.Putf(out_file,' ');
    Text_IO.Putf(out_file,c1rec.job);
    Text_IO.Putf(out_file,' ');
    ----ok -- upto here
    Text_IO.Putf(out_file,to_char(c1rec.mgr));
    Text_IO.Putf(out_file,to_char(c1rec.hiredate));
    Text_IO.Putf(out_file,to_char(c1rec.sal));
    Text_IO.Putf(out_file,to_char(c1rec.comm));
    Text_IO.Putf(out_file,to_char(c1rec.deptno));
    END LOOP;
    EXCEPTION
    WHEN no_data_found THEN
    Text_IO.Fclose(out_file);
    END;
    Other requirement is the text in the file gets zig zag.
    I want to start every column from a fixed column in the
    text file.
    My text looks like this :-
    7499 ALLEN SALESMAN
    7521 WARD SALESMAN
    7566 JONES MANAGER
    requirement is :-
    7499 ALLEN SALESMAN
    7521 WARD SALESMAN
    7566 JONES MANAGER
    7654 MARTIN SALESMAN
    7698 BLAKE MANAGER
    If someone have solution pl suggest asap.
    thanks
    [email protected]

    I think you can try to use your own buffer to construct a text line. For example:
    buf varchar2(4000);
    LOOP
    buf:=
    to_char(c1rec.empno) || ' ' ||
    c1rec.ename || ' ' ||
    to_char(c1rec.deptno);
    text_io.put_line( buf );
    END LOOP
    I think It may solve the problem.
    I want to start every column from
    a fixed column in the text file.You could use the LPAD or RPAD functions. For example:
    buf:=
    lpad( to_char(c1rec.empno), 10, ' ' ) || ' ' ||
    lpad( c1rec.ename, 50, ' ' ) || ' ' ||

  • A text_io problem: ORA-302000

    Hi,all:
    I have 2 apps on form.
    The first one is to read from file, and the second is to write on the file.
    Firstly, i have created the file on the server, and the file(abc.txt)'s permission is rwxr--r--.
    Then i tested the first one, it can read from file well.
    But when i tested the second, it throwed a exception: ORA-302000.
    I was so confused. why it can read from file with text_io, but can not write?
    Can anyone help me to solve this problem, Thanks so much.
    Here's my code:
    1.WHEN-BUTTON-PRESSED(to read): works fine
    DECLARE
         in_file text_io.file_type;
         line_bufer varchar2(80);
         lv_strtmp varchar2(100);
         errnum NUMBER                := ERROR_CODE;
         errtxt VARCHAR2(80) := ERROR_TEXT;
         errtyp VARCHAR2(3)      := ERROR_TYPE;
    BEGIN
         in_file := text_io.fopen('/home/cn01278/abc.txt', 'r');
         text_io.Get_Line(in_file,line_bufer);
         lv_strtmp := substr(line_bufer, 1,10);
         :blk_text.txt_content := :blk_text.txt_read_err || lv_strtmp;
         text_io.Fclose(in_file);
    END;
    2.WHEN-BUTTON-PRESSED(to write): thown an exception
    DECLARE
              out_file text_io.file_type;
              line_bufer varchar2(80);
              lv_strtmp varchar2(100);
              lv_content varchar2(100);
              errnum NUMBER := ERROR_CODE;
              errtxt VARCHAR2(80) := ERROR_TEXT;
              errtyp VARCHAR2(3) := ERROR_TYPE;
    BEGIN
         message('111',acknowledge);
              out_file := text_io.fopen('/home/cn01278/abc.txt', 'w');
              message('222',acknowledge);
              text_io.put('123');
              text_io.new_line;
              text_io.put_line(out_file, 'abcd...');
         text_io.fclose(out_file);
    END;
    3.ON-ERROR Trigger
    DECLARE
         errnum NUMBER := ERROR_CODE;
         errtxt VARCHAR2(80) := ERROR_TEXT;
         errtyp VARCHAR2(3) := ERROR_TYPE;
    BEGIN
    message('error:',acknowledge);
         Message(errtyp||'-'||TO_CHAR(errnum)||': '||errtxt,acknowledge);
         --:blk_text.txt_err := errtyp||'-'||TO_CHAR(errnum)||': '||errtxt;
         text_io.fclose(out_file);
         RAISE Form_Trigger_Failure;
    END;
    -----------------------------------------------------------------------------------

    Thanks for attension.
    the problem is resolved, it's a access/right problem with the file(abc.txt).
    after i change the file permission from rwxr--r-- to rwxrw-rw-, then it works fine.
    But I have some confuse about it.
    1.The file must exist firstly. if not, then read or wirte the file will cause the ORA-302000 error. Can the file not exist? Can anyone tell me how to create file(abc.txt) with text_io if the file not exist.
    2.If the file was created by A, and A have rw rights, but the group owner have no rw rights, then you run the form by A(connect DB by A), it would cause ORA-302000 error too(both read and write).Why the group owner must have rw rights, or the form can not works fine?
    By the way, my DB account and my App server(Linux) account are same(both A).

  • Put_line

    Hi!
    I want to put the text into the same row.
    If i make a put_line in my code the each text have its own row:
    This is my code:
    Open MSP_SUBTYP_cur ;
              s := 1;
              Loop
              fetch MSP_SUBTYP_cur into ID_SUB;
              exit when MSP_SUBTYP_cur %NotFound;
              open CV for Select ID_ATTRIBNAME,ATTRIB_TYP,ATTRIBNAME FROM STD_BM_ATTRIB WHERE ID_SUBTYP = ID_SUB;
              n :=1;
              loop
         fetch cv into ID_ATTRIB,TYP,A_NAME ;
         exit when CV%NotFound;
         -- abfrage_2:=('(Select Attribname from STD_BM_ATTRIB where ID_ATTRIBNAME ='||ID_ATTRIB||')||'';''||');
         Text_IO.Put_line(out_file,'S'||s ||'A'||n);
    n:= n +1;
    end loop;
              close CV;
              IF MSP_SUBTYP_cur%ROWCOUNT = 1 THEN
                   abfrage_2:=('(Select Attribname from STD_BM_ATTRIB where ID_ATTRIBNAME ='||ID_ATTRIB||')||'';''');
                   Text_IO.Put_line(out_file,abfrage_2);
              END IF;
              s := s + 1;
              Text_IO.Put_line(out_file,s);
              end loop;
              Close MSP_SUBTYP_cur;
    Thanks for help
    Nicole

    Use TEXT_IO.PUT or PUTF instead. PUTF is more powerful as you can use a format string like the C prinf() function with
    "%s" placeholders to define string positions and "\n" to force a newline.

  • Barcode report is not working in linux

    hi,
    i am running the report using the barcode, which is running perfectly in the windows server - i meant in the report builder.
    but when i try run the same report in linux server through application, i am getting the below mentioned error:
    Terminated with error:
    REP-1401: 'beforereport': Fatal PL/SQL error occurred. ORA-39565: Message 39565 not found; product=RDBMS; facility=ORA
    below mentioned is the code written in beforereport trigger:
    globals.barcode_to_use := BarCodeConstants.BAR_CODE_128;
    globals.bcobj := barcodemaker.new();
    i have include the jar file path /ora/u01/oracle/v101/ds1/reports/jlib/oraclebarcode.jar both in class path and report_path, but still its not working.
    any one had solve this issue?...pls help me out
    for you info:
    CLASSPATH=/ora/u01/oracle/v101/ds1/j2ee/OC4J_BI_Forms/applications/formsapp/formsweb/WEB-INF/lib/frmsrv.jar:/ora/u01/oracle/v101/ds1/jlib/repository.jar:/ora/u01/oracle/v101/ds1/jlib/ldapjclnt10.jar:/ora/u01/oracle/v101/ds1/jlib/debugger.jar:/ora/u01/oracle/v101/ds1/jlib/ewt3.jar:/ora/u01/oracle/v101/ds1/jlib/share.jar:/ora/u01/oracle/v101/ds1/jlib/utj.jar:/ora/u01/oracle/v101/ds1/jlib/zrclient.jar:/ora/u01/oracle/v101/ds1/reports/jlib/rwrun.jar:/ora/u01/oracle/v101/ds1/forms/java/frmwebutil.jar:/ora/u01/oracle/v101/ds1/reports/jlib/oraclebarcode.jar
    RW=$ORACLE_HOME/reports; export RW
    REPORTS_PATH=$ORACLE_HOME/reports/templates:$ORACLE_HOME/reports/samples/demo:$ORACLE_HOME/reports/integ:$ORACLE_HOME/reports/printers:${REPORTS_PATH}; export REPORTS_PATH
    REPORTS_TMP=/tmp; export REPORTS_TMP
    REPORTS_NO_DUMMY_PRINTER=TRUE; export REPORTS_NO_DUMMY_PRINTER
    REPORTS_TAGLIB_URI=/WEB-INF/lib/reports_tld.jar; export REPORTS_TAGLIB_URI
    REPORTS_CLASSPATH=$ORACLE_HOME/reports/jlib/rwbuilder.jar:$ORACLE_HOME/reports/jlib/rwrun.jar:$ORACLE_HOME/jlib/zrclient.jar:$ORACLE_HOME/j2ee/home/oc4j.jar:$ORACLE_HOME/j2ee/home/lib/ojsp.jar:$ORACLE_HOME/reports/jlib/oraclebarcode.jar; export REPORTS_CLASSPATH
    repserver.conf file setting:
    <engine id="rwEng" class="oracle.reports.engine.EngineImpl" initEngine="1" maxEngine="1" minEngine="0" engLife="50" maxIdle="30" callbackTimeOut="90000" jvmOptions="-Xms512m -Xmx512m" classPath="/ora/u01/oracle/v101/ds1/reports/jlib/oraclebarcode.jar">
    <property name="sourceDir" value="/ora/u02/oraadmin/config/as2/app_qits_run"/>
    <property name="tempDir" value="/ora/u02/oraadmin/config/as2/app_qits_tmp"/>
    </engine>
    <engine id="rwURLEng" class="oracle.reports.urlengine.URLEngineImpl" initEngine="1" maxEngine="1" minEngine="0" engLife="50" maxIdle="30" callbackTimeOut="60000" classPath="/ora/u01/oracle/v101/ds1/reports/jlib/oraclebarcode.jar"/>
    thanks
    renjish

    Hello,
    The first step if to find the PL/SQL line causing the error in 'cf_1formula':
    create a procedure Trace in your Reports : (modify the line trace_file := Text_IO.Fopen('d:\temp\rep_trace.txt', 'A'); to adapt the filename to your system)
    PROCEDURE Trace (trace_string in varchar2) IS
    trace_file Text_IO.File_Type;
    BEGIN
    trace_file := Text_IO.Fopen('d:\temp\rep_trace.txt', 'A');
    Text_IO.Put_Line(trace_file, trace_string);
    Text_IO.Fclose (trace_file);
    END;
    Then, add some calls to this procedure in the program unit 'cf_1formula'
    trace('Before line 1';
    <PL/SQL code of line 1>
    trace('Before line 2';
    <PL/SQL code of line 2>
    trace('Before line 3';
    <PL/SQL code of line 3>
    Excecute the Reports and find in the file 'd:\temp\rep_trace.txt' the last line executed.
    Regards

  • Delete data from a flat file using PL/SQL -- Please help.. urgent

    Hi All,
    We are writing data to a flat file using Text_IO.Put_Line command. We want to delete data / record from that file after data is written onto it.
    Please let us know if this is possible.
    Thanks in advance.
    Vaishali

    There's nothing in UTL_FILE to do this, so your options are either to write a Java stored procedure to do it or to use whatever mechanism the host operating system supports for editing files.
    Alternatively, you could write a PL/SQL procedure to read each line in from the file and then write them out to a second file, discarding the line you don't want along the way.

  • Excel o/p in Reports 9i-additional report header for every row

    Dear All,
    Is there any way to generate an Excel file output from OracleReports9i.Actually I have tried the simple report.
    I am able to create a delimited output.But the prob is it contains an additional report header for every row of the report and this is very strange.Its coming like that
    Empno     Ename     Job     7566     JONES      MANAGER
    Empno     Ename     Job     7902     FORD      ANALYST
    I need the Xls o/p like that
    Empno     Ename          Job
    7566     JONES      MANAGER
    7902     FORD      ANALYST
    8877 JAMES SALES
    my Environment oracle9i developersuite /forms9i/reports9i
    I have given     DESFORMAT = DELIMITED
              MODE      = CHARACTER
    I am able to generate the reports in html/HTMLCSSIE/HTMLCSS/PDF/RTF
    Only delimited is giving problem
    What should i do to resolve this issue. Please help me it is very very urgent for me.
    Thanks in advance
    Pavendhan.N

    I had the same problem and this is what I did, works great. You have the total control.
    function BeforeReport return boolean is
    fp text_io.file_type;
    begin
    -- creating a file name
    :CP_filename := 'C:\Gap'||to_char(sysdate,'MMDDYYHHMISS')||'.csv';
    -- Opening the file in write mode
    fp := text_io.fopen(:CP_filename,'w');
    -- writing the column headings into the file
    text_io.put_line(fp,'"Platform","Sys#","GapType",');
    text_io.fclose(fp);
    return (TRUE);
    end;
    and then where ever it is suitable, depending on the requirement, write into file by opening it in the append mode.
    function R_G_systemplatformFormatTrigge return boolean is
    fp text_io.file_type;
    begin
    --     srw.message(99,:dname);
    fp := text_io.fopen(:CP_filename,'a');
    text_io.put(fp,'"' || :systemplatform || '",');
    text_io.put(fp,'"' || to_char(:sysno) || '",');
    text_io.put_line(fp,'"' || :CF_gaptype || '",');
    text_io.fclose(fp);
    return (TRUE);
    end;
    This works great. Hope this helps.

  • Any ideas why the second HOST call does not work???

    Hi Folks.
    I have written the following code which works fine in all but one respect.
    The code creates a zip file on a server (Accessed over a network) hence the full windows network path name.
    The call to host on the server works in terms of running the zipinvoices.bat file and the zip file is generated on the server in the correct location.
    The prigram unit also generates the correctly formatted mailinvoices.bat file. However, the second call to HOST does not run/execute the mailinvoices.bat file. If I go to the server and run the mailinvoices.bat file directly, it runs perfectly and emails the file to me, no problemo.
    Why does the second call to HOST from the client machine not run?
    Any clues anyone???
    Cheers
    Simon Gadd
    PROCEDURE send_email_invoices_pu_p (p_organisation IN VARCHAR2) IS
    v_processing_cycle          CHAR(4);     
         v_alert_but                              NUMBER;
         v_error_num                              NUMBER;
         v_sent_status                     NUMBER(1);
    v_stage                                        NUMBER(1);
    v_year                                        VARCHAR2(4);
    v_month                                        VARCHAR2(9);
    v_folder_name                         VARCHAR2(25); -- Name of the file which holds the 'Printed' invoices in the receivables folder. v_organisation                    VARCHAR2(50);
    v_password                              VARCHAR2(25);
    v_organisation                    VARCHAR2(25);
         v_host_command                    VARCHAR2(100);
    v_from_name                              VARCHAR2(100);
    v_to_name                                   VARCHAR2(100);
    v_subject                                   VARCHAR2(100);
    v_error_txt                              VARCHAR2(200);
    v_file                                        VARCHAR2(200);
    v_message                                   VARCHAR2(500);
         v_line_buffer                         VARCHAR2(5000);
    v_working                                   BOOLEAN := TRUE;
    v_zipinvoices_bat               TEXT_IO.FILE_TYPE;
         v_mailinvoices_bat          TEXT_IO.FILE_TYPE;
         CURSOR c_sent_status IS
              SELECT sent
              FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
         CURSOR c_select_folder IS
              SELECT folder
              FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);     
    CURSOR c_select_email_elements IS
    SELECT      send_to,
                        send_from
    FROM INVOICE_EMAIL
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    BEGIN
    v_organisation := p_organisation;
    -- Check to see if the invoices have already been e-mailed for this Procssing Cycle. If they have,
    -- then warn the user of this and get them to confirm that they wish to proceed and e-mail them again.
    -- The batch e-mail process will re-zip the invoices (ignoring a pre existing .zip file) and overwrite
    -- the existing zip file if it exists or generate it if it does not exist.
         OPEN c_sent_status;
              FETCH c_sent_status INTO v_sent_status;
         CLOSE c_sent_status;     
         IF v_sent_status = 1 THEN
              v_alert_but := SHOW_ALERT('SEND_AGAIN_ALRT');
                   IF v_alert_but = ALERT_BUTTON2 THEN RAISE FORM_TRIGGER_FAILURE;
                        ELSE NULL;
                   END IF;
         END IF;
    :CONTROL.WORKING := 'Started Zipping invoices for '||INITCAP(v_organisation)||'.'||CHR(10)||'Please wait..';
    SYNCHRONIZE;
    -- The following code opens the zipinvoices.bat file which resides in the root folder \\Ebony\c$\FCSS\DB_SCRIPTS\ and modifies it ready to
    -- zip up the invoices in the relevant organisation's invoice folder for the current processing cycle.
    v_processing_cycle := GET_CURRENT_TRAFFIC_PERIOD;
    v_month := RTRIM(INITCAP(TO_CHAR(TO_DATE(v_processing_cycle, 'MMYY'), 'MONTH')));
    v_year := (TO_CHAR(TO_DATE(v_processing_cycle, 'MMYY'), 'YYYY'));
         OPEN c_select_folder;
         FETCH c_select_folder INTO v_folder_name;
         CLOSE c_select_folder;
    KILL_OLD_ZIP_PU_P('del \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices.zip');
    SELECT zip_password
    INTO v_password
    FROM INVOICE_EMAIL
    WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    v_zipinvoices_bat := TEXT_IO.FOPEN('\\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat', 'w');
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'wzzip -s'||v_password||' -x*.zip -ybc \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\*.*';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    v_line_buffer := 'exit';
    TEXT_IO.PUT_LINE (v_zipinvoices_bat, v_line_buffer);
    TEXT_IO.FCLOSE (v_zipinvoices_bat);
    -- The following code executes the freshly edited \\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat file to produce the zipped invoices file
    -- ready to be e-mailed out to the address specified in the INVOICE_EMAIL table for the relevant organisation.
    v_host_command := '\\Ebony\c$\FCSS\DB_SCRIPTS\zipinvoices.bat';
    v_stage := 1;
    HOST (v_host_command, NO_SCREEN);
    IF NOT Form_Success THEN
         IF v_stage = 1 THEN
         :CONTROL.WORKING := 'Error -- The .zip file for '||INITCAP(v_organisation)||' was not produced.';
              SYNCHRONIZE;     
         ELSIF v_STAGE = 2 THEN
         :CONTROL.WORKING := 'Error -- The zipped invoices file for '||INITCAP(v_organisation)||' was not emailed.';
              SYNCHRONIZE;               
              END IF;     
    ELSE NULL;
    END IF;
    :CONTROL.WORKING := 'All invoices for '||INITCAP(v_organisation)||' successfully zipped.'||CHR(10)||'Attempting to send via e-mail.'||CHR(10)||'Please wait..';
    SYNCHRONIZE;
    -- The following code e-mails the freshly created .zip file for the relevant organisation and e-mails it to the
    -- recipient specified in the relevant row in the INVOICE_EMAIL programme along with from address, subject and
    -- message if specified.
    OPEN c_select_email_elements;
    FETCH c_select_email_elements INTO
    v_to_name,
    v_from_name;
    CLOSE c_select_email_elements;
    v_stage := 2;
    v_mailinvoices_bat := TEXT_IO.FOPEN('\\Ebony\c$\FCSS\DB_SCRIPTS\mailinvoices.bat', 'w');
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'cd..';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'clemail -quiet -smtpserver mailhost.0800dial.com -smtpport 25 -to '||v_to_name||' -from '||v_from_name||' -subject "'||v_month||' '||v_year||' Roaming Traffic Invoices from United Clearing Ltd" -bodyfile \\Ebony\c$\FCSS\DB_SCRIPTS\invoice_body.txt -attach \\Ebony\c$\FCSS\CYCLE_DATA\'||v_processing_cycle||'\receivables\'||v_folder_name||'\invoices.zip';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    v_line_buffer := 'exit';
    TEXT_IO.PUT_LINE (v_mailinvoices_bat, v_line_buffer);
    TEXT_IO.FCLOSE (v_mailinvoices_bat);
    v_host_command := '\\Ebony\c$\FCSS\DB_SCRIPTS\mailinvoices.bat';
    HOST (v_host_command, NO_SCREEN);
    IF NOT Form_Success THEN
         IF v_stage = 1 THEN
         :CONTROL.WORKING := 'Error -- The .zip file for '||INITCAP(v_organisation)||' was not produced.';
              SYNCHRONIZE;     
         ELSIF v_STAGE = 2 THEN
         :CONTROL.WORKING := 'Error -- The zipped invoices file for '||INITCAP(v_organisation)||' was not emailed.';
              SYNCHRONIZE;               
              END IF;     
    ELSE NULL;
    END IF;
    UPDATE INVOICE_EMAIL
         SET sent = 1
              WHERE UPPER(ORGANISATION) = UPPER(v_organisation);
    COMMIT;
    GO_BLOCK ('INVOICE_EMAIL');
    EXECUTE_QUERY;               
    :CONTROL.WORKING := 'Please press a button on the left to e-mail invoices to the organisations listed.';
    SYNCHRONIZE;
    EXCEPTION
         WHEN OTHERS THEN
              v_error_num := SQLCODE;
              v_error_txt := SUBSTR(SQLERRM, 1, 200);
              MESSAGE('The error was: '||v_error_txt||' and the code was: '||v_error_num);
              RAISE FORM_TRIGGER_FAILURE;
    END;

    As a suggestion I'd put the Text_io segments into their own begin - exception - end sub-blocks within the main code. This way if Text_io does raise an exception you can catch it earlier as it may be able to recover - That is if it is a text_io exception.
    Other than that you;ll have to step through in Debug.

  • Need step-by-step help on how to set up javabean on form6i

    I create a form to be run on the web,winnt server, database 8.1.7 on sun.
    I need to set up a javabean on forms6i to allow users to output their file (delimited text file) to their local pc. I used TEXT_IO it works ok but the output file is saved on the server site not on the client pc. I've completed created a javabean program called TextPJC.jar and included it on ARCHIVE tag on formsweb.cfg file when I run my form it's ok.
    On my form I have a field V_FILE_NAME (combo Box/List Item) to allow user to enter the file name, then press the button to create the file(on user's PC).this is my by WWHEN-BUTTON_PRESSED coding:
    DECLARE
    v_line VARCHAR2(2000);
    button NUMBER;
    button2 NUMBER;
    v_file_name VARCHAR2(255);
    v_prompt TEXT_IO.FILE_TYPE;
    C_EIN_NMBR C.test6.CASE_PENPLN_EIN_NMBR%TYPE;
    v_ein_count NUMBER;
    ex_ein_notmatch EXCEPTION;
    ALERT_FILE_GENERATED NUMBER;
    CURSOR cur_test IS
    SELECT
    to_char(C_EIN_NMBR)&#0124; &#0124;'!'&#0124; &#0124;
    to_char(C_OPEN_DATE)&#0124; &#0124;'!'&#0124; &#0124;
    to_char(C_CLOSE_DATE)&#0124; &#0124;'+++'
    FROM C.test
    WHERE C_EIN_NMBR = :STPROMPT.EIN;
    BEGIN
    -- checking if output file name field is null or not
    IF :STPROMPT.V_FILE_NAME IS NULL
    THEN button := SHOW_ALERT('ALERT_MISSING_PATH');
    IF BUTTON = ALERT_BUTTON1
    THEN SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    GO_item(':stprompt.V_FILE_NAME');
    END IF;
    ELSIF :STPROMPT.EIN IS NULL
    THEN button := SHOW_ALERT('ALERT_NO_EIN');
    ELSIF :STPROMPT.EIN IS NOT NULL
    THEN
    BEGIN
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
    SELECT COUNT(DISTINCT(C_EIN_NMBR))
    INTO v_ein_count
    FROM C.STPROMPT
    WHERE C_EIN_NMBR C_EIN_NMBR = :STPROMPT.EIN;
    IF v_ein_count = 0
    THEN RAISE ex_ein_notmatch;
    ELSE
    v_file_name := :STPROMPT.V_FILE_NAME;
    v_prompt := TEXT_IO.FOPEN(v_file_name, 'W');
    TEXT_IO.PUT_LINE(v_prompt,
    to_char(P_EIN_NMBR)&#0124; &#0124;'!'&#0124; &#0124;
    to_char(P_OPEN_DATE)&#0124; &#0124;'!'&#0124; &#0124;
    to_char(P_CLOSE_DATE)&#0124; &#0124;'+++'
    OPEN cur_testl6;
    LOOP
    FETCH cur_testl6
    INTO v_line;
    EXIT WHEN cur_testl6%NOTFOUND;
    TEXT_IO.PUT_LINE(v_prompt, v_line);
    END LOOP;
    CLOSE cur_testl6;
    TEXT_IO.FCLOSE(v_prompt);
    SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    -- Confirms when textfile is created.
    ALERT_FILE_GENERATED := SHOW_ALERT('TEXTFILE_GENERATED');
    IF ALERT_FILE_GENERATED = ALERT_BUTTON1
    THEN GO_BLOCK('stprompt');
    END IF;
    END IF;
    END;
    END IF;
    EXCEPTION
    WHEN ex_ein_notmatch
    THEN SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    button2 := SHOW_ALERT('ALERT_NO_EIN_EXIST');
    IF button2 = ALERT_BUTTON1
    THEN go_block('stprompt');
    END IF;
    -- takes care of other exceptions such as misspelled/non-existing output file directories/path
    WHEN others
    THEN SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
    button := SHOW_ALERT('ALERT_TYPO');
    IF button = ALERT_BUTTON1
    THEN go_block('stprompt');
    END IF;
    END;
    Now I want to know how to setup javabean on forms so that I can make my form work it way it should work. Please help.

    you can get samples of using javabeans in forms in the form section of the otn.
    but let me suggest something that might be simpler.
    create the file on the server and then use:
    web.show_document('url of file on server');
    this will cause the file to download to the client.

Maybe you are looking for

  • Error message while Archiving  the PO on 4.6C version

    Hello Team , We are archiving the PO in SAP 4.6C version. Some of the PO failed  with the below error message "4203018801 Item 00002 still entered in info record as last document item". i have kept the deletion flag for the info record and tried to a

  • Video Podcast no longer plays audio

    Within the last week, (Possibly the last update), I can no longer get audio to work on Video Podcasts.  No audio in iTunes or on iPhone for Video Podcasts.  However, Audio Podcasts play just fine and no other issues with Movies, etc. 

  • The "J2EE process table" node not visible  in the SAP MMC

    For Netweaver 7.0 - The "J2EE process table" node not visible  in the SAP MMC. Details for below SAP Systems Manager SAP AG Version: 7100.109.15.8983 Window Xp Any suggestions would be apperecited. Thanks Srini

  • RF Queue for a specific Shipping Point ...... Is it possibe?

    Hi, We have around 10 doors and 10 shipping points. Transfer orders created for all the outbound deliveries are directed to an RF queue for picking. Now, we have a specific  Shipping Point which we want to seperate out for picking and we want the tra

  • Pages import doesn't show portlets

    hi, we have 3 pages with multiple portlets. portlet contains forms and reports and other components. we exported pages with pageexp utility. when we import it , we cannot get the whole page,instead it shows only the tabs not the content and applicati