Creation of query

Hi Friends,
Consider the following scenario.Following are the stock values on each day in an ODS.
<b>DATE     MATERIAL     QTY
1-Jan     A     100
1-Jan     C     1000
5-Jan     A     110
8-Jan     B     50
9-Jan     B     75
9-Jan     C     1100
11-Jan     A     120
18-Jan     B     10
19-Jan     A     75
26-Jan     A     225
29-Jan     C     750</b>
(Note: MATERIAL refers to compound of Material, plant, storage location, etc.)
the user runs the query on Jan 7 for balance on Jan 6 (through a date variable) the max date in the ODS for Material A is Jan 5 and that for material C is Jan 1. The query should retrieve 110 units for A and 1000 for C.  The front end variable controls the time slice....
<b>How do I put this in a query</b>? Any help will be appreciated.

Hi,
Try the following approach. This is just an idea.I never used this in my project.
1) Use one z Key figure to represent the Quantity. This KF should have 'Last Value' for Exceptional Aggregation and 0calday as the 'Agg Reference char'.
2) In the query define a variable on 0calday to take user single entry(say ZVAR1)
3) Define restriction on quantity(z KF) with this variable like as follows:
KF : ZKeyFigure
0calday  > ZVAR1.
With rgds,
Anil Kumar Sharma .P

