Huge query  with  parameter for to use Dynamic Cursor with Parameters

Hi
Is possible put the query below like dynmic cursor passing Parameters ?
How can I do it ?
    OPEN P_CURSOR FOR
    WITH NOTIFICACAO AS(
      SELECT 
       t1.cd_consultora,
       t1.dc_nome_consultora,
       t2.nm_notificacao_cn,
       t2.dt_notificacao_cn dt_notificacao,
       t2.dt_atendimento_notificado,
       t1.cd_tipo_estrutura_comercial,
       t1.cd_estrutura_comercial
        FROM t_consultora t1, nc.t_nc_notificacao_cn t2
       WHERE t2.dt_notificacao_cn BETWEEN w_DTA_INI AND w_DTA_FIM
         AND t2.cd_consultora = t1.cd_consultora
         AND t1.cd_setor = w_cd_setor
         AND t1.cd_tipo_estrutura_comercial = p_tp_estrutura_comercial
         AND t1.cd_estrutura_comercial = p_cd_estrutura_comercial),
    T_NOTIFICADA AS ( select Count(t1.nm_notificacao_cn) over (partition by  t1.cd_consultora,t1.nm_notificacao_cn ) QTD_NOTAS,
                             Count(t2.nm_item_notificacao_cn) over (partition by  t1.cd_consultora,t1.nm_notificacao_cn ) QTD_ITENS,
                             T3.*
                              from nc.t_nc_notificacao_cn t1,
                                   nc.t_nc_item_notificacao_cn  T2,
                                   NOTIFICACAO                  T3 
                               where       t1.dt_notificacao_cn >= to_date('01/09/2006','dd/mm/yyyy')
                                and   t3.nm_notificacao_cn = t1.nm_notificacao_cn
                               and    t1.nm_notificacao_cn = t2.nm_notificacao_cn
                               and    ((t2.cd_tipo_item_nc = 4 and t2.cd_subtipo_item_nc = 6)
                                       or t2.cd_tipo_item_nc = 2 or t2.cd_tipo_item_nc = 3)
                                       and t3.cd_consultora = t1.cd_consultora (+)  )  ,
    T_BLOQUEADA AS ( SELECT T4.* FROM
                 (SELECT  T3.*,
                        CASE WHEN T3.BLOQUEADA = -1 THEN  'Bloqueada'
                             WHEN  T3.BLOQUEADA = 0 THEN
                          (CASE WHEN T3.QTD_NOTAS > 2 THEN
                             CASE WHEN T3.QTD_ITENS > 8 THEN 'Atencao / Analise'
                             ELSE
                                'Normal'
                             END
                           ELSE
                             'Atencao / Analise'   
                          END)
                         END OBSERVACAO
                  FROM  (SELECT CASE WHEN NVL(T2.ID_CN_BLOQUEADA,1) = 1 then -1
                               WHEN NVL(T2.ID_CN_BLOQUEADA,1) = 0  THEN 0
                               END BLOQUEADA, T1.*
                    FROM   T_NOTIFICADA T1,
                           T_PS_CONSULTORA T2 
                           WHERE T1.CD_CONSULTORA = T2.CD_PESSOA)T3) T4 )
        select *
          from (SELECT t1.*, ROWNUM r_linha
           FROM (SELECT  cd_consultora,
                   dc_nome_consultora,
                   fnc_busca_telefone(CD_CONSULTORA, 1) TELEFONE1,
                   fnc_busca_telefone(CD_CONSULTORA, 2) TELEFONE2,
                    EMAIL,
                    observacao,
                   nm_notificacao_cn,
                   nvl(vl_total_final,0) vl_total_final,                  
                   dt_notificacao,
                   qt_produto_item_nc,
                  sg_notificacao,
                  ID_SITUACAO,
                   qtd_registros
                FROM (SELECT /*+ INDEX(W5 I0_NC_TIPO_ITEM_NC) */
                   W1.cd_consultora,
                   W1.dc_nome_consultora,
                   fnc_busca_telefone(w1.CD_CONSULTORA, 1) TELEFONE1,
                   fnc_busca_telefone(w1.CD_CONSULTORA, 2) TELEFONE2,
                   fnc_busca_email(w1.CD_CONSULTORA) EMAIL,
                   W1.OBSERVACAO observacao,
                   W1.nm_notificacao_cn,
                   sum(W4.qt_produto_nf *
                       W4.vl_unitario_final_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) vl_total_final,
                   W1.dt_notificacao,
                   sum(W4.qt_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) qt_produto_item_nc,
                   'PENDENTE' sg_notificacao,
                   W5.dc_tipo_item_nc ID_SITUACAO,
                   W_qtd_registros qtd_registros
                    FROM T_BLOQUEADA               W1,
                         nc.t_nc_item_notificacao_cn W2,
                         nc.t_nc_produto_item_nc     W3,
                         nc.t_nc_produto_item_nf     W4,
                         nc.t_nc_tipo_item_nc        W5
                   WHERE W1.dt_atendimento_notificado is null
                     and W1.nm_notificacao_cn =
                         W2.nm_notificacao_cn
                     and W2.cd_tipo_item_nc = W5.cd_tipo_item_nc
                     and W2.nm_notificacao_cn =
                         W3.nm_notificacao_cn(+)
                     and W2.nm_item_notificacao_cn =
                         W3.nm_item_notificacao_cn(+)
                     and W3.nm_notificacao_cn =
                         W4.nm_notificacao_cn(+)
                     and W3.nm_item_notificacao_cn =
                         W4.nm_item_notificacao_cn(+)
                     and W3.nm_sequencia_produto_item_nc =
                         W4.nm_sequencia_produto_item_nc(+)
                     and W2.cd_tipo_item_nc not in (6, 7)
                     and ((W2.id_situacao_item_nc = 1) OR
                         (W2.id_situacao_item_nc = 3 OR
                         W2.id_solucao_definida is not null))
                  UNION
                  SELECT /*+ INDEX(W5 I0_NC_TIPO_ITEM_NC) */
                   W1.cd_consultora,
                   W1.dc_nome_consultora,
                   fnc_busca_telefone(w1.CD_CONSULTORA, 1) TELEFONE1,
                   fnc_busca_telefone(w1.CD_CONSULTORA, 2) TELEFONE2,
                   fnc_busca_email(w1.CD_CONSULTORA) EMAIL,
                   W1.OBSERVACAO observacao,
                   W1.nm_notificacao_cn,
                   sum(W4.qt_produto_nf *
                       W4.vl_unitario_final_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) vl_total_final,
                   W1.dt_notificacao,
                   sum(W4.qt_produto_nf) OVER(PARTITION BY W1.cd_consultora, W1.nm_notificacao_cn) qt_produto_item_nc,
                   'ATENDIDO' sg_notificacao,
                   W5.dc_tipo_item_nc ID_SITUACAO,
                   W_qtd_registros qtd_registros
                    FROM T_BLOQUEADA                W1,
                         nc.t_nc_item_notificacao_cn W2,
                         nc.t_nc_produto_item_nc     W3,
                         nc.t_nc_produto_item_nf     W4,
                         nc.t_nc_tipo_item_nc        W5
                   WHERE W1.dt_atendimento_notificado is not null
                     and W1.nm_notificacao_cn =
                         W2.nm_notificacao_cn
                     and W2.cd_tipo_item_nc = W5.cd_tipo_item_nc
                     and W2.nm_notificacao_cn =
                         W3.nm_notificacao_cn(+)
                     and W2.nm_item_notificacao_cn =
                         W3.nm_item_notificacao_cn(+)
                     and W3.nm_notificacao_cn =
                         W4.nm_notificacao_cn(+)
                     and W3.nm_item_notificacao_cn =
                         W4.nm_item_notificacao_cn(+)
                     and W3.nm_sequencia_produto_item_nc =
                         W4.nm_sequencia_produto_item_nc(+)
                         )T2
---- here with NDS   I changed order by
                   ORDER BY DECODE(p_nm_asc_desc,0,DECODE(p_nm_col_ordem ,1, cd_consultora,2,dc_nome_consultora)) ASC, --,8,vl_total_final)) ASC,
                   DECODE(p_nm_asc_desc,1,DECODE(p_nm_col_ordem ,1, cd_consultora,2,dc_nome_consultora)) desc --,8,vl_total_final)) DESC
                         ) T1
           where rownum <= W_TO_REC)
         where r_linha >= W_FROM_REC;Is It Query very much great and how can I to pass parameters w_DTA_INI ,w_DTA_FIM, W_TO_REC,W_FROM_REc ....etc
