UTL_FILE help/samples

Hello Folks,
I need to write a routine to read in a CSV file parse it and inser the data into a table.
Does anybody have examples?
TIA

Use this as a skeleton:
set serveroutput on size 1000000 format word_wrapped
set verify off
DECLARE
EOF CONSTANT VARCHAR2(30) := '~~+~~+~~';
iCount NUMBER;
sEOF VARCHAR2(30);
sPath VARCHAR2(2000);
sRecord VARCHAR2(2000);
sSQLCode NUMBER;
sSQLErrM VARCHAR2(255);
pFileHandle utl_file.file_type;
BEGIN
dbms_output.enable(1000000);
iCount := 0;
sEOF := '';
sPath := 'C:\Data';
pFileHandle := utl_file.fopen(sPath, 'file.cvs', 'r');
loop
BEGIN
utl_file.get_line(pFileHandle, sRecord);
EXCEPTION
when NO_DATA_FOUND then sEOF := EOF;
END;
exit when sEOF = EOF;
iCount := iCount + 1;
dbms_output.put_line(sRecord);
end loop;
commit;
dbms_output.put_line("Records read: "| |iCount);
utl_file.fclose(pFileHandle);
EXCEPTION
when UTL_FILE.INVALID_OPERATION then
utl_file.fclose(pFileHandle);
raise_application_error(-20001, 'Invalid Operation');
when UTL_FILE.INVALID_FILEHANDLE then
utl_file.fclose(pFileHandle);
raise_application_error(-20002, 'Invalid File Handle');
when UTL_FILE.WRITE_ERROR then
utl_file.fclose(pFileHandle);
raise_application_error(-20003, 'Write Error');
when UTL_FILE.INTERNAL_ERROR then
utl_file.fclose(pFileHandle);
raise_application_error(-20004, 'Internal Error');
when UTL_FILE.INVALID_PATH then
utl_file.fclose(pFileHandle);
raise_application_error(-20005, 'Invalid Path ['| |sPath| |']');
when UTL_FILE.INVALID_MODE then
utl_file.fclose(pFileHandle);
raise_application_error(-20006, 'Invalid Mode');
when UTL_FILE.READ_ERROR then
utl_file.fclose(pFileHandle);
raise_application_error(-20007, 'Read Error');
when OTHERS then
utl_file.fclose(pFileHandle);
sSQLCode := SQLCODE;
sSQLErrM := substr(SQLERRM, 1, 255);
raise_application_error(-20008, sSQLCode| |' - '| |sSQLErrM);
END;
To chop the record into separate fields you must use something like:
iStart := instr(sRecord, '|', 1, 2) + 1;
iLen := instr(sRecord, '|', 1, 3) - iStart;
if iLen = 0 then
sField := '#NULL#';
else
sField := substr(sRecord, iStart, iLen);
null