Similar Messages

  • Authorization Object for role creation for query display?

    Hi,
    Can Anybody here tell me what is the Authorization object that we use for role creation for query display?
    I want to assign a role to the newly designed query! that query does not have any role so far!
    Pls suggest me
    Thanks,
    Ravi

    Hi,
    I could make the authorization tab green by entering the authorization object!
    But user tab still remains red as it is not allowing me to enter my username in the user tab!
    in the user tab  i am unable to enter my user name?
    Any suggestions?
    Thanks,
    Ravi

  • POWL creation from Query

    Hi,
    I had created a query using SQ01. Now i want to create the POWL from this query and from the existing queries.
    Is there any document to create it.
    Anurodh

    hi,
    Use the below link. It has the document for POWL creation from Infoset query:
    [Powl from Infoset Qery|http://help.sap.com/bp_ekit604/BBLibrary/Documentation/k52_How_to_Guide_EN_DE.doc]
    Regards,
    MAdhu

  • Need help in creation of query

    Hi Experts,
    Can you please let me know, how to create a query for the following requirement .. I have a XXX -DSO, on which i have to take no of records for the particular date of loading for company code & account document type ...
    Please let me know ASAP ..
    Thanks & Regards
    PT

    Hi,
    I am trying to understand your requirement.  Are you trying to get the count for the day with respect to company code and document type?
    Do you need count which matches both the company code and document type?
    Regards.
    Shanker

  • Creation of query using ME13 transaction

    Hi All,
    I have created a query the details of the out put taken from ME13 transction. In ME13 transctions three tabels are used EINA, EINE , KONP  I have joined this tabels in infoset. For KONP and other two table4s system is showing no realtion so I have taken LFM1 for joing KONP with other two.
    I am not getting anuy output. Can someone help me on this whether the table join is correct  or any improvement in that is required
    Regards,
    Prashant

    Please define additional fields in the query.
    You can select a field1 from table1 after comparing field2 in table2 with field2 in table1 even though table1 and table2 cannot be joined
    For e.g. "select single mahna from mhnk into DUNNINGPROCEDURE where kunnr eq mhnd-kunnr."
    Please show this code code as example to your ABAP consultant, he should be able to help.

  • Creation of Query using Infoset

    Hi everyone i have a problem with assignment of user goups to infoset in writing a query for generating own report. first i created user group, next infoset and later while creating query when the user group is selected the infoset which i created and assigned to user group is not showing in dialog box. it's showing something else. i have checked all the assignments so far everything is good but couldn't figure out. can one help in this? tks in adv.

    Hi Rajesh,
    There will be two querry areas, check in which area you have created Infoset and user group. You will find the combination in relevant query area only.
    Two area are
    Standard Area (Client-specific)
    Global Area (Cross-client)
    Thanks
    ANAND K

  • Creation of Query View

    Hi All,
    Can someone pls explain me how to create a query view and what is its importance?
    Thanks in advance.
    Chaitra

    Hi Chaitra,
    i dont know which BW version you use but let me explain that for BW 3.5:
    1.) Local Views: If you navigate in your BEx workbook - for example you start a query and navigate in Excel - you can save the view state in the BEx workbook. Than this view is a local view stored in the BEx workbook. You can open this views by using the "jump" button in the BEx toolbar.
    For example you filter your query by different sales organizations and there are 4 sales orgs available. You can than filter and create a local view for each sales organization.
    Its a good way to switch fast between different views within a workbook without many navigation steps. Just a click or link is enough. End users like this.
    The view is saved "in the workbook".
    Hint: to save use the blue save button in BEx Analyzer.
    2. Global Views: You can navigate within your query in the BEx Analyzer and if you reached a good view state with the filters and the requested drill down you can save the whole view with any settings (query, characteristcs, key figures etc.) as a "global" view. In this case you must save the global view a description and a technical name. Now this view is saved "on the BW server" and any user can open this view by using the open function.
    And you can use this global view in the Web Appication Designer as an initial view for tables and charts. There are many more things you can do with it. For example: if you filter for example a special sales org in a global view, than you can use a drop down box (mapped with sales org in web application designer) and the drop down box is pre filtered with this sales org. As you can see global views are important for wen reporting.
    Hint: to save use the blue save button in BEx Analyzer.
    Global views can be openend in the excel or web.
    If you read the online help you will find more useful examples.
    Hope this helps.
    Regards,
    Adem

  • Creation of Query - SQ01

    Hello All,
    Can anybody expalin in brief regarding how to write a quiery using SQ01?
    If possible can anybody send me the docs relating to this?
    Thank you,
    Regards,
    Santosh Kumar V

    Santosh - I am also new to SQ01, however I have some suggestions that hopefully will be helpful to you.  I recommend starting with the QuickViewer.  You can access this from SQ01 or via SQVi directly. 
    From here you can create your own queries (similar to local objects) which can then be converted into InfoSets/Queries in which users can access. 
    1. Enter a name + Create
    2. Give a description, decide if Data Source is a table (single) or a join (many)
    3. I assume you are creating a join.  When you select join it will take you into the tool to generate the query.  The first step is selecting (and joining) your tables.  Insert table (Shift +F1) will get you started here.  Once all your data is selected you green arrow back to select/map out your selection criteria and the data in which you wish to list in the results.
    4. You can execute from here as well to confirm your results
    5. Once you are good to go, you can easily convert this query by going back to SQ01 (select SAP Query).  Enter your QuickView query name and then in the menu path select Query --> ConvertQuickView.  This will then prompt you through the steps to convert your QuickView Query into an SAP infoset/Query. 
    6. Once you have created the SAP Query you can then assign usergroups via menu path environment --> usergroups for authorization.  This allows others to execute your query, however not create one themselves. 
    I hope this is helpful. Best of luck!

  • Creation of query extract

    Hello All,
    Via the rscrm_bapi transaction I am trying to create a query extract but I receive the following error message "Error when scheduling the query (JOB_CLOSE)".
    Please advise on what the problem is and how to rectify.
    Regards,
    Keith Kibuuka

    You are probably logged onto an app server instance which is not running the required Backg process to schedule the jobs.
    Do this. Go to SM51. Double click on the server instance which is running Backg (Background process). Now you will be logged onto the appropriate server. Now you can to schedule the RSCRM_BAPI job.
    Good Luck
    Uma

  • Creation of query using SQ00

    Hi All,
    As business users we don't have access to SE16 or SE16N and during month end we have to check the deleted POs for the particular month and report it back. Each time we have to go to support team who will extract this data for us and this takes 2-3 days unnecessarily.
    Now I know we have to look in table EKPO, set date field between 01.08.2014 to 31.08.2014, and populate field LOEKZ = L to get the deleted POs for August month but I am unable to convert this into a SQ00 query. Can some of you experts help me with some kind of documentation or steps here to create the SQ00 query?
    Best Regards,
    Anup

    Hi Anup ,
    Method A
    1) . create an infoset on EKPO table . Go to extras , in the code section go to record processing and there write the below mentioned code :
    CHECK EKPO-LOEKZ = 'L'  .
    2).  now create a query on this infoset .
    Method B
    1). create an infoset on EKPO table .
    2). create a query on this infoset . Mark LOEKZ as selection screen field .
    So now when you execute the query ,  on selection screen pass 'L' to LOEKZ field .

  • Creation of query base on quarters

    Hi
      we have to create a query which shows sales of customer for last four quarters.
    can you pls tel me how to get the data for last four quarters

    Hi HariPriyasS  ,
    Take 0CALMONTH and restrict it with variable 0CMCQUAR.
    Now in the same same where you have selected this variable 0CMCQUAR, there is a button called "Set Offset for Variable", use this button to set the offset. Now take the offset as "-12". So this will give you "the Current Quarter in Last year".
    Now again do the same activity as described above but with offsets as -9 , -6 , -3  and at last use same variable with no offset that will represent current quarter.
    Hope this gives you a better clarity.
    Regards,
    Pratap Sone

  • Variable creation in query designer

    Hi Experts,
    In BW3.5 Query designer,when we create a new variable we have option "Processing By: Customer exit ".
    I have created variable with this option for hierarchy but where should I change it in customer exist and how do I know/test whether it's calling customer exit FM?
    I have read the documents but can anybody explain me in simple steps.

    Hi,
    Check the below link gives good knowledge on variables:
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/579b3c494d8e15e10000000a114084/content.htm
    Reg
    Pra

  • Formula creation in Query designer

    Hi All
    I want to explain a bit more on my requirement .
    I have supplied qty and ordered qty and i have the difference between both which is called as service level as %. there will always be 100% for some suppliers and lessthan 100% . So i want to count only the 100% suppliers and divide by all the suppliers . so that i can get the perfect order . and the formula is below .
    I need to apply a formula line count with 100% / line count in one of my querys how to do it the qury designer . Can you anybody guide how to do it .
    Thanks in advance . I am sorry if i have posted in the worng fourm .
    thanks

    you must be having an  infobject refering to say supplier say supplier no. ( like customer number).
    STEP 1: create a new CKF ( formula in query designer on right columns panel)
    STEP 2: create a formula variable with reference characteristic as supplier no . replacement path replaced with infobject->attribute value - constant 1.
    STEP 3. you CKF  " NO OF SUPPLIERS"  definition would be as below
    supplier counter .
    STEP 4. identifying 100% suppliers.create a new CKF  " NO OF 100% SUPPLIER " ( formula in query designer on right columns panel).
    it definition would be
    supplier counter * ( ordered qty == supplied qty ).
    where supplier counter is formula variable. this will give total counts of supplier where ordered qty == supplied qty.
    STEP 4.
    divide CKF  " NO OF 100% SUPPLIER " / " NO OF SUPPLIERS"

  • INDEX Creation for Query Optimization

    Hi Experts
    I have the below query:
    SELECT A~VBELN A~POSNR A~MATNR A~KWMENG A~KBMENG
    A~ERDAT A~ERZET A~PSTYV D~AUART E~ETTYP E~EDATU
    INTO TABLE INT_RES
    FROM VBAK AS D INNER JOIN VBAP AS A
    ON D~VBELN EQ A~VBELN
    INNER JOIN VBEP AS E
    ON E~VBELN EQ A~VBELN AND
    E~POSNR EQ A~POSNR
    WHERE D~VBELN IN S_VBELN AND
    D~AUART IN S_AUART AND
    D~VKORG IN S_VKORG AND
    D~VBTYP EQ 'C' AND
    ( ( A~MATNR LIKE C_PREFIX_SP AND ZZ_MSPOSNR NE 0 AND KBMENG EQ 0 ) OR
    ( MATNR LIKE C_PREFIX_FP AND KWMENG NE A~KBMENG ) ) AND
    A~ABGRU EQ SPACE AND
    A~MTVFP IN R_MTVFP AND
    A~PRCTR IN R_PRCT AND
    E~ETENR EQ '1'.
    I tried many ways of re-writing the query - yet performance could not be improved. Now I need to create an INDEX and check if it works out?
    Could you please help me suggesting upon which table and which fields in which order I can create an effective INDEX?
    Please Help

    Hi,
    Check which selection criteria are polulated when you run the query.
    Also one issue might be with using the LIKE keyword in the where clause.
    ( ( A~MATNR LIKE C_PREFIX_SP AND ZZ_MSPOSNR NE 0 AND KBMENG EQ 0 ) OR
    ( MATNR LIKE C_PREFIX_FP AND KWMENG NE A~KBMENG ) ) AND
    Instead of using this, I would suggest you get all the materials from material master using the like operator and pass them in a range to this query.
    select matnr from mara into it_mara
    where matnr like c_prefix_sp.
    select matnr from mara appending table it_mara where matnr like c_prefix_fp.
    "Loop at it_mara and populate a range. Which will then be used in the select query
    That might help improve the performance.
    regards,
    Advait

  • New structure creation in query

    Hi Experts,
    I need to create structure  to be a key figure, that structure I can put in to any query.Pls tell me procedure to create sturcture with few sales employess names ,so tht i can use it in other queries.
    Thanks!

    HI,
    Create a Structure and save as by giving technical name and description,
    in Query Designer top left side you can see a folder name as Structure, expand it
    structure are two types,
    1) Structure with key figures
    2) Structure without key figures
    in your created structure if you have key figures, then expand the Folder (structure with Keyfigures); you can just drag the structure to columns/rows like any other objects.
    these structures will be available and valid for all the queries which you create on the same infoProvider.
    Note: what ever the changes you made to these structures will effect globally; if you want to make any changes to this structure for only one query without effecting globally than, in the query panel remove the reference by right click-->remove reference, now you can use this structure locally.
    Regards
    Reddy A

Maybe you are looking for