Pl.tell a query for non databsae items values as zero

hai
i have table like this
emp_name     date           hours
xxx          19-12-2007     3
yyy          20-12-2007     4
zzz          23-12-2007     3
i want a query to get the data for 5 days.(ie.19 to 23)
In that the left two days should be placed as zero in the output.
please help me.
thanks

Something like:
SQL> ed
Wrote file afiedt.buf
  1  with t as (select 'xxx' as emp_name, to_date('19-12-2007','dd-mm-yyyy') as dt, 3 as hours from dual union all
  2             select 'yyy', to_date('20-12-2007','dd-mm-yyyy'), 4 from dual union all
  3             select 'zzz', to_date('23-12-2007','dd-mm-yyyy'), 3 from dual)
  4  -- END OF TEST DATA
  5  select t.emp_name, d.dt, nvl(t.hours,0) as hours
  6  from t,
  7       (select to_date('19-12-2007','dd-mm-yyyy')+rownum-1 as dt
  8        from dual connect by rownum <= to_date('23-12-2007','dd-mm-yyyy') - to_date('19-12-2007','dd-mm-yyyy') + 1) d
  9  where d.dt = t.dt(+)
10* order by d.dt
SQL> /
EMP DT                       HOURS
xxx 19/12/2007 00:00:00          3
yyy 20/12/2007 00:00:00          4
    21/12/2007 00:00:00          0
    22/12/2007 00:00:00          0
zzz 23/12/2007 00:00:00          3
SQL>

