How to assign the output of a function to a text area: a PLSQL challenge

I have a function that returns a PLSQL table of varchar4(4000)
Here is its signature in a package:
create or replace package researcher_request_pk
is
TYPE query_table_type is table of varchar2(4000) index by binary_integer;
FUNCTION RequestSQL(P_RRQ_ID in number) return query_table_type;
end;
I use this to get around the 32k limit on clobs and varchar2 variables
I want to assign the output of the function to a text area. I've tried the following PLSQL in a dynamic action and also as the source attribute of the Text Area but it doesn't populate the text area.
Here is the code i'm using
declare
v_table researcher_request_pk.query_table_type;
begin
v_table:=researcher_request_pk.RequestSQL(:P64_RRQ_ID);
for i in 1..v_table.count loop
htp.prn(v_table(i));
end loop;
end;
Any ideas on the correct syntax to do this?
thanks in advance
PaulP

Thanks for your reply
The function does populate the PLSQL table with data. e.g. If I place that exact code in a PLSQL region it generates the output on the screen with no problems. The problem is just generating the output into the text area.
I want the text area to display the output of the PLSQL table (-a dynamic select SQL statement) which I then plan to execute to return records.( i.e. I've build my own runtime query builder)
My plan is to allow the user to edit the SQL output first before sending the statement for execution.
Funnily enough I do get the very first word of the first cell appearing, namely 'SELECT' but nothing else. Maybe the "||" that follows has something to do with the rest of it not appearing?? hmmm... will experiment more.
thanks
PaulP

Similar Messages

  • How to break the output in a function

    Hi All,
    I am using oracle Db 10g
    I have write a function to get the output of Expire date and pass this function to Alert in oracle.
    My Function is Like this
    create or replace
    function Expiry_alert (P_EXPIRY_DATE date)
    return VARCHAR2
    IS
    lv_return_value varchar2(10000);
    cursor c_exp_alt
    is
    SELECT Distinct c_po_number,c_bg_type,c_guarantee_number,c_expiry_date,c_supplier_name
    from xxbgs_bank_guarantee_master
    WHERE TRUNC (TO_DATE (C_expiry_date) -15) = TRIM (SYSDATE)
    and c_expiry_date= p_expiry_date;
    BEGIN
    for c_exp_alt_rec in c_exp_alt
    loop
    lv_return_value:= lv_return_Value||CHR(10)||'Bank Guarantee('||c_exp_alt_rec.C_guarantee_number||','||c_exp_alt_rec.C_BG_TYPE ||','||c_exp_alt_rec.C_po_number||','||c_exp_alt_rec.c_supplier_name ||')'||'is getting expired on'||'('||C_EXP_ALT_REC.C_EXPIRY_DATE||')'||;
    end loop;
    return(lv_return_value);
    exception
    when others then
    null;
    --dbms_output.put_line ('Error:'sqlerrm);
    --return(lv_return_value);
    END;
    When i execute the function using select statement like this
    SELECT distinct Expiry_alert(C_EXPIRY_DATE)
    FROM xxbgs_bank_guarantee_master
    WHERE TRUNC (TO_DATE (C_expiry_date)-15) =
    TRIM (SYSDATE)
    My output is like this
    Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12) Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
    In a single line, But here i have two different Guarantee number so i need two records like this
    Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12)
    Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
    Can any one pls tell me how to change the function to achieve this.
    Regards
    Srikanth
    Edited by: Srikkanth.M on Feb 16, 2012 4:41 PM

    Srikkanth.M wrote:
    Hi All,
    I am using oracle Db 10g
    I have write a function to get the output of Expire date and pass this function to Alert in oracle.
    My Function is Like this
    .. snip ..
    exception
    when others then
    null;
    Seriously? Your function contains an exception handler to mask any and all errors that may occur? WHY?
    When i execute the function using select statement like this
    SELECT distinct Expiry_alert(C_EXPIRY_DATE)
    FROM xxbgs_bank_guarantee_master
    WHERE TRUNC (TO_DATE (C_expiry_date)-15) =
    TRIM (SYSDATE)
    My output is like this
    Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12) Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
    In a single line, But here i have two different Guarantee number so i need two records like this
    Bank Guarantee(100012,Parent Company Guarantee,1000,Advantage Corp)is getting expired on(02-MAR-12)
    Bank Guarantee(123890,Advance Bank Guarantee,1011,Office Supplies, Inc.)is getting expired on(02-MAR-12)
    Can any one pls tell me how to change the function to achieve this.Sounds like you need a pipelined function to return multiple rows...
    Basic example of pipelined function with multiple columns...
    CREATE OR REPLACE TYPE myrec AS OBJECT
    ( col1   VARCHAR2(10),
      col2   VARCHAR2(10)
    CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
    CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      v_obj myrec := myrec(NULL,NULL);
    BEGIN
      LOOP
        EXIT WHEN v_str IS NULL;
        v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
        IF INSTR(v_str,',')>0 THEN
          v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
          v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
        ELSE
          v_obj.col2 := v_str;
          v_str := NULL;
        END IF;
        PIPE ROW (v_obj);
      END LOOP;
      RETURN;
    END;
    SQL> select *
      2  from table(pipedata('(1,2),(3,4),(5,6)'));
    COL1       COL2
    1          2
    3          4
    5          6of course why you need to do this in a function in the first place? Can't you just query the data concatenated as you want it?

  • Assigning the output  type to the shipment number

    hello,
    can any one tell me how to assign the output type to the shipment number.
    Ex: ALTR to all my shipment numbers. By default, its taking other output types.
    Thanks in advance.

    Hello!
    Please check which output-types for shipment have been maintained in transaction code VV7x (Output-Condition Records).
    Menu path: Logistics -> Sales and Distribution -> Master Data -> Output -> Shipment
      - VV71 - Create
      - VV72 - Change
      - VV73 - Display
    Or go to customizing (TCode: SPRO) to verify how they have been maintained:
    Menu path: IMG -> Logistics Execution -> Transportation -> Basic Transportation Functions -> Output Control -> Maintain Output Determination for Shipments
    Regards.

  • How to assign an output type to a document via ABAP

    Hello Guru's
    I have an interface with a 3rd party system to send information from deliveries. When a delivery is created, we trigger output with 'Post goods issue' and output triggers the interface.
    We need to also trigger output with 'reverse goods issue' and here is the problem. When GI is cancelled I don't know how to trigger the interface having the control from Sales not from MM.
    I'm thinking to use the same approach assigning an output to the delivery in a user-exit of GI cancellation process. But I don't know how to assign this output to a delivery document using ABAP. I have looked for BAPI's or Functions but no successful.
    - Do you know how to assign outputs to documents via ABAP?
    - Do you have any other idea to trigger the interface when GI is cancelled?
    Thank you in advance,
    Manuel

    Hi,
    Guess u need to maintain it in SPAD transaction.
    Cheers
    VJ

  • How to download the output of a report along with column header

    Hi,
    Could someone please tell me on how to download the output of a report along with column header to .txt format. A download option needs to be given to the user using physical and logical file names .The report basically contains header details and item details and requirement is to download the same format into an .txt format.

    Hello,
    Try this FM:
    Data: being of itab occurs 0,
    matnr like mara-matnr,
    maktx like makt-maktx,
    end of itab.
    data:begin of fld_tab occurs 0,
    fld_name(20),
    end of fld_tab.
    fld_tab = 'Material'.
    append fld_tab.
    fld_tab = 'Material Desc'.
    append fld_tab.
    CALL FUNCTION 'WS_DOWNLOAD'
       EXPORTING
            BIN_FILESIZE            = ' '
            CODEPAGE                = ' '
             FILENAME                = 'C:\1.txt '
             FILETYPE                = 'DAT'
            MODE                    = ' '
            WK1_N_FORMAT            = ' '
            WK1_N_SIZE              = ' '
            WK1_T_FORMAT            = ' '
            WK1_T_SIZE              = ' '
            COL_SELECT              = ' '
            COL_SELECTMASK          = ' '
            NO_AUTH_CHECK           = ' '
       IMPORTING
            FILELENGTH              =
         TABLES
              DATA_TAB                = itab
              FIELDNAMES              = fld_tab
       EXCEPTIONS
            FILE_OPEN_ERROR         = 1
            FILE_WRITE_ERROR        = 2
            INVALID_FILESIZE        = 3
            INVALID_TYPE            = 4
            NO_BATCH                = 5
            UNKNOWN_ERROR           = 6
            INVALID_TABLE_WIDTH     = 7
            GUI_REFUSE_FILETRANSFER = 8
            CUSTOMER_ERROR          = 9
            OTHERS                  = 10
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Regards,
    Naimesh

  • How to Assigning the number ranges for Purchase Order using EXIT_SAPMM06E_0

    How to Assigning the number ranges for Purchase Order using EXIT_SAPMM06E_001 using Functional Module NUMBER_GET_NEXT explain me ?

    Hi,
    First go thourh the FM import export parameters list.
    Try to create an internal table of type INRI-NRRANGENR for number ranges.
    We can provide the lower and higher values for this table so that what ever PO is created will be with that range.
    Try to create the ncessary ones using this FM.
    In the Exit, EXIT_SAPMM06E_001,
    the Export parameters are-
    EKKO-EBELN- the PO ios created with in that specified range
    Range as INRI-NRRANGENR - Here try to assign the Internal table that was populated in the FM.
    Try to code this in the Include provded and keep Breakpint and check the PO number generated.
    Reply if u need more help on this.
    Reward if helpful.
    Best Wishes,
    Chandralekha

  • How to get the output of my batch file or script file

    Hello,
    I am a beginner in java and I have to run a batch file(in win) or a script(in linux). I want the output of the file in my java program. How to read the output. I used the following code and it always gave me the empty string output
    Runtime r = Runtime.getRuntime();
    Process p = null;
    p = r.exec("./test.bat"); //./test.sh
    int res = p.waitFor();
    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String tempStr = "", str = null;
    while((str=br.readLine()) != null) {
    tempStr += str + "\n";
    System.out.println(tempStr);
    I know this is a simple one but it's taking a lot of time. Can any one there help me quickly.

    hi
    the below function works well for me..
    just make a try with it
    protected String runConsoleCommand(String command) throws IOException {
    Process p = Runtime.getRuntime().exec(command);
    InputStream stdoutStream = new BufferedInputStream(p.getInputStream());
    StringBuffer buffer = new StringBuffer();
    for (; ; ) {
    int c = stdoutStream.read();
    if (c == -1)
    break;
    buffer.append( (char) c);
    String outputText = buffer.toString();
    stdoutStream.close();
    System.out.println("the output to file is:"+outputText);
    return outputText;

  • How to send the output of one step as input to next step

    Hello All,
                   I have a question that how to send the output of the first step as the input to the next step.
     for e.g
                  consider a test sequence as below,
      1.battery ON.
      2. read Voltage
      3. Check battery voltage.
     as initially the battery gets ON when ever the test starts. in the second step it reads the voltage. let us assume that the voltage is 11.5V,
    in the third step we r checking/validating that battery voltage in the range 11V to 12 V. . I mean if the vloltage value is  less than 11V or greater than 12V te test has to FAIL.
     so in order to check that voltage we need to send the voltage read from the second step.
    so how can I send the voltage read from the second step to the third step so that I can check the battery voltage test.
    kindly suggest me this using LabVIEW/Test stand.

    Hi,
    Why do you need the third step, if the second step is a Numeric Limit Test step type, you can setup the limits of this step for your required limits of 11V and 12V. Your result is returned from your VI to Step.Results.Numeric which will be evaluated in the Status Expression giving you a Pass / Fail status.
    Look at the example TestStand\examples\demo\..\Computer Motherboard Test\computer.seq
    But to answer your reoriginal question, some additional information is required.
    What are your inputs and outputs assigned to in TestStand, do you use the Step properties, Locals, FileGlobals?
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • How to assign an output type to an Output Device?

    How to assign an output type to an Output Device?
    I'm using SSF_GET_DEVICE_TYPE to get the device type. But for that device type there is no output device configured. How to do that one. I'm getting the output type as PDF1.
    Please help me.

    Hi,
    Guess u need to maintain it in SPAD transaction.
    Cheers
    VJ

  • Sap isu-cic(how to check the output)

    HI to all......
    In isu-cic  how to check the output,i have done all the assign ments like framewrk creation etc...i defined the organizational structure with assign hoder...after that wats the next steps?
    can anybody plz reply....
    Cheers..
    sateesh

    Hello satish
    Step 1:
    Create Framework Id( assign hidden & visible components)
    Step 2: Create CIC profile
    Step 3: create Org unit and assign person
    Step 4: Assign CIC profile to Org. unit (or) person
    Path : Easy access screen
              Logistics>Customer service>Customer Interaction center>Adminstration>CIC structure>Org.Structure(Change,T.code-PPOMW)>select Org. unit
    In this screen on the top i.e menu bar find Go To
    Go To>detail Object>Enchanced object description
    Now u r in Maintain object page(T code-PP01)
    Now in the Active tab page select CIC profile
    Now in menu bar Edit>create infotype
    Again u r in new page(T code-PP01)
    Enter the CIC profile Id which u have created in customizing
    Run T code- CIC0
    I hope u r able to see the screen now
    Rgds
    Madhusudhan

  • Storing the output of a function module into a custom table

    Hi Gurus,
    Is it possible to store the output of a function module into a custom table.How can this be done?Is it complex?

    hi,
    After u execute the FM and get values in the internal table ITAB_RESULT. Create a custom table having structure same as ITAB_RESULT call it ZRESULT.
    data :wa type ITAB_RESULT.
    call FM and get result it ITAB_RESULT
    loop at itab_result.
    move-corresponding itab_result to wa.
    insert wa to ZRESULT.
    endloop.
    Regards,
    Mansi.

  • How to assign the budget to maintenance order

    Dear PM Guru's,
    I like to know the how to assign the budget for a maintenance order. how we control the expenses from a maintenance order. suppose for a small work manangement assigns budget as 2lacs. now i like to restrict if any thing purchased once budget reached to 2lacs system should populates the error message to restrict the creation of Purchase orders / material requisitions and some other issues. Please suggest me how i can map in SAP? if any one have full documentatioin regard this please send through mail.
    thanks in advance to all of PM Guru's.
    regards
    Jalu

    Hi,
    There are different approaches for budget control in PM orders.
    1) Option1: In koab transaction maintain commitment managemen active and in budget profile (oioa) you must tick total values ,annual values,activation type should be 1-automatic activated when budget allocation done. Then distribute budget in PM order through KO22.
    2) Option2:You can also opt for Investment management approach but it is mainly done in case of capital work/projects/internal orders. In this approach you need to activate IM for orders(done by CO people). Investment programs are created and budget distributed through IM52. For details you may consult your FICO consulatnt.
    3) Option3: Fund Management approach enables you to monitor budget-relevant plant maintenance processes. enables you to monitor budget-relevant plant maintenance processes in FM.
    The link between the plant maintenance process and FM is established by entering an FM account assignment (commitment item, funds center, and fund) when you create a plant maintenance order.
    You have to enter the FM account assignment manually. If, however, you have maintained the assignments of FM account assignments to CO account assignments, the system determines the FM account assignment from the cost center of the technical object (functional location, equipment) which is assigned to the plant maintenance order.
    FM takes care of budget related processes from creation of maintenance order till settlement.
    Hope this helps you to decide an appropiate approach.
    Regards,
    S.Basu
    Edited by: S Basu on Nov 10, 2011 5:34 PM
    Edited by: S Basu on Nov 10, 2011 5:34 PM

  • How to store the output of a analog to digital converter into an 2D array

    Hi
    I am doing my M.Tech Thesis in Image reconstruction and I am using labview for simulation and I want to know how to store the output of a analog to digital converter into an 2D labview array.

    nitinkajay wrote:
    I want to know how to store the output of a analog to digital converter into an 2D labview array.
    How exactly are you performing 'Analog to Digital'???
    Grabbing image using camera OR performing data acquisition using DAQ card OR some other way????
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.

  • How to use the Output clause for the updated statment

    How to use the output clause for the below update stament,
    DECLARE @MyTableVar table(
        sname int NOT NULL)
    update A set stat ='USED' 
    from (select top 1 * from #A 
    where stat='AVAILABLE' order by sno)A
    Output inserted.sname
    INTO @MyTableVar;
    SELECT sname
    FROM @MyTableVar;
    Here am getting one error incorrect syntax near Output
    i want to return the updated value from output clause

    see
    http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to change the output as text format in Apps R12.1.3

    Hi All,
    Currently iam trying to modify the Java Concurrent Program (FDExtractAndFormatting) in Batch Payment Process. This Program is generated in text format in 11i APPS. Now we are upgrading to R12.1.3. In R12.1.3 output is coming as PDF format. Here my requirement is how to change the output as text format in R12.1.3 also.
    Please do the needful and suggest me.
    Regards,
    Jagadeesh

    1. It is seeded java concurrent program. Some attributes are missing from 11i to R12. In 11i it is a text format.So i have to investgate on how to retrive those attributes in R12. What is the concurrent program name?
    Have you tried to change the output and submit the request?
    2. Once all are attributes are coming in PDF format. Client wants to open same output in text format as it is 11i (In R12 it is generated in PDF format).If the above does not help, please log a SR.
    Thanks,
    Hussein

Maybe you are looking for