OIVL query (warehouse Journal)

Hi Everyone,
First query below is working because the parameter is static, but if i set a dynamic parameter then it will return an error.
SELECT 'CN TO PRIMARY WHs' as 'Type', A.CreatedBy, A.Transtype, A.DocDate, A.ItemCode, A.InQty, A.OutQty, A.Price, A.LocCode, A.SumStock, A.Usersign,
CASE  WHEN A.Transtype = 13 THEN 'AR INVOICE'
WHEN A.Transtype = 14 THEN 'ARCM'
WHEN A.Transtype = 16  THEN 'RETURNS'
WHEN A.Transtype = 60 THEN 'Goods Issue/Issue for Production'
WHEN A.Transtype = 59 THEN 'Goods Receipt/Receipt from Production'
WHEN A.Transtype = 20 then 'Goods Receipt PO'
WHEN A.Transtype = 18 then 'A/P Invoice'
WHEN A.Transtype = 10000071 then 'Inventory Posting'
WHEN A.Transtype = 15 THEN 'Delivery 'ELSE 'Others' END AS Document_Type ,A.Base_Ref as Docnum
FROM OIVL A
WHERE A.[DocDate] >= '20140901' and A.Transtype NOT IN ('15', '59', '67') and A.LocCode not in ('LLD', 'THD')
DECLARE @Date  = /* SELECT FROM dbo.OIVL A WHERE A.DocDate >= */  '[%0]'
SELECT 'CN TO PRIMARY WHs' as 'Type', A.CreatedBy, A.Transtype, A.DocDate, A.ItemCode, A.InQty, A.OutQty, A.Price, A.LocCode, A.SumStock, A.Usersign,CASE WHEN A.Transtype = 13 THEN 'AR INVOICE'
  WHEN A.Transtype = 14 THEN 'ARCM'
  WHEN A.Transtype = 16  THEN 'RETURNS'
  WHEN A.Transtype = 60 THEN 'Goods Issue/Issue for Production'
  WHEN A.Transtype = 59 THEN 'Goods Receipt/Receipt from Production'
  WHEN A.Transtype = 20 then 'Goods Receipt PO'
  WHEN A.Transtype = 18 then 'A/P Invoice'
  WHEN A.Transtype = 10000071 then 'Inventory Posting'
WHEN A.Transtype = 15 THEN 'Delivery 'ELSE 'Others' END AS Document_Type ,A.Base_Ref as Docnum
FROM OIVL A
WHERE A.Docdate >= @Date and A.Transtype NOT IN ('15', '59', '67') and A.LocCode not in ('LLD', 'THD')
PS I also tried running it on A.Docdate >= [0%] but its not working.
Any ideas?
Thanks!
Regards,
Darius Gragasin

Hi,
Try this:
DECLARE @Date as Datetime
Set @date = /* SELECT FROM dbo.OIVL A WHERE A.DocDate >= */  '[%0]'  
SELECT 'CN TO PRIMARY WHs' as 'Type', A.CreatedBy, A.Transtype, A.DocDate, A.ItemCode, A.InQty, A.OutQty, A.Price, A.LocCode, A.SumStock, A.Usersign,CASE WHEN A.Transtype = 13 THEN 'AR INVOICE'  
WHEN A.Transtype = 14 THEN 'ARCM'  
  WHEN A.Transtype = 16  THEN 'RETURNS' 
WHEN A.Transtype = 60 THEN 'Goods Issue/Issue for Production' 
  WHEN A.Transtype = 59 THEN 'Goods Receipt/Receipt from Production' 
  WHEN A.Transtype = 20 then 'Goods Receipt PO' 
WHEN A.Transtype = 18 then 'A/P Invoice' 
  WHEN A.Transtype = 10000071 then 'Inventory Posting' 
WHEN A.Transtype = 15 THEN 'Delivery 'ELSE 'Others' END AS Document_Type ,A.Base_Ref as Docnum 
FROM OIVL A 
WHERE A.Docdate >= @Date and A.Transtype NOT IN ('15', '59', '67') and A.LocCode not in ('LLD', 'THD')
Thanks & Regards,
Nagarajan

