Re: Select statement in the report

Hi Experts,
In my selection-screen contains ernam as a parameter.
If it balnk in the selection-screen,
the select statement is not working.
if it is not blank ,the select statement is  working fine.
TABLES: vbak.
TYPES: BEGIN OF ty_vbak,
        vbeln TYPE vbeln,
        knumv TYPE knumv,
       END OF ty_vbak.
DATA: v_vkorg TYPE vkorg,
      v_vtweg TYPE vtweg,
      v_erdat TYPE erdat.
DATA: i_vbak  TYPE STANDARD TABLE OF ty_vbak.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS:     p_ernam TYPE ernam .
SELECT-OPTIONS: s_vkorg FOR v_vkorg,
                s_vtweg FOR v_vtweg,
                s_erdat FOR v_erdat.
PARAMETERS:     p_kvgr4 TYPE tvv4-kvgr4 OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
  SELECT vbeln
         knumv
  FROM vbak
  INTO TABLE i_vbak
  WHERE erdat IN s_erdat
  AND   ernam = p_ernam
  AND   vkorg IN s_vkorg
  AND   vtweg IN s_vtweg
  AND   kvgr4 = p_kvgr4.
  IF sy-subrc = 0.
    WRITE:/ 'HI'.
  ENDIF.
Thank's in Advance,
Harsha.

report .
TABLES: vbak.
TYPES: BEGIN OF ty_vbak,
vbeln TYPE vbeln,
knumv TYPE knumv,
END OF ty_vbak.
DATA: v_vkorg TYPE vkorg,
v_vtweg TYPE vtweg,
v_erdat TYPE erdat.
DATA: i_vbak TYPE STANDARD TABLE OF ty_vbak with header line.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
select-options: s_ernam for  vbak-ernam .
SELECT-OPTIONS: s_vkorg FOR v_vkorg,
s_vtweg FOR v_vtweg,
s_erdat FOR v_erdat.
PARAMETERS: p_kvgr4 TYPE tvv4-kvgr4 .
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
SELECT vbeln
knumv
FROM vbak
INTO TABLE i_vbak
WHERE erdat IN s_erdat
AND ernam in s_ernam
AND vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND kvgr4 = p_kvgr4.
IF sy-subrc = 0.
loop at i_vbak.
write:/ i_vbak-vbeln.
endloop.
ENDIF.

