Problem on Dynamic Query Report

Hello,
I need to perform a report depend on the user who is accesing to my application,
I am using the following query:
declare
q varchar2(4000);
v_usuario varchar2(10);
begin
SET v_usuario = (CASE
WHEN :P101_USERNAME='janet' THEN v_usuario = 'JA'
WHEN :P101_USERNAME='cesar' THEN v_usuario = 'CC'
WHEN :P101_USERNAME='luisjavier' THEN v_usuario = 'LT'
WHEN :P101_USERNAME='mauricio' THEN v_usuario = 'MO'
WHEN :P101_USERNAME='enrique' THEN v_usuario = 'EH'
ELSE ' ')
q:=' select p.cliente, ';
q:=q||' p.partner, ';
q:=q||' p.channel_mgr, ';
q:=q||' p.fm_sales_rep, ';
q:=q||' p.status, ';
q:=q||' p.sc_leader, ';
q:=q||' p.sector, ';
q:=q||' p.fecha_inicio, ';
q:=q||' from adminorv.proyectosongoing p ';
q:=q||' where p.sc_leader = v_usuario';
return q;
end;
However, I got this error:1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-06550: line 1, column 9: PLS-00103: Encountered the symbol "" when expecting one of the following: begin function package pragma procedure subtype type use form current cursor
Somebody can give a hint?

You have a bunch of syntax errors there.
The code should look more like this:
declare
q varchar2(4000);
v_usuario varchar2(10);
begin
v_usuario := (CASE
WHEN :P101_USERNAME='janet' THEN  'JA'
WHEN :P101_USERNAME='cesar' THEN  'CC'
WHEN :P101_USERNAME='luisjavier' THEN  'LT'
WHEN :P101_USERNAME='mauricio' THEN  'MO'
WHEN :P101_USERNAME='enrique' THEN  'EH'
ELSE ' ' END);
q:=' select p.cliente, ';
q:=q||' p.partner, ';
q:=q||' p.channel_mgr, ';
q:=q||' p.fm_sales_rep, ';
q:=q||' p.status, ';
q:=q||' p.sc_leader, ';
q:=q||' p.sector, ';
q:=q||' p.fecha_inicio ';
q:=q||' from adminorv.proyectosongoing p ';
q:=q||' where p.sc_leader = v_usuario';
return q;
end;But I don't see why you are using dynamic SQL and a function returning a query here.
That could be done with just a simple query like this:
select p.cliente, p.partner, p.channel_mgr, p.fm_sales_rep, p.status, p.sc_leader,
       p.sector, p.fecha_inicio
  from adminorv.proyectosongoing p
where p.sc_leader = CASE WHEN :P101_USERNAME = 'janet' THEN 'JA'
                          WHEN :P101_USERNAME = 'cesar' THEN 'CC'
                          WHEN :P101_USERNAME = 'luisjavier' THEN 'LT'
                          WHEN :P101_USERNAME = 'mauricio' THEN 'MO'
                          WHEN :P101_USERNAME = 'enrique' THEN 'EH'
                          ELSE ' '
                      END