Similar Messages

  • Flex 3 How to recording the voice to the local file.can u help sample souce code

    How to recording the voice to the local file.can u help sample souce code

    What? the link is not opening? Check once properly man.  If you need code here it is
    import flash.system.Security;
    import flash.media.Microphone;
    import flash.events.ActivityEvent;
    import flash.events.SampleDataEvent;
    import flash.events.StatusEvent;
    import flash.utils.ByteArray;
    import flash.media.Sound;
    import flash.events.MouseEvent;
    import flash.media.SoundChannel;
    import flash.events.Event;
    import org.bytearray.micrecorder.encoder.WaveEncoder;
    import flash.net.FileReference;
    var mic:Microphone;
    var soundBytes:ByteArray;
    var recBytes:ByteArray= new ByteArray();
    var sc:SoundChannel;
    var sound:Sound;
    recordBtn.addEventListener(MouseEvent.CLICK, getMic);
    stopBtn.addEventListener(MouseEvent.CLICK, stopRecording);
    playBtn.addEventListener(MouseEvent.CLICK, plays);
    saveBtn.addEventListener(MouseEvent.CLICK, saveAudio);
    function getMic(e:MouseEvent)
    soundBytes= new ByteArray();
    //returns an array that total mics available
    var totalMics:Array = Microphone.names;
    //mic is a singleton class gets microphone to record sound
    mic = Microphone.getMicrophone();
    //Sets the minimum input level that should be considered
    mic.setSilenceLevel(0);
    mic.rate = 44;
    //to capture microphone audio listen for this event
    mic.addEventListener(SampleDataEvent.SAMPLE_DATA, recordAudio);
    function recordAudio(e:SampleDataEvent)
    //capture the byte array data available with the event
    while (e.data.bytesAvailable)
    var soundData:Number = e.data.readFloat();
    soundBytes.writeFloat(soundData);
    function stopRecording(e:MouseEvent)
    mic.removeEventListener(SampleDataEvent.SAMPLE_DATA, recordAudio);
    //set the bytearray position to zero for playing from starting
    soundBytes.position = 0;
    function plays(e:MouseEvent)
    //intatiazle sound instance
    sound= new Sound();
    soundBytes.position = 0;
    //listen for the event when runtime requests new audio data.
    sound.addEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
    //play the sound with sound channel
    sc = sound.play();
    sc.addEventListener(Event.SOUND_COMPLETE, soundComplete);
    function playAudio(e:SampleDataEvent)
    //if audio bytes is greate than 4 read the recorded byte array data and write it into the sound
    for (var i=0; i<8192; i++)
    if (soundBytes.bytesAvailable > 4)
    var sample:Number = soundBytes.readFloat();
    e.data.writeFloat(sample);
    e.data.writeFloat(sample);
    function soundComplete(e:Event)
    sound.removeEventListener(SampleDataEvent.SAMPLE_DATA, playAudio);
    sc.stop();
    function saveAudio(e:MouseEvent)
    soundBytes.position = 0;
    //waveencoder class used to encodes bytearray data properly used to play properly after saving
    //you can get this api from below link
    //http://code.google.com/p/micrecorder/downloads/detail?name=MicRecorder%201.2.zip&can=2&q=
    var encod:WaveEncoder= new WaveEncoder();
    var byte:ByteArray = encod.encode(soundBytes,2);
    var file:FileReference= new FileReference();
    file.save(byte, “test.wav”);

  • Utl_file help!!!

    Hey people :) Below is my code it is produces a list of names address for a mail merge, an example of an outputted file:
    32-36 GREAT VICTORIA STREET
    BELFAST
    BT2 7BA
    08448920902
    0026936
    000001
    MRS FRAME
    51 HOUSE DRIVE
    HOUSETOWN
    COUNTY ANTRIM
    BT36 7JY
    03 DEC 2008
    MRS FRAME
    0.35
    28-JUL-08
    07-DEC-08
    01-APR-08
    07-DEC-08
    0.72
    ALAN CASKEY
    Which is perfect, but when some users input the data, tehy leave the l.INPUT_HOUSE_NO as null and input the house number as part of the l.input_address_line1, which leaves a blank space where the house number should be for example:
    32-36 GREAT VICTORIA STREET
    BELFAST
    BT2 7BA
    08448920902
    0031955
    000002
    MR TOWNSLEY
    __2 HOUSE GARDENS (unneeded space in the address, how could i fix this??)
    HOUSETOWN
    BT13 3RJ
    03 DEC 2008
    MR TOWNSLEY
    0.04
    01-APR-08
    23-NOV-08
    01-APR-08
    23-NOV-08
    0.60
    ALAN CASKEY
    Thanks
    DECLARE
         v_count NUMBER(10) := 0;
         wk_start_seqno date;     
         EXEC_file UTL_FILE.FILE_TYPE;
       CURSOR read_lpa_input
       IS
          SELECT
                     a.address_line3,
                     a.address_line4,
          a.address_line5,
          a.post_code,
          a.tel_no,
                  l.claim_no,
                  lpad(row_number() OVER(ORDER BY l.claim_no), 6, '0') AS snum,
                  l.input_title,
          l.input_surname,
                     l.INPUT_HOUSE_NO,
                  l.input_address_line1,
          l.input_address_line2,
          l.input_address_line3,
          l.input_address_line4,
          l.input_post_code,     
                 to_char(sysdate, 'DD MON YYYY') AS prntdate,
          l.input_title AS input_title2,
          l.input_surname AS input_surname2,
          h.lpa_amt,
          h.start_date,
          c.paidto_date,
          h.start_date AS start_date2,
          c.paidto_date AS paidto_date2,
          c.overpay_halahra,
          a.sho_name
    FROM lpa_input l, lpa_address a, lpa_history h, lpa_claim c
         WHERE a.aun_code = l.input_aun_code
         AND h.claim_no = c.claim_no
         AND l.claim_no = h.claim_no
         AND c.overpay_halahra > '0'
         and ent_seqno = (select max (ent_seqno) from lpa_history where claim_no = c.claim_no);
    TYPE wk_tab IS TABLE OF read_lpa_input%ROWTYPE
          INDEX BY PLS_INTEGER;
       wk   wk_tab;
    BEGIN
    exec_file := utl_file.fopen('/spp/spool/RBLIVE/rr_output', 'output501.txt', 'W');
      OPEN read_lpa_input;
       LOOP
       EXIT WHEN read_lpa_input%NOTFOUND;
       FETCH read_lpa_input
       BULK COLLECT INTO wk LIMIT 100;
          FOR i IN 1 .. wk.count
          LOOP
    select start_date  into wk_start_seqno from lpa_history where claim_no = wk(i).claim_no
    and ent_seqno = (select max (ent_seqno) - 1 from lpa_history
    where claim_no = wk(i).claim_no);
    v_count :=0;
    utl_file.put_line(exec_file, wk(i).address_line3);
    utl_file.put_line(exec_file, wk(i).address_line4);
    IF wk(i).address_line5 IS NOT NULL THEN
    utl_file.put_line(exec_file, wk(i).address_line5);
    ELSE
      v_count := v_count+1; -- count the number of blank lines
    END IF;
    utl_file.put_line(exec_file, wk(i).post_code);
    IF v_count > 0 THEN -- we have omitted some lines
      FOR i IN 1..v_count LOOP -- loop that many times
        utl_file.new_line(exec_file); -- write a blank line
      END LOOP;
    END IF;
             utl_file.put_line(exec_file, wk(i).tel_no);
             utl_file.put_line(exec_file, wk(i).claim_no);
    utl_file.put_line(exec_file, wk(i).snum);
    utl_file.put_line(exec_file, wk(i).input_title||' '||wk(i).input_surname);
    v_count :=0;
    ---------------------------------------------------------------------------------HELP HERE!!!!
    IF wk(i).input_address_line1 IS NOT NULL THEN
    utl_file.put_line(exec_file, wk(i).INPUT_HOUSE_NO||' '||wk(i).input_address_line1);
    ELSE
    v_count := v_count+1; -- count the number of blank lines
    END IF;
    IF wk(i).input_address_line2 IS NOT NULL THEN
    utl_file.put_line(exec_file, wk(i).input_address_line2);
    ELSE
      v_count := v_count+1; -- count the number of blank lines
    END IF;
    IF wk(i).input_address_line3 IS NOT NULL THEN
    utl_file.put_line(exec_file, wk(i).input_address_line3);
    ELSE
      v_count := v_count+1; -- count the number of blank lines
    END IF;
    IF wk(i).input_address_line4 IS NOT NULL THEN
    utl_file.put_line(exec_file, wk(i).input_address_line4);
    ELSE
      v_count := v_count+1; -- count the number of blank lines
    END IF;
             utl_file.put_line(exec_file, wk(i).input_post_code);
    IF v_count > 0 THEN -- we have omitted some lines
      FOR i IN 1..v_count LOOP -- loop that many times
        utl_file.new_line(exec_file); -- write a blank line
      END LOOP;
    END IF;
             utl_file.put_line(exec_file, wk(i).prntdate);
             utl_file.put_line(exec_file, wk(i).input_title2||' '||wk(i).input_surname2);
             utl_file.put_line(exec_file, to_char(round(wk(i).lpa_amt,2),'99G990D00'));
          utl_file.put_line(exec_file, wk(i).start_date);
          utl_file.put_line(exec_file, wk(i).paidto_date);
          utl_file.put_line(exec_file, wk_start_seqno);
          utl_file.put_line(exec_file, wk(i).paidto_date2);
          utl_file.put_line(exec_file, to_char(round(wk(i).overpay_halahra,2),'99G990D00'));
          utl_file.put_line(exec_file, wk(i).sho_name);
          END LOOP;
       END LOOP;
       CLOSE read_lpa_input;
       utl_file.fclose(exec_file);
    END;
    /Edited by: user653315 on 03-Dec-2008 04:11

    Try this...
    IF wk(i).input_address_line1 IS NOT NULL THEN
      utl_file.put_line(exec_file, CASE WHEN wk(i).INPUT_HOUSE_NO IS NULL THEN NULL ELSE wk(i).INPUT_HOUSE_NO||' ' END||wk(i).input_address_line1);
    ELSE
      v_count := v_count+1; -- count the number of blank lines
    END IF;

  • UTL_FILE help..Plz Help urgently

    CREATE OR REPLACE PROCEDURE test_file
    AS
    n_output_file_handle UTL_FILE.file_type;
    /**************************Beginning of the procedure **********************/
    BEGIN
    --DBMS_OUTPUT.ENABLE(2000000);
    DBMS_OUTPUT.put_line('p_utl_dir:');
    DBMS_OUTPUT.put_line('c_output_file_name:'|| 'test.txt' );
    n_output_file_handle := UTL_FILE.fopen ('C:\MPPI','test.txt','w');
    UTL_FILE.put_line (n_output_file_handle, 'test1');
    UTL_FILE.fclose(n_output_file_handle);
    I have this procedure to write text to a file. I execute this on my own machine but it does not write to the file.I exceute it from SQLPlus by execute test_file();.It says proc successfully completed but nothing is written to text file.
    Could somone plz help me with this urgently.

    Hi, what is the value for the parameter UTL_FILE?
    You use an absolute path for the directory to write to in you r procedure.
    If you would use a directory object in the database to specify where to write to you would not need to set UL_FILE parameter.
    Regards,
    Lutz

  • UTl_file help - To generate table records using execute imediate statment

    Hi Guys,
    I need small help from you guys to generate file . For below results I would like to send it UTL_file and generate text file on table name . My table name will be dynamic ( suppose now emp table as input next record will be employee as input like so but my all columns are same for all the tables ( as inputs to this procedure) )
    declare
    type empdtlrec is record (empno number(4),
    ename varchar2(20),
    deptno number(2));
    empdtl empdtlrec;
    begin
    execute immediate 'select empno, ename, deptno ' ||
    'from emp where empno = 7934'
    into empdtl;
    end;
    Please help me for the above query

    declare
    type empdtlrec is record (empno number(4),
    ename varchar2(20),
    deptno number(2));
    empdtl empdtlrec;
    begin
    execute immediate 'select empno, ename, deptno ' ||
    'from emp where empno=(select max(empno) from emp)'
    into empdtl;
    dbms_output.put_line('empno ' || empdtl.empno );
    dbms_output.put_line('ename ' || empdtl.ename );
    dbms_output.put_line('deptno ' ||empdtl.deptno );
    end;
    I want to create a file using above records and send a mail to users .Please help me

  • Urgent help; Sample application

    Hello All,
    I am new to smart card application, however, i undertstand the concept of the JavaCard platform for developing applets and OpenCard Framework for developing host-based applications for the CAD.
    But i require how to integrate an entire end-to-end smart card application.
    Getting a complete sample application as simple as an electronic purse application, that is both the card side and reader side application and an explanation of how to put them all together installing on the card and testing will help me a lot.
    Most books/tutorials concentrate on just the card side or the host-based application. i need to knwo how to put them together.
    Does any one know where i can get help with this?
    Thanks,

    thanks a lot,
    I am really grateful for the information. I have downloaded and installed the SmartCard Tool set from the URL you gave.
    I can also write VB6 conveniently, I also understand how APDUs work. I have Eclipse+JCOP3. Infact i have written a card applet using Eclipse+JCOP3.
    I read some tutorial on JCShell to see if i could test the applet using the JCShell console in JCOPs plug-in for ecllipse. I but was wondering how i'd test it by writing a host application. that can communicate with it; do PIN verification, send data and have it processed.
    What further hand can you give me with the use of this SC Toolset.
    Also i bought a card reader and then found out it was the wrong one. Can you give information on where i could get a PC/SC complaint reader as well as smart cards.
    Regards

  • STUDENT HELP: SAMPLE INSERT DATA PROGRAM (DYNPRO)

    Hello,
    I am a current student working on a project for school, so assume I am a beginner.
    I am asking for an example of a simple ABAP Dynpro (Not WebDynpro, we don't have access to that) program that will allow user to input, modify, and delete multiple records at once to a DB table.
    The DB tables are set up like this:
    Z_HBK
    MANDT
    HBK_ID
    S_PLANT
    R_PLANT
    HBK_DATE
    Z_HBK_DATA
    MANDT
    HBK_ID
    DRIVER
    CHECKER
    CUSTOMER
    PRODUCT
    R2S_QTY
    DAM_QTY
    DEST_QTY
    I need to be able to enter multiple records into the Z_HBK_DATA table, with the same HBK_ID. I have set the tables composite key to so the table can accept multiple HBK_ID entries:
    MANDT
    HBK_ID
    DRIVER
    CHECKER
    CUSTOMER
    PRODUCT
    I have tried countless times to use table wizard, but have not been successful.
    Please help my to create simple program that will enter multiple records at 1 time into the Z_HBK_DATA table.
    Also, If anyone can help me to add a button onto the following program to allow user to email report from individual report output screen, that would be very helpful as well.
    Thank you,
    Mike
    *& Report  Z03_HBK_REPORT_ALL
    REPORT  Z03_HBK_REPORTS.
    TYPES:  BEGIN OF TY_HBK_DATA,
            HBK_ID type Z03_HBK_DOC_NUM,
            DRIVER type PERSNO,
            CHECKER TYPE PERSNO,
            CUSTOMER TYPE KUNNR,
            PRODUCT TYPE MATNR,
            R2S_QTY TYPE INT2,
            DAM_QTY TYPE INT2,
            DEST_QTY TYPE INT2,
            END OF TY_HBK_DATA,
            BEGIN OF TY_HBK_DATA_R2S,
            HBK_ID type Z03_HBK_DOC_NUM,
            DRIVER type PERSNO,
            CHECKER TYPE PERSNO,
            CUSTOMER TYPE KUNNR,
            PRODUCT TYPE MATNR,
            R2S_QTY TYPE INT2,
            END OF TY_HBK_DATA_R2S,
            BEGIN OF TY_HBK_DATA_DAM,
            HBK_ID type Z03_HBK_DOC_NUM,
            DRIVER type PERSNO,
            CHECKER TYPE PERSNO,
            CUSTOMER TYPE KUNNR,
            PRODUCT TYPE MATNR,
            DAM_QTY TYPE INT2,
            END OF TY_HBK_DATA_DAM,
            BEGIN OF TY_HBK_DATA_DEST,
            HBK_ID type Z03_HBK_DOC_NUM,
            DRIVER type PERSNO,
            CHECKER TYPE PERSNO,
            CUSTOMER TYPE KUNNR,
            PRODUCT TYPE MATNR,
            DEST_QTY TYPE INT2,
            END OF TY_HBK_DATA_DEST.
    DATA: IT_HBK_DATA TYPE TABLE OF TY_HBK_DATA,
          WA_HBK_DATA TYPE TY_HBK_DATA,
          IT_HBK_DATA_R2S TYPE TABLE OF TY_HBK_DATA_R2S,
          WA_HBK_DATA_R2S TYPE TY_HBK_DATA_R2S,
          IT_HBK_DATA_DAM TYPE TABLE OF TY_HBK_DATA_DAM,
          WA_HBK_DATA_DAM TYPE TY_HBK_DATA_DAM,
          IT_HBK_DATA_DEST TYPE TABLE OF TY_HBK_DATA_DEST,
          WA_HBK_DATA_DEST TYPE TY_HBK_DATA_DEST.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
      SELECT-OPTIONS: S_DATA FOR WA_HBK_DATA-HBK_ID.
    SELECTION-SCREEN END OF SCREEN 100.
    SELECTION-SCREEN BEGIN OF SCREEN 101.
      SELECT-OPTIONS: S_R2S FOR WA_HBK_DATA_R2S-HBK_ID.
    SELECTION-SCREEN END OF SCREEN 101.
    SELECTION-SCREEN BEGIN OF SCREEN 102.
      SELECT-OPTIONS: S_DAM FOR WA_HBK_DATA_DAM-HBK_ID.
    SELECTION-SCREEN END OF SCREEN 102.
    SELECTION-SCREEN BEGIN OF SCREEN 103.
      SELECT-OPTIONS: S_DEST FOR WA_HBK_DATA_DEST-HBK_ID.
    SELECTION-SCREEN END OF SCREEN 103.
    PARAMETERS: HBK_DATA RADIOBUTTON GROUP ONE,
                HBK_R2S RADIOBUTTON GROUP ONE,
                HBK_DAM RADIOBUTTON GROUP ONE,
                HBK_DEST RADIOBUTTON GROUP ONE.
    IF HBK_DATA = 'X'.
      CALL SELECTION-SCREEN 100 STARTING AT 10 10 ENDING AT 100 10.
      PERFORM GET_HBK_DATA.
      PERFORM DISP_HBK_DATA.
    ELSEIF HBK_R2S = 'X'.
      CALL SELECTION-SCREEN 101 STARTING AT 10 10 ENDING AT 100 10.
      PERFORM GET_HBK_DATA_R2S.
      PERFORM DISP_HBK_DATA_R2S.
    ELSEIF HBK_DAM = 'X'.
      CALL SELECTION-SCREEN 102 STARTING AT 10 10 ENDING AT 100 10.
      PERFORM GET_HBK_DATA_DAM.
      PERFORM DISP_HBK_DATA_DAM.
    ELSEIF HBK_DEST = 'X'.
      CALL SELECTION-SCREEN 103 STARTING AT 10 10 ENDING AT 100 10.
      PERFORM GET_HBK_DATA_DEST.
      PERFORM DISP_HBK_DATA_DEST.
    ENDIF.
    *&      Form  GET_HBK_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_HBK_DATA .
      SELECT HBK_ID
               DRIVER
               CHECKER
               CUSTOMER
               PRODUCT
               R2S_QTY
               DAM_QTY
               DEST_QTY FROM Z03_HBK_DATA INTO TABLE IT_HBK_DATA
        WHERE HBK_ID IN S_DATA.
    ENDFORM.                    " GET_HBK_DATA
    *&      Form  DISP_HBK_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISP_HBK_DATA .
    LOOP AT IT_HBK_DATA INTO WA_HBK_DATA.
          AT FIRST.
            WRITE: /10'HAULBACK NUMBER',
                    30 'DRIVER ID',
                    50 'CHECKER ID',
                    70 'CUSTOMER ID',
                    90 'PRODUCT',
                    110 'R2S QTY',
                    130 'DAMAGED QTY',
                    150 ' DESTROY QTY'.
            WRITE: /10 SY-ULINE.
          ENDAT.
          WRITE: /10 WA_hbk_data-HBK_ID,
                   30 WA_HBK_DATA-DRIVER,
                   50 WA_HBK_DATA-CHECKER,
                   70 WA_HBK_DATA-CUSTOMER,
                   90 WA_HBK_DATA-PRODUCT,
                   110 WA_HBK_DATA-R2S_QTY,
                   130 WA_HBK_DATA-dAM_QTY,
                   150 WA_HBK_DATA-DEST_QTY.
        ENDLOOP.
    ENDFORM.                    " DISP_HBK_DATA
    *&      Form  GET_HBK_DATA_R2S
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_HBK_DATA_R2S .
      SELECT HBK_ID
               DRIVER
               CHECKER
               CUSTOMER
               PRODUCT
               R2S_QTY FROM Z03_HBK_DATA INTO TABLE IT_HBK_DATA_R2S
        WHERE HBK_ID IN S_R2S.
    ENDFORM.                    " GET_HBK_DATA_R2S
    *&      Form  DISP_HBK_DATA_R2S
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISP_HBK_DATA_R2S .
    LOOP AT IT_HBK_DATA_R2S INTO WA_HBK_DATA_R2S.
          AT FIRST.
            WRITE: /10'HAULBACK NUMBER',
                    30 'DRIVER ID',
                    50 'CHECKER ID',
                    70 'CUSTOMER ID',
                    90 'PRODUCT',
                    110 'R2S QTY'.
            WRITE: /10 SY-ULINE.
          ENDAT.
          WRITE: /10 WA_hbk_data_R2S-HBK_ID,
                   30 WA_HBK_DATA_R2S-DRIVER,
                   50 WA_HBK_DATA_R2S-CHECKER,
                   70 WA_HBK_DATA_R2S-CUSTOMER,
                   90 WA_HBK_DATA_R2S-PRODUCT,
                   110 WA_HBK_DATA_R2S-R2S_QTY.
        ENDLOOP.
    ENDFORM.                    " DISP_HBK_DATA_R2S
    *&      Form  GET_HBK_DATA_DAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_HBK_DATA_DAM .
      SELECT HBK_ID
               DRIVER
               CHECKER
               CUSTOMER
               PRODUCT
               DAM_QTY FROM Z03_HBK_DATA INTO TABLE IT_HBK_DATA_DAM
        WHERE HBK_ID IN S_DAM.
    ENDFORM.                    " GET_HBK_DATA_DAM
    *&      Form  DISP_HBK_DATA_DAM
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISP_HBK_DATA_DAM .
    LOOP AT IT_HBK_DATA_DAM INTO WA_HBK_DATA_DAM.
          AT FIRST.
            WRITE: /10'HAULBACK NUMBER',
                    30 'DRIVER ID',
                    50 'CHECKER ID',
                    70 'CUSTOMER ID',
                    90 'PRODUCT',
                    130 'DAMAGED QTY'.
            WRITE: /10 SY-ULINE.
          ENDAT.
          WRITE: /10 WA_hbk_data_DAM-HBK_ID,
                   30 WA_HBK_DATA_DAM-DRIVER,
                   50 WA_HBK_DATA_DAM-CHECKER,
                   70 WA_HBK_DATA_DAM-CUSTOMER,
                   90 WA_HBK_DATA_DAM-PRODUCT,
                   130 WA_HBK_DATA_DAM-dAM_QTY.
        ENDLOOP.
    ENDFORM.                    " DISP_HBK_DATA_DAM
    *&      Form  GET_HBK_DATA_DEST
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_HBK_DATA_DEST .
      SELECT HBK_ID
               DRIVER
               CHECKER
               CUSTOMER
               PRODUCT
               DEST_QTY FROM Z03_HBK_DATA INTO TABLE IT_HBK_DATA_DEST
        WHERE HBK_ID IN S_DEST.
    ENDFORM.                    " GET_HBK_DATA_DEST
    *&      Form  DISP_HBK_DATA_DEST
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISP_HBK_DATA_DEST .
    LOOP AT IT_HBK_DATA_DEST INTO WA_HBK_DATA_DEST.
          AT FIRST.
            WRITE: /10'HAULBACK NUMBER',
                    30 'DRIVER ID',
                    50 'CHECKER ID',
                    70 'CUSTOMER ID',
                    90 'PRODUCT',
                    150 ' DESTROY QTY'.
            WRITE: /10 SY-ULINE.
          ENDAT.
          WRITE: /10 WA_hbk_data_DEST-HBK_ID,
                   30 WA_HBK_DATA_DEST-DRIVER,
                   50 WA_HBK_DATA_DEST-CHECKER,
                   70 WA_HBK_DATA_DEST-CUSTOMER,
                   90 WA_HBK_DATA_DEST-PRODUCT,
                   150 WA_HBK_DATA_DEST-DEST_QTY.
        ENDLOOP.
    ENDFORM.                    " DISP_HBK_DATA_DEST
    Thank you,
    Mike

    Michael, you can adopt your needs using different technologies. If you tried it using a table-control (with wizard), that is something, I do not recommend. Try searching for "editable ALV grid", which will show your editable data that you can always just take from your internal table and pass it to the INSERT / UPDATE / MODIFY statement. You will find it much easier to use during your progress.
    If you have more specific questions, go ahead and ask. But do not expect people will give you the whole code once you do not have the idea (that is the place where it comes to the learning part of it).

  • Help - Sampling Scheme

    Hello SAP Gurus,
    I have defined a Dynamic Modification Rule a Sampling Scheme and a Sampling Procedure to use in inspection plan.
    Everything is working fine but the Sample Size is always 0. In Results Recording (QA32) the inspection lot quantity and number os the materials to inspect is correct... but the sample size is 0! The sample size shoud be equal to the number of the materials to inspect, right?
    Heres is a picture of the sampling scheme:
    [http://picasaweb.google.pt/lh/photo/5sVXnGLRTCHgHU4Koionzw?feat=directlink]
    Here is the link for the inspection lot:
    [http://picasaweb.google.pt/lh/photo/8veDwWC-lwE20o0w-qeTEQ?feat=directlink]
    The inspection lot is for 10 UN so, acording to the sampling scheme, the sample is 3 UN.... but the sample field is 0.
    In the results recording is OK, here is an image:
    [http://picasaweb.google.pt/lh/photo/zH-_DjwFlDbw7iXJZXwXEA?feat=directlink]
    Thanks in advance,
    Adelmo Silva
    Edited by: Adelmo Silva on Oct 19, 2009 5:45 PM

    Hello SujitSND,
    The characteristic is mandatory and I have maintained the relation between Sampling Procedure and Dynamic Mod. Rule and still not working...
    I dont undestand what you mean by "Also have you used seviarity & AQL level same in DMR & SP"
    Thanks,

  • Help:sample code of collaborative session

    Hi, all
    I'm new to Java, I need sample code of how to develop a collaborative session, can any one give me a hand? Thanks
    Louis

    1) Learn Java
    2) Learn Java networking
    3) Examine, test, and study Java extensions
    4) Select appropriate Java extensions and environments
    5) Create requirements
    6) Create use cases
    7) Design system
    8) Implement design
    9) Test, test, test, test based on #5 and #6
    10) Fix and go back to #9
    11) Put it into production and cross your fingers that you didn't miss anything...
    I think that just about covers it.

  • Help sample code not working

    this code came from the adobe help manuals:
    on (press) {
    var myURL:String = "
    http://www.mysite/subscribe.cfm";
    getURL("javascript:openNewWindow('" + String(myURL) +
    I have inserted this code in the actions panel of a button
    and it is not working, at runtime when i click the button nothing
    happen, any idea why the new browser window is not opened?
    Dario

    already tested online but I get an 'error on page' in the
    browser window. it compiles without error but it just does not
    work, the page being called is on the servert too. I can't figure
    out what's wrong.

  • Question around UTL_FILE and writing unicode data to a file.

    Database version : 11.2.0.3.0
    NLS_CHARACTERSET : AL32UTF8
    OS : Red Hat Enterprise Linux Server release 6.3 (Santiago)
    I did not work with multiple language characters and manipulating them. So, the basic idea is to write UTF8 data as Unicode file using UTL_FILE. This is fairly an empty database and does not have any rows in at least the tables I am working on. First I inserted a row with English characters in the columns.
    I used utl_file.fopen_nchar to open and used utl_file.put_line_nchar to write it to the file on the Linux box. I open the file and I still see English characters (say "02CANMLKR001".
    Now, I updated the row with some columns having Chinese characters and ran the same script. It wrote the file. Now when I "vi" the file, I see "02CANè¹æ001" (some Unicode symbols in place of the Chinese characters and the regular English.
    When I FTP the file to windows and open it using notepad/notepad++ it still shows the Chinese characters. Using textpad, it shows ? in place of Chinese characters and the file properties say that the file is of type UNIX/UTF-8.
    My question : "Is my code working and writing the file in unicode? If not what are the required changes?" -- I know the question is little vague, but any questions/suggestions towards answering my question would really help.
    sample code:
    {pre}
    DECLARE
       l_file_handle   UTL_FILE.file_type;
       l_file_name     VARCHAR2 (50) := 'test.dat';
       l_rec           VARCHAR2 (250);
    BEGIN
       l_file_handle := UTL_FILE.fopen_nchar ('OUTPUT_DIR', l_file_name, 'W');
       SELECT col1 || col2 || col3 INTO l_rec FROM table_name;
       UTL_FILE.put_line_nchar (l_file_handle, l_rec);
       UTL_FILE.fclose (l_file_handle);
    END;
    {/pre}

    Regardless of what you think of my reply I'm trying to help you.
    I think you need to reread my reply because I can't find ANY relation at all between what I said and what you responded with.
    I wish things are the way you mentioned and followed text books.
    Nothing in my reply is related to 'text books' or some 'academic' approach to development. Strictly based on real-world experience of 25+ years.
    Unfortunately lot of real world projects kick off without complete information.
    No disagreement here - but totally irrevelant to anything I said.
    Till we get the complete information, it's better to work on the idea rather than wasting project hours. I don't think it can work that way. All we do is to lay a ground preparation, toy around multiple options for the actual coding even when we do not have the exact requirements.
    No disagreement here - but totally irrevelant to anything I said.
    And I think it's a good practice rather than waiting for complete information and pushing others.
    You can't just wait. But you also can't just go ahead on your own. You have to IMMEDIATELY 'push others' as soon as you discover any issues affecting your team's (or your) ability to meet the requirements. As I said above:
    Your problems are likely:
    1. lack of adequate requirements as to what the vendor really requires in terms of format and content
    2. lack of appropriate sample data - either you don't have the skill set to create it yourself or you haven't gotten any from someone else.
    3. lack of knowledge of the character sets involved to be able to create/conduct the proper tests
    If you discover something missing with the requirements (what character sets need to be used, what file format to use, whether BOMs are required in the file, etc) you simply MUST bring that to your manager's attention as soon as you suspect it might be an issue.
    It is your manager's job, not yours, to make sure you have the tools needed to do the job. One of those tools is the proper requirements. If there is ANYTHING wrong, or if you even THINK something is wrong with those requirements it is YOUR responsibility to notify your manager ASAP.
    Send them an email, leave a yellow-sticky on their desk but notify them. Nothing in what I just said says, or implies, that you should then just sit back and WAIT until that issue is resolved.
    If you know you will need sample data you MUST make sure the project plan includes SOME means to obtain sample data witihin the timeline needed by your project. As I repeated above if you don't have the skill set to create it yourself someone else will need to do it.
    I did not work with multiple language characters and manipulating them.
    Does your manager know that? If the project requires 'work with multiple language characters and manipulating them' someone on the project needs to have experience doing that. If your manager knows you don't have that experience but wants you to proceed anyway and/or won't provide any other resource that does have that experience that is ok. But that is the manager's responsibility and that needs to be documented. At a minimum you need to advise your manager (I prefer to do it with an email) along the following lines:
    Hey - manager person - As you know I have little or no experience to 'work with multiple language characters and manipulating them' and those skills are needed to properly implement and test that the requirements are met. Please let me know if such a resource can be made available.
    And I'm serious about that. Sometimes you have to make you manager do their job. That means you ALWAYS need to keep them advised of ANY issue that might affect the project. Once your manager is made aware of an issue it is then THEIR responsibility to deal with it. They may choose to ignore it, pretend they never heard about it or actually deal with it. But you will always be able to show that you notified them about it.
    Now, I updated the row with some columns having Chinese characters and ran the same script.
    Great - as long as you actually know Chinese that is; and how to work with Chinese characters in the context of a database character set, querying, creating files, etc.
    If you don't know Chinese or haven't actually worked with Chinese characters in that context then the project still needs a resource that does know it.
    You can't just try to bluff your way through something like character sets and code conversions. You either know what a BOM (byte order mark) is or you don't. You have either learned when BOMs are needed or you haven't.
    That said, we are in process of getting the information and sample data that we require.
    Good!
    Now make sure you have notified your manager of any 'holes' in the requirements and keep them up to date with any other issues that arise.
    NONE of the above suggests, or implies, that you should just sit back and wait until that is done. But any advice offered on the forums about specifics of your issue (such as whether you need to even worry about BOMs) is premature until the vendor or the requirements actually document the precise character set and file format needed.

  • Reg : txt Files in Server directory (UTL_FILE)

    Hi Experts,
    Suppose, I've placed 5 +.txt+ files (procedure/table creation scripts) in a db server directory.
    Is there any way I can loop through each of the files?
    I need to pull the content of each file into oracle table using a procedure. So, I'm trying dynamically trying to use External Tables with Execute Immediate inside my proc. Will package UTL_FILE help in this?
    Please give some suggestions.
    Let me know if you have any concerns.
    Ranit B.

    As an alternative solution, have you considered using external LOB's? Using this approach could save significant overhead vs. the external tables solution because it doesn't require any schema objects for accessing the txt files (if you use an SQL script instead of a stored procedure).
    http://docs.oracle.com/cd/B14117_01/appdev.101/b10796/adlob_bf.htm#1010878
    Below is an excerpt from the link the Oracle docs above; this could be used as a starting point. (Substitute your directory name/file name for the BFILENAME arguments.)
    /* This file is installed in the following path when you install */
    /* the database: $ORACLE_HOME/rdbms/demo/lobs/plsql/fdisplay.sql */
    /* Displaying BFILE data.  */
    /* Procedure displayBFILE_proc is not part of DBMS_LOB package: */
    CREATE OR REPLACE PROCEDURE displayBFILE_proc IS
       file_loc BFILE := BFILENAME('MEDIA_DIR', 'monitor_3060.txt');
       Buffer   RAW(1024);
       Amount   BINARY_INTEGER := 200;
       Position INTEGER        := 1;
    BEGIN
       DBMS_OUTPUT.PUT_LINE('------------ BFILE DISPLAY EXAMPLE ------------');
       /* Opening the BFILE: */
       DBMS_LOB.OPEN (file_loc, DBMS_LOB.LOB_READONLY);
       LOOP
          DBMS_LOB.READ (file_loc, Amount, Position, Buffer);
          /* Display the buffer contents: */
          DBMS_OUTPUT.PUT_LINE(substr(utl_raw.cast_to_varchar2(Buffer), 1, 250));
          Position := Position + Amount;
       END LOOP;
       /* Closing the BFILE: */
       DBMS_LOB.CLOSE (file_loc);
       EXCEPTION
       WHEN NO_DATA_FOUND THEN
          DBMS_OUTPUT.PUT_LINE('End of data');
    END;
    SHOW ERRORS;

  • Need help connect Access Database to Crystal Report Viewer in java

    Need example for passing parameters to PropertyBag Class and IConnectionInfo Class.
    We use CR_JRC_11.8
    Thanks

    A sample that demonstrates how to change the database that a report uses at runtime in the JRC can be found at the following link on the SAP Portal:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0ad3d3d-be66-2b10-2181-f46c6e05a420
    To help determine what connection properties need to be changed at runtime through code, create a copy of your original report and use the Crystal Reports designer to change this report to new datasource manually.  You can then use the  jrc_display_connection_info helper sample to examine what the parameters should be in the property bag before setting the IConnection information.  The jrc_display_connection_info helper sample can be found at the following link on the SAP Portal:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/706202a4-bd66-2b10-4e8b-92f4a8024ea1
    Hope these samples help.
    Regards.
    - Robert

  • JRC degraded performance, large reports using exportPDF of JRC sample code

    All,
    I am using JRC, Weblogic, and Oracle in order to dynamically create reports using Crystal.  The problem I am seeing is that for very large reports (e.g. 600K +), the performance degrades substantially. 
    There are not a lot of subreports, and I've narrowed it down that the queries are not taking significant amount of time to execute.  I'm using the JRC Helper Sample code, exportPDF call in order to create these reports.
    For small reports (e.g. < 40k) we are looking at a few seconds.  When we start executing the larger reports we are seeing them in 6-20+ minute range.
    Weblogic version is 8, jdk 1.4.
    Any suggestions?  We are not using stored procs, just straight JNDI/JDBC calls.
    Thank you for your time,
    Scott

    Hi Scott,
    I recommend to put this question in our [Java dev f|Java SDK Application Development;orum
    Best regards
    Falk

  • Need help for a quey

    I want to select columns from a table. Also I need one more record '-1' with the result. I should not use oracle specific keywords like rownum,Dual etc.. since we
    will be using the query with all DB types.
    create table test(a varchar(10));
    Insert into test values ('sample');
    I want a query which will give output result as ( NO DUAL,ROWNUM Or Oracle specific keywords) Can someone help
    'sample'
    '-1'

    user3745497 wrote:
    Thanks
    Decode is not there but case expression is in DB2. Problem is we have a product which supports Db2,Oracle,DB2AS400,SQLServer. we will form the string and execute through java.
    With Clause is not present in all DB's
    Is it possible without using any keywords to get the resultset? If not possible, we have to think of other possible choice.
    Thanks for your answers. It was helpful.
    Edited by: user3745497 on Sep 24, 2010 12:33 PMAny time you try to write an app that will work across all dbms's without having to be aware of the dbms .... you are committing to write a very poor and buggy app. This is not far removed from trying to write an app that will run on all flavors of *nix, Windows, VMS and Z/OS.  There are just too many underlying differences to pull it off.
    Even Oracle itself, with the impressive number of OS's they've supported (and continue to support) has to write a certain amount of code that is OS specific. Writing for the dbms is no different, just a layer of abstraction further away from the silicon.

Maybe you are looking for

  • Tax error while posting an invoice in SRM

    We are using SRM 5.5 SP4, ECS and ECC 6.0. We are using vertex for tax caluculation and we configured the tax calculation to always occur in ECC. One more important point is, client has decided to use invoicing in SRM. Now the problem is we ran in to

  • How to create a local EJB 3.0 and execute in JDeveloper?

    Hello guys! I'm brand new with EJB 3.0. I would like to know how can I create a @Local EJB and a client in JDeveloper? It's was ease to create a @Remote EJB and the sample java client, how can I do same to @Local EJB? I'm using JDeveloper 10.1.3.1.0.

  • [SOLVED] Upgraded to GRUB2, none of the menu choices are bootable

    So I installed Arch a few days ago and I've been loving it so far... however, when it installed GRUB (not GRUB 2), it failed to detect my Windows 7 installation. I couldn't get GRUB (1) to detect it at all, so I decided to try installing GRUB 2. It i

  • What is IP address? trying to connect to wi-fi network.

    typed in my wi-fi network (FIOS).  it's still searching for the network, i guess... was instructed that the next thing to do would be to input password.  I am not seeing a place to input a password.  Confused and frustrated.

  • Query from Distributed Cache

    Hi I am newbie to Oracle Coherence and trying to get a hands on experience by running a example (coherence-example-distributedload.zip) (Coherence GE 3.6.1). I am running two instances of server . After this I ran "load.cmd" to distribute data across