Similar Messages

  • How to display the sort value in the selection screen in the report title

    Dear All,
    How to display the sort value in the selection screen in the report title? I have selected a value in the selection screen for sorting , but i need that values by which i have sorted with in the report title. Can you please throw some light on this!!
    Good day,
    Thanks and regards
    Arun S

    Hi Arun,
    Try this.
    1, Set one dynamic parameter,
    2, Drag and drop that parameter into  your report title.
    3, Pass the value(sort value) dynamically from your application,
    4, Cheers..
    Other wise Try with Dataset, create a dataset and fill thev alue into that.. Then  set the data source from CR designer. and darg and drop that data column into the report.
    Hope this will work,
    Regards,
    Salah
    Edited by: salahudheen muhammed on Mar 25, 2009 11:13 AM

  • Using Select Statement in the decoe function in Oralce Form10 g

    Hello All:
    Is it possible to call another Select Statement inside the Decode Function in Oracle Form? I tested the SQL on PL/SQL Plus, it ran without giving any errors. However, I got the following errors when I tried to compile the procedure in the Oracle Form right after the where condiction at the first select statement....
    Error 103 at line number....
    Encountered the symbol "," when expecting one of the following
    ) intersect minus order union .....
    Select a.col1
    a.col2,
    decode((select min(test_date) pa_closr_date from table_name c where a.col1 = c.col1), null, a.col3,(select min(test_date) pa_closr_date from table_name c where a.col1 = c.col1)) test_date,
    a.col4,
    from table_name a;
    thanks ahead for any help.
    KMD

    You don't need the Select within the decode. In SQL Plus, I tried your SQL using this:
    Select
        a.col1,
        a.col2,
        decode( (select min(test_date) pa_closr_date
                   from table_name c where a.col1 = c.col1), null, a.col3,
                (select min(test_date) pa_closr_date
                   from table_name c where a.col1 = c.col1)
              ) test_date
      from table_name a;And this gives the same result:
    Select
        a.col1,
        a.col2,
        decode(c.pa_closr_date, null, a.col3, c.pa_closr_date ) test_date
      from table_name a,
           ( select col1, min(test_date) pa_closr_date
             from table_name
             group by col1 ) c
      where c.col1(+) = a.col1;

  • Navigational Attrribute of 0plant in Selection criteria of the Report

    Dear ALl,
    We are facing an issue where we ares entering the inputs for Report Selection Criteria
    plant
    fiscal year period
    currency type &
    company code ( company code is the navigation attribute of the plant )
    When we enter plant, fiscal year period & currency with out company code we get the output. But when we enter the value for company code it doesnt shwo the data it shows no applicable data found.
    hence i would like to understand whetther we can use the company code which is the navigation attribute of the plant in the selection screen of the report via a variable?
    If yes why is my report showing no applicable data found. Request your suggestion on  this.
    Thanks & Regards
    K janardhan Kumar

    Hi Janardhan,
    Please check if your Plant Master data is loaded as well.
    Another check you can do is, when you run the report only on Plant, Fiscper and currency, drill down on Company Code (which is attribute of Plant) and see the values you get there. That might give you a hint.
    Also, you can check if for the company codes you enter while selection, is there transactional data present for the corresponding Plant.
    Other than this, its perfectly alright to use a navigational attribute as selection filter in the report.
    Thanks,
    Abhishek.

  • Multi-Select Prompt to the Report

    Hi,
    How to pass value(s) chosen in a Multi-Select Prompt to the Report?
    Is Prompted will pass the values but My requirement is to exclude those values in the Report.
    I think we can not use of Presentation Variable in this scenario..
    How can I do it?
    Thanks,
    Vency

    Hi..
    okay.. have you think of guided navigation in this case...
    I am not sure.. that it really helps... but just one approach...
    If it works.. then okay.. just think in that way...
    This may helpful to you in understanding of guided navigation...
    http://oraclebizint.wordpress.com/2008/01/17/oracle-bi-101332-selecting-reports-from-dashboard-prompts-and-guided-navigation-sections/
    Thanks & Regards
    Kishore Guggilla

  • XML Publisher - can we specify multiple SQL statements in the report?

    Hi there,
    can we specify multiple SQL statements in the report with XML Publisher?
    Regards,
    Liviu

    Could we eventually generate with the Wizards available in XML Publisher desktop 5.6.2 an xml file with a structure like the one given below? The reason is to facilitate creation of the two rowsets. Thanks, Liviu.
    <?xml version="1.0" encoding="UTF-8"?>
    <DATA>
         <ROWSET2>
              <ROW2>
                   <FIELD1>Query1</FIELD1>
                   <FIELD2>field2</FIELD2>
                   <FIELD3>field3</FIELD3>
              </ROW2>
         </ROWSET2>
         <ROWSET>
              <ROW>
                   <FIELD1>Query2</FIELD1>
                   <FIELD2>field2</FIELD2>
                   <FIELD3>field3</FIELD3>
              </ROW>
         </ROWSET>
    </DATA>

  • Using if the else logic in regards to a select statement for a report

    Hi all,
    I've a question regarding if then else logic in Oracle.
    I'm developing a report application which contains 3 selectlists
    - ProductGroup - SubGroup - Manufacturer
    Each one containing several values. And are based on eachother, meaning if you select an item from the PG list, you only get the SG items regarding the PG item you've choosen before. The process logic should be as the following:
    When a user selects one item from for example the PG list, the query will be:
    select * from x where PG = :P_PG
    and the report displays all the items in the PG category selected
    The other two bindvariables would be null as the user didn't pick them
    If he then proceeds and selects one item from the SG list, the query would be:
    select * from x where PG = :P_PG and SG = :P_SG
    and the report displays all the items in the PG and SG category selected
    If he then proceeds and selects one item from the MA list, the query would be:
    select * from x where PG = :P_PG and SG = :P_SG and MA =:P_MA
    and the report displays all the items in the PG and SG and MA category selected
    Now, I've read some documentation about the decode function, but I can't figure it out, please help.
    Peter

    Okay, Chet, have set it up on htmldb, so you can see my problem, will go in high detail, it is not producing what I want. Example on htmldb:
    DEMO/test
    http://htmldb.oracle.com/pls/otn/f?p=33229:6
    Defenitions:
    3 LOV's, namely:
    - LOVPG - select distinct productgroep, productgroep pg from plijst
    - LOVSG - select distinct subgroep, subgroep sg from plijst where productgroep = :P6_LOVPG
    - LOVLE- select distinct leverancier, leverancier le from plijst where productgroep = :P6_LOVPG and subgroep = :P6_LOVSG
    3 Selectitems with submit, namely:
    - :P6_LOVPG
    - :P6_LOVSG
    - :P6_LOVLE
    Report region select statement:
    select * from plijst where (productgroep = :P6_LOVPG or :P6_LOVPG IS NULL) and (subgroep = :P6_LOVSG or :P6_LOVSG IS NULL) and (leverancier = :P6_LOVLE or :P6_LOVLE IS NULL)
    Branch to:
    Branche to page on submit after processing
    What it should do is:
    When you select an item from the first selectlist, productgroep, the report should show all rows containing the specified productgroep.
    When the user selects the next item in the subgroep selectlist, the report should show all rows containing the previously selected prodctgroup and the just selected subgroep.
    When the user selects the final item , the report should show all rows based on all three selected itemvalues, productgroep, subgroep, leverancier.
    The problem is that with this setup the report is only generated after the final selectlist choice of the user. But the user should see a report before that, going deeper into the structure. Hope, you see my problem?
    Sincerely,
    Pete

  • Questions on select statement in the data model

    Hi,
    In the select statement, the order by statement seems only to work at the lowest level of the select statement. Is this true?
    What is the the purpose of the group by statement in the select statement?
    As far as I understand, the grouping is catered for in the data model.....
    Regards,
    Kin

    From the oracle report docs:
    The order of column values in a default group is
    determined by the ORDER BY clause of the query for
    SQL queries and by the sort column for Express queries.
    For column values in user-created groups, however, you
    must use Break Order to specify how to order the break
    column's values.So order by in your sql query is affected by groups in your data model.
    The purpose of a group by statement in your select statement is to group values for aggregation purposes, like
    select department_id,
           min(salary),
           max (salary)
      from employees
    group
        by department_id
    order
        by department_id;Grouping in the data model of a report is a little different than a group by clause, but not entirely.

  • Change the default select statement in the execute_query function

    I want to list all records where c1 like '%ABD%'. So I set the following in the 'when_button_pressed' tigger:
    set_block_property ('block_name',DEFAULT_WHERE,'upper(c1) like '''||'%'||:block_name.blk_col_name||'%'||'''');
    execute_query;
    When I click on the button the :system.last_query holds the following select statement:
    select c1, c2, .. cn from t_n where upper(c1) like '%ABD%' and (upper(c1) = 'ABD' and (c1 like 'ab%' or c1 like 'aB%' or c1 like 'Ab%' or c1 like 'AB%')) order by c1
    Since the condition upper(c1) = 'ABD' is not satisfied oracle does not return any rows.
    My question is how to overcome this or is it possible to change the built-in select statement of execute_query.

    Have you tried this :
    'upper(c1) like upper('''||'%'||:block_name.blk_col_name||'%'||''''));

  • Functional area(FKBER field in the selection screen of the report painter))

    Hi,
    I have a requirement to add functional area field in the selection screen for a report painter report. This report using library 1VK and table 'CCSS'. I added functional area field in the general data selection . After the execution of report with functional area field filled with value. report not giving any output. do i need to maintain any setting to achieve?
    Regards,
    Palani

    1. Call GR22 and click "Characteristics".
    2. Check FKBER and assign a position number to it.
    3. Save and close the library.
    4. Call your report in GRR2 and you should now see FKBER as an available characteristic.
    5. Use it in the General Data Selection or as a Lead Column, as per requirement.
    Or,
    1. Call GR21 and create a custom library. Provide a name and description and also provide a library you can copy from (scan for the best-fit library).
    2. Now follow the steps 2 through 5 above to achieve your result.
    Hope this helps.
    Cheers.

  • Select option in the report

    Hi All,
    i have a FICO AP  report  , in which i have vendor number as the variable , v can view the report based on the vendor number but now the user says since its difficult to remember the vendor number he should be able to key iin the vendor name and it will find the vendor number...
    I know hthere is a concept of matchcode in sap abap but i couldnt find anything like that in bi
    Can someone help me out with this at the earliest......
    Thanks in advance...

    Hi,
    You can create a text variable VAR1 in query, which has processing by 'User entry/ default value'. Make it ready for input. In this text variable,  the user can input vendor name.
    Create another characteristic variable on Vendor VAR2, which has processing by Customer exit.
    Now, in the customer exit, under i_step =2 you can write code
          DATA: L_S_RANGE TYPE RSR_S_RANGESID,
                LOC_VAR_RANGE LIKE RRRANGEEXIT.
    if i_step = 2.
    case i_vnam.
    when 'VAR2'.
          loop at i_t_var_range into loc_var_range where vnam = 'VAR1'.
    select vendor from ztable into l_s_range-low where vendorname = loc_var_range-low.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            append l_s_range to e_t_range.
          endloop.
    This should work for you. Please note that here I have assumed that only 1 vendor can be given as input to query.

  • How to get the select statement from the DISPLAY_ERROR; window

    Hi
    Do you know a way to get the select statement that is displayed in the
    display_error; window ( select hola from u where a = :d),
    this for saving to a text file.
    Thanks in Advance.

    You must copy-and-paste it. You can't access that error from within Forms.
    Regards,
    Robin Zimmermann
    Forms Product Management

  • Variable-Selection before running the report

    Hi Bex experts,
    i have a Web-Report with Navigation block.
    Before user run the report he should enter a value for Profit Cetner.
    In Query definition, I defined a simple variable ( typ: user entry/default value).
    Profit center has an attribute u201CStatusu201D.
    We have in system let say more than 1000 profit centers and only 200 of them are with Status u201Cactiveu201D. Like below.
    PC1 activ
    PC2 non-active
    PC3 activ
    u2026
    Before user run the report, he clicks on Selection Button for Profit Center and  he see there all Profit- Center from masterdata  but he want to see only the active Profit -Center for selection.
    Is it possible ?
    Thanks.

    Hi,
    in Backend Level (RSA1) Make STATUS as a Navigational Attibute, insert it as a Nav Attr in Infoprovider
    in Query Designer: create a Manual input variable for the Profit center Status - (Nav Attr)
    when you execute the report,  in the variable screen you will have 2 seperate variables
    1) Profit Center
    2) Profit Center Status (Nav Attr)
    Hopes it will help you
    Regards
    ReddY A

  • How to speed a select statement with the NOT EXISTS where condition ?

    Hi all,
    I created a view : create or replace view view_name as select * from table_1,table_2 where join_condition and some conditions.
    Now I have added in the view "where" clause two NOT EXISTS conditions based on one another different table respectively.
    Before I added these two conditions the response time was fast ; but after I added these two conditions then the response time deteriorated.
    So how to optimize the select statement ? Hints and so on ...
    Thank you very much indeed
    Message was edited by:
    andrianiaina

    Just run the script :
    SQL> explain plan for select * from dual;
    Explained.
    SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
    PLAN_TABLE_OUTPUT
    | Id  | Operation            |  Name       | Rows  | Bytes | Cost  |
    |   0 | SELECT STATEMENT     |             |       |       |       |
    |   1 |  TABLE ACCESS FULL   | DUAL        |       |       |       |
    Note: rule based optimization
    9 rows selected.
    SQL>Nicolas.

  • PLS-00382 Type error in the select statement in the Cursor.

    Hi,
    I am trying to combine several different sql statements to form one large cursor for my java layer. I have attached the PL/SQL procedure that I am using and when I am trying to compile it is giving PLS-00382 error. Please help me.
    PL/SQL Code.
    CREATE OR REPLACE PROCEDURE test IS
    tmpVar NUMBER;
    TYPE checkRecord is RECORD (
    name1 APPS.EMCSV_R25_DIST_PROF_TBL.distmgrfname%TYPE,
         name2 APPS.EMCSV_R25_DIST_PROF_TBL.distmgrfname%TYPE,
         name3 APPS.EMCSV_R25_DIST_PROF_TBL.distmgrfname%TYPE,
         name4 APPS.EMCSV_R25_DIST_PROF_TBL.distmgrfname%TYPE,
         oppstatus1 APPS.EMCSV_R25_DIST_PROF_TBL.oppstatus%TYPE,
         oppcount1 APPS.EMCSV_R25_DIST_PROF_TBL.oppcount%TYPE,
         oppamount1 APPS.EMCSV_R25_DIST_PROF_TBL.oppamount%TYPE,
    oppstatus2 APPS.EMCSV_R25_DIST_PROF_TBL.oppstatus%TYPE,
         oppcount2 APPS.EMCSV_R25_DIST_PROF_TBL.oppcount%TYPE,
         oppamount2 APPS.EMCSV_R25_DIST_PROF_TBL.oppamount%TYPE,
         oppstatus3 APPS.EMCSV_R25_DIST_PROF_TBL.oppstatus%TYPE,
         oppcount3 APPS.EMCSV_R25_DIST_PROF_TBL.oppcount%TYPE,
         oppamount3 APPS.EMCSV_R25_DIST_PROF_TBL.oppamount%TYPE,
         oppstatus4 APPS.EMCSV_R25_DIST_PROF_TBL.oppstatus%TYPE,
         oppcount4 APPS.EMCSV_R25_DIST_PROF_TBL.oppcount%TYPE,
         oppamount4 APPS.EMCSV_R25_DIST_PROF_TBL.oppamount%TYPE);
    TYPE checkCur IS REF CURSOR RETURN checkRecord;
    checkCurVal checkCur;
    checkCurRec checkRecord;
    chechcurVal checkCur;
    NAME: test
    PURPOSE:
    REVISIONS:
    Ver Date Author Description
    1.0 3/8/2006 1. Created this procedure.
    NOTES:
    Automatically available Auto Replace Keywords:
    Object Name: test
    Sysdate: 3/8/2006
    Date and Time: 3/8/2006, 10:01:59 AM, and 3/8/2006 10:01:59 AM
    Username: (set in TOAD Options, Procedure Editor)
    Table Name: (set in the "New PL/SQL Object" dialog)
    BEGIN
    tmpVar := 0;
    OPEN checkCurVal FOR
    SELECT
         a.distmgrfname,
    a.distmgrlname,
         a.salesrepfname,
         a.salesreplname,
         cursor (
         SELECT b.oppstatus,
         b.oppcount,
         b.oppamount
         from APPS.EMCSV_R25_DIST_PROF_TBL b
         where b.userid = '100000001' AND
         b.reportid = 'ISARPTR25' AND
                   b.oppstatus = 'Open' AND
                   b.isoppstatusselected = 'Y'),
         cursor (
         SELECT c.oppstatus,
         c.oppcount,
         c.oppamount
         from APPS.EMCSV_R25_DIST_PROF_TBL c
         where c.userid = '100000001' AND
         c.reportid = 'ISARPTR25' AND
                   c.oppstatus = 'Commit' AND
                   c.isoppstatusselected = 'Y'),
         cursor (
         SELECT
         d.oppstatus,
         d.oppcount,
         d.oppamount
         from APPS.EMCSV_R25_DIST_PROF_TBL d
         where d.userid = '100000001' AND
         d.reportid = 'ISARPTR25' AND
                   d.oppstatus = 'Closed-Won' AND
                   d.isoppstatusselected = 'Y'),
         cursor (
         SELECT
         e.oppstatus,
         e.oppcount,
         e.oppamount
         from APPS.EMCSV_R25_DIST_PROF_TBL e
         where e.userid = '100000001' AND
         e.reportid = 'ISARPTR25' AND
                   e.oppstatus = 'Closed-Lost' AND
                   e.isoppstatusselected = 'Y')               
                   from APPS.EMCSV_R25_DIST_PROF_TBL a
         where a.userid = '100000001' AND
         a.reportid = 'ISARPTR25' AND
                   a.isoppstatusselected = 'Y' ;
         LOOP
         FETCH checkCurVal INTO checkCurRec;
              EXIT WHEN checkCurVal%NOTFOUND;
              DBMS_OUTPUT.PUT_LINE (checkCurRec.name1 ||
              checkCurRec.name2 ||
                                            checkCurRec.name3 ||
                                            checkCurRec.name4 ||
                                            checkCurRec.oppstatus1 ||
                                            checkCurRec.oppcount1 ||
                                            checkCurRec.oppamount1 ||
                                            checkCurRec.oppstatus2 ||
                                            checkCurRec.oppcount2 ||
                                            checkCurRec.oppamount2 ||
                                            checkCurRec.oppstatus3 ||
                                            checkCurRec.oppcount3 ||
                                            checkCurRec.oppamount3 ||
                                            checkCurRec.oppstatus4 ||
                                            checkCurRec.oppcount4 ||
                                            checkCurRec.oppamount4);                                        
         END LOOP;     
    END test;
    /

    Thanks for Replying.
    I am trying to build a cursor to fetch the records from the table. Table structure is something like this.
    reportid VARCHAR2(10) NOT NULL,
    distmgrid NUMBER DEFAULT 0,
    salesrepid NUMBER DEFAULT 0,
    distmgrfname VARCHAR2(40 CHAR) DEFAULT 'rfname',
    distmgrlname VARCHAR2(40 CHAR) DEFAULT 'rlname',
    salesrepfname VARCHAR2(40 CHAR) DEFAULT 'afname',
    salesreplname VARCHAR2(40 CHAR) DEFAULT 'aname',
    issalesrepselected CHAR(1 CHAR) DEFAULT 'Y',
    oppstatus VARCHAR2(40 CHAR) DEFAULT 'oppstatus',
    isoppstatusselected CHAR(1 CHAR) DEFAULT 'Y',
    oppcount NUMBER DEFAULT 0,
    oppamount NUMBER DEFAULT 0,
    oppquote NUMBER DEFAULT 0,
    Attribute1 VARCHAR2(10 CHAR),
    Attribute2 VARCHAR2(15 CHAR),
    Attribute3 NUMBER,
    Attribute4 NUMBER
    But from the above table, I am trying to build a report for which I need a cursor which I listed in the proc. Is it not possible to build a cursor within a cursor?
    Yes each individual cursor return only one row.

Maybe you are looking for

  • Unable to proceed with upgrade utility while upgrading from 10g to 11g

    We have installed Weblogic server,configured the domain also performed the schema creation using the RCU and Installaed OBIEE 11.1.1.6. But while running the the upgrade assistance utility facing the following error: UPGCMP-02712: Expected oracle.bie

  • Problem in main window of smartform

    Hi experts, I have a secondary window in my page of smartform. and then a main window in which i have used a table to display line item from internal table. Now my problem is that when the data exceeds first page the remaining part of dat in mainwind

  • Which is the best way for posting a large number of records?

    I have around 12000 register to commit to dababase. Which is the best way for doing it? What depends on ? Nowadays I can't commit such a large number of register..The dabatase seems hanged!!! Thanks in advance

  • Problem with OracleParameter.Clone()

    I've found a strange behaviour in ODP. I've created a parameter collection where i've added all the parameters. then i simply create a copy of the collection in the command object: //adds all parameters that existed in collection of parameters foreac

  • Hi @include in a JSP function

    Hi, I wanted to use the @include directive in a jsp function. But when I compile it I get errors. Is this allowed ? <%! private boolean isDisplayAllowed () { %> <%@include file="foo.inc"%> <%@include file="bar.inc"%> <% %> Thanks RT