TIA

I did (some time ago and it was a packaged procedure) something like
Procedure p(p_one in datatype,p_two in datatype,p_dataset out sys_refcursor) is
  the_sql varchar2(32000);
  the_cursor sys_refcursor;
begin
  the_sql = 'WITH NOTIFICACAO AS( ' ||
            '      SELECT ' ||
            '       t1.cd_consultora, ' ||
            '                               where       t1.dt_notificacao_cn >= to_date(''01/09/2006'',''dd/mm/yyyy'') ' ||  -- note the ''
            '           where rownum <= :W_TO_REC) ' ||   -- parameter 1
            '         where r_linha >= :W_FROM_REC ';     -- parameter 2
  open the_cursor for the_sql using p_one,p_two;  -- just by the book
end p;if I remember correctly
Regards
Etbin

Similar Messages

  • ADF how can i execute a query with parameters when the page renders

    hi
    i am using ADF web 11g
    i need to execute a query with parameters when the page renders
    thanks

    hello,
    I'm a fan of Java code, I really am.
    But when you use ADF, you decided to move to a more declarative environment.
    So why not do it declarative, the adf way?
    In your pagedef insert a action binding.
    This can be anything, a call to the application module, a call on the iterator(Like executeWithparams, etc.)
    Create an invokeAction in your pagedef and set the condition.
    This example refreshes(Action 2 is execute query) the data.
    First the method binding:
        <action IterBinding="PersoonIterator" id="Execute" InstanceName="LSAppModuleDataControl.Persoon"
                DataControl="LSAppModuleDataControl" RequiresUpdateModel="true" Action="2"/>And the invoke action
        <invokeAction Binds="Execute" id="refreshData"/>This always refreshes the data on page entry, but anything is possible, you can set condictions for the invokeAction.
    -Anton
    PS Yes I know that pagedefs become backing beans in the end and yes that is Java code, but if you wanna play the ADF way, the goal is the reduction of Java code and the increased performance of declarative programming.

  • SQL query with "parameters"

    Hi,
    I want a sql query as follows (but it seems not be as simple as that...)
    select A1, A2,
    select sum(B3)
    from B1 = A2
    where
    from A
    where A1 = '1001'
    is it possible, in some way, to have A2 from outer select statement as a parameter to inner select statement?

    Hi,
    user8819407 wrote:
    Hi,
    I want a sql query as follows (but it seems not be as simple as that...)
    select A1, A2,
    select sum(B3)
    from B1 = A2
    where
    from A
    where A1 = '1001'
    is it possible, in some way, to have A2 from outer select statement as a parameter to inner select statement?Yes, you can reference columns from a parent query within its child query.
    For example:
    select  A1, A2,
             select  sum (b.B3)
             from   b
             where  b.B1 = a.A2
    from     A
    where     A1 = '1001'
    ;Within the sub-query, you don't have to qualify columns from b; that is, b3 is assumed to mean b.b3. If the column name is unique, you don't have to qualify columns from table a, either. That is, if b does not have a column called a2, then a2 in the sub-query could only mean a.a2, and Oracle doesn't make you spell out which table a2 comes from, but it makes the code a lot easier to understand and debug if you do qualify the columns.
    By the way, a sub-query that references its parent query like this is called a Correlated Sub-Query .
    "Parameter" doesn't really apply to this situation.

  • Query with parameters

    SELECT
    A.DocEntry, A.DocNum, A.Series, A.PostDate, A.DueDate,
    A.ItemCode AS Parent,A.PlannedQty, A.CmpltQty, A.RjctQty,
    B.ItemCode AS CHLD, B.BaseQTY, B.PlannedQTY,B.IssuedQTY,
    A.CmpltQtyB.BaseQTY AS Compl_QTY, A.RjctQtyB.BaseQTY AS Rej_QTY,
    C.LastPurPrc as PurPrise, C.LstEvlPric as EvlPrice,
    D.LineTotal,
    B.IssuedQTY -((A.CmpltQtyB.BaseQTY) + (A.RjctQtyB.BaseQTY)) As WIP_QTY,
    (B.IssuedQTY -((A.CmpltQtyB.BaseQTY) + (A.RjctQtyB.BaseQTY)))* C.LstEvlPric As WIP_Valuation,
    A.Comments
    FROM
    OWOR A INNER JOIN WOR1 B ON A.DocEntry = B.DocEntry
           INNER JOIN OITM C ON B.ItemCode = C.ItemCode
           JOIN IGE1 D ON B.DocEntry=D.BaseRef AND D.BaseLine =B.LineNum
    WHERE A.Status='R'
    AND  A.PostDate BETWEEN
    (CASE WHEN '\[%0]' = ' ' THEN '1/1/2007' else '\[%0]' END)
    and
    (CASE WHEN '\[%1]' = '' THEN '1/12/2050' else '\[%1]' END)
    The above query does not accept parameter for the table OWOR A.It gives error for the parameter A.PostDate as,
    Query sentence was not completed.
    Parameters are being accepted for the other tables.
    Edited by: Dilip Kumbhar on Feb 12, 2008 12:07 PM

    If you run the query direct in sql management studio or query analyzer, gives it the same error?
    I think, that the problem is somewhere in SBO, because i found out, that sap is modifiing the queries inside.
    Try to rename one plannedqty in select statement as plan1 - maybe two same names in select are doing this problems. Or to prevent the sap modifiing, try it as select from select as
    select
    DocEntry, DocNum, Series, PostDate, DueDate,
    Parent,Plan1, CmpltQty, RjctQty,
    CHLD, BaseQTY, PlannedQTY,IssuedQTY,
    Compl_QTY,  Rej_QTY,
    PurPrise,  EvlPrice,
    LineTotal,
    WIP_QTY,
    WIP_Valuation,
    Comments
    from
    SELECT
    A.DocEntry, A.DocNum, A.Series, A.PostDate, A.DueDate,
    A.ItemCode AS Parent,A.PlannedQty as Plan1, A.CmpltQty, A.RjctQty,
    B.ItemCode AS CHLD, B.BaseQTY, B.PlannedQTY,B.IssuedQTY,
    A.CmpltQtyB.BaseQTY AS Compl_QTY, A.RjctQtyB.BaseQTY AS Rej_QTY,
    C.LastPurPrc as PurPrise, C.LstEvlPric as EvlPrice,
    D.LineTotal,
    B.IssuedQTY -((A.CmpltQtyB.BaseQTY) + (A.RjctQtyB.BaseQTY)) As WIP_QTY,
    (B.IssuedQTY -((A.CmpltQtyB.BaseQTY) + (A.RjctQtyB.BaseQTY)))* C.LstEvlPric As WIP_Valuation,
    A.Comments
    FROM
    OWOR A INNER JOIN WOR1 B ON A.DocEntry = B.DocEntry
    INNER JOIN OITM C ON B.ItemCode = C.ItemCode
    JOIN IGE1 D ON B.DocEntry=D.BaseRef AND D.BaseLine =B.LineNum
    WHERE A.Status='R'
    ) T
    hope it helps you

  • Auto Query in Master Detail Form using dynamic page doesn't work

    I created a Master-Detail form, and implement AutoQuery using a dynamic page
    with the following code :
    <HTML>
    <BODY>
    <ORACLE>DECLARE
    nre_ VARCHAR2(100);
    BEGIN
    nre_ := emp_nre;
    if nre_ is not null then
    net_portal.Popula_Agregados(nre_);
    net_portal.Popula_Docs_Agregados (nre_);
    htp.p('<iframe id=myFrame name="myFrame" frameborder=0 width="250%"
    height="300"
    src="/pls/portal/PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=
    3
    388118140&p_arg_names=_show_header&p_arg_values=NO&p_arg_names=_cad_nre_cond&p_a
    rg_values=%3D&p_arg_names=cad_nre&p_arg_values='||nre_||'">
    </iframe>');
    end if;
    EXCEPTION
    WHEN OTHERS THEN
    htp.p(SQLERRM);
    END;
    </ORACLE>
    </BODY>
    </HTML>
    It works fine when we access the first time to the page, but if i press the
    save button after inserting or updating a detail record, the header record is
    lost. How can i avoid this situation ?

    I changed query:
    select
    Replace(
    '<img src="#IMAGE_PREFIX#ed-item.gif" border="0" alt="EditMap" usemap="#editmap***id***"></img>
    <map name="editmap***id***">
    <area shape="rect" coords="0,0,16,16" href="http://apex.oracle.com/pls/otn/f?p=&APP_ID.:'
    || decode ( type, 'FOLDER', '33', '22' )
    || ':&APP_SESSION.::&DEBUG.::P'
    || decode ( type, 'FOLDER', '33', '22' )
    || '_ID,P'
    || decode ( type, 'FOLDER', '33', '22' )
    || '_CALLING_PAGE:' || id || ',&APP_PAGE_ID." ></area></map>' ,
    '***id***', id
    ) Edit,
    id,
    type,
    name,
    decode ( type, 'FOLDER', 33, 22 ) target
    from tThe idea is - each img uses its own map.
    It works now.
    Check:
    http://apex.oracle.com/pls/otn/f?p=20980:13
    Lev
    Edited by: le on Nov 3, 2010 11:11 AM

  • BC4J Query by example for dates uses wrong date format

    When querying by example on date fields, I get the following nested exceptions:
    oracle.jbo.SQLStmtException: JBO-27121: SQL error during statement execution.
    JBO-26044: Error while getting estimated row count for view object
    and
    java.sql.SQLException: ORA-01830: date format picture ends before converting entire input string.
    It would seem to be caused by the following clause added to the end of the entity object's query:
    "QRSLT WHERE ( ( (DATE_FIELD = TO_DATE('23/12/2003', 'yyyy-mm-dd')) ) )"
    which causes problems as our entity objects use a 'dd/MM/yyyy' date format.
    Is there a way we can make the query by example use the same date format as the rest of our app?

    I‘m not an expert on this but I see nobody is replying so this might help you. I've been having problems with dates as well and I‘m pretty sure that the attached formatter isn't used in find mode. That is because the java date class (can't remember which one) used by the BC4J has the format yyyy-mm-dd. I don't now if it is possible to change it but I got around the problem by writing my own domain. You can take a look at Toystore demo, by Steve Muench, that uses a custom date domain, ExpirationDate (see the code below). It is mapped to a VARCHAR column in the database but it is possible to map it to a DATE column.
    I have been watching the postings with questions about dates and I have noticed that a lot of people have problems with this but I haven’t seen an answer yet.
    package toystore.model.datatypes.common;
    import java.io.Serializable;
    import java.text.SimpleDateFormat;
    import java.util.Calendar;
    import java.util.Date;
    import oracle.jbo.Transaction;
    import oracle.jbo.domain.DataCreationException;
    import oracle.jbo.domain.DomainInterface;
    import oracle.jbo.domain.DomainOwnerInterface;
    // --- File generated by Oracle Business Components for Java.
    * This custom datatype implements an immutable domain class that
    * maps to a VARCHAR column containing values like '10/2004' representing
    * expiration dates of credit cards. We could have chosen to implement
    * this as a domain that stores itself in a DATE column instead of a
    * VARCHAR column, but since the Java Pet Store demo schema stored the
    * information in a VARCHAR column, we decided to illustrate how to
    * accommodate that case using domains.
    public class ExpirationDate implements DomainInterface, Serializable {
    private Date mDate;
    private String mDateAsString;
    protected ExpirationDate() {
    mDate = new Date();
    convertDateToStringFormat();
    * Return the value of the expiration date as a java.util.Date
    public Date getDateValue() {
    return mDate;
    * Allow expiration date to be constructed from two
    * strings representing month and year
    public ExpirationDate(String monthVal, String yearVal) {
    this(monthVal+'/'+yearVal);
    public ExpirationDate(String val) {
    validate(val);
    convertDateToStringFormat();
    * The getData() method must return the type of object that JDBC will
    * see for storage in the database. Since we want this ExpirationDate
    * datatype to map to a VARCHAR column in the database, we return the
    * string format of the date
    public Object getData() {
    return mDateAsString;
    * <b>Internal:</b> <em>Applications should not use this method.</em>
    public void setContext(DomainOwnerInterface owner, Transaction trans, Object obj) {
    * Performs basic validation on strings that represent expiration dates
    * in the format of MM/YYYY. Note that in the process of testing whether
    * the string represents a valid month and year, we end up setting
    * the private member variable mDate with the date value, so if the
    * validate() method does not throw an exception, the mDate will be setup.
    protected void validate(String val) {
    if (val != null) {
    if (val.length() != 7 ||
    val.charAt(2) != '/' ||
    !isAllDigitsExceptSlashAtPositionTwo(val) ||
    !isValidMonthAndYear(val)) {
    throw new DataCreationException(ErrorMessages.class,
    ErrorMessages.INVALID_EXPRDATE,
    null,null);
    * Returns true if all digits except position 2 (zero-based) are digits
    private boolean isAllDigitsExceptSlashAtPositionTwo(String val) {
    for (int z=0, max = val.length(); z < max; z++) {
    if (z != 2 && !Character.isDigit(val.charAt(z))) {
    return false;
    return true;
    * Returns true if the val string, assumed to be in "MM/YYYY" format
    * is a valid month and year value, setting the mDate member variable
    * if they are valid.
    private boolean isValidMonthAndYear(String val) {
    try {
    int month = Integer.parseInt(val.substring(0,2));
    int year = Integer.parseInt(val.substring(3));
    Calendar c = Calendar.getInstance();
    c.setLenient(false);
    c.set(year,month-1,1); // Month is zero-based !
    mDate = c.getTime();
    catch (IllegalArgumentException i) {
    return false;
    return true;
    public String toString() {
    return mDateAsString;
    * Convert mDate to String format
    private void convertDateToStringFormat() {
    if (mDate != null) {
    SimpleDateFormat sdf = new SimpleDateFormat("MM/yyyy");
    mDateAsString = sdf.format(mDate);
    * Return true if the expiration date is in the future
    public boolean isFutureDate() {
    return mDate.compareTo(new Date())> 0;
    * Compare the Expiration Dates by comparing their respective
    * getData() values
    public boolean equals(Object obj) {
    if (obj instanceof DomainInterface) {
    Object thisData = getData();
    if (thisData != null) {
    return thisData.equals(((DomainInterface)obj).getData());
    return ((DomainInterface)obj).getData() == null;
    return false;

  • Printing parameter on report - using dynamic parameter in XI

    Post Author: jackel
    CA Forum: Formula
    I need to have the following print on the report when using parameter that accepts multiple values:
    1 value selected - prints that value
    2 or more values selected - prints "multiple"
    All values selected - prints "all"
    Example: parameter "Colors"
    Values- blue, green, red, yellow, etc (more may be added/deleted at any time)
    When just blue is selected - "blue" prints
    When just red is selected - "red" prints
    When red and yellow are selected - "multiple" prints
    When all are selected >> "all prints
    Any help would be appreciated.
    - j

    Post Author: jackel
    CA Forum: Formula
    I reduced the formula to (I didn't expect a solution for "all"):
    If count({?parameter}) = 1 or then {?parameter}    
    else
    If count({?parameter}) > 1 then 'Multiple'
    and received this error:  "This array must be subscripted.  For example: Array&#91;i&#93;."
    If count({?parameter}) = 1 then "One"
    else
    If count({?parameter}) > 1 then 'Multiple'
    works fine but I really wanted the value printed when only one is selected.
    Thanks so much for your help - I feel we're on the right track.
    -j

  • Is it possible to provide an BEx Web Query with parameters based on iView?

    Hi SAP Portal experts,
    My knowledge of SAP Portal is limited and I ran into the following problem:
    I have got about 60 BEx Web Queries which should be put into some sort of navigation. Furthermore I would like to intodruce one start page where the user can preselect common bex query variables (e.g. company code) by clicking on a map.
    My approach was to put all query links into a BEx Web Application Template. The template includes a JavaScript storing the userdefined values in a cookie. As soon as the user clicks on a link the cookie values are read from that cookie and a query parameter string is set up like "&BI_COMMAND_1-BI_COMMAND_TYPE=SET_VARIABLES_STATE&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE=VARIABLE_INPUT_STRING&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE_TYPE-VARIABLE_INPUT_STRING=2100&BI_COMMAND_1-VARIABLE_VALUES-VARIABLE_VALUE_1-VARIABLE=0P_COCD" and concatenated with the URL for the BEx Query.
    My colleague wants me to put all this into SAP Portal and to create an iView for each BEx Query. How can I achieve that? I have already had a look at the iView property "parameters passed on to BEx Web Application". If I put my parameter string there, it works fine. However, I would like to replace VARIABLE_INPUT_STRING=2100 and VARIABLE=0P_COCD with the values selected by the user by clicking on the map. So how can I set up a parameter or variable in one iView and read it in another iView with a BEx Web Query???
    Thank you very much in advance
    Martin

    I have thought about this. There are some problems here....
    I cannot use the same proxy to invoke the java callout and then based on the code or handler disable it, since
    1) i would have no way to enable back the proxy again.
    2) Also there is some amount of message loss.
    So i will have to use another proxy to do the same, but in this case
    1) what would be the trigger to this proxy?
    2) And how often do i invoke the java callout to see if the URI is up or not? (wouldnt that affect the performance?)
    I am just wondering why did they give an offline URI option in the business service and no similar option in the proxy service, Any Idea?
    Thanks

  • Jpa query with parameters in Greek

    Hello
    I use netbeans 6.9.1 and toplinlk essensials for jpa connected to a mysql database
    mysql database constants:
    character_set_database = utf8
    character_set_server = utf8
    character_set_system = utf8
    I have this code
    Query qItemom = emOpsw.createQuery("SELECT m FROM Itemom m WHERE "
    + " m.book = :book AND m.omfile = :omfile AND m.omaster = :omaster ");
    qItemom.setParameter("book", (short)1);
    qItemom.setParameter("omfile", (byte)2);
    qItemom.setParameter("omaster", "ΕΚΡ");
    The "omaster" parameter is a String. When i pass latin characters i get results, but when i pass
    a greek character string "ΕΚΡ" for example, i do not get any results at all.
    Can anyone help me?
    Than you in advance.

    Could be a MySQL or JDBC issue. Try the same query using raw JDBC and the bind parameter.
    You could also try disabling parameter binding, if the issue has to do with your JDBC driver's binding.
    James : htttp://www.eclipselink.org

  • 11G Pivot Query with parameters

    Hello all,
    I would like to find some way, any way to pass parameters to a pivot query. The following pivot query works, but I would like segment2 to be a variable as well as the period names so....
    select * from
    select segment2, accounted_dr, period_name
    from gl_je_lines a, gl_code_combinations b
    where b.code_combination_id = a.code_combination_id
    and segment2 >='007611' and segment2 <='007751' AND period_name in ('SEP-08','OCT-08','NOV-08'))
    pivot
    sum(accounted_dr)
    for period_name in ('SEP-08','OCT-08','NOV-08') )
    ....would be something like....
    select * from
    select segment2, accounted_dr, period_name
    from gl_je_lines a, gl_code_combinations b
    where b.code_combination_id = a.code_combination_id
    and segment2 >= :P4_OBJECT_FROM AND and segment2 <=:P4_OBJECT_TO AND period_name in &P4_EPSB_PERIOD_HOLD.)
    pivot
    sum(accounted_dr)
    for period_name in (&P4_EPSB_PERIOD_HOLD.) )
    It is our understanding that we have to hardcode period names and objects, but we would like to get around that. Does anyone have any ideas or tricks?
    Thanks

    lilhelp wrote:
    Hello all,
    We are trying to use the 11G pivot query function with data from Oracle E-Business Suite. We have an 11G database installed with our Oracle APEX. We cannot seem to get the pivot function to work. At a glance, would anyone be able to see any glaring errors in our syntax. I am not certain it is possible to provide test data Why not?
    >
    We are trying to have column headings with the Period Names SEP-08 OCT-08 NOV-08, with rows of segment2 007751 and accounted_dr as the dataset.
    When we run the sql we get an error ORA-00904: "PERIOD_NAME": invalid identifier.
    Any help or insight would be greatly appreciated.
    select * from (
    select segment2, accounted_dr, period_name
    from gl_je_lines a, gl_code_combinations b
    where b.code_combination_id = a.code_combination_id
    and segment2 = '007751')
    pivot
    sum(accounted_dr)
    for period_name in ('SEP-08','OCT-08','NOV-08')
    group by segment2, period_nameDon't use GROUP BY. When you use PIVOT, the grouping is implied by what is in the PIVOT clause and what is not.
    Try this:
    select    *
    from        (
           select  segment2
           ,       accounted_dr
           ,       period_name
           from       gl_je_lines          a
           ,       gl_code_combinations     b
           where       b.code_combination_id = a.code_combination_id
           and       segment2 = '007751'
    pivot       (
           sum (accounted_dr)
           for period_name in ('SEP-08','OCT-08','NOV-08')
    ;which is just your posted query without the GROUP BY clause.

  • Query with parameters syntax

    Hi,
    Could somebody please help with the C# syntax for Oracle Lite. I can execute select statement without parameters, but parameterized query doesn’t work. What is wrong in my code?
    LiteConnection liteConn=new LiteConnection("10270_pwcoffline");
    LiteCommand lcmd=new LiteCommand() ;
    lcmd.Connection=liteConn;
    lcmd.CommandText="Select * from ol_off_dept where office = :off";
    lcmd.CommandType=CommandType.Text ;
    int off = 10;
    LiteParameter p1 = new LiteParameter("off", DbType.VarNumeric, "office");
    p1.Value = off;
    lcmd.Parameters.Add(p1);
    LiteDataAdapter lad=new LiteDataAdapter(lcmd);
    DataSet ds=new DataSet();
    lad.Fill(ds,"TDM");
    this.dataGrid1.DataSource = ds;
    The error is:
    System.Data.DataException: 37000[POL-5228] syntax error at Oracle.Lite.Data.LiteCommand.Prepare()…
    Thanks

    Jenny,
    Please let us know if you still need this post resolved.
    Thank you.

  • Reports 9ids query with parameters

    I've created a basic report that pulls from one table. However, I need to have it read two different global variables from the form from which it is run from. I have not been able to make that happen. currently I'm running the report by utilizing WEB.show.document. I need it to pull in the report where two of the fields are equal to the two global variables. How do I do this?? Any help would be great. Part of the URL i've created a keycommand in the cgicmd.dat file.
    Thank you

    If I understand correctly, you want to base the output of your report on some global data in the form from which you're invoking the report. In that case, you can create user parameters in your report, and base your query on those user parameters (say, P_1 and P_2). Pass the values of these parameters in the report invocation URL.
    That's only as far as I understood your question. Also refer to the Building Reports Manual and the Publishing Reports Manual for more insights.
    -Manish

  • How to refresh report data from bex query (BW) with parameters

    Hello,
    i hope someone can help me with my problem. I developed an desktop application, which loads (actual state) a report from the local file system. After setting the parameters, the report should be saved as a pdf file. Loading the report into the ReportDocument object and exporting the report to a pdf works fine. Setting parameters (without) a data source too. But now i can't refresh the data in the reports given by a parameter (e.g. time).
    I know there are two methods to do this. Push and pull. I want to use the pull method, cause my program should exports different reports and i think it should be easier to handle this with this method.
    On my development environment is installed:
    Crystal Reports SP 4
    MS Visual Studio 2010 (coding with C# .NET)
    .NET Framework 4
    SAP Integration Kit
    Crystal Reports for Visual Studio 2010 SP1 - SDK libraries
    Crystal Reports for Visual Studio 2010 SP1 - Runtime 32 bit
    SAP GUI 7.20 (Compilation 3)
    The bex query is enabled for external use from ole db for olap. Do i have forget something else?
    Here is a part of my code:
            public ReportDocument doPullMethod(ReportDocument crReportDocument)
                TableLogOnInfo crTableLogOnInfo = crReportDocument.Database.Tables[0].LogOnInfo;
                ConnectionInfo crConnectionInfo = crTableLogOnInfo.ConnectionInfo;
                crConnectionInfo.Password = "*******";
                crReportDocument.SetDatabaseLogon(crConnectionInfo.UserID, crConnectionInfo.Password, crConnectionInfo.ServerName, crConnectionInfo.DatabaseName);
                MessageBox.Show(crConnectionInfo.UserID + " _ " + crConnectionInfo.Password + " _ " + crConnectionInfo.ServerName + " _ " + crConnectionInfo.DatabaseName);
                for (int i = 0; i < crReportDocument.Database.Tables.Count; i++)
                //    crReportDocument.Database.Tables<i>.ApplyLogOnInfo(crTableLogOnInfo);
                    MessageBox.Show("TestConnectivity: " + crReportDocument.Database.Tables<i>.TestConnectivity());
                return crReportDocument;
    Cause i'm using only one bex query, i know that the SetDatabaseLogon()-method should bring me the same result as the ApplyLogOnInfo()-method SAP Crystal Reports .NET API Guide
    Exists an order which i have to follow? First setting parameter and then set the login informations or backwards? Cause i also get the "Failed to load database information" exception, when i set a parameter and TestConnectivity() returns false.
    Do i have to activate the data refresh manually or will be the data refreshed automatically on export?
    I searched in this forum (.NET - SAP Crystal Reports) and found only this thread which according to my problem:
    [Re: Crystal report connects to BW RFC by .NET;
    The question is assumed answered.

    Hi Robin,
    There is a SAP Integration Kit you need to allow CR to connect to SAP data sources. There isn't one for CR for VS 2010 and I don't believe there are the various extra options available in the SDK, no SDK access to the DB driver.
    Possibly, Check the other post, download and run the app Ludek suggested, it will get the connection info for your report using RAS and then plug the output code into your code and see if that works. It should show the crdb_olap dll is the database driver, assuming that is the connection method you used when designing the report.
    Pay attention to the database dll in the output from that app and verify it is on your PC in: C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86
    If that doesn't work then.....
    The problem is, CR for VS 2010 ( version 13 ) is the runtime for BOE 4.0  ( version 14 ) which includes the Integration kit drivers on install. There is no standalone install of the database drivers. They are installed with CR 2011, which doesn't have a SDK included, CR for VS 2010 is also the Developer version for CR 2011.
    Because of the "custom" connection requirements there is no SDK or access to the BW datasource extra options....
    Also note that CR 2008 is not supported in VS 2010, it should work though as long as you stick to 2.0 -> 3.5 framework, no 4.0 Framework support in CR 2008 or BOE 4.0
    You may want to try the SAP Integration Kit forum to see if anyone has been able to make this work or contact your account manager to verify if there are any plans to do what you are doing....
    Don

  • BEx query with variant from ABAP

    Hello,
    I'm looking for possibility to start BEx query with variant (variant is created with tx RSRT) from ABAP. There are some funktion modules, which start queries (launch excel), for example RSAH_LAUNCH_EXCEL or RSSEM_QUERY_LAUNCH, but they are ending with short dump, when there are variables in the query. Is there any standard FM, which starts the query with variant or accepts parameters?
    regards,
    Krzysztof

    Hi,
    the short dump was my fault, I've passed query name instead of genuniid to the RSAH_LAUNCH_EXCEL.
    What I'm trying to do is to I'll start BEx query with parameters (I don't want to get selection-screen from the query, I need to fill it from ABAP).
    Here is my example, which is not working.
    DATA:
      lv_query(30) TYPE c,
      lv_genuniid  TYPE rsrrepdir-genuniid,
      ls_var       TYPE rrx_var,
      lt_var       TYPE TABLE OF rrx_var.
    lv_query = 'YB_MAKLER_DETAIL'.
    CALL FUNCTION 'CONVERSION_EXIT_GENID_INPUT'
      EXPORTING
        input  = lv_query
      IMPORTING
        output = lv_genuniid.
    IF lv_genuniid = ''.
      WRITE: / 'There is no Query', lv_query.
    ELSE.
      ls_var-vnam = 'YS_MKLE'.
      ls_var-sign = 'I'.
      ls_var-opt  = 'EQ'.
      ls_var-low  = '0000005100'.
      APPEND ls_var TO lt_var.
      ls_var-vnam = 'YS_VTGJ'.
      ls_var-sign = 'I'.
      ls_var-opt  = 'EQ'.
      ls_var-low  = '1999'.
      APPEND ls_var TO lt_var.
      CALL FUNCTION 'RSAH_LAUNCH_EXCEL'
        EXPORTING
          i_genuniid                       = lv_genuniid
          I_OBJVERS                        = 'A'
          i_hide_sapgui                    = 'X'
        TABLES
          I_T_VAR                          = lt_var.
    ENDIF.
    If parameter 'i_hide_sapgui' is empty, I'm getting empty selection-screen,
    If parameter 'i_hide_sapgui' equals 'X' I'm getting selection-screen filled with values, which were used last time manualy, not with values from the internal table 'lt_var'.
    Do you have any idea how to pass parameters to the query with this function module?
    Regards,
    Krzysztof

  • Update query with multiple foreign key parameters

    I am trying to perform an update query on one field that uses multiple foreign key parameters from one table to update the other table. The data in all three foreign key parameter fields are not constant. Accuracy is absolutely critical. I tied this as well as other various scenarios with no success. Can anyone help?
    Update A_table a
    set a.rate = (
    select b.rate
    from B_table b
    where b.id = a.id
    and b.transdate = a.transdate
    and b.orgnum = a.orgnum
    and b.transdate = to_date('31/12/2007', 'dd/mm/yyyy')
    )

    I would check symbols by a user name and number of posts before calling anyone a hot shot, especially damorgon.<br><br>
    Yes version matters (due to bugs and features in each version).<br>
    DDL matters because of indexes and associations.<br>
    Data matters because it makes a difference on how SQL can be written.<br>
    Reasons why an SQL statement don't work is because we aren't looking over your shoulder at your screen.<br><br>
    damorgon did leave off his list that the best place for this question is on the PL/SQL, where they will ask you similar questions in addition to your explain plan and data volumes.

Maybe you are looking for