What this function does: AIB3_EVALUATE_ODS_ASSIGN in PS/IM?

Dear all,
I'm investigating for the possible cause of data lost in transit in PS/IM area. The suspect currently is an update rule involving a function AIB3_EVALUATE_ODS_ASSIGN, as based on its E_SUBRC output value a record is skipped or not. Though I'm working with Z-objects now, this turns to be a part of Business Content as well.
Does anyone has an idea what is the logic of that function? SAP doesn't provide any documentation on that, so the only option I have at the moment is to play with that blackbox...
Cheers!
/RB

I'm not worried about race conditions, as evaluation of the expression takes place as the last thing before the new execution is started. It must either be done just before the SequenceCall, or as the first thing in the Setup group of the subsequence.
It's fragile to modify the expression at runtime to mimic a different context (by replacing stuff like "Locals." with "RunState.Caller.Locals." for instance, if they were in the same callstack), since such string replacement could never be exhaustive. What about "Step."? What about constructs like ("L" & "ocals.")? I could never identify them all.
I could split the expression up in two, like this (evaluated in the subsequence):
Evaluate("Locals." + Locals.TargetName) = Evaluate("RunState.Caller.Locals.SourceName")
The above works if Locals.SourceName was in the caller context, but my problem is a bit more complex than that; I need the right hand side to evaluate any expression string, and I need to supply a context to do it within. It's too fragile to string-replace "Locals." with "RunState.Caller.Locals." etc., as the expression might contain "Parameters.", "FileGlobals.", or much more complex access patterns from the caller context.
One way would be to make a new expression object and use Expression.Evaluate(context,evaloptions) on that in the subsequence, with context passed from the caller, but how do I make and pass an expression object to the sequence in which to set the TargetName local variable? It has something to do with Engine.NewExpression, but where do I store this expression object in the caller? And how do I set its Text property to "Locals.SourceName" (in this particular example, but remember it could be any expression)? And finally how do I pass this expression object to the subsequence via a parameter (what type should the parameter be)?
Cheers,
Steen
CLA, CTA, CLED & LabVIEW Champion