Similar Messages

  • Approval Query for Invoices with Items Onhand below zero.

    Dear Experts,
    I would like to make an approval procedure applicable on A/R Invoice. 
    When ever one of the Invoice items OnHand amount is below ZERO - I need the Approval Procedure to Popup and this way the Produce of the Invoice will be blocked.
    Is there any way to write a query on Approval Template for that?
    Thanks! 
    Regards,
    D.Medalion

    Hi D.Medalion
    Please Follow some step
    First Create Approval Stages in Administration ->Approval Procedures->Approval Stages
    First -
    Administration ->Approval Procedures->Approval Templates->Documents-> Click On A/R Invoice .
    Second-   Administration ->Approval Procedures- Approval Templates->Terms->When the Following Applies->Click Tick On Deviation from Commitment  and ration Drop Down Choose Greater or Equal
    Thanks & Regard
    Khan Imran

  • How can we run MDBT transaction for non-valuated items only

    HI,
    We want to run the MDBT transaction for non-valuated items only...but through this transaction we can run for all items..
    How can we run only for non-valuated items???
    Regards,

    Dear Anil,
    MD02 - Material level planning ( Multilevel )
    MD01 - Plant level planning ( Multilevel )
    MDBT - Back ground MRP ( Multilevel )
    coming to ur query if all 20 materials belongs to one storage location or one MRP controller
    Then you perform MRP for that 20 materials with the above given user exit
    Also Plz refer my reply from this thread
    [Re: MD01 Replanification.]
    Regards
    Madhu

  • For non Stock items ?

    Hi ,
    For non stock items (which do not have material code ) , what price we will put in PR ?
    In live scenario, suppose a  requestor from HR dept is raising a PR for non stock material.
    Suppose the material is procuring for first time in that company .
    He doesnt know the price for that .
    So what price he will put in the PR?
    Please tell me in live scenarios , what people used o do ?
    regards,

    Hello Sandeep,
    While creating purchase requisition, normally user dept will put the approximate price for that material/service. sometime user will put even price as 0.01 (currency) also in PR and purchasing dept will put the negotiated price at the time of Purchase order creation.
    Hope this helps.
    Regards,
    Arif Mansuri
    Reward if answer is helpful.

  • Formatted Search - Calculate GP Base Price for Non Inventory Items

    Hi Experts,
    On one of our customer's 8.8 PL 15 installation, requirement was to calculate GP for Non Inventory Items (on SO screen). Since SAP does not automatically calculates it we proposed and implemented following solution.
    1. Have all Non Inventory Items to be costed at Standard cost so that you can manually enter the cost in the Item Master.
    2. Write following formatted search on GP Base Price field so as to calculate the GP Base Price for the Non Inventory Items only. The formatted search must not make any changes to Inventory Items as we want system to calculate the GP automatically (just in case cost changes from SO to Delivery or Invoice).
    DECLARE @II AS nVarchar(1)
    DECLARE @COST AS Numeric(19,2)
    SET @II = (SELECT OITM.InvntItem FROM OITM WHERE OITM.ItemCode = $[RDR1.ItemCode])
    SET @COST = (SELECT     (OITW.AVGPrice * $[RDR1.NumPerMsr]) FROM     OITW WHERE     OITW.ItemCode = $[RDR1.ItemCode] AND
         OITW.WhsCode = $[RDR1.WhsCode])
    IF (@II = 'N')
    BEGIN
    SELECT @COST
    END
    3. Formatted search achieves what was originally required however if a user overwrites the Item Code (Inventory Item) in the SO then above formatted search clears the GP Base Price field and sets the GP basis for the item as "Manual". By obverwrite means user first selected item A0001 on line 1 and then entered A0002 on same line i.e. Line 1.
    My question here is what is wrong in the formatted search that is resulting in this behaviour.
    Any questions please let me know.
    Thanks in advance.
    Regards
    Devinder

    Hi Gordon,
    Thanks for taking out time to help me however Key requirement here is
    Write formatted search on GP Base Price field so as to calculate the GP Base Price for the Non Inventory Items only.
    Your query sets the base price for GP Base Price for Inventory Item to ZERO and Base Price By to Manual.
    Note that my Formatted search has a problem only when an Inventory Item line is overwritten. I am not sure if this is a problem with SAP itself rather than my query.
    Any other ideas please?
    Regards
    Devinder

  • GR/IR Clearing for Non-Inventory Items in PO

    Hi all,
    Can anybody explain if GR/IR reconciliation can be done for non-inventory items in PO. For example, I've raised a PO for a service and received invoice before the service is delivered (little hypothetical, of course, but incase).
    If so, will it show in the same MR11?
    Thanks
    durga.

    Hi,
    First of all , in case of Service ,Only SR/IR reconcilation can be done.....second ,if your service is not delivered then you can give advance against service PO.
    Regards

  • Credit memo for non inventory item

    Hi MM consulatnats,
    My client need to know the best practices to handle teh credit memo for non inventory item ??
    We have two options like FB65 in FI part where it wont update in PO history.
    In MIRO also we can make credit memo w.r.to PO.
    What they  want to know is if FB65  is the correct way to do this to fully reverse the effect that the receipt and invoicing of the item had on the financial accounts.
    What is the best pracise to adopt ??
    Need your views
    Thanks
    A.Gururajan

    Hi,
    You can use MIRO for credit Memo with ref to PO.
    This will update both PO history as well as your FI accounts/Vendor Balance.
    Thanks & Regards,

  • Cost of goods sold (cogs) for non-shippable items (intangible items)

    Hi Experts,
    Can anyone please help me on this issue for shippable item we can check in material transactions--distributions for cogs account and cost of an item. But how can we check the cost and account for non-shippable items (intangible items) with out using the items and item cost form.
    Thanks in advance,
    Christ.

    Hi,
    You need to replace the join MSI.SALES_ACCOUNT(+) = GCC.CODE_COMBINATION_ID with msi.cost_of_sales_account(+) = GCC.CODE_COMBINATION_ID to get the COGS account. Currently you are getting sales account not COGS.
    Thanks
    Vishalaksha

  • MIGO Print label WEE1 for non stock items from GR for PO

    Hi,
    I added logic to print new label into printing program MZ07DETI which is printing labels for stock items. My label is for non stock items. The problem is that for non stock items printing process is not triggered. I created PO with Account Assign. Category F, P or K no material number and no storage location. For this type of PO no print possible during GR posting. Is any set up available in IMG to make it work. I appreciate any response.

    Hi,
    Please check up if there is any default value at the plant level;in case of such default,the system will post to the GL Account defaulted,not with standing the "standard item category".Better checkup if any cost center /order has been assigned.
    The GL item is defaulted thro'the item category.If both the goods and services have been defaulted to the same GL  Account,then not with standing the type [ie] whether goods or services,the system will post tot he same GL Acct.
    Hope this helps.
    Regards.
    Ramesh

  • How to create ABAP Query for vendor open items

    HI,
    My client has requested me to create ABAP Query for vendor open items . So that it will be usefull for the users . Could anyone help me with this. I will assign you points.Thanks in advance.

    Hello,
    Use Table BSIK <Open Items of AP > & BSAK <AP Cleared items>......
    For Query you can use SQ01.
    USE BSID & BSAD for AR open/clear items...
    LFA1, LFB1 are vendor master data tables
    This is FYI
    Hope this helps.
    Rgds
    Rajendra

  • Vendor part number for non catalog item in shopping cart?

    I have a requirement to get the vendor part number field in shopping cart basic data for non catalog item. This field is available for catalog items, would it be possible to make the same field available for non catalog items as well?

    Hi Gummadi,
    You can create custom fields in Shopping cart uisng a BADI and can populate the information.
    BBP_CUF_BADI can be used to create customer fields.
    Please get discuss with your ABAP fellow for the creation of customer field.
    Award points for helpful answers.
    Rgds,
    Teja

  • Query for non turn customer report in service module(Add-on)

    Hi,
    I want create  query for non turn customer report, that mean the customer who are not come for  last 6 months to our service workshop in service module(Add-on). this is a scenario. 
      SELECT T1.U_CardDate, T1.U_JCardNo,T1.U_TypeSrv,T2.U_VehReg,T2.U_PurchDt, T2.U_VehDesc, T2.U_VehModel, T1.U_KmsRead,   T1.U_BPCode, T0.CardName, T0.AddrType , T0.Building,T0.Block, T0.Address,T0.City,T0.ZipCode, T0.State1,T0.MailBuildi,T0.MailBlock, T0.MailAddres, T0.MailZipCod, T0.MailCity, T0.State2 ,T0.MailAddrTy,  T0.Phone1, T0.Phone2, T0.Cellular FROM [dbo].[OCRD]  T0 INNER JOIN [dbo].[@ALD_JOBCARD]  T1 ON T0.CardCode = T1.U_BPCode INNER JOIN  [dbo].[@ALD_VEHMAST]  T2 ON T1.U_BPCode = T2.U_BPCode WHERE T1.U_CardDate BETWEEN [%0] AND [%1] ORDER BY T1.U_CardDate.
    this query is get all  customer data who are not come to service workshop for last 6 month. i want to filter data who are not come last 6 months this year. kindly assist me
    thank you.

    Check this:
    SELECT Max(T1.U_CardDate) 'Lase Serve Date', T1.U_JCardNo,T1.U_TypeSrv,T2.U_VehReg,Max(T2.U_PurchDt) 'Last Purchase', T2.U_VehDesc, T2.U_VehModel, T1.U_KmsRead, T1.U_BPCode, T0.CardName, T0.AddrType, T0.Building,T0.Block, T0.Address,T0.City,T0.ZipCode, T0.State1,T0.MailBuildi,T0.MailBlock, T0.MailAddres, T0.MailZipCod, T0.MailCity, T0.State2 ,T0.MailAddrTy, T0.Phone1, T0.Phone2, T0.Cellular
    FROM [dbo].[OCRD] T0
    INNER JOIN [dbo].[@ALD_JOBCARD] T1 ON T0.CardCode = T1.U_BPCode
    INNER JOIN [dbo].[@ALD_VEHMAST] T2 ON T1.U_BPCode = T2.U_BPCode
    WHERE T1.U_BPCode NOT IN
    (SELECT DISTINCT U_BPCode FROM dbo.[@ALD_JOBCARD] WHERE DateDiff(DD,U_CardDate,GetDate()) < 183)
    Group By T1.U_JCardNo,T1.U_TypeSrv,T2.U_VehReg,T2.U_VehDesc, T2.U_VehModel, T1.U_KmsRead, T1.U_BPCode, T0.CardName, T0.AddrType, T0.Building,T0.Block, T0.Address,T0.City,T0.ZipCode, T0.State1,T0.MailBuildi,T0.MailBlock, T0.MailAddres, T0.MailZipCod, T0.MailCity, T0.State2 ,T0.MailAddrTy, T0.Phone1, T0.Phone2, T0.Cellular
    ORDER BY T1.U_CardDate

  • Order Priority not transferred to PR for NON stock items

    Dear GUYS
    Order priority is not getting transferred to PR for Non sotck item
    ideally we should get this in the source of supply in the PR as requirement priority & requirement urgency
    Regards
    chandrashekhar Ingole

    chandrashekhar Ingole,
    It may be possible to transfer the PM Priority data to the PR via [user-exit|http://pjatkin.users.btopenworld.com/documents/PMCSUserExits.pdf] :
    - COZF0001: Change purchase req. for externally processed operation
    - COZF0002: Change purchase req. for externally procured component
    PeteA

  • PO Partial confirmation Quantity not updated for non-catalog items in SRM

    Hi Experts,
    Partial Confirmation plus Partial Rejection from Ariba(Suppliers network) could not be processed.
    Steps to Reproduce:
    1) Create a purchase order.
    2) Confirm some part of the quauntity and reject the balance part in Ariba.
    3) Open the link in SRM and click Copy push button.
    4) Click on Process PO and check PO, the PO is not updated with the changes done in Ariba
    Expected Result:
    PO should update the changes done in Ariba.
    Here when part quantity is confirmed and part is rejected at Ariba, its sending a POR but SRM is not updating anything for non-catalog items when POR is copied onto PO.But where as  in the Catalog items partially confirmed POR is copied onto PO.
    kindly give your valuable inputs to poceed furthur.
    Regards,
    Chandu

    Hi,
    I'm not clear you issue. Is it SC -> PR(backend) -> PO(backend) classic scenario ? or You just created a PO in backend system?
    BBP_GET_STATUS_2 will update SC follow-on doc information from backend.
    Regards,
    Masa

  • MR11- for non material item

    I just try to do for one PO with all non material item and
    I can't do MR11 for non material item..
    error:      Error  while determining the currency types for 6302400500 00010

    Hello,
    a non material item can be a text item but it can be also a service item.
    This depends from your customizing. Which item type is relevant for your non material item.
    In the item type you can maintain if an item is relvant for pricing or not.
    Please have a look in transaction VOV7. Here you can set the flag 'Pricing'.
    This flag can have the following specification:
          Blank  No pricing
    X     Pricing standard
    A     Pricing for empties
    B     Pricing for free goods (100% discount)  
    I hope that the information are helpful.
    Best regards
    Claudia
    Edited by: Claudia Neudeck on Jul 17, 2008 8:17 AM

Maybe you are looking for