Similar Messages

  • Warehouse journal

    Dear All,
    is there a warehouse journal table available for non stock item like sales item or purchase item ?
    Rajh

    OINM - Warehouse Journal
    Jeyakanthan

  • Duplicate rows on Query with journal entries and AP documents

    Hi Experts,
    I ahve the below query allowing me to have some information from journal entries and retrieve some other from AP docuements and PO.
    The thing is the query duplicates rows because the AP docuements have several rows but i don t know how to do to remove them (i guess this has to do with JOIN function...)
    SELECT
    T2.[GroupMask] as 'Account Family',
    T2.[FatherNum] as 'Parent Account',
    T2.[AcctCode] AS 'Account Code',
    T2.[AcctName] AS 'Account Name',
    T0.[TaxDate] AS 'Document Date',
    T0.[Number] AS 'Number',
    T0.[DocSeries] AS 'Document Series',
    T0.[BaseRef] AS 'Base Reference',
    T0.[TransId] AS 'Transaction Number',
    T0.[Ref2] AS 'Reference 2',
    T1.[ContraAct] AS 'Offset Account',
    T4.[BaseRef] AS 'PO code',
    T1.[Project] AS 'Project Code',
    T1.[ProfitCode] AS 'Distribution Rule',
    T1.[OcrCode2] AS 'Costing Code 2',
    T1.[OcrCode3] AS 'Costing Code 3',
    T1.[OcrCode4] AS 'Costing Code 4',
    (T1.[SYSdeb]-T1.[SYSCred])  AS 'Total Amount EUR',
    (T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
    T5.[DocTotalSy] AS 'PO Amount (EUR)'
    FROM  [dbo].[OJDT] T0 
    INNER  JOIN [dbo].[JDT1] T1  ON  T1.[TransId] = T0.[TransId]  
    INNER  JOIN [dbo].[OACT] T2  ON  T2.[AcctCode] = T1.[Account]  AND T2.[AcctCode] = T1.[Account]  
    INNER JOIN [dbo].[OPCH] T3 ON T3.[DocNum] = T0.[BaseRef]
    INNER JOIN [dbo].[PCH1] T4 ON T3.[DocEntry] = T4.[DocEntry]
    LEFT JOIN [dbo].[OPOR] T5 ON T5.[DocNum] = T4.[BaseRef]
    WHERE
    (T2.[AcctCode] > (N'599999' ) ) AND  (T2.[AcctCode] < (N'799999' ) )
    AND (T0.[TaxDate]>= [%0] ) AND (T0.[TaxDate]<= [%1])

    Try This
    SELECT T2.[GroupMask] AS 'Account Family',
       T2.[FatherNum] AS 'Parent Account',
       T2.[AcctCode] AS 'Account Code',
       T2.[AcctName] AS 'Account Name',
       T0.[TaxDate] AS 'Document Date',
       T0.[Number] AS 'Number',
       T0.[DocSeries] AS 'Document Series',
       T0.[BaseRef] AS 'Base Reference',
       T0.[TransId] AS 'Transaction Number',
       T0.[Ref2] AS 'Reference 2',
       T1.[ContraAct] AS 'Offset Account',
       T4.[BaseRef] AS 'PO code',
       T1.[Project] AS 'Project Code',
       T1.[ProfitCode] AS 'Distribution Rule',
       T1.[OcrCode2] AS 'Costing Code 2',
       T1.[OcrCode3] AS 'Costing Code 3',
       T1.[OcrCode4] AS 'Costing Code 4',
       sum(T1.[SYSdeb]-T1.[SYSCred]) AS 'Total Amount EUR',
       sum(T1.[FCDebit]- T1.[FCCredit]) AS 'Total Amount (FC)',
       T6.[DocTotalSy] AS 'PO Amount (EUR)'
    FROM OJDT T0
    INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
    INNER JOIN OACT T2 ON T1.Account = T2.AcctCode
    INNER JOIN OPCH T3 ON T0.TransId = T3.TransId
    INNER JOIN PCH1 T4 ON T3.DocEntry = T4.DocEntry
    INNER JOIN POR1 T5 ON T4.[BaseEntry] = T5.[DocEntry]
    AND T4.[BaseLine] = T5.[LineNum]
    INNER JOIN OPOR T6 ON T5.DocEntry = T6.DocEntry
    GROUP BY T2.[GroupMask],
       T2.[FatherNum],
       T2.[AcctCode],
       T2.[AcctName],
       T0.[TaxDate],
       T0.[Number],
       T0.[DocSeries],
       T0.[BaseRef],
       T0.[TransId],
       T0.[Ref2],
       T1.[ContraAct],
       T4.[BaseRef],
       T1.[Project],
       T1.[ProfitCode],
       T1.[OcrCode2],
       T1.[OcrCode3],
       T1.[OcrCode4],
       T6.[DocTotalSy]
    Regards,
    Kennedy

  • Query for Journal Entry as Incoming/Outgoing Payment

    Hi all,
    I need a query that returns all journal entries that are incoming/outgoing payments.
    I have not found anything in the journal entries tables that marks it as a payment.
    thanks,
    Lucas.

    Hi Lucas,
    I am afraid 2 queries could be more meaningful. That might be more convenient:
    Incoming:
    SELECT T0.TransId as [Journal Entry#],
    T0.RefDate as [Posting Date],
    T0.BaseRef as [Incoming Payment #],
    Isnull(T1.AcctName,T0.ShortName) as [GL Account Name/Vendor Code],
    T0.Credit
    from JDT1 T0
    Left JOIN OACT T1 ON T1.AcctCode= T0.ShortName
    where T0.TransType=24 AND
    T0.Credit > 0
    Order By T0.RefDate
    Outgoing:
    SELECT T0.TransId as [Journal Entry#],
    T0.RefDate as [Posting Date],
    T0.BaseRef as [Outgoing Payment #],
    Isnull(T1.AcctName,T0.ShortName) as [GL Account Name/Vendor Code],
    T0.debit
    from JDT1 T0
    Left JOIN OACT T1 ON T1.AcctCode= T0.ShortName
    where T0.TransType=46 AND
    T0.debit > 0
    Order By T0.RefDate
    Thanks,
    Gordon

  • How do you query the journal drilldown data using SQL

    Hi All,
    Appreciate if anybody can assist me into querying the database via SQL query so the journal data includes sub ledger detail.
    I found that I cannot link the GL journal batch id (etc.) with the existing sub ledger (AR and AP). Is there any way to perform this query, if not, how can the drill down works?
    I needed the guidence since there are certain info that is not available in the journal (rct number, PO no, check no etc). I need to ensure that the data I have is tally with GL journals.
    Reasons: doing some recon download to be feeded to a third party system.
    Thanks.

    Hi there are mappings for the reference fields from AP and AR, so you can buid up the links there. Just look at the reference fields of gl_je_lines and try to identify which is valuable for you.
    Ugur YILMAZ
    http://oracle-master.com

  • Journal Voucher Query

    Hi Expert,
    Can I generate a query from Journal Entry Voucher with an open status that will show the following:
    1. Posting date
    2. Ref1
    3. Account Code
    4. Debit
    5. Credit
    6. Transaction Code
    7. Profit Code
    Thanks and looking forward for your immediate feedback.
    Regards,
    ArlmiPJ

    Hi,
    Run this Query,
    SELECT * FROM OBTF T0 WHERE T0.[BtfStatus] = 'O'
    pick the fields you need
    regards,
    Fidel

  • Cant retrieve new created Journal through Journal manger Query

    Hi,
    System info: BPC7.5 NW SP03
    i created the journal template and successfully saved a new journal, the message indicate that " Journal successfully saved" and I can see that there is journal ID created for this, them, the data was disappear from the journal entry layout and if I tried to run the query from journal manager, the message indicate that" No journal found".
    exactly the same issue i have found in the forum but with no results. So i guess the problem shoud be resolved in the new release.
    Journal entry disappear
    Does anyother know the issue.
    Thanks a lot in advance
    -Xiaojun

    Well this reply is a little late but the resolution appears to be to install SP05.
    Please see SAP Note 1494696 (Text copied below)
    Summary
    Symptom
    Journal Manager is not showing some journals which could be observed.
    Steps:
    1.Logon BPC Excel Client.
    2.Go to Journal Manager.
    3.Select All and proceed.
    4.A message that no journals are found will be displayed.
      Actually there are some journals existed in back-end system.
    Other terms
    journal, query
    Reason and Prerequisites
    Program error
    Solution
    Please upgrade to BPC NW 7.5 SP05 or BPC NW 7.0 SP09.

  • Inventory in warehouse report

    Hi all,
    Let's say I'm on january 25th and I'd like to run the Inventory in Warehouse Report  as per january 10th. Is there a way to acess the code of the report to run the query for a specific date (not for the current date as I'm getting it) ?
    Any idea would be appreciated.
    Best regards,

    Douglas,
    To get the code of this report you will have to use SQL Server Profiler.  Just start the service before trigerring the report and stop it there after and you should get the SQL.
    Another better way, would be to create a report by querying the OINM (warehouse journal) table. This table records all warehouse transaction and also has the date.
    <Font Color="Blue" Size=3>To understand the OINM table run this query
    </Font>
    SELECT T0.TransNum AS 'Transaction Number', T0.DocDate AS 'Posting Date', T0.ItemCode AS 'Item No.', T0.Dscription AS 'Item Description', T0.InQty AS 'Receipt Quantity', T0.OutQty AS 'Issue Quantity', T0.Warehouse AS 'Warehouse Code', T0.Balance AS 'Stock Balance' FROM  [dbo\].[OINM\] T0  WHERE T0.ItemCode = 'A00001' ORDER BY T0.TransNum
    <Font Color="Blue" Size=3>To get the stock by date, use the query below
    </Font>
    SELECT TOP 1 T0.ItemCode AS 'Item No.', T0.DocDate, T0.Balance AS 'Stock Balance' FROM  [dbo\].[OINM\] T0 
    WHERE T0.DocDate = '[%0\]'
    ORDER BY T0.TransNum DESC
    Note I have added '[%0\]' parameter for date selection presuming you will use this within SAP.
    Suda

  • Goods issued and delivered query

    I want to find out the quantity taken out of stock for a selection of items in a given month.  I can obviously create a query based on deliveries but we also issue some stock for internal use.  I'm struggling to identify the correct table.  I have located OITM (warehouse journal) but am not sure if this is the correct one.  Also I have been unable to work out which 'transaction type' I need if any.
    Any thoughts appreciated.

    Hi,
    Welcome you post on the forum.
    OINM is what you need. However, for new version it is a view only. What is your B1 version and PL?
    Thanks,
    Gordon

  • Delivered PeopleSoft Query

    I need your help with a GL delivered query.  I am sure if you look at your client environment, the query should be delivered as well.  The delivered query is  called, GL_ARCH_JRNL that archives Journals in GL.
    I couldn’t make out from the criteria column what it is doing.  From what I gathered it is archiving Journals that are posted and closed by specifying as prompt values the Business unit and ledger group. ?? I know this query archives Journals which are closed and posted but I wasn’t sure what the other prompt values meant such as Request data, As of Data, Retention days and Begin date…
    Please advise if am understanding this correct.
    Please advise.

    This query is used to archive journals through the Data Archive Manager tool.
    It is documented in the PeopleSoft Enterprise General Ledger 9.1 PeopleBook  under "Archiving for Ledgers and Journals". There you'll find an explanation of the prompts under "Journal Archive Query Parameter Descriptions".
    Regards,
    Bob

  • Journal report - template by account

    I have a question about the journal report based on the by account template which comes with BPC. When I run it (for testing I have one journal only) and select an account, the report shows the correct journal ID but it shows both the credit and the debit entry, though only one of the two is posted to the account I have selected.
    I wanted to use the report to check the amounts posted to a specific account by journal ID but it seems that this is not possible.
    Has anyone worked with this report and can help me?
    Thanks,
    Arnold

    Arnold - I am pretty sure that if you look at the account string, this report will show you both sides of each journal transaction.
    This is another canned report that BPC automatically creates.  It is built on SQL Services Reporting Services, and it is very limited.  I would be interested in what others have to say, but so far I have not found many people on this discussion board that actively use Journals feature of BPC.
    Something you may want to consider is to research how to set up a DQY file, to be able to start at an intersection and drill through to the detailed journals related to an account intersection.
    Another thing you might want to try is to create a Data Manager package that would query the journal tables directly dbo.jrnApplicationName (which contains header info) and dbo.jrnDTLApplication Name (which contains detail journal info), and either send you the report in email or save it at a server location. 
    Greg

  • Intercompany Journals in GL

    Hi
    Could you give pointers on how intercompany journals are created in GL and what setups are required.
    Thanks

    Hi ,
    My requirement is to setup intercompany journal function through GIS in 11.5.10
    Though I've multiple books, for simplicity sake I'll discuss setup between 2 books only ( Book A and Book B both USD and using the same COA and calendar)
    Here are the following steps I performed.
    1.Setup a GIS book (Book GIS) with parent previliges
    2.Assign a GIS super user responsibility.
    3.Create Book A as subsidiary by logging into the GIS super user responsibility. in Subsidiaries window. The Intercompany book and local book refers to Book A.
    4.Create Book B as subsidiary . The Intercompany book and local book refers to Book B.
    5. Created 2 responsibilities one each for Subsidiary A and Sub B and assigned the appropriate subsidiary book in the profile option.
    6. Setup clearing accounts for Subsidiary A and B.
    7.Login as sub A and created sender side transaction. Then login in Sub B and entered receiver transaction, approved.
    8 Transfered into the respective books and could see the interco journals in book A and B.
    Now the question is
    1. Is it the correct setup for GIS ?
    2. What purpose does the 'Book GIS' satisfy. When I query for journals from that book using the journal find window , I don't see the interco-journals.
    Thanks

  • Unable to delete a journal using Group ID

    Hello guys,
    I have an imported journal that needs to be deleted. I used the delete journal window, issued the group id, the source and the request id and submitted the delete program but the journal could not be deleted. Though, the progrm completed normal.
    Any idea will help.

    In which table is the data still appearing?
    Headers?
    If so query the Journal from front end and delete it.

  • FIFO layers detail requirement

    Hi Team,
    I am facing problem for the development of costing of the fininshed
    goods whihc we are manfucturing in warehouse through production module .
    For my result purpose i need to know the detail of raw material whihc
    actually consumed and from whihc layers based on the FIFO concept.
    i am reffering to oinm table (warehouse journal) in whihc all the
    detial of the material flow is present but information related to
    layers from whihc the items are consumed actually ,
    this information is missing in oinm due to whihc my link
    development is not proper and i am
    facing problem to track the actual consumption FIFO wise.
    so kindly provide me the infromation how to get the data of layers 
    for eg. the layer information should be like
    GRPO 20(doc No OF GRPO) and 3(line no of GRPO 20)
    so that technical developer can easily identify the layer of the rawmaterial from oinm table for the consumed item.
    i am at live stage and customer requiremeent is
    suffering very much due to this missing information in oinm system
    table.
    amit

    Hi Amit
    The system uses a "Lot" to control the FIFO layers, although this is not physically represented by a separate table or structure. In the OINM table you will find a field called OpenQty which will indicate which FIFO layers (or costs) have not yet been consumed or sold either partially or in full. SAP Business One checks for OpenQty by date and consumes from the oldest "Lot" first. Writing a query or getting the "Lot" information could be tricky but I would suggest using the DocDate & DocTime with the OpenQty to determine what is still available and what production would consume.
    Kind regards
    Peter Juby

  • Inventory - last purchase date

    This is my first post, so my apologies if all is not correct.
    We were recently taken over and the new owners are trying to put a realistic value on the stock and it has fallen to me to provide the information. I need to ascertain the age of the stock and could do this 2 ways if the information was available:
    1. Use the last purchase date to determine how long we have held the stock. Acceptable but the last purchase field in OITM is not the last purchase date. For items it is, for others it is the last stock transaction date and for the rest I have no idea what the date relates to.
    2. Use a last transaction date, if only SAP had one. Our old system had this date and it made life very simple.
    I can find dates for last issue, receipt and sale but not for production order transactions. If I could then I can get the information merging a few spreadsheets.
    A last transaction date must be stored somewhere, maybe in the financials?
    Any help would be gratefully received.
    Regards
    Stewart Clark
    We are using 2005 SP1 PL45.

    Stewart Clark,
    To expand on what Petr has mentioned most of the information you are looking for is available in SAP Business One.
    The Inventory posting list contains an entry for every inventory transaction that has been processed inclusing Goods Issue, Receipt, Delivery, Production, .....
    The table these values are stored is OINM (warehouse journal).  If you could manage using SQL you could query this table and get the details you need.
    Let me know if you need further assistance with anything to help you move forward
    Suda

Maybe you are looking for

  • Huge gap between icons in menu bar

    Lately the menu bar will randomly throw in a huge gap between icons. Initially I thought it was a specific app, but now it's happening with all sorts of random icons there...definitely not the same icon each time. The icons you see on the left are th

  • Module PI 7.11 error

    You can goto Message Monitoring in RWB and choose to monitor message via the adapter engine. Here you should be able to find a detailed log. Also to have more info on whats going wrong in the module, it is advised to write adapter logs/traces within

  • Installation of Qualcomm module on hp dm4-1150 ca

    Hi can some one upload picturesand intruction how to install Qualcomm Gobi gps module.  I just recently purchase  Qualcomm gobi  2000 hp un2420 wwan card 4. But i have no idea where to install it.

  • Upgrading to WLS 12.1.3 only to hit metro-default.xml not found issue

    Application is happily deployed and working in WLS 12.1.2 and in WebSphere 8.5.5. Recently tried to upgrade to WLS 12.1.3 and we get the following. Any thoughts? Aug 01, 2014 9:45:21 AM com.sun.xml.ws.transport.http.servlet.WSServletContextListener c

  • Join conditions in Multiprovider and Infoset

    Hi experts, 1. I am using the multiprovider 0IC_MC01 which contains the cube 0IC_C03 and 0MATERIAL. I want to know the join conditions between these two infoproviders in the Multiprovider. How and where to get this info? 2. Similarly, I've a Infoset(