Similar Messages

  • How to use "url.openStream()" . What this function does?

    how to use "url.openStream()" . What this function does?
    Edited by: sahil1287 on Apr 16, 2009 10:02 PM

    http://java.sun.com/javase/6/docs/api/java/net/URL.html#openStream()
    http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html

  • Helper.eventURL( , , ) in MAM CODE - What this function does ??

    Hi all,
    Following are few code lines from MAM code :
    // this is in common.inc"
    <jsp:useBean id="helper"
        class="com.sap.mbs.core.web.ViewHelper" scope="request"/>
    String allOrderURL = helper.eventURL("onOrderList", "orderListType", "ALL_ORDERS");
    helper.getApplicationURL()
    Could anyone please tell what this eventURL ,getApplicationURL methods are for ?
    I couldnt find any documentation that explains it.
    Regards,
    Vipin

    Hello Vipin.
    Jo is rite.
    The class is abstract but the class which is used to create the bean is the implementation class:
    <b>DefaultViewHelper</b>
    This is the implementation of the abstract class ViewHelper.
    The ViewHelper is used to create URLs which are used to load a new page with our without submitting a form.
    You can use eventURL to build an URL for a link you want to create (JO's example).
    You can use submitEventURL in order to submit your form.
    This method builds a call to a JavaScript method.
    You can find this method in the file:
    app-root/include/common.inc
    function submitURL(url).
    This function uses url as action for the submit.
    So if you use something like this:
    onClick="<%=helper.submitEventURL("onOK")%>"
    all the form content is written to the context and the onOK method of the corresponding controller class is called. You can get the form content using the context in this controller method then.
    When I started working with MAM I was also confused about the mbs.core Framework.
    Read this maybe it helps:
    SAP MAU MVC
    Best regards,
    Sascha
    Message was edited by: Sascha Dingeldey

  • Any idea what this function is meant for?

    DB version:10gR2
    Have you guys any idea what this function does?
    create or replace function separate_1
        in_list varchar2,
        in_del varchar2 := ','
    ) return split_tbl pipelined
    is
        l_idx    pls_integer;
        l_list    varchar2(32767) := in_list;
        l_value    varchar2(32767);
    begin
        loop
            l_idx := instr(l_list,in_del);
            if l_idx > 0 then
                pipe row(substr(l_list,1,l_idx-1));
                l_list := substr(l_list,l_idx+length(in_del));
            else
                pipe row(l_list);
                exit;
            end if;
        end loop;
        return;
    end separate_1;The comment for this functions says that this is used to split a string delimited by a comma separator. But i didn't understand this function. Can this functionality be achieved without a table function?

    user10450365 wrote:
    DB version:10gR2
    Have you guys any idea what this function does?Odd that. Apart from a couple of parameter name changes it looks almost identical to a function I posted a couple of years back...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK

  • Can you tell me what this code does?

    Can you tell me what this code does?
    import java.io.*;
    class Assignment1
    public static String[][] tdi = {     {"Paris", "418", "Rome", "55"},
                             {"Liverpool", "121", "Copenhagen", "35"},
                             {"Liverpool", "418", "Paris", "50"},
                             {"Liverpool", "553", "Frankfurt", "55"},
                             {"Frankfurt", "553", "Budapest", "50"},
                             {"Amsterdam", "121", "Madrid", "65"},
                             {"Amsterdam", "418", "Paris", "35"},
                             {"Madrid", "121", "Stockholm", "90"},
                             {"Budapest", "553", "Warsaw", "30"},
                             {"Copenhagen", "121", "Amsterdam", "35"},
                             {"Rome", "418", "Amsterdam", "60"},
    //--Start Method--
    public static void main( String args[] ) throws IOException
    System.out.println("Welcome to NoWings Airline.");
    InputStreamReader input = new InputStreamReader(System.in);
    BufferedReader keyboardInput = new BufferedReader(input);
    System.out.println("Please enter the airport you wish to depart from:");
    String[] info = TDIDLL.searchDest( keyboardInput.readLine() );
    if (info == null)
    System.out.println("Sorry, no plane to this destination");
    else
    System.out.println(info[0]+" departing at platform "+info[1]); }}
    public static String[] searchDest( String dest )
    String[] result = null;
    for(int i = 0; i < tdi.length; i++)
         if (tdi[1].equals(dest)) {
         result = new String[2];
         result[0] = tdi[i][0];
         result[1] = tdi[i][2];
         return result;
    return result; }
    // Info Method //
    // Fly Method //
    // Exit Method //
    Thanks. Also, can you tell me where I have gone wrong in the code.
    Much appreciated.

    Can you tell me what this code does?Why don't you run it and find out for yourself?

  • What this code does ?

    what this code does ?
    System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

    i am studying this code....
    //Verify the hostname, check all trusted cetifcates and install them in the machine
                             com.sun.net.ssl.HostnameVerifier ver = new com.sun.net.ssl.HostnameVerifier(){
                                  public boolean verify(String urlHostname,String certHostname)
                                       try
                                                                {  return true;
                                       } catch(Exception x){ return true; }
                             javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[]{
                                  new javax.net.ssl.X509TrustManager() {
                                       public java.security.cert.X509Certificate[] getAcceptedIssuers() {
                                            return null;
                                       public void checkClientTrusted(
                                            java.security.cert.X509Certificate[] certs, String authType) {
                                       public void checkServerTrusted(
                                            java.security.cert.X509Certificate[] certs, String authType) {
                             // Install the all-trusting trust manager
                             try {
                                  javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
                                  sc.init(null, trustAllCerts, new java.security.SecureRandom());
                                  HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
                                  sc=null;
                             } catch (Exception e) {
                                  e.printStackTrace();
                             //Setting the defaultHost name verfier set by the user for communication
                             HttpsURLConnection.setDefaultHostnameVerifier(ver);/**/please note the bold colored code from the above i.e
    HttpsURLConnection.setDefaultHostnameVerifier(ver);
    so, ver instance has been presented to the setDefaultHostnameVerifier . fine....but who is calling the methods verify() which is described in the implemented Annoynymous interface HostnameVerifier .
    who is calling that overridden method verify() ?
    similarly, who is calling getAcceptedIssuers() method?
    I DONT see any invocation of these overridden methods .
    are these methods are FRAUD and BUGGY...and are not needed in this code....are they redundant ?
    OR are these methods are invoked by the HttpsURLConnection internally somehow....
    confused about the functionng of this code.
    thanks for the time

  • What this one does?

    I tried http://kuba.zilp.pl/?id=1, and don't understand the statement " ADFUtils.executeOperation("downloadingPageDef", "Execute");". What this one does?
    Thanks in advance!, I am using jdeveloper 10g.
    Rgds!

    xsyang wrote:
    I tried http://kuba.zilp.pl/?id=1, and don't understand the statement " ADFUtils.executeOperation("downloadingPageDef", "Execute");". What this one does?
    Thanks in advance!, I am using jdeveloper 10g.
    ADFUtils is a utility helper class for usage in the ViewController. I am not familiar with the specific 10g version of executeOperation() method but it seems to be used to execute a method binding. In this case the method binding is called Execute and is bound in the downloadingPageDef page definition file.
    Searching the forum will yield these results:
    http://forums.oracle.com/forums/search.jspa?objID=f83&q=ADFUtils

  • Where/how can i find out what this is doing

    I know this old but not concerned with that, just what is it doing,  this is java script in an .asp that loads
    a flash application, I'm most concerned/interested
    why it references a clsid?
    what is the code base all about? (is this embedding code in the browser? it does the embed everytime the app is loaded?)
    what is the PLUGINSPAGE?
    how does all this affect the opertion of the flash apps that run after this initializtion?
    this is kinda/somewhat/ normal for anytime /anyone running a flash app?
    It seems there's a lot going here, if too much to answer please just point me somewhere where i can RTFM, but
    please make it a good RTFM not a FWOT!!!
    flName = "default-app.swf"
    document.write('<OBJECT'
             + ' CLASSID=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
             + ' CODEBASE=":http//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0 ,79,0"'
             + ' ID="flash"'
             + ' WIDTH=' + flWidth
             + ' HEIGHT=' + flHeight + '>'
             + '<PARAM NAME=movie VALUE="' + flName + cookString + '">'
             + '<PARAM NAME=menu VALUE="false">'
             + '<PARAM NAME=quality VALUE=high>'
              etc more params
             finally
             + ' TYPE="application/x-shockwave-flash"'
             + ' PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
             + '</EMBED></OBJECT>'

    that's standard flash embedding code with variable swf name, width and height.

  • Can anyone tell me what this is doing

    hey this is part of some parser code from an earlier java forum post
    http://forum.java.sun.com/thread.jspa?threadID=506162&messageID=2399163#239 9163
    i modified the code slightly to work with my program which involves its use in an applet and to solve logical equations. However i'm still uncertain as to what certain sections of the code are doing
    i know that this code evaluates the variables within the given equation, begins a for loop that does not exit until i = codeSize which is the length of the given String. However i'm not so certain as to how it achieves this. I'd like to know
    private int eval(int variableX, int variableY, int variableZ)
                    try {
                            int top = 0;
                            for (int i = 0; i < codeSize; i++)
                                    if (code[i] >= 0)
                                            stack[top++] = constants[code];
    else if (code[i] >= POWER)
    int y = stack[--top];
    int x = stack[--top];
    int ans = (int)Double.NaN;
    switch (code[i])
    case PLUS: ans = x | y; break;
    case MINUS: ans = x & y; break;
    case TIMES: ans = x & y; break;
    case DIVIDE: ans = x / y; break;
    // case POWER: ans = Math.pow(x,y); break;
    if (Double.isNaN(ans))
    return ans;
    stack[top++] = ans;
    else if (code[i] == VARIABLEX)
    stack[top++] = variableX;
    else if (code[i] == VARIABLEY)
    stack[top++] = variableY;
    else if(code[i] == VARIABLEZ)
    stack[top++] = variableZ;
    /* else {
    double x = stack[--top];
    double ans = Double.NaN;
    int d;
    d = (int) ans;
    switch (code[i])
    case SIN: ans = Math.sin(x); break;
    case COS: ans = Math.cos(x); break;
    case TAN: ans = Math.tan(x); break;
    case COT: ans = Math.cos(x)/Math.sin(x); break;
    case SEC: ans = 1.0/Math.cos(x); break;
    case CSC: ans = 1.0/Math.sin(x); break;
    case ARCSIN: if (Math.abs(x) <= 1.0) ans = Math.asin(x); break;
    case ARCCOS: if (Math.abs(x) <= 1.0) ans = Math.acos(x); break;
    case ARCTAN: ans = Math.atan(x); break;
    case EXP: ans = Math.exp(x); break;
    case LN: if (x > 0.0) ans = Math.log(x); break;
    case LOG2: if (x > 0.0) ans = Math.log(x)/Math.log(2); break;
    case LOG10: if (x > 0.0) ans = Math.log(x)/Math.log(10); break;
    case ABS: ans = Math.abs(x); break;
    case SQRT: if (x >= 0.0) ans = Math.sqrt(x); break;
    case UNARYMINUS: ans = -x; break;
    if (Double.isNaN(ans))
    return d;
    stack[top++] = d;
    catch (Exception e)
    double b = Double.NaN;
    int i = (int)b;
    return i;
    } double d2;
    if (Double.isInfinite(stack[0]))
    d2 = Double.NaN;
    int i2 = (int) d2;
    return i2;
    }else
    return stack[0];
    any help much appreciated
    cheers
    podger

    Well this is a very basic interpreter. What this piece of code does is:
    1) take an opcode from the code array, and retrieves the description for it from the constants array. This description is stored in the stack array.
    stack[top++] = constants[code];
    2) check what opcode it is
    switch (code)
    3) "execute" the opcode with simple java math operators.
    case PLUS:    ans = x | y;  break;
    case MINUS:   ans = x & y;  break;
    case TIMES:   ans = x & y;  break;
    case DIVIDE:  ans = x / y;  break;4) store the result of the opcode in the stack array, after the description of the opcode retrieved in step 1)
    stack[top++] = ans;There is also some sort of error check in there: initially the result of the opcode is "NaN", (not a number). If the opcode passed to this code is not known, the result is not added to the stack according to this piece of code:
    if (Double.isNaN(ans))
    return ans;

  • What this method does ?

    Q1.
    boolean isInterface()
              Determines if the specified Class object represents an interface type. what this method means ?
    Look it is saying "....object represents an interface type.. But an interface can not refer objects unless it is implemented by some concrete class.
    is there any polymorphism involved(i guess) ?
    i mean like this ......
    interface ABC
    // blah
    class CDE implements ABC
    // defined everything here
    ABC s = new CDE(); // it is legal
    does this method relates to this ?
    Am i right ? However code below is not comfortable.........
    Q2:
    Here is the code i stumbled................ It usues that method.
    Description: Determining If a Class Object Represents a Class or Interface
    Code:
    Class cls = java.lang.String.class; // Line-1.....is it valid !!!!
    boolean isClass = !cls.isInterface(); // true
    cls = java.lang.Cloneable.class; 
    isClass = !cls.isInterface(); // falseLook at Line-1.................i dont see any heirchy down the String class in the API.....( java.lang.String.class .....is it valid ? yes that bold .class !! ) its a peculiar use of String class !!.
    can anybody explain what is happening here. what reference who calls ?
    Thank you

    good explanation indeed.
    Look ur comment
    // By way of a string........why String ? why
    do i hardcode
    Class.forName("java.lang.String");......there
    are lots of Classes in the API who extends Object
    class.
    Look
    cls = java.lang.String.class // again u have
    hardcoded String class !!!
    It seems to me i need to hardcode always with
    String class( right ? no other class can be
    usued !!) to get the Class or Inteface type out of
    object.No, you can do it for any class: Class c1 = List.class;
    Class c2 = new List().getClass();
    Class c3  = Class.forName("java.util.List"); All are legal, and you can do that with any class or interface, not just String.
    So if you do something that gets a Class object--say the user enters a class name or interface name, and you pass that to Class.forName()--you can then call isInterface() to see if it's an interface.
    String classname = getStringFromUser(); // assume user enters "java.util.Comparator"
    Class klass = Class.forName(classname);
    boolean  isIxfc = klass.isInterface(); // true for java.util.Comparator

  • Can anyone explain what this code does.

    <b>Below is the FM for a  SAP Exit Variable ( 0FPER - Fiscal Period Variable ) , I would really appreciate if someone can give some explanation what does the code do.</b>
    FUNCTION RSVAREXIT_0F_FPER.
    ""Lokale Schnittstelle:
    *"       IMPORTING
    *"             VALUE(I_VNAM) LIKE  RSZGLOBV-VNAM
    *"             VALUE(I_VARTYP) LIKE  RSZGLOBV-VARTYP
    *"             VALUE(I_IOBJNM) LIKE  RSZGLOBV-IOBJNM
    *"             VALUE(I_S_COB_PRO) TYPE  RSD_S_COB_PRO
    *"             VALUE(I_S_RKB1D) TYPE  RSR_S_RKB1D
    *"             VALUE(I_S_RKB1F) TYPE  RRO01_S_RKB1F
    *"             VALUE(I_THX_VAR) TYPE  RRO01_THX_VAR
    *"       EXPORTING
    *"             VALUE(E_T_RANGE) TYPE  RSR_T_RANGESID
    *"       EXCEPTIONS
    *"              UNKNOWN_VARIABLE
    *"              UNEXPECTED_VARTYPE
    *"              INVALID_PERIV
    *"              VARIABLE_INITIAL
    *"              NO_REPLACEMENT
      data:
      l_s_range   type rs_s_range,
      ld_periv    type rro01_s_rkb1f-periv,
      ld_curdate  like sy-datum,
      ld_poper    like t009b-poper,
      ld_fiscyear like t009b-bdatj.
      refresh e_t_range.
      clear l_s_range.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      case i_vartyp.
        when rro04_c_vartyp-formula.
    *--- Determine fiscal year variant
          call function 'BWCO_FISCVARNT_GET'
               exporting
                    i_s_rkb1d        = i_s_rkb1d
                    i_s_rkb1f        = i_s_rkb1f
                    i_thx_var        = i_thx_var
               importing
                    e_periv          = ld_periv
               exceptions
                    no_replacement   = 1
                    unknown_variable = 2
                    others           = 3.
          case sy-subrc.
            when 0.
            when 2.
              raise unknown_variable.
            when others.
              raise no_replacement.
          endcase.
          if ld_periv is initial.
            raise invalid_periv.
          endif.
    *--- Determine current fiscal year
          ld_curdate = sy-datum.
          call function 'DATE_TO_PERIOD_CONVERT'
               exporting
                    i_date         = ld_curdate
                    i_periv        = ld_periv
               importing
                    e_buper        = ld_poper
                    e_gjahr        = ld_fiscyear
               exceptions
                    input_false    = 1
                    t009_notfound  = 2
                    t009b_notfound = 3
                    others         = 4.
          if not sy-subrc is initial.
            raise invalid_periv.
          endif.
    *--- Determine the highest fiscal period in the current fiscal year
          CALL FUNCTION 'GET_ACCOUNT_OF_PERIODS'
               EXPORTING
                    I_GJAHR         = ld_fiscyear
                    I_PERIV         = ld_periv
               IMPORTING
                    E_ANZBUPER      = ld_poper
               EXCEPTIONS
                    INPUT_FALSE     = 1
                    T009B_NOTFOUND  = 2
                    T009_NOTFOUND   = 3
                    OTHERS          = 4
          IF SY-SUBRC <> 0.
                raise invalid_periv.
          ENDIF.
    *--- fill value ranges
          l_s_range-low = ld_poper.
          append l_s_range to e_t_range.
        when others.
          raise unexpected_vartype.
      endcase.
    endfunction.

    1) Fiscal year variant is determined using Function Module - 'BWCO_FISCVARNT_GET'
    2) With Fiscal variant & Current Date as input to Function Module - 'DATE_TO_PERIOD_CONVERT' gets Fiscal Year.
    3) With Fiscal year & variant as input to 'GET_ACCOUNT_OF_PERIODS' gets 
    the highest fiscal period in the current fiscal year

  • Anyone know what this sign does?

    Good morning all,
    Just a quick question. Ive tried googling this and checking my books but after an hour of doing so I just thought Id ask. Why would one use th (+) in a query, especially when joining two tables?
    I saw this:
    SELECT inv.item, inv.price, recpt.recept
    FROM inventory inv, receipts recpt
    WHERE inv.item(+) = recpt.item;
    But dont know why you need that plus sign. Whats its purpose?

    Spot the difference:
    SQL> create table t1 as select level col from dual connect by level <= 3;
    Table created.
    SQL> create table t2 as select level col from dual connect by level <= 5;
    Table created.
    SQL> select col from t1;
           COL
             1
             2
             3
    3 rows selected.
    SQL> select col from t2;
           COL
             1
             2
             3
             4
             5
    5 rows selected.
    SQL> select t1.col t1col
      2  ,      t2.col t2col
      3  from   t1
      4  ,      t2
      5  where  t1.col = t2.col;
         T1COL      T2COL
             1          1
             2          2
             3          3
    3 rows selected.
    SQL> select t1.col t1col
      2  ,      t2.col t2col
      3  from   t1
      4  ,      t2
      5  where  t1.col(+) = t2.col;
         T1COL      T2COL
             1          1
             2          2
             3          3
                        5
                        4
    5 rows selected.

  • Can anyone pls explain what this procedure does?

    i could only figure out that it will be performing a transpose.
    create or replace
    PROCEDURE TEST_TRANSPOSE(o_test OUT SYS_REFCURSOR) AS
    report_exists number(3);
    report_name varchar(30) := 'REPORT_TBL' ;
    query_main varchar(16000) := 'create table ' || report_name || ' as select MAGAZINE ' ;
    query_part varchar(1024) ;
    my_var varchar2(5);
    cursor cur_region is select distinct REGION from MAIN_TBL order by region;
    begin
    select count(*) into report_exists
    from tab
    where tname = report_name;
    if ( report_exists = 1 ) then
    execute immediate 'drop table ' || report_name ;
    end if;
    open cur_region ;
    loop
    fetch cur_region into my_var ;
    exit when cur_region%NOTFOUND;
    query_part := 'select nvl(sum(quantity),0) from MAIN_TBL x where x.magazine = main.magazine and x.region='''||my_var||'''' ;
    query_main := query_main || chr(10) || ',(' || query_part || ')"' || my_var || '"';
    end loop;
    close cur_region ;
    query_main := query_main || ' from (select distinct MAGAZINE from MAIN_TBL ) main' ;
    DBMS_OUTPUT.PUT_LINE(query_main);
    --execute immediate query_main ;
    open o_test for query_main;
    end;
    {code}
    i need to transpose  a table which has dynamic number of rows.This was what i tried.Could you pls bhelp me out to correct this i get "P_TRAN_YEAR" invalid identifier
    [code]
    create or replace
    PROCEDURE         PRM_R_MAT_RPT (p_EmpID     IN  Integer,
    P_TRAN_YEAR IN NUMBER,
    P_TRAN_MONTH IN NUMBER,O_rc OUT sys_refcursor) IS
    v_cnt NUMBER;
    v_sql VARCHAR2(32767);
    v_basic Number(16, 4);
    BEGIN
    select PPH_ORG_AMOUNT into v_basic from prm_p_hop
    where pph_emp_id=p_empid
    and pph_tran_year=p_tran_year
    and pph_tran_month=P_TRAN_MONTH
    and pph_hop_code=5
    and PPH_SALARY_THRU='R';
    -- SELECT  distinct count(*)
    --  INTO v_cnt
    --  FROM PRM_T_VAR_HOP
    --  where PTVH_EMP_ID=p_EMPID
    --  and PTVH_TRAN_YEAR=p_TRAN_YEAR
    --  and PTVH_TRAN_MONTH=P_TRAN_MONTH;
    v_sql := 'select  distinct PCH_SHORT_DESCRIPTION,v_basic,PTVH_AMOUNT Amount ';
    --  FOR i IN 1..v_cnt
    --  LOOP
    v_sql := v_sql || ',max(decode(rn, PCH_SHORT_DESCRIPTION)) as description ';
    --v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_INTEREST)) as interest'||to_char(i);
    -- v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_PRINCIPAL_SALARY)) as principle'||to_char(i);
    -- v_sql := v_sql || ',max(decode(rn, '||to_char(i)||', PDSL_SOCIETY_CODE)) as SOC_CODE'||to_char(i);
    --  END LOOP;
    v_sql := v_sql || ' from (select  PRM_T_VAR_HOP.*, PRM_C_HOP.*, row_number() over (partition by PTVH_EMP_ID order by PTVH_EMP_ID) as rn
    from  
    PRM_T_VAR_HOP,
    PRM_C_HOP
    WHERE PTVH_EMP_ID         =P_empid
    And   PTVH_TRAN_YEAR      =P_TRAN_YEAR
    And   PTVH_TRAN_MONTH     =P_TRAN_MONTH
    And   PTVH_HOP_CODE       =PCH_HOP_CODE
    AND   PCH_CALCULATION_BASIS=''V''
    AND   PCH_TAG              =''C''
    AND   PTVH_SALARY_THRU     =''R'')';
    OPEN O_rc FOR v_sql;
    END;
    [/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Your first piece of code does not work, because a create table statement cannot be issued using a ref cursor like that. When executed with the "execute immediate" command, it works. Then, the refcursor is only a "select * from report_tbl".
    What it does, is dynamically dropping and creating a table report_tbl and filling it with the results of a horribly inefficient pivot query. If the report_tbl has no other purpose after running this procedure, then I'd suggest to not drop and create tables dynamically like that. In the second variant of test_transpose, you can see how you can do that.
    SQL> create table main_tbl (magazine,region,quantity)
      2  as
      3  select 'MAGAZINE1','REGION1',1 from dual union all
      4  select 'MAGAZINE1','REGION2',2 from dual union all
      5  select 'MAGAZINE1','REGION3',3 from dual union all
      6  select 'MAGAZINE2','REGION1',4 from dual union all
      7  select 'MAGAZINE2','REGION2',5 from dual union all
      8  select 'MAGAZINE2','REGION3',6 from dual
      9  /
    Tabel is aangemaakt.
    SQL> create or replace PROCEDURE TEST_TRANSPOSE(o_test OUT SYS_REFCURSOR)
      2  AS
      3    report_exists number(3);
      4    report_name varchar(30) := 'REPORT_TBL' ;
      5    query_main varchar(16000) := 'create table ' || report_name || ' as select MAGAZINE ' ;
      6    query_part varchar(1024) ;
      7    my_var varchar2(7);
      8
      9    cursor cur_region is select distinct REGION from MAIN_TBL order by region;
    10  begin
    11    select count(*) into report_exists
    12    from tab
    13    where tname = report_name;
    14    if ( report_exists = 1 ) then
    15    execute immediate 'drop table ' || report_name ;
    16    end if;
    17
    18    open cur_region ;
    19    loop
    20      fetch cur_region into my_var ;
    21      exit when cur_region%NOTFOUND;
    22      query_part := 'select nvl(sum(quantity),0) from MAIN_TBL x where x.magazine = main.magazine and x.region='''||my_var||'''' ;
    23      query_main := query_main || chr(10) || ',(' || query_part || ')"' || my_var || '"';
    24    end loop;
    25    close cur_region ;
    26
    27    query_main := query_main || ' from (select distinct MAGAZINE from MAIN_TBL ) main' ;
    28    execute immediate query_main;
    29    open o_test for 'select * from ' || report_name;
    30  end;
    31  /
    Procedure is aangemaakt.
    SQL> var rc refcursor
    SQL> exec test_transpose(:rc)
    PL/SQL-procedure is geslaagd.
    SQL> print rc
    MAGAZINE     REGION1    REGION2    REGION3
    MAGAZINE1          1          2          3
    MAGAZINE2          4          5          6
    2 rijen zijn geselecteerd.
    SQL> create or replace procedure test_transpose (o_test out sys_refcursor)
      2  as
      3    l_query varchar2(1000) := 'select magazine';
      4  begin
      5    for r in (select distinct region from main_tbl)
      6    loop
      7      l_query := l_query || ', sum(decode(region,''' || r.region || ''',quantity)) ' || r.region;
      8    end loop;
      9    l_query := l_query || ' from main_tbl group by magazine';
    10    open o_test for l_query;
    11  end;
    12  /
    Procedure is aangemaakt.
    SQL> exec test_transpose(:rc)
    PL/SQL-procedure is geslaagd.
    SQL> print rc
    MAGAZINE     REGION1    REGION2    REGION3
    MAGAZINE1          1          2          3
    MAGAZINE2          4          5          6
    2 rijen zijn geselecteerd.Regards,
    Rob.

  • Please explain what this program doing- I see the results but don't underst

    public class Mystery2{
    public static void main(String []args){
    int count = 1;
    while (count <= 10){
    System.out.println(count % 2==1? "****":"++++++");
    ++count;
    }//end while
    }//end main
    }//end class

    Hello! First of all - where did you find this code (just for information, so it's easier to answer the question)
    Secondly, pls be so kind as to use code tags. Here's the same program, reformatted and in code tags:
    public class Mystery2
        public static void main (String [] args)
            int count = 1;
            while (count <= 10)
                System.out.println (count % 2 == 1 ? "****" : "++++++");
                ++count;
            }//end while
        }//end main
    }//end class

  • What much Function Does Mac Agent could use ?

    Hi All
    I am try to install Mac Client in my lab...but I find latest 10.2.3 agent only Inventory/Bundle/Patch module...not see User management/Remote Management and endpoint function....
    Whether Mac Client indeed only support these functions or not ? (Because My customer wish manage Mac device, and could perform R.M function to these Mac devices)
    wyldkao

    Wyldkao,
    user management - no. Remote management - yes, but limited http://www.novell.com/documentation/...a/bzcbbdm.html
    Shaun Pond

Maybe you are looking for

  • Database Status report.

    Hi Export, Currently i joined a company as a Oracle Dba. i am new to DBA world, My manager told me to prepare a database status report. Please suggest me how can i create the report. Regards... Asmit

  • Best practice for hierarchical DTOs?

    Hi! Can someone tell me the best practice for hierarchical DTOs? Use case: I've got a User object which holds one Folder object, which in turn holds a Set of Folder objects (children). class User {   Folder rootFolder; class Folder { Set children; }N

  • Adobe Reader 9.0 background color

    I just downloaded Adobe Reader 9.0. The default background color is black. How can I change that to a different color? I'm not talking about the background color when in "full screen" mode; I just mean when the reader is open and no document is open,

  • PO output type.

    Hi, I am trying to send a PO through EDI but I get a status of yellow. I tried to repeat output for a successfully sent PO but even that gave a status of yellow. I went to NACE to see the config but everything seems to be alright. Can't figure out th

  • How do i update iphone 4s to ios7

    how do i update iphone 4s to ios7