Similar Messages

  • Dynamic query report problem

    I have followed the tutorial in on dynamic query and created a region where the type is SQL Query (PL/SQL function body returning SQL Query)
    The source is
    declare
    q varchar2(4000);
    teatid NUMBER := :P305_TARGET_ID;
    begin
    wwv_flow.debug('teatid = ' || teatid);
    q:=' select f.id, ';
    q:=q||' f.eat_id ';
    q:=q||' from xmlTransactions f ';
    q:=q||' where f.eat_id = ' || teatid; -- I've also tried putting :P305_TARGET_ID here
    wwv_flow.debug('sql = ' || q);
    return q;
    end;
    I have chosen "Use Generic Column Names...".
    When I run the page, I get NO ROWS FOUND. However, when I cut and paste the SQL statement printed out by the debug statement and run it, it returns rows. Both debug statements print correct values.
    I'm not sure what the problem is here, but basically, I want to do a query where I substitute a value passed into the page from another page.
    In this case the value in P305_TARGET_ID is passed in via a button spawning a popup as in var url = 'f?p=&APP_ID.:305:&APP_SESSION.::::P305_TARGET_ID:' + targetID;
    APEX version is 3.0.1.00.08
    Thank you.
    - JohnW

    Hi, JohnW
    I don't understand why you use a dynamic query for that.
    A "direct" SQL query like this :
    select f.id,f.eat_id from xmlTransactions f where f.eat_id=:P305_TARGET_ID;
    should work.
    Mike

  • Sort problem on dynamic query !!

    Hi,
    I have a dynamic query written in pl/sql, when I check "Sort" for each field in Report Attribute, error message raised up as "ORA-01785: ORDER BY item must be the number of a SELECT-list expression".
    If I do not check Sort, it works fine. In my apps I need all fields sorted by user, how to fix this problem?
    My query as below:
    declare
    query varchar2(2000):='select';
    s_class varchar2(1000);
    cursor c1 is select * from demo_preference;
    begin
    for c1_val in c1 loop
    if c1_val.login is not null then
    query := query ||' ' || 'login' || ',';
    end if;
    if c1_val.id is not null then
    query := query ||' ' || 'id' || ',';
    end if;
    end loop;
    query := SUBSTR(query, 1, length(query)-1);
    s_class := '(NVL(:P2_class, ''%'' || ''null%'') = ''%'' || ''null%'' OR
    EXISTS (SELECT 1 FROM apex_collections WHERE collection_name = ''P2CLASSCOL'' AND c001 = class))';
    query := query ||' ' || 'from ming.reg_report_view1 where'
    || ' ' || s_class;
    return(query);
    end;

    Maybe the internally mapped column used when you clicked on sort is not shown in the report. Try using aliases when you construct the query string, it could help apex internally in identifying a column even if its order changes for a different user. After all the column order in the code is dynamic and I guess even the no of columns displayed might vary both of which could make sorting on a column identified with a number, invalid.
    How about displaying the report query somewhere, so that you know what is the exact query being processed, it might give you better information about the problem.
    If the problem persists, then use a collection that is fetched those record using the same query string and change the report to refer the collection and then set column sorting on. This way apex would get confused on what columns are being sorted and it would just sort on a c001..c050 column as though it was a string(yes problems with number columns sorting when you do this).

  • Multiple Parameter Dynamic Query/Report

    I'm very much a newbie to both APEX and SQL. I want to create a page with two regions, one used to hold parameters (LOV Select Lists), and one to reflect a dynamic SQL report including filtering the results using the values of the items in the select lists.
    I can do this with one Parameter/LOV select list - but am not clear on how to code for multiple parameters.
    Can someone give me an example on how to code the query, to include multiple parameters (P1_Empl, P1_AssetNo, P1_AssetType, etc)? The query with 'null' parameters/filters gives you all records; with any or many parameters acting as filters the query and resulting report would reflect the value of the filters.
    In addition, is there a specific type of region that needs to be used for the report region?
    Implied is the question - how do you handle the initial page view, so no error messages are seen - I'd like to get all records as a default.
    Thanks
    Rich

    sbkenned,
    The referenced sql for that report gives me problems.
    [ P3_Department_ID is the LOV of departments ]
    [ Null allowed and null return value is -1 ]
    <code>
    SELECT e.EMPLOYEE_ID,
    e.FIRST_NAME,
    e.LAST_NAME,
    e.HIRE_DATE,
    e.SALARY,
    e.COMMISSION_PCT,
    calc_remuneration(salary, commission_pct) REMUNERATION,
    e.DEPARTMENT_ID,
    d.DEPARTMENT_NAME
    FROM OEHR_EMPLOYEES e,
    OEHR_DEPARTMENTS d
    WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID(+) AND
    (e.DEPARTMENT_ID = :P3_DEPARTMENT_ID or
    (e.DEPARTMENT_ID is null and nvl(:P3_DEPARTMENT_ID,'-1') = '-1'))
    </code>
    The where clause: I'm guessing it is checking e.deptno = d.deptno
    but then what is (+)?
    can I use the '(+) and' to add on sections for each select list/parameter?
    In the paran part of the where clause, I get the first part and the use of 'or' - but I'm not sure what the last statement is doing.
    e.deptno is null AND ?? if there is a null value in P3_Department_ID return -1 otherwise return -1 ??
    I'm lost at that point as I clearly don't understand the syntax.
    Would you suggest multiple clauses in a where statement in order to add multiple filter values, and how do I handle nulls so those filters are not used/relfected?
    I am not using a self submitting LOV select list - I am using a button to refresh the query region manually
    I am comfortable with using an interactive report, but that interface is not what I need to present.
    As I indicated - I'm weak in the SQL area and need an example on how to code this type of query.
    Thanks.
    Rich

  • Create table problem using Dynamic Query

    Hi all,
    I want to create a temporary table within a stored procedure so I decided to do it using a dynamic query:
    create or replace procedure p1
    as
    begin
    execute immediate 'CREATE GLOBAL TEMPORARY TABLE tt(id number(2))';
    end;
    / It created successfuly but when I execute that procedure I got:SQL> exec p1;
    BEGIN p1; END;
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "SCOTT.P1", line 4
    ORA-06512: at line 1 While I can create that table using the same user without any problem!
    My question is:What privilege should I grant to user(minimum of privileges please! ) to execute that procedure successfuly?
    -Thanks

    Hi,
    To say a little bit more about Nicolas' answer:
    SQL> grant create table to scott;
    This is the right answer, but you might wonder why you have to do so if you usually can create tables with this user..
    11:59:19 TEST.SQL>CREATE USER UTEST
    11:59:28   2  IDENTIFIED BY UTEST;
    User created.
    11:59:35 TEST.SQL>CREATE ROLE RTEST;
    Role created.
    11:59:40 TEST.SQL>GRANT RTEST TO UTEST;
    Grant succeeded.
    11:59:45 TEST.SQL>GRANT CREATE SESSION TO RTEST;
    Grant succeeded.
    11:59:54 TEST.SQL>GRANT CREATE TABLE TO RTEST;
    Grant succeeded.
    12:00:03 TEST.SQL>GRANT UNLIMITED TABLESPACE TO UTEST;
    Grant succeeded.
    12:00:17 TEST.SQL>CREATE PROCEDURE UTEST.CT_TEST
    12:00:32   2  IS
    12:00:33   3  BEGIN
    12:00:35   4  EXECUTE IMMEDIATE 'CREATE TABLE UTEST.TTEST (A NUMBER)';
    12:00:56   5  END;
    12:00:58   6  /
    Procedure created.
    12:00:59 TEST.SQL>EXEC UTEST.CT_TEST;
    BEGIN UTEST.CT_TEST; END;
    ERROR at line 1:
    ORA-01031: insufficient privileges
    ORA-06512: at "UTEST.CT_TEST", line 4
    ORA-06512: at line 1
    12:01:06 TEST.SQL>GRANT CREATE TABLE TO UTEST;
    Grant succeeded.
    12:01:15 TEST.SQL>EXEC UTEST.CT_TEST;
    PL/SQL procedure successfully completed.Don't forget that when you're using PL/SQL, privileges granted via roles are ignored!
    Regards,
    Yoann.

  • HTMLDB Dynamic Query Reports

    This question is based on Oracle How To: http://www.oracle.com/technology/products/database/htmldb/howtos/dynamic_report-1.6.htm
    I tried creating my own dynamic report as follows below, but it failed in HTMLDB with the error: [Failed to parse SQL query: ORA-00933: SQL command not properly ended]
    I have examined my code quite thoroughly but still cannot understand what the problem is .. i.e. the code seems syntatically correct. Can anyone help please?
    DECLARE
    q VARCHAR2(4000);
    BEGIN
    q:=' SELECT a.customer, ';
    q:=q||' a.country, ';
    q:=q||' b.group_ga, ';
    q:=q||' SUM(nvl(a.total_sla_pass,0))TT_SLA_Pass, ';
    q:=q||' SUM(nvl(a.total_sla_fail,0)) TT_SLA_Fail,';
    q:=q||' SUM(nvl(a.total_sla_unassess,0))TT_SLA_Unassessed,';
    q:=q||' SUM(nvl(a.total_sla_pass,null)) TT_Total';
    q:=q||' FROM ms_portal_load_mv a, ms_portal_load_mv b';
    q:=q||' WHERE a.sh_fix_time >= :p400_Start_Date';
    q:=q||' AND a.sh_fix_time < :p400_End_Date';
    q:=q||' AND a.index_x = 3';
    q:=q||' AND b.index_x = 3';
    q:=q||' AND a.non_sla = 0';
    q:=q||' AND a.group_assignment_id IS NULL';
    q:=q||' AND a.ticket_id = b.parent_ticket_id';
    IF :p400_select_customer != 'All' THEN
    q:= q||'AND a.customer = :p400_select_customer';
    END IF;
    q:=q||' GROUP BY a.customer, a.country, b.group_ga;'
    RETURN q;
    END;

    Thanks for your replies.
    I have tried all suggestions but the code still generates error in HTMLDB:
    # 1 error has occurred
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00933: SQL command not properly ended
    Any other ideas?
    Thanks in advance
    Kezie

  • Problem with dynamic query in Forms Builder

    Hi,
    I need in forms builder cursor in procedure which parameter is a whole query. But i stuck when i wanna give some text in signs '' to procedure.
    I wanna give like test('select ' ||'test' || ' from dual');
    But this is not good beacuse it is missing ''.
    Query which procedure get is select test from dual.
    The right sql would be select 'test' from dual.
    How could i pass signs '' to procedure.
    Any ideas.
    Thanks in advance.

    test('select ''' ||'test' || ''' from dual');Francois

  • Conditional URL ( CASE )  within a Dynamic Query

    I need extra eyes or help in RE-FORMATTING the following SELECT STMT. My approach was to formulate the following query to get a functioning URL to the page that displayed the corrections made on that record (if it was corrected)...which I did. So now I'm trying to move the CASE portion into a dynamic query report. I'm having difficulties rewriting the CASE into the dynamic query due to placement of single-quotes. Is there an easy way to do this...or do I still need to find the correct placement of quotes? HELP!
    select "ID",
    "EMP_ID",
    "ENTRY_DATE",
    "JOB_TITLE",
    "START_DATE",
    "END_DATE",
    "MODIFIED_DATE",
    "lkup_1"."DESCRIPTION" as "Status",
    CASE
    WHEN rec_status = 'CR' -- corrected record
    THEN '<a href="'
                      || 'f?p=&APP_ID.:90:&SESSION.::&DEBUG.::'
                      || 'P90_RID,P90_TIMESTAMP:'
                      || rid ||',' || TO_CHAR(modified_date,'MM/DD/YYYY')
                      || ">'
    || 'See Update(s)'
    || '</a>'
    || '</a>'
    ELSE NULL
    END LINK,
    "lkup_2"."DESCRIPTION" as "Action",
    "CATEGORY",
    apex_item.checkbox(1,rid) as "Confirm"
    from "JOB_SUMMARIES",
    "LOOKUPS" "lkup_1",
    "LOOKUPS" "lkup_2"
    where "REC_STATUS" <> 'CF'
    and "REC_STATUS" = "lkup_1"."CODE"
    and "ACTION" = "lkup_2"."CODE"(+)
    Here is what I sort of come up with, but I'm getting dizzy looking at it so many times!
    ' CASE '||
    ' WHEN rec_status = ' || '''' || '''CR''' || '''' ||
    ' THEN ' || '''' || '<a href="' || '''' ||
             '            ||' || '''' || 'f?p=&APP_ID.:90:&SESSION.::&DEBUG.::' || '''' ||
             '            ||' || '''' || 'P90_RID,P90_TIMESTAMP:' || '''' ||
             '            ||' || ' id ||' || '''' || ''',''' || '''' || '|| TO_CHAR(modified_date,' || '''' || 'MM/DD/YYYY' || '''' || ')' || '''' ||
             '            ||' || '''' || ">' || '''' ||
    ' ||' || '''' || 'See Update(s)' || '''' ||
    ' ||' || '''' || '</a>' || '''' ||
    ' ||' || '''' || '</a>' || '''' ||
    ' ELSE NULL '||
    ' END LINK, '||
    I'm still getting an error which is:
    1 error has occurred
    * Query cannot be parsed within the Builder. If you believe your query is syntactically correct,
    check the ''generic columns'' checkbox below the region source to proceed without parsing.
    ORA-00905: missing keyword

    I still cannot get the insertion of the CASE to compile...I keep getting MISSING EXPRESSION error.
    1 error has occurred
    * Query cannot be parsed within the Builder. If you believe your query is syntactically correct,
    check the ''generic columns'' checkbox below the region source to proceed without parsing.
    ORA-00936: missing expression
    Here is my dynamic query and I want to place the CASE as indicated. The numerous quotes or the Q syntax is really messing up my attempts to get this page working. I have a dynamic query because I am allowing search parameters. And I thought it would be nice to have a LINK to another page that displayed changed column values if a user CORRECTED one of their records. All changes must be verified and accepted by a REVIEWER.
    declare
    q varchar2(32767); -- query
    w varchar2(4000) ; -- where clause
    we varchar2(1) := 'N'; -- identifies if where clause exists
    begin
    q := 'select "ID", '||
    ' "EMP_ID", '||
    ' "ENTRY_DATE", '||
    ' "JOB_TITLE", '||
    ' "START_DATE", '||
    ' "END_DATE", '||
    ' "lkup_1"."DESCRIPTION" as "Status", '||
    >WANT TO PLACE CASE RIGHT HERE
    ' "lk_up2"."DESCRIPTION" as "Action", '||
    ' "CATEGORY", '||
    ' apex_item.checkbox(1,rid) as "Confirm" '||
    ' from "#OWNER#"."JOB_SUMMARIES", '||
    ' "#OWNER#"."LOOKUPS" "lkup_1", '||
    ' "#OWNER#"."LOOKUPS" "lkup_2" '||
    ' where "REC_STATUS" <> ' || '''' || 'CF' || '''' ||
    ' and "REC_STATUS" = "lkup_1"."CODE" '||
    ' and "ACTION" = "lkup_2"."CODE"(+) ';
    if :P16_EMP_ID != '-1'
    then
    w := ' AND EMP_ID = :P16_EMP_ID ';
    we := 'Y';
    end if;
    if :P16_RECORD_STATUS != '-1'
    then
    w := w || ' AND REC_STATUS = :P16_RECORD_STATUS ';
    we := 'Y';
    end if;
    if :P16_CATEGORY != '-1'
    then
    w := w || ' AND CATEGORY = :P16_CATEGORY ';
    we := 'Y';
    end if;
    if we = 'Y'
    then q := q || w;
    end if;
    return q;
    end;
    Edited by: JSandoval on Aug 10, 2009 3:42 PM

  • Dynamic Query in Report Builder

    HI
    I have a doubt:
    I need to receive a parameter in my report and I need this parameter in the query, that means, I need to create a dynamic query depending on the value that I receive in one of the parameters that has my report.
    I tried to use the resource of Searching by Reference Cursor tool, it is a blue circle in the Data Model View of Report Builder.
    When I click this tool, I have an initial code, It is:
    function QR_1RefCurDS return <RefCurType> is
    begin
    end;
    In PL/SQL I tried to create to test and to play, this code:
    Note: If you want to try only to test, it is simple and works:
    create or replace package TEST_REFCURTYPE as
    type refcurtype is ref cursor;
    function TEST_REFCURTYPE (P_DATE_TO nvarchar2) return refcurtype;
    end;
    create or replace package body TEST_REFCURTYPE as
    function TEST_REFCURTYPE (P_DATE_TO nvarchar2)
    return refcurtype is
    refcur refcurtype;
    mysql varchar(1000);
    begin
    If P_DATE_TO is not null then
    mysql := 'select '''|| P_DATE_TO ||''' from dual';
    else
    mysql := 'select sysdate from dual';
    end if;
    open refcur for mysql;
    return refcur;
    end;
    end;
    The problem is to pass this example of code to the function QR_1RefCurDS, I do not have a place to make reference to the type:
    type refcurtype is ref cursor;
    I tested the Unit Program in the Report Builder but it did not work, because all the code I try to write and create, for example in the Event BEFORE REPORT, it opens  Funcion( ) …., and I can not make reference to the type refcurtype inside a Function( ).
    Would you help me please?
    Or there is another way to make a dynamic query in the Report Builder?
    Sorry for my English, I am a Brazilian living in Spain.

    Hi,
    you can use lexical parameters in your queries. Instead of a ":" use in the query before the parameter a "&". Then the parameter stands for a part of the query and not for a value (Bind parameter). In the before report trigger you can set this parameters. They can contain parts of SQL like order or where. Make sure that the default value for this lexical parameters are set to get a valid query.
    SELECT ENAME, &p_column as COL2 FROM EMP &p_order
    and in the trigger something like
    IF :p_which_column = 1 THEN
    :p_column := 'SAL'
    ELSE
    Saludos
    Rainer

  • Dynamic query in updatable report

    I have generated a updatable report with the folowing select:
    select
    "INSTALLATIEID",
    "INSTALLATIEID" INSTALLATIEID_DISPLAY,
    "CO_DRUK" druk,
    "CO_H2O" h2o,
    "CO_O2" o2,
    "CO_O2_11" o2_11,
    "CO_TEMP" temp
    from "#OWNER#"."CORRECTIE"
    The table correctie has above the 50 columns (the same columns for different components) so I want to change the query in:
    select
    "INSTALLATIEID",
    "INSTALLATIEID" INSTALLATIEID_DISPLAY,
    "&P50_COMP._DRUK" druk,
    "&P50_COMP._H2O" h2o,
    "&P50_COMP._O2" o2,
    "&P50_COMP._O2_11" o2_11,
    "&P50_COMP._TEMP" temp
    from "#OWNER#"."CORRECTIE"
    The item P50_COMP will be filled with a default value and is a select list with submit.
    The problem is when I change the query in the above way, the query cannot be parsed and I cannot applay the changes without parsing the query.
    Also not when I use Generic Column Names (parse query at runtime only)
    Can somebody help me with this problem.

    Fred,
    You should switch to a PL/SQL Function Body Returning SQL Statement (Dynamic Query) in order to achieve this. Your Function would look like this:
    declare
      l_sql varchar2(32767);
    begin
      l_sql := 'select
    "INSTALLATIEID",
    "INSTALLATIEID" INSTALLATIEID_DISPLAY,
    "' || :P50_COMP || '._DRUK" druk,
    "' || :P50_COMP || '._H2O" h2o,
    "' || :P50_COMP || '._O2" o2,
    "' || :P50_COMP || '._O2_11" o2_11,
    "' || :P50_COMP || '._TEMP" temp
    from "#OWNER#"."CORRECTIE"';
    return l_sql;
    end;Thanks,
    - Scott -

  • The problem about  integrate  Portal and R/3 : vendor query report problem

    Hi everyone :
       We want to achieve that our vendor can query R/3 report via our Portal. I had done SSO configuration.
       But we had about 500 vendors, it is impossible that we create 500 R/3 users for our vendors,  because the cost is too much .
       And there is another problem, vendor who had the authorization to query report can query the other vendor's data at same time. But we expect that certain vendor can query his data only.
       I think this is a general problem when integrate Portal and R/3, BW .
       Is there somebody had solved this problem or give any advice?
       Any discuss is welcome.
    Best Regards,
    Jianguo Chen

    Hi,
    I would say: get in contact with your SAP account manager anc check which options SAP can offer you...
    Normally every user using a R/3 system has to have a valid user license in that system. Expecially when you want to access control to data on user (vendor) level you nedd to identifiy the user clearly and uniquely which by standard means you need a user for every vendor.
    Hth,
    Michael

  • I am facing a problem in a crystal report which is based on Infoset query

    Hi All,
    I am facing a problem in a crystal report which is based on Infoset query.in the Cost Analysis - Planned vs. Actual Order Costs
    There are two querys like Query: CO_OM_CA_20_Q1 and InfoSet: ZBPBI131_INFO_ODVR. I build infoset query based on sap best practice user guide but problem is not able to find CO_OM_CA_20_Q1
    Best Regards,
    Srinivas

    Hi,
    I would first of all suggest you don't open the same question twice. this looks like a duplicate to this entry:
    Best Practices v3.31 - SAP InfoSet Query connection
    Did you assign the queries and the infosets to an InfoSet user group and you assign the SAP account to it as well ?
    Ingo

  • I am facing a problem in a crystal report which is based on Infoset query.i

    Hi All,
    I am facing a problem in a crystal report which is based on Infoset query.in the Cost Analysis - Planned vs. Actual Order Costs
    There are two querys like Query: CO_OM_CA_20_Q1 and InfoSet: ZBPBI131_INFO_ODVR. I build infoset query based on sap best practice user guide but problem is not able to find CO_OM_CA_20_Q1

    Please re-post if this is still an issue to the Business Objects Integration Kits - SAP Forum or purchase a case and have a dedicated support engineer work with you directly

  • Problem in Data Display in Dynamic ALV Report

    Hi all,
    I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    DO 20 TIMES.
       DO p_colms TIMES.
         l_index = sy-index.
         CONCATENATE 'FIELD' l_index INTO l_fieldname.
         ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
         <l_field> = sy-index.
       ENDDO.
       INSERT <fs_dyntable> INTO TABLE <gt_table>.
    ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    CLEAR: l_fieldname,
            l_tabname,
            l_fieldtext,
            l_index.
    DO  p_colms TIMES.
       CLEAR l_index.
       l_index = sy-index.
       CONCATENATE 'FIELD' l_index INTO l_fieldname.
       CONCATENATE 'Field' l_index INTO l_fieldtext.
       l_tabname = '<GT_TABLE>'.
       PERFORM fieldcatalog USING: l_fieldname
                                   l_tabname
                                   l_fieldtext.
    ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    v_srlno.
    LOOP AT it_itab.
       v_srlno = v_srlno + 1.
    ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    1st Field
    l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    Please guide me how my problem will solve.
    Thanks & Regards
    Nirmal

    Hi all, I am developing a Dynamic ALV report where I want display material batch (zjpack_base-charg) in column and Material (zjpack_base-matnr) & Qty (Zjpack_base-netwr) field row wise.My intention is to show report datewise for a material how many batch developed with there qty.I am sending you the code which i already wrote.Here column is developed batchwise but I am not able to show the qty against each batch.Please see my code and guide me how to display.
    *& Report  ZDYNAMIC_TEST                                               *
    REPORT  zdynamic_test                           .
    *REPORT  ztest_notepad.
    *& Declarations
    *Type-pools
    TYPE-POOLS: slis.
    *TABLES
    TABLES: zjpack_base.
    *Types
    TYPES:
          ty_fcat      TYPE lvc_s_fcat,
          ty_fcatalog  TYPE slis_fieldcat_alv.
    *Work areas
    DATA:
          wa_fcat      TYPE ty_fcat,
          wa_fcatalog  TYPE ty_fcatalog.
    *Internal tables
    DATA:
          it_fcat      TYPE STANDARD TABLE OF ty_fcat,
          it_fcatalog  TYPE STANDARD TABLE OF ty_fcatalog.
    *Type reference
    DATA:
          it_dyn_tab   TYPE REF TO data,
          wa_newline   TYPE REF TO data.
    *INTERNAL TABLE
    DATA: BEGIN OF it_itab OCCURS 0.
            INCLUDE STRUCTURE zjpack_base.
    DATA: END OF it_itab.
    *Filed symbols
    FIELD-SYMBOLS:
          <gt_table>   TYPE STANDARD TABLE,
          <fs_dyntable>,
          <fs_fldval>  TYPE ANY,
          <l_field>    TYPE ANY.
    *Variables
    DATA:
          l_fieldname  TYPE lvc_s_fcat-fieldname,
          l_tabname    TYPE lvc_s_fcat-tabname,
          l_fieldtext  TYPE lvc_s_fcat-seltext,
          l_index      TYPE char2.
    "Selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-s11 .
    SELECT-OPTIONS:s_matnr FOR zjpack_base-matnr.
    SELECT-OPTIONS:s_charg FOR zjpack_base-charg.
    SELECT-OPTIONS:s_fdate FOR zjpack_base-fdate .
    SELECTION-SCREEN END OF BLOCK b1.
    PARAMETERS:
             p_colms   TYPE i.
    *& start-of-selection.
    START-OF-SELECTION.
      PERFORM select_data.
      PERFORM build_fieldcat.
      PERFORM create_dynamic_table.
    *  DO 20 TIMES.
    *    DO p_colms TIMES.
    *      l_index = sy-index.
    *      CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *      ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
    *      <l_field> = sy-index.
    *    ENDDO.
    *    INSERT <fs_dyntable> INTO TABLE <gt_table>.
    *  ENDDO.
      LOOP AT it_itab.
        l_index = sy-tabix.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        ASSIGN COMPONENT l_fieldname OF STRUCTURE <fs_dyntable> TO <l_field>.
        <l_field> = it_itab-matnr.
        INSERT <fs_dyntable> INTO TABLE <gt_table>.
      ENDLOOP.
      LOOP AT it_fcat INTO wa_fcat.
        PERFORM fieldcatalog1 USING: wa_fcat-fieldname
                                      wa_fcat-tabname
                                      wa_fcat-seltext.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program = 'ZTEST_NOTEPAD'
          it_fieldcat        = it_fcatalog
        TABLES
          t_outtab           = <gt_table>.
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat .
    *  CLEAR: l_fieldname,
    *         l_tabname,
    *         l_fieldtext,
    *         l_index.
    *  DO  p_colms TIMES.
    *    CLEAR l_index.
    *    l_index = sy-index.
    *    CONCATENATE 'FIELD' l_index INTO l_fieldname.
    *    CONCATENATE 'Field' l_index INTO l_fieldtext.
    *    l_tabname = '<GT_TABLE>'.
    *    PERFORM fieldcatalog USING: l_fieldname
    *                                l_tabname
    *                                l_fieldtext.
    *  ENDDO.
    ENDFORM.                    " BUILD_FIELDCAT
    *&      Form  CREATE_DYNAMIC_TABLE
    FORM create_dynamic_table .
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fcat
        IMPORTING
          ep_table        = it_dyn_tab.
      ASSIGN it_dyn_tab->* TO <gt_table>.
    * Create dynamic work area and assign to FS
      CREATE DATA wa_newline LIKE LINE OF <gt_table>.
      ASSIGN wa_newline->* TO <fs_dyntable>.
    ENDFORM.                    " CREATE_DYNAMIC_TABLE
    *&      Form  FIELDCATALOG
    FORM fieldcatalog USING field table f_txt.
      wa_fcat-fieldname = field.
      wa_fcat-tabname   = table.
      wa_fcat-seltext = f_txt.
      APPEND wa_fcat TO it_fcat.
      CLEAR  wa_fcat.
    ENDFORM.                    " FIELDCATALOG
    *&      Form  FIELDCATALOG1
    FORM fieldcatalog1 USING field table f_txt.
      wa_fcatalog-fieldname = field.
      wa_fcatalog-tabname   = table.
      wa_fcatalog-seltext_m = f_txt.
      APPEND wa_fcatalog TO it_fcatalog.
      CLEAR  wa_fcatalog.
    ENDFORM.                    " FIELDCATALOG1
    *&      Form  SELECT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM select_data .
    *  DATA: v_srlno TYPE i.
      SELECT matnr charg blqty
      INTO CORRESPONDING FIELDS OF it_itab
      FROM zjpack_base
      WHERE matnr IN s_matnr
      AND   charg IN s_charg
      AND   fdate IN s_fdate.
        COLLECT it_itab.
      ENDSELECT.
    *  v_srlno.
    *  LOOP AT it_itab.
    *    v_srlno = v_srlno + 1.
    *  ENDLOOP.
      CLEAR: l_fieldname,
              l_tabname,
              l_fieldtext,
              l_index.
    * 1st Field
    *  l_index = sy-tabix.
      CONCATENATE 'FIELD' '1' INTO l_fieldname.
      l_fieldtext = 'MATNR'.
      l_tabname = '<GT_TABLE>'.
      PERFORM fieldcatalog USING: l_fieldname
                                  l_tabname
                                  l_fieldtext.
    * Other fields
      LOOP AT it_itab.
        CLEAR l_index.
        l_index = sy-tabix + 1.
        CONCATENATE 'FIELD' l_index INTO l_fieldname.
        CONCATENATE 'CHARG-' it_itab-charg INTO l_fieldtext.
        l_tabname = '<GT_TABLE>'.
        PERFORM fieldcatalog USING: l_fieldname
                                    l_tabname
                                    l_fieldtext.
      ENDLOOP.
    ENDFORM.                    " SELECT_DATA

  • Query report problem

    I copied all query reports from one old database to another new database using a copy express.
    But while executing the query report in the current new database.
    It is showing an error" FORM NOT FOUND [66000-9]"

    Sometimes the errors provide little information as feedback to correct the problem.  I would suggest that you review the query iin both databases and see if have been copied correctly.  Secondly make sure all field and table references in the query actually exists in the copied database.
    Suda

Maybe you are looking for

  • Steps to create Process Chain in  Version 2004S SAP NetWeaver

    Hi, I have created a process chain in 3.5 version.Now i want to create a process chain in 2004s version.so what should be the steps to create this process chain.

  • Want to Book bonds and Repos on a yield not price (ftr_create screen)

    I am implementing sap treasury in South africa and i see SAP TRM is based on the european markets which trade on the price but South Africa trades on the yield, how do i capture a bond on a yield not on the price." We want to do this on ftr_create or

  • Rendering reduces image quality. Confused

    I'm working in P Pro 7.1 with GH3 footage shot 72mbps/All-intra MOV files. I made a sequence from a clip (settings posted below). A clip in the sequence has the yellow render bars and plays back very nicely. But if I render it, a whole bunch of artif

  • Result set plz iam confused

    Hello sir, I have database for names ok it works fine but if iam entering the names with spaces like Raj kulkarni which is the full name of person it is going into the database but when i access into another form for other module through rs.getString

  • Ibook G4 shuts down unexpectedly and resets time and date

    More and more frequently my iBook will shut down completely unexpectedly when not plugged in. This happens regardless of how much battery life it has or it claims to have (80%, 40%, 20%, 12%). It will not start up again from battery only. When I plug