Query for Open Invoices
Hi 2 all
Anybody know that how to fetch open invoices in 11i and these invoices balances should be match with Supplier Statement of Account Report.
Thanks,
Zulqarnain
Hi,
I use this one:
SELECT HEADER.*,
HEADER.END_BALANCE - HEADER.BEGIN_BALANCE NET_BALANCE,
HEADER.BEGIN_BALANCE BEGIN_BALANCE_2,
LINE.*,
NVL(LINE.DEBE, 0) - NVL(LINE.HABER, 0) NETO_LINEA
FROM (SELECT TP.THIRD_PARTY_ID,
TP.THIRD_PARTY_NAME,
TP.THIRD_PARTY_NUMBER,
S.SUB_ID,
S.SUB_NAME,
AB_START.ACCOUNT_SEGMENT,
AB_START.PERIOD_NAME BEGIN_BALANCE_PERIOD,
AB_END.PERIOD_NAME END_BALANCE_PERIOD,
AB_START.END_BALANCE_DR - AB_START.PERIOD_NET_DR +
AB_START.PERIOD_NET_CR - AB_START.END_BALANCE_CR BEGIN_BALANCE,
AB_END.END_BALANCE_DR - AB_END.END_BALANCE_CR END_BALANCE
FROM AX_THIRD_PARTIES_V TP,
AX_SUBS_V S,
AX_BALANCES AB_START,
GL_PERIOD_STATUSES GPS_START,
AX_BALANCES AB_END,
GL_PERIOD_STATUSES GPS_END
WHERE TP.APPLICATION_ID = 200
AND TP.APPLICATION_ID = S.APPLICATION_ID
AND TP.APPLICATION_ID = AB_START.APPLICATION_ID
AND TP.APPLICATION_ID = GPS_START.APPLICATION_ID
AND TP.APPLICATION_ID = AB_END.APPLICATION_ID
AND TP.APPLICATION_ID = GPS_END.APPLICATION_ID
AND TP.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
AND S.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
AND S.SUB_ID = AB_START.SUB_ID
AND AB_START.SET_OF_BOOKS_ID = GPS_START.SET_OF_BOOKS_ID
AND AB_START.PERIOD_NAME = GPS_START.PERIOD_NAME
AND TP.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
AND S.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
AND S.SUB_ID = AB_END.SUB_ID
AND AB_END.SET_OF_BOOKS_ID = GPS_END.SET_OF_BOOKS_ID
AND AB_END.PERIOD_NAME = GPS_END.PERIOD_NAME
AND AB_START.SET_OF_BOOKS_ID = :P_SOB
AND TP.THIRD_PARTY_NUMBER =
NVL(:P_VENDOR_NUMBER, TP.THIRD_PARTY_NUMBER)
AND TP.THIRD_PARTY_NAME = NVL(:P_PARTY_NAME, TP.THIRD_PARTY_NAME)
AND S.SUB_NAME = NVL(:P_SUB_NAME, S.SUB_NAME)
AND AB_END.ACCOUNT_SEGMENT = AB_START.ACCOUNT_SEGMENT
AND GPS_START.EFFECTIVE_PERIOD_NUM =
(SELECT MIN(P_BALANCE.EFFECTIVE_PERIOD_NUM)
FROM AX_BALANCES BALANCE,
GL_PERIOD_STATUSES P_BALANCE,
GL_PERIOD_STATUSES P_DATE
WHERE BALANCE.APPLICATION_ID = AB_START.APPLICATION_ID
AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
AND BALANCE.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
AND BALANCE.SUB_ID = AB_START.SUB_ID
AND BALANCE.SET_OF_BOOKS_ID = AB_START.SET_OF_BOOKS_ID
AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
AND P_DATE.PERIOD_NAME = :P_PERIOD_START
AND P_BALANCE.EFFECTIVE_PERIOD_NUM >=
P_DATE.EFFECTIVE_PERIOD_NUM
AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
AND BALANCE.CODE_COMBINATION_ID =
AB_START.CODE_COMBINATION_ID)
AND GPS_END.EFFECTIVE_PERIOD_NUM =
(SELECT MAX(P_BALANCE.EFFECTIVE_PERIOD_NUM)
FROM AX_BALANCES BALANCE,
GL_PERIOD_STATUSES P_BALANCE,
GL_PERIOD_STATUSES P_DATE
WHERE BALANCE.APPLICATION_ID = AB_END.APPLICATION_ID
AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
AND BALANCE.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
AND BALANCE.SUB_ID = AB_END.SUB_ID
AND BALANCE.SET_OF_BOOKS_ID = AB_END.SET_OF_BOOKS_ID
AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
AND P_DATE.PERIOD_NAME = :P_PERIOD_END
AND P_BALANCE.EFFECTIVE_PERIOD_NUM <=
P_DATE.EFFECTIVE_PERIOD_NUM
AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
AND BALANCE.CODE_COMBINATION_ID =
AB_END.CODE_COMBINATION_ID)) HEADER,
((SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
INV.INVOICE_DATE FECHA_TRANSACCION,
LOOK.DESCRIPTION TIPO_TRANSACCION,
LINE.REFERENCE_25 NUM_TRANSACCION,
INV.DOC_SEQUENCE_VALUE SECUENCIA,
LINE.ACCOUNTED_DR DEBE,
LINE.ACCOUNTED_CR HABER,
CODE.SEGMENT3 CUENTA
FROM AX_SLE_LINES LINE,
AX_SLE_HEADERS HEAD,
GL_CODE_COMBINATIONS CODE,
AP_INVOICES_ALL INV,
FND_LOOKUP_VALUES LOOK
WHERE HEAD.EFFECTIVE_DATE BETWEEN
(SELECT START_DATE
FROM GL_PERIOD_STATUSES_V
WHERE PERIOD_NAME = :P_PERIOD_START
AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND APPLICATION_ID = 101)
AND (SELECT END_DATE
FROM GL_PERIOD_STATUSES_V
WHERE PERIOD_NAME = :P_PERIOD_END
AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND APPLICATION_ID = 101)
AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND HEAD.SET_OF_BOOKS_ID = INV.SET_OF_BOOKS_ID
AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
AND HEAD.SET_OF_BOOKS_ID = :P_SOB
AND LINE.REFERENCE_7 = INV.INVOICE_ID
AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
AND LINE.SOURCE_TABLE != 'AP_INVOICE_PAYMENTS'
AND LOOK.LOOKUP_TYPE = 'INVOICE TYPE'
AND LOOK.LANGUAGE = 'E'
AND LOOK.LOOKUP_CODE = INV.INVOICE_TYPE_LOOKUP_CODE
AND LINE.CODE_COMBINATION_ID IN
(SELECT CODE_COMBINATION_ID
FROM GL_CODE_COMBINATIONS
WHERE SEGMENT3 LIKE '40%' -- Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
OR SEGMENT3 LIKE '04%'
OR SEGMENT3 LIKE '41%')) UNION ALL
(SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
INV.CHECK_DATE FECHA_TRANSACCION,
'Pago' TIPO_TRANSACCION,
LINE.REFERENCE_25 NUM_TRANSACCION,
INV.DOC_SEQUENCE_VALUE SECUENCIA,
LINE.ACCOUNTED_DR DEBE,
LINE.ACCOUNTED_CR HABER,
CODE.SEGMENT3 CUENTA
FROM AX_SLE_LINES LINE,
AX_SLE_HEADERS HEAD,
GL_CODE_COMBINATIONS CODE,
AP_CHECKS_ALL INV
WHERE HEAD.EFFECTIVE_DATE BETWEEN
(SELECT START_DATE
FROM GL_PERIOD_STATUSES_V
WHERE PERIOD_NAME = :P_PERIOD_START
AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND APPLICATION_ID = 101)
AND (SELECT END_DATE
FROM GL_PERIOD_STATUSES_V
WHERE PERIOD_NAME = :P_PERIOD_END
AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND APPLICATION_ID = 101)
AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
AND HEAD.SET_OF_BOOKS_ID = :P_SOB
AND LINE.REFERENCE_7 = INV.CHECK_ID
AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
AND LINE.SOURCE_TABLE = 'AP_INVOICE_PAYMENTS'
AND LINE.CODE_COMBINATION_ID IN
(SELECT CODE_COMBINATION_ID
FROM GL_CODE_COMBINATIONS
WHERE SEGMENT3 LIKE '40%' --Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
OR SEGMENT3 LIKE '04%'
OR SEGMENT3 LIKE '41%'))) LINE
WHERE HEADER.THIRD_PARTY_ID = LINE.VENDOR_ID(+)
AND HEADER.ACCOUNT_SEGMENT = LINE.CUENTA(+)
ORDER BY LINE.FECHA_CONTABLE
:P_VENDOR_NUMBER -> Supplier Num
:P_PARTY_NAME -> Supplier Name
:P_SUB_NAME -> Supplier Address
:P_SOB -> set_of_books_id
:P_PERIOD_START -> Period Start
:P_PERIOD_END -> Period End
Similar Messages
-
Hi All,
I need to develop an Aging report for open invoice, there is no indication for open invoice or close invoice since we are using customise DS and DS from third party system. only one key flag we have is clearing date. so kindly let me know how to write the logic for this requirement.. can I use Customer exit for this? I have an Idea to do like
first logic is
*If Clearing date = blank than invoice is = open (by using of this logic we can get all open invoice).
second logic
total number of invoice = current date - document date.
but I do not know how to implement this logic in BEx hnece kinnly advice me whether this logic can be work or suggest with different solution ples..
Regards,hi,
You can check few default PO reports wid proper paramater in it
or
Can check table EKBE
or
Check PO history in the PO doc
Or
Check the ME80FN
Regards
Priyanka.P -
Query for multiple invoice numbers.
Hi,
My question is if I can add multiple invoice numbers in the search field "invice number"?
For example when I receive a balance confirmation request from a supplier and their list contains 10 invoices. Can I do a search for all 10 at the same time or I can olny do a search one by one?
Thank you!
AngieHi,
there's no direct possibility to query for multiple Invoice number in terms of entering e.g. 5 number for a query.
But you can work with placeholders '_' and '%' to find multiple invoices at one time. Underscore sign stands
for exactly one character which can have multiple value, percentage sign for multiple ones.
Example (assuming you are using letters and numbers for invoice numbering):
When entering 'A12_' as search String, invoices from 'A120' to 'A12z' would be found.
When using 'A12_01_' all invoices from 'A120010' to 'A12z01z' would be found.
When using 'A12%' all invoices starting with 'A12' - no matter about the rest would be found.
These are only a few examples but i think when using a clever combination of wildcards and parts of the
invoices - which often share a common component, if the invoices come from the same vendor - you'll get
at least a small step farther.
Regards -
Query for Opening And Closing Stock
Hi Experts...
I need a report for Opening and Closing stocks and Goods Receipt and Goods Issue for Raw Materials and Finished Goods and Consumbles ..instead of going for different reports for each we need a combined report which can display for all Raw Materials, Finished Goods and Consumbles and we need it for a specific date range Material type(Raw MAterials,Finished Goods, Consumbales)
and below is the format i needed.
RAW MATERIALS /FINISHED GOODS/CONSUMBALES
Opening Stock Closing Stock Goods Receipt Goods Issue
Qty Value Qty Value Qty Value Qty Value
Item Name
Regards,
Vamsi.Hi Guys.
I need an Inventory stock report with Item name, Opening Stock,Goods issue Quantity,Goods Received ,Item Price,Location ,(Closing Stock)Total Value.
We need the input by Date Range and Item Group and Location(if Possible) Below is the Code i used to run the report.
Pls Update the Query...
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @Group nvarchar(10)
Declare @Whse nvarchar(10)
Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]')
Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]')
Set @Group = (Select Max(s2.ItmsGrpCod) from dbo.OITB S2 Where S2.ItmsGrpNam = '[%2]')
Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = '[%3]')
Select @Whse as 'Warehouse', a.Itemcode, max(a.Dscription), sum(a.[Opening Balance]) as [Opening Balance], sum(a.[IN]) as [IN], sum(a.OUT) as OUT,max(a.Price) as 'Price', ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing from dbo.OITM I1
Left JOIN (Select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.Price, (sum(N1.inqty)-sum(n1.outqty)) as [Opening Balance], 0 as [IN], 0 as OUT
From dbo.OINM N1
Where N1.DocDate < @FromDate and N1.Warehouse = @Whse
Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
Union All
select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.price, 0 as [Opening Balance], sum(N1.inqty) as [IN], 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
Union All
select N1.Warehouse, N1.Itemcode, N1.Dscription,N1.price, 0 as [Opening Balance], 0 as [IN], sum(N1.outqty) as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a ON a.ItemCode=I1.ItemCode
where I1.ItmsGrpCod = @Group
Group By a.Itemcode
Order By a.Itemcode
Regards,
Vamsi. -
Formatted search query for displaying invoice items details
hi all,
i need to display all the items in AP invoice.kindly suggest me a query for that.
in AP invoice
Ex. row items
code--descqtyprice--
total
I0001--XXXXXXX5--
100 -
500
query should display this row as
code--desc--
price
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
I0001--XXXXXXX--
100
=================================
the query should display as the qty is 5 so it will display the same item 5 times
kindly suggest me some query for formatted search
its very urgent
regards
sandipHi Sandip,
DoQuery("Select b.ItemCode from OINV a,INV1 b Where a.DocEntry=b.DocEntry")
Hope its help for you
Give me reward points,
Regards,
G.Suresh. -
Hi,
We are trying to create a query for the open items (purchase orders ) in order to add some fields useful for users.
Would you be able to advise with the query needed to show us only the open items?
Best regards,
MBHi,
Try this one:
Select distinct t1.cardcode as Vendor, t1.CardName as Name, t1.docnum as PO#, t0.itemcode, t0.Dscription, t0.OpenQty as 'Open Qty', t0.linenum Row#, t1.DocCur as Currency, t0.price as 'Purchase Price', t0.whscode, t1.taxdate as "PO Date"
from dbo.por1 t0
inner join dbo.opor t1 on t1.docentry = t0.docentry
where t1.DocType = 'I' and t0.linestatus = 'O'
order by t1.docnum Desc, t0.linenum
Thanks,
Gordon -
Crystal Query for Opening / Closing Stock
Hi Experts,
i need a query in crystal for Opening and Closing total Stock per date..
i found this querys and need to join them, but o dont now how...
thanks for any tips..
Query 1
=======================
SELECT distinct
T0.[TransType], T0.[DocDate], T0.[InQty], T0.[OutQty], T0.[Dscription], T0.[CalcPrice], T0.[ItemCode] FROM [dbo].[OINM] T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode WHERE T0.[DocDate] >= {?DateInicial} and T0.[DocDate] <= {?DateFinal} and T1.[Canceled] = 'N'
Query 2
=========================
Declare @FromDate Datetime
Declare @ToDate Datetime
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >={?Data1}
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <={?Data2}
Select a.Itemcode, max(a.Dscription) as ItemName,
sum(a.OpeningBalance) as OpeningBalance, sum(a.INq) as 'IN', sum(a.OUT) as OUT,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing ,(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 0 as INq, 0 as OUT
From dbo.OINM N1try this
Declare @ItmsGrpNam varchar(100)
Declare @Whse nvarchar(10)
Declare @Fromdate Datetime
Declare @Todate DateTime
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >=[%0]
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <=[%1]
select @Whse = Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = [%2]
Select a.Itemcode, max(a.Dscription) as ItemName,
(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM,
sum(a.OpeningBalance) as OpeningBalance,
((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing
from( Select N1.Itemcode, N1.Dscription, (sum(N1.inqty)-sum(n1.outqty))
as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
Where N1.DocDate < @FromDate and N1.Warehouse = @Whse and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,
N1.Dscription Union All select N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
sum(N1.inqty) , 0 as OUT From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
and N1.Inqty >0 and N1.Warehouse = @Whse and b.ItmsGrpNam = @ItmsGrpNam Group By N1.ItemCode,N1.Dscription
Union All select N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
From dbo.OINM N1 inner join OITM i on i.ItemCode = N1.ItemCode
inner join OITB b on b.ItmsGrpCod = i.ItmsGrpCod
Where N1.DocDate >= @FromDate
and N1.DocDate <=@ToDate and N1.OutQty > 0 and N1.Warehouse = @Whse and b.ItmsGrpNam = @ItmsGrpNam
Group By N1.ItemCode,N1.Dscription) a, dbo.OITM I1 ,OITB b1
where a.ItemCode=I1.ItemCode
and I1.ItmsGrpCod = b1.ItmsGrpCod
Group By a.Itemcode ,I1.ItmsGrpCod , b1.ItmsGrpNam
Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0
Order By a.Itemcode -
Approval Query for AP Invoices Containing Budget Related GL Account
Hi Experts,
I would like to create a approval template for all AP invoices that include a GL account that is related to the budget. Can you please help me with the approval query?
Thank you!
JaneHello Gordon Du,
"B1 approval will only apply to document level. If you want to check line level, only the first line can be subjected to."
I was thinking to trigger the approval process based on a document (AP invoice) containing relevant cost centres on a line by line basis as entered via one of the enabled dim fields.
Writing a trigger query for each cost centre effected? This does not appear to be a good solution, what is a better direction. Is there another way? (PO are not yet used via SAPB1)
Currently my invoices add, but do not trigger the approval process based on my attempts thus far.
Can the originator manually choose an approval pathway?
If this is against posting etiquette delete and advise.
I am a relative newbie to SAP B1, so am happy to be pointed to relevant help files. I arrived via google searching and arrived here.
Thankyou. -
Query for Opening Stock + Purchase Qty + Sales Qty
Hi ,
Can anyboday help me by how to develop a query for the following requirement. If any custom query is available please provide me .We are working on SBO 2007B PL 8. The required report structure is
ItemNo ***OpeningStock**** Purchase ********* Sales****
(Batchwise)** Qty*** Value ****Qty** Value ***Qty***Value
Thanks & Regards
SriniHi Srini,
I found this on the forum, see if it helps you;
select b.Itemcode,b.Item_Description,b.UOM, b.rate as Rate,b.Opening_Stock,b.Receipt,b.Issue, b.Material_Revalue,b.Closing_Stock,b.Closing_Value from (select *,(case closing_stock when 0 then 0 else(Closing_Value/Closing_Stock)end) as Rate from( SELECT T0.Itemcode as 'Itemcode' ,min(T0.Dscription) as 'Item_Description', max(T1.InvntryUom) as UOM, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,59,20,16,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<'[%0]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0)+ (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.transtype in (-2)),0)))as Opening_Stock, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (20,18)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (67)),0) + isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.inqty>0 and O1.transtype in (58,59,16,14)),0)) as Receipt, (isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (13,15)),0) + isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (67)),0)+ isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate>='[%0]' and O1.docdate<='[%1]' and O1.outqty>0 and O1.transtype in (58,60,21,19)),0)) as Issue, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (162)),0) as Material_Revalue, (isnull((Select sum(isnull(inqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,59,20,16,14,19,67,-2)),0) - isnull((Select sum(isnull(outqty,0)) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,21,19,60,15,67,-2,13)),0))as Closing_Stock, isnull((select sum(Transvalue) from OINM O1 where O1.itemcode=T1.itemcode and O1.docdate<='[%1]' and O1.transtype in (58,18,-2,67,59,20,16,14,15,13,21,19,60,69,162)),0) as Closing_Value FROM OINM T0 INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode INNER JOIN OITW T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OITB B1 ON T1.ItmsGrpCod=B1.ItmsGrpCod where ((B1.ItmsGrpNam>='[%2]' and B1.ItmsGrpNam<='[%3]') or ('[%2]'='' and '[%3]'='')) GROUP BY T1.itemcode,T0.Itemcode )a Where (a.Opening_Stock + a.Receipt + a.Issue + a.Material_Revalue + a.Closing_Stock + a.Closing_Value) <> 0 )b
Thanks,
Joseph -
Report for open invoice value against GR done within a date range
Dear experts ,
I need a report between date ranges for which there is a GR done , but invoice is pending .
Where can i get this ?
Regards
Anishi,
You can check few default PO reports wid proper paramater in it
or
Can check table EKBE
or
Check PO history in the PO doc
Or
Check the ME80FN
Regards
Priyanka.P -
FI AR: Partial payments for open invoices
Hi Experts,
Greetings to all.
We are using standerd data source 0FI_AR_04, Our data flow is Data source to DSO 0FIAR_O03 to CUBE 0FIAR_C03.
Could you please tell me how to calculate due date analysis for partial payments.
I checked the SAP note 522235, apart from this note is there any other soution.
Appriciate your quick response, Thanks in advance.
With Regards
BharathI ,
Use RSR_OLAP_BADI to create virtual characteristics for your infocube.
create ageing bucket for due date analysis for AR items.
it will give u ageing bucket wise open AR items and amount.
input dates are system date and net due date .
take a look at below code.
ETHOD IF_EX_RSR_OLAP_BADI~COMPUTE.
DATA: AGE TYPE I.
FIELD-SYMBOLS <L_AGEING> TYPE ANY.
FIELD-SYMBOLS <L_CALDAY> TYPE ANY.
FIELD-SYMBOLS <L_DUEDATE> TYPE ANY.
DATA : C_DATE(8),
C_DATE1(10),
C_AGE(10).
IF SY-MANDT = 175.
C_DATE = 'K____007'.
C_AGE = 'K____10370' .
C_DATE1 = 'K____10305' .
ELSEIF SY-MANDT = 475.
C_DATE = 'K____007'.
C_AGE = 'K____5194'.
C_DATE1 = 'K____5078'.
ENDIF.----
. This part should be according your system paramaters
ASSIGN COMPONENT C_DATE
OF STRUCTURE C_S_DATA TO <L_CALDAY>.
ASSIGN COMPONENT C_DATE1
OF STRUCTURE C_S_DATA TO <L_DUEDATE>.
ASSIGN COMPONENT C_AGE
OF STRUCTURE C_S_DATA TO <L_AGEING>.
IF AS_ON_DATE >= <L_CALDAY>.
IF <L_DUEDATE> NE '00000000'.
AGE = AS_ON_DATE - <L_DUEDATE>.
IF AGE >= 00 AND AGE <= 07.
<L_AGEING> = 01.
ELSEIF AGE >= 08 AND AGE <= 15.
<L_AGEING> = 02.
ELSEIF AGE >= 16 AND AGE <= 30.
<L_AGEING> = 03.
ELSEIF AGE >= 31 AND AGE <= 60.
<L_AGEING> = 04.
ELSEIF AGE >= 61 AND AGE <= 90.
<L_AGEING> = 05.
ELSEIF AGE >= 91 AND AGE <= 180.
<L_AGEING> = 06.
ELSEIF AGE > 180.
<L_AGEING> = 07.
ELSE.
<L_AGEING> = 99.
ENDIF.
ELSE.
<L_AGEING> = 99.
ENDIF.
ELSE.
<L_AGEING> = 99.
ENDIF.
ENDMETHOD.
regards,
hreddy -
Query for invoice and distribution detail
hi 2 all
anybody have the query for getting invoice with distribution detail in oracle payable r12.
thanks
zulqarnainselect ass.SEGMENT1 vendor_number,
ass.VENDOR_NAME,
assa.VENDOR_SITE_CODE VENDOR_SITE,
aia.INVOICE_NUM,
aia.INVOICE_DATE,
aia.INVOICE_AMOUNT,
aia.INVOICE_TYPE_LOOKUP_CODE,
gcc.CONCATENATED_SEGMENTS distribution_account ,
gcc1.CONCATENATED_SEGMENTS liability_account,
to_char(aia.GL_DATE) GL_DATE,
AP_INVOICES_PKG.GET_APPROVAL_STATUS( AIa.INVOICE_ID,
AIa.INVOICE_AMOUNT, AIa.PAYMENT_STATUS_FLAG,
AIa.INVOICE_TYPE_LOOKUP_CODE) APPROVAL_STATUS_LOOKUP_CODE
from ap_invoices_all aia,
ap_suppliers ass,
ap_supplier_sites_all assa,
ap_invoice_distributions_all aid,
gl_code_combinations_kfv gcc,
gl_code_combinations_kfv gcc1
where aia.VENDOR_ID = ass.VENDOR_ID
and assa.VENDOR_SITE_ID = aia.VENDOR_SITE_ID
and ass.VENDOR_ID = assa.VENDOR_ID
and aid.INVOICE_ID = aia.INVOICE_ID
and aid.DIST_CODE_COMBINATION_ID = gcc.CODE_COMBINATION_ID
and assa.ACCTS_PAY_CODE_COMBINATION_ID = gcc1.CODE_COMBINATION_ID
--and aia.INVOICE_ID = 81000
and aia.GL_DATE between '01-JAN-12' and '31-MAR-12'
order by aia.GL_DATE
Thanks,
Atul -
Find open invoices and A/R for Customers in R/3 system
Hello Experts,
I have a requirement to identify the Open Invoices and A/R for the particular customer.
Please loet me know in which table I can find the same?
ThanksHi,
Good Day,
For Open Invoice use Transaction FBL5N or FBL6N
Table Name BSID.
Best Regards,
KSK -
Issue in counting open invoices
Hi All,
I am facing an issue which could be common but i am getting the correct count for open invoices.
We have following scenario :
Assume, we are loading an invoice(INV1) which was open(determined by item status = O) yesterday and loaded the same into ODS and to the cube yesterday itself.
As we want to see the invoices which are open as of that particulat day.
we have a CKF defined with value = 1 and aggregation : counter of all values, reference characteristic : 0REFERENCE.
I run the report and I see open invoices = 1, which is correct.
Now,the invoice which was open yesterday was cleared and paid today.
Now , I loaded the data to ODS and then to the cube.
In the cube, I have three entries like
Invoice Item Status Amount
INV1 O(Open) 100
INV1 O(Open) -100
INV1 C(Cleared) 100
Since, this invoice is cleared today, when i run the report , i should get invoice count "Zero" but I am getting the count as "1" and the amount "0".
The CKF which was created is getting the count as "1" even though it is cleared.If the invoice is cleared, it should not be counted.
Anyone has any suggestions ?
Regards,
Jeevanokay - a number of issues here
The two item statuses of O will cancel each other out and be deleted if you have zero elemination on the cube and run the next compression
The negative zero was generated by the change log of the ODS when the item status = C cleared document came in
You always run the open items as at a point in time using two RKFs added together in one CKF
RKF1 is item status = O AND posting date <= key date of query
RKF2 is cleared date > key date of query AND posting date <= key date of query
Thus you can always restate the open items which have been subsequently cleared back to a point in time (ie historical aged debt reports etc..)
You must not just use item status = O
Now how to do the counts..
I normally put a counter onto the cube and negate the counter when the changelog negative O record (so the two Os cancel each other out) and then just add up the values of the counter as per the RKFs above
However there is another option but it still involves a change to the data model
The counts are based on the uniqueness of a document number
The full key of a uniqieness of an AR or AP document number in SAP is...
Company Code, Fiscal Year, Document Number, line item
(the line item is due to one AP document being split across many lines due to installment plans with different net due dates or partially allocated cash across many outstanding line items)
The other items have to be considered in uniqueness because SAP allows you to configure number ranges per company code wither with internal or external numbering and these ranges can be year specific - hence the full key is required
You cannot just count document number as this will give a false result as the same document numebr can be used in multiple years within the same company code AND across company codes as well (so group reporting of outstanding counts will be affected as well)
So you have to create a new infoobject that is called "Document Full Key" - that concatenates Company Code, Fiscal Year, Document Number, line item into one object string
You then put that in yoru cube and update it via the transformation rules
Then you can create the RKFs above and do a count all values based on the characteristic "Document Full Key" - then create a few more RKFs to do the splits of net due date and the offsets required for -30 -60 etc as per normal
Sorry for the bad news - but if you want to do it properly - I don;t think you have another other choice but the two options above..
But then what do I know! -
MB5B Report table for Open and Closing stock on date wise
Hi Frds,
I am trying get values of Open and Closing stock on date wise form the Table MARD and MBEW -Material Valuation but it does not match with MB5B reports,
Could anyone suggest correct table to fetch the values Open and Closing stock on date wise for MB5B reports.
Thanks
Mohan MHi,
Please check the below links...
Query for Opening And Closing Stock
Inventory Opening and Closing Stock
open stock and closing stock
Kuber
Maybe you are looking for
-
How to not print a page of a report under a condition
Hi, I need to build a report with a specific layoutdepending on a user paramater. Ex: If parameter value is 1, then display the layout of the first page of the report If parameter value is p_layout2, then display the layout of the second page of the
-
Where is the radio icon in iTunes?
There were other who said they force quit and it showed up. I am not so lucky.
-
Output parameter rowtype problem
Hi, I have this type from Oracle: TYPE typ_vec_com_acces_doss IS TABLE OF COM_ACCES_DOSS%ROWTYPE INDEX BY binary_integer; And this Stored proc PROCEDURE LireAccesDossier (p_cod_ret OUT NOCOPY NUMBER, p_msg_ret OUT NOCOPY VARCHAR2, p_vec_com_acces_dos
-
hello all, i actually have t run a project about database maintenance. till now, my database is about 38gb and i run sbo 2005 A 6.80... i would like to remove if it possible old data (for instance data based on 2007) to history tables or something li
-
for the code:- public class s{ public static void main(String[] args){ System.out.println("Why this output ...................."+(char)-100); i get output as :- Why this output ....................? (char)-100 gives a question mark.. im not getting w