BOM query help
hi ,
In bom,i jus want to display all the child items (including sub child components). i jus want the report to find the material cost, labour cost, and all the charges that is included in bom... pls help me in getting this query.
regards,
Vignesh
Hi Rahul,
will explain u the scenario....actually we will get BOM report right , where it shows the parent and all child components,so from tht report i jus want to know
MATERIAL COST- LABOUR COST-SUB CONTRACT CHARGES-ELECTRICITY CHARGES----TOOL AMORTAZATION COST
for parent and all child components .... it should contain all the components like how it displays in BOM report(expanded format).
regards,
Vignesh
Similar Messages
-
Query Help:
http://forum.java.sun.com/thread.jsp?forum=45&thread=471180&tstart=15&trange=15
It seems I have confused enough people with my improper presentation of query. Sorry guys. I will restate my question with different table names.
The above was my previous posting, which was not clear..so Iam restating my problem as follows....
I have the following tables
Customer(custID, Name, Address)
Order(custID, OrderID, orderDate)
CreditCard(custID, creditCard#, creditCardType)
Now if I have 3 records in Order with custID 100 and 2 records in CreditCard as
Order:
100,A001,11/22/03
100,A002,11/24/03
100,A003,12/02/03
CreditCard:
100,42323232..., VISA
100,5234234...., MASTER
Now how can I get
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
data in minimum no. of records....
I think I have made my query clear..
now please help me guys...
thanks so much for your help.You are right.
But frankly the actual tables on my database are not customer,orders and creditcards..but I just tried to reproduce the problem with these tables, please ignore that user needs a refund etc situtaion. If the tables were actually order,creditcards etc..it would have been a problem to be considered.
Can you please help me with the query
if I have m rows in Order and n rows in CreditCard. I will get m*n records, I looking for max(m,n).
With the following fields in my query result,
custID, Name, Address, OrderID, orderDate, creditCard#, creditCarType
from Customer, Order, CreditCard tables
Thanks so much for your htlp -
SQL Query Help - Is this possible or impossible????
Hi guys,
I need help with an SQL query that I'm trying to develop. It's very easy to explain but when trying to implement it, I'm struggling to achieve the results that I want.....
For example,
I have 2 tables
The first table is:
1) COMPANY create table company (manufacturer varchar2(25),
date_established date,
location varchar2(25) );My sample test date is:
insert into company values ('Ford', 1902, 'USA');
insert into company values ('BMW', 1910, 'Germany');
insert into company values ('Tata', 1922, 'India');The second table is:
2) MODELS create table models (manufacturer varchar(25),
model varchar2(25),
price number(10),
year date,
current_production_status varchar2(1) ) ;My sample test data is:
insert into models values ('Ford', 'Mondeo', 10000, 2010, 0);
insert into models values ('Ford', 'Galaxy', 12000, 2008, 0);
insert into models values ('Ford', 'Escort', 10000, 1992, 1);
insert into models values ('BMW', '318', 17500, 2010, 0);
insert into models values ('BMW', '535d', 32000, 2006, 0);
insert into models values ('BMW', 'Z4', 10000, 1992, 0);
insert into models values ('Tata', 'Safari', 4000, 1999, 0);
insert into models values ('Tata', 'Sumo', 5500, 1996, 1);
insert into models values ('Tata', 'Maruti', 3500, 1998, 0);And this is my query:
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer IN ('Ford', 'BMW', 'Tata')
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCWhat I want the query to output is this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0
Tata 1922 India Sumo 5500 1998 1If current_production_status is 1 it means this particular model has been discontinued
If current_production_status is 0 it means the manufacturer does not have any discontinued models and all are in procuction.
The rule is only one record per manufacturer is allowed to have a current_production_status of 1 (so only one model from the selection the manufactuer offers is allowed to be discontinued).
So the query should output the one row where current_production_status is 1 for each manufacturer.
If for a given manufacturer there are no discontinued models and all have a current_production_status of 0 then ouput a SINGLE row that only includes the data from the COMPANY table (as above). The rest of the columns from the MODELS table should be populated with a '-' (hyphen).
My query as it is above will output all the records where current status is 1 or 0 like this
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
Tata 1922 India Sumo 5500 1998 1
Ford 1902 USA - - - 0
Ford 1902 USA - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
BMW 1910 Germany - - - 0
Tata 1922 India - - - 0
Tata 1922 India - - - 0However this is not what I want.
Any ideas how I can achieve the result I need?
Thanks!
P.S. Database version is '10.2.0.1.0'Hi Vishnu,
Karthiks query helped...
But this is the problem I am facing...
SELECT
com.manufacturer,
com.date_established,
com.location,
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.model),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.price),
DECODE(nvl(mod.current_production_status, '0'), '0', '-', mod.year),
mod.current_production_status
FROM
company com,
models mod
WHERE
mod.manufacturer = com.manufacturer
and com.manufacturer = 'Ford'
and mod.current_production_status IN (1,0)
ORDER BY
mod.current_production_status DESCThe value of:
and com.manufacturer = 'Ford'will be dependent on front end user input....
When I run the query above I get all the rows where current_production_status is either 1 or 0.
I only require the rows where current_production_status is 1.
So if I amend it to look like this:
and mod.current_production_status = 1This works....
BUT if a user now passes in more than one manufacturer EG:
and com.manufacturer IN ('Ford', 'BMW')The query will only return the one row for Ford where current_production_status is 1. However because BMW has no models where current_production_status is 1 (all 3 are 0), I still want this to be output - as one row....
So like this:
com.manufacturer com.date_established com.location mod.model mod.price mod.year mod.current_production_status
Ford 1902 USA Escort 10000 1992 1
BMW 1910 Germany - - - 0So (hopefully you understand), I want both cases to be catered for.....whether a user enters one manufacturer or more than one...
Thanks you so much!
This is really driving me insane :-( -
hii
i need a query help
i have two tables
the 1st table will look like this
associate id weekid no.of. hours
4000 810 40
4000 820 30
4000 830 60
4000 840 70
2nd table will look like this
associate id weekid no.of.hours
4000 810 40
4000 820 70
4000 830 130
4000 840 200
so when i subtract the last two records frm each other in the second table the value should be equal to the no.of.hours in the first table.. for example
the query shud consider the last record and one before the last record and the difference between two records shud be equal to the value in the 1st table
for example
consider week id 830 and 840
in second table 830=130
840=200
when u subtraced both values the difference shud be equal to value in the 1st table for tht week id
1 ---->>>> 840 - 830
=200 - 130
=70
in first table 840 has 70 hrs
like this it shud check with all records and it shud return only the records which are not equal
regards
srikanthThis..?
sql>select * from t1;
A_ID W_ID HRS
4000 810 40
4000 820 30
4000 830 60
4000 840 70
4000 850 80
sql>select * from t2;
A_ID W_ID HRS
4000 810 40
4000 820 70
4000 830 130
4000 840 200
4000 850 260
sql>
select a_id,w_id,hrs,sum_hrs
from(
select t1.a_id a_id,t1.w_id w_id,t1.hrs hrs,t2.hrs sum_hrs,
t2.hrs - nvl(lag(t2.hrs) over(order by t1.w_id),0) diff
from t1,t2
where t1.w_id = t2.w_id)
where diff != hrs;
A_ID W_ID HRS SUM_HRS
4000 850 80 260 -
BOM Archive Helper (Tiger) v Archive Helper (Leopard) - what gives?
Drop a tar.gz on old Tiger BOM archive helper and it unpacked, compiled or whatever and left you with a disk image on your desktop where you could drag the app to your apps folder.
In Leopard all I seem to get with the "archive helper" is an unpacked folder - behaving more like unStuffit - with files still needing to be compiled.
I took tar.gz file across to Mac running Tiger and it unpacks as usual, so I realized there appears to be a difference between the old BOM Archive Helper and the Leopard "archive helper" --- they left something out it seems to me namely the compiling bit.
Anyone throw any light on this?Hi, I think the problem is the crazy deal that once unzipped, it can have a completely unrelated Name & creation date, for those I move the ZIP file to a New Folder al it's own, unzip it there by double clicking, and the result should be in that folder.
-
Need help in writing a query to fetch all the assembled items. I have requirement as part of which I will pass Item1, Item2, Item3.... need to get all the assembled items which are using all this items (not just one all the items).
Below query is fetching assembly items which are using any one items.
Select * from bom_bill_of_materials bom, bom_inventory_components bic, mtl_system_items_b msib
where bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1','Item2','Item3')
How can modify it to fetch only assembly items which are using all the 3 items.
As the above query 'IN' is acts like OR (condition1 or condition2....)
Thanks for your responseHi,
User910243567 wrote:
Need help in writing a query to fetch all the assembled items. I have requirement as part of which I will pass Item1, Item2, Item3.... need to get all the assembled items which are using all this items (not just one all the items).That depends on your data.
Whenever you have a problem, please post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) from all tables.
Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using.
Below query is fetching assembly items which are using any one items.Is it really doing that?
Usually, "bill of materials" means a recursive, multi-level parent-child relationship. For example, a wagon may consist of a body, a handle, and 2 axle assembiles. An axle assembly may consist of an axle and 2 wheel assemblies, and a wheel assembly may consist of a wheel, a bracket, and 4 XYZ screws. If you're interested in which products require XYZ screws, would that mean just a wheel assembly, or would it include axle assembly and wagon as well as wheel assembly? The query you posted seems to only look at parents and their children; there's nothing recursive or multi-level about it.
Select * from bom_bill_of_materials bom, bom_inventory_components bic, mtl_system_items_b msib
where bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1','Item2','Item3')
How can modify it to fetch only assembly items which are using all the 3 items.
As the above query 'IN' is acts like OR (condition1 or condition2....)
Thanks for your responseIf the query above really is finding all the objects that use any 1 of the 3 components, then the following will return objects that are using all 3 of them:
WITH got_cnt
SELECT ... -- list distinct columns needed for output
, COUNT (DISTINCT msib.segment1) OVER (PARTITION BY x) AS cnt
FROM bom_bill_of_materials bom
, bom_inventory_components bic
, mtl_system_items_b msib
WHERE bic.component_item_id = msib2.inventory_item_id
AND bom.bill_sequence_id = bic.bill_sequence_id
AND msib.segment1 IN ('Item1', 'Item2', 'Item3')
SELECT * -- or list all columns except cnt
FROM got_cnt
WHERE cnt = 3
;where x uniquely identifies the object that must include all 3. (X can be a single column, or some other expression, or a list of several columns and/or other expressions.)
If one of the target items is "XYZ screw", then neither query above would include wagon or axle assembly. To get those results, you could do a CONNECT BY query, using CONNECT_BY_ROOT. In this case, it's especially important to say which version of Oracle you have, because every version since Oracle 7 has had singnificant improvements in this area. -
Implosion BILL OF MATERIALS (BOM) Query
Hi ,
Can anyone help me with framing a BOM Implosion query. The query is expected to return me all the PARENT items for a particular CHILD item i give in the filter. It is like a query which returns the 'ITEM WHERE USED' data for a child item referring
to where all the child item has been used (In any parent items). Google-ing on the same we could only get queries which gives BOM explosions .. if anyone has any idea on the IMPLOSION query please do share .... woul
It would be helpful if the query has ERP tables which can be used rather than examples ThankyouTry this:
SELECT DISTINCT
LEVEL, mp.organization_code, msi1.inventory_item_id parent_item_id, msi1.segment1 parent_item , msi1.description parent_desc, msi1.item_type,
bic.COMPONENT_QUANTITY, sys_connect_by_path(msi2.segment1, '/') as "PATH"
FROM bom.bom_structures_b bbom ,
bom.bom_components_b bic , apps.mtl_system_items msi1, apps.mtl_system_items msi2, apps.mtl_parameters mp
WHERE bbom.bill_Sequence_id = bic.bill_sequence_id
AND bbom.organization_id = bic.pk2_value
AND bbom.assembly_item_id = msi1.inventory_item_id
AND bbom.organization_id = msi1.organization_id
AND bic.component_item_id = msi2.inventory_item_id
AND bbom.organization_id = msi2.organization_id
and bbom.organization_id = mp.organization_Id
AND NVL(bic.disable_date, SYSDATE+1) > SYSDATE
AND bbom.organization_id = :org_id
START WITH bic.component_item_id = :component_item_id --Start with the component_item_id
CONNECT BY NOCYCLE PRIOR bbom.assembly_item_id = bic.component_item_id AND PRIOR bbom.organization_id = bbom.organization_id -
Hi ,
I have a requirement that i have to display the report in horizontal format like
TABLE 1
1 xyz
2 abc
TABLE2
1 DXB
1 BOM
1 MAS
I need to show the output like
OUTPUT
1 xyz DXB-BOM-MAS
Could you please any one to help me to build the report query.
Thanks,
Venkataraman LWithout any Oracle Version, I would suggest below:
with table_1 as
select 1 col1, 'xyz' col2 from dual union all
select 2, 'abc' from dual
table_2 as
select 1 col1, 'DXB' col2 from dual union all
select 1 col1, 'BOM' col2 from dual union all
select 1 col1, 'MAS' col2 from dual
data as
select a.col1, a.col2 a_col2, b.col2 b_col,
row_number() over(partition by a.col1 order by b.col2) curr
from table_1 a join table_2 b
on a.col1 = b.col1
select col1, a_col2,
ltrim(max(sys_connect_by_path(b_col, ' - ')) keep (dense_rank last order by curr), ' - ') conn
from data
start with curr = 1
connect by prior curr = curr - 1
and col1 = prior col1
and a_col2 = prior a_col2
group by col1, a_col2;
COL1 A_COL2 CONN
1 xyz BOM - DXB - MASIf on Oracle 11g R2:
with table_1 as
select 1 col1, 'xyz' col2 from dual union all
select 2, 'abc' from dual
table_2 as
select 1 col1, 'DXB' col2 from dual union all
select 1 col1, 'BOM' col2 from dual union all
select 1 col1, 'MAS' col2 from dual
data as
select a.col1, a.col2 a_col2, b.col2 b_col
from table_1 a join table_2 b
on a.col1 = b.col1
select col1, a_col2,
listagg(b_col, ' - ') within group (order by a_col2) conn
from data
group by col1, a_col2;
COL1 A_COL2 CONN
1 xyz BOM - DXB - MAS -
Query help on Goods Receipt Query with AP Invoice
Looking for a little help on a query. I would like to list all the goods receipts for a given date range and then display the AP Invoice information (if its been copied to an AP Invoice). I think my problem is in my where clause, I plagerized an SAP query to show GR and AP from a PO as a start. SBO 2005 SP01. Any help would be great appreciated. Thanks
SELECT distinct 'GR',
D0.DocStatus,
D0.DocNum ,
D0.DocDate,
D0.DocDueDate,
D0.DocTotal,
'AP',
I0.DocStatus,
I0.DocNum ,
I0.DocDate,
I0.DocDueDate,
I0.DocTotal,
I0.PaidToDate
FROM
((OPDN D0 inner Join PDN1 D1 on D0.DocEntry = D1.DocEntry)
full outer join
(OPCH I0 inner join PCH1 I1 on I0.DocEntry = I1.DocEntry)
on (I1.BaseType=20 AND D1.DocEntry = I1.BaseEntry AND D1.LineNum=I1.BaseLine))
WHERE
(D1.BaseType=22 AND D1.DocDate>='[%0]' AND D1.DocDate<='[%1]')
OR (I1.BaseType=20 AND I1.BaseEntry IN
(SELECT Distinct DocEntry
FROM PDN1 WHERE BaseType=22 AND DocDate>='[%0]' AND DocDate<='[%1]'))Hi Dalen ,
I believe it is because of the condition
(D1.BaseType=22 AND D1.DocDate>='%0' AND D1.DocDate<='%1')
OR (I1.BaseType=20 AND I1.BaseEntry IN
(SELECT Distinct DocEntry FROM PDN1 WHERE PDN1.BaseType=22 AND DocDate>='%0' AND DocDate<='%1'))
Try changing
D1.BaseType=22 OR D1.DocDate>='%0' AND D1.DocDate<='%1
PDN1.BaseType=22 OR DocDate>='%0' AND DocDate<='%1'))
Lets see what would be the result . Lets have some fun with troubleshooting
See what would be the difference in the result .
Thank you
Bishal -
Query help: query to return column that represents multiple rows
I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
I need a query to find all names that occur in both of two separate locations.
For example,
bob usa
bob mexico
dot mexico
dot europe
hal usa
hal europe
sal usa
sal mexico
The query in question, if given the locations usa and mexico, would return bob and sal.
Thanks for any help or advice,
-=beekyHow about this?
SELECT NAME
FROM <LOCATIONS_TABLE>
WHERE LOCATION IN ('usa','mexico')
GROUP BY NAME
HAVING COUNT(DISTINCT LOCATION) >= 2Results:
SQL> WITH person_locations AS
2 (
3 SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
4 SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
5 SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
6 SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
7 SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
8 SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
9 SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
10 SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
11 )
12 SELECT NAME
13 FROM person_locations
14 WHERE LOCATION IN ('USA','Mexico')
15 GROUP BY NAME
16 HAVING COUNT(DISTINCT LOCATION) >= 2
17 /
NAM
bob
salHTH!
Edited by: Centinul on Oct 15, 2009 2:25 PM
Added sample results. -
QUERY HELP!!! trying to create a query
i'm creating a summary report
i have a table with sale dates
for example i have a table tab_1 and column saleDate as
saleDat
1923
1936
1945
2003
2005
saleDate contains years and there are some missing years where no sale
was made
My report has to display years starting from earliest year
so i have to create a query that starts with 1923
but the problem is that I have to have years that are not in table.
for example i have to display years 1924 which is not in table
so the part of report has to look like
1923 blah blah summary.........
1924 "
1925
1926
2005
2006
upto current year (2006 may not be in the table, but i have to display)
i just need to know the query that can query all the years starting from
the ealiest saleDate to current year
thanks in advancePlease write the query in the following form:
SELECT a.year, --- place other columns from your table.
FROM (SELECT (:start_num + rownum) year
FROM all_tab_columns
WHERE :start_num + rownum <= :end_num) a,
tab_1 b
WHERE a.year = b.saleDat(+);
Note:
1) if your start year and end year are 1923 and 2006. Then input as below:
:start_num = 1922
:end_num = 2006
2) Since for some of the years (1924 etc) may not be there in your so you may need to use NVL to print proper indicators.
3) If you have more than one record in tab_1 for a particular year then group them based year and then use it.
Hope this helps.
- Saumen. -
Pulling open invoices, and paid invoices with details (Query Help).
Hello All,
I am sure I messed something up in my joins. I am looking to pull a report of all invoices OINV for a month, then list details of any payment (if it is paid) next to it from RCT2. It is giving me a list of all of the paid invoices, but even though I have a LEFT JOIN it is not listing any of the invoices without payments.
This is where I am now from the report wizard in Crystal.
SELECT "OINV"."DocNum", "OINV"."SlpCode", "OINV"."CardCode", "OINV"."DocTotal", "OINV"."U_Commission", "OSLP"."SlpName", "RCT2"."DcntSum", "ORCT"."TaxDate", "OINV"."DocEntry", "OINV"."TotalExpns", "OINV"."CANCELED", "ORCT"."Canceled", "ORCT"."DocNum", "RCT2"."InvType"
FROM ("DBName"."dbo"."OINV" "OINV" LEFT OUTER JOIN "DBName"."dbo"."OSLP" "OSLP" ON "OINV"."SlpCode"="OSLP"."SlpCode")
INNER JOIN ("DBName"."dbo"."ORCT" "ORCT" INNER JOIN "DBName"."dbo"."RCT2" "RCT2" ON "ORCT"."DocNum"="RCT2"."DocNum")
ON "OINV"."DocEntry"="RCT2"."DocEntry"
WHERE "OINV"."CANCELED"='N' AND "ORCT"."Canceled"='N' AND "RCT2"."InvType"<=N'14'
ORDER BY "OINV"."SlpCode", "ORCT"."DocNum", "ORCT"."TaxDate"
Thank you in advance for any help you can give me.Hello Kiran,
I thought about that, but my purposes for running the report is to determine commission based on the date that the invoice was paid, I need the TaxDate in ORCT as it relates to the payment in RCT2.
Removing the ORCT.cancelled condition and the RCT2.invtype conditions now pulls all of the invoices, paid and unpaid. I know now I cant have them in my query, when the record does not exist in ORCT it doesnt have a value for cancelled, and when there is no record in RCT2 there is no invtype, and is filtered.
Maybe I can say where ORCT.Canelled = 'N' OR ORCT.Cancelled = NULL, but I dont know if that would work. -
Query Help for reporting on last receipt qty
SBO Version: 8.82 PL11
Hello Forum,
I am looking for some help devising a command behind a crystal report. We are hoping to achieve the last receipt quantity. To arrive at this we would like it to get the last GRPO for an item and total the quantity on that particular GRPO. In addition to this, we want to consider all the lines on the document and SUM them.
At present, the query I have is as follows:
Select SUM(c0.Quantity) from PDN1 c0 WHERE c0.ItemCode = T1.ItemCode AND Shipdate = (select Max(ShipDate) from PDN1 C0 INNER JOIN OPDN c1 ON c0.DocEntry = c1.DocEntry where C0.Itemcode =T1.ItemCode AND c1.DocStatus <> 'C'))
Any assistance would be greatly received.
Thanks
SarahHi Sarah,
Please repost to the SAP Business One Application space.
-Abhilash -
SQL Query help ( On connect By level clause)
Hi all,
I have this query developed with data in with clause.
With dat As
select '@AAA @SSS @DDD' col1 from dual union all
select '@ZZZ @XXX @TTT @RRR @ZZA' col1 from dual
Select regexp_substr( col1 , '[^@][A-Z]+',1,level) Show from dat
connect by level <= regexp_count(col1, '@');Current output :-
SHOW
AAA
SSS
DDD
RRR
ZZA
TTT
RRR
ZZA
XXX
DDD
RRR
SHOW
ZZA
TTT
RRR
ZZA
. . .1st row comes fine, But next row data is getting duplicated. And total record count = 30. I tried with some but didn't work.
Expected output :-
SHOW
AAA
SSS
DDD
ZZZ
XXX
TTT
RRR
ZZAI need some change on my query and I am not able to find that. So anybody can add on that or can also provide some different solution too.
Thanks!
AshutoshHi,
When you use something like "CONNECT BY LEVEL <= x", then at least one of the following must be true:
(a) the table has no more than 1 row
(b) there are other conditions in the CONNECT BY clause, or
(c) you know what you are doing.
To help see why, run this query
SELECT SYS_CONNECT_BY_PATH (dname, '/') AS path
, LEVEL
FROM scott.dept
CONNECT BY LEVEL <= 3
;and study the results:
PATH LEVEL
/ACCOUNTING 1
/ACCOUNTING/ACCOUNTING 2
/ACCOUNTING/ACCOUNTING/ACCOUNTING 3
/ACCOUNTING/ACCOUNTING/RESEARCH 3
/ACCOUNTING/ACCOUNTING/SALES 3
/ACCOUNTING/ACCOUNTING/OPERATIONS 3
/ACCOUNTING/RESEARCH 2
/ACCOUNTING/RESEARCH/ACCOUNTING 3
/ACCOUNTING/RESEARCH/RESEARCH 3
/ACCOUNTING/RESEARCH/SALES 3
/ACCOUNTING/RESEARCH/OPERATIONS 3
/ACCOUNTING/SALES 2
/ACCOUNTING/SALES/ACCOUNTING 3
84 rows selected. -
Query Help required to Connect JDT1 with OINV tables
Dear Experts,
I have the following query which gives me the customer ageing report. I want some addtional fields from the OINV table and the document numbering table like Document Series Name, AR Invoice document Number,AR invoice remarks, BP Projects Number ( filled in accounting tab in BP projects) and in the query in Reference 1 column its giving the Invoice Numbers as posted in the Journal but for manual Journal Entries it not giving the Journal Number which I also want to be shown in Ref 1 or a seperat field.
The Query is as under :
select OCRD.cardcode 'Supplier Code',OCRD.cardname 'Name',sysdeb 'Debit Amount',syscred 'Credit Amount',
case JDT1.transtype
when '13' then 'INV'
when '14' then 'AR CN'
when '24' then 'INCOMING'
else 'Other'
end 'Type',
Ref1,
fccurrency 'BP Currency',
CONVERT(VARCHAR(10), refdate, 103)'Posting Date' ,
CONVERT(VARCHAR(10), duedate, 103) 'Due Date',
CONVERT(VARCHAR(10), taxdate, 103) 'Doc Date' ,
CASE
when (DATEDIFF(dd,refdate,current_timestamp))+1 < 31
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "0-30 days",
case when ((datediff(dd,refdate,current_timestamp))+1 > 30
and (datediff(dd,refdate,current_timestamp))+1< 61)
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "31 to 60 days",
case when ((datediff(dd,refdate,current_timestamp))+1 > 60
and (datediff(dd,refdate,current_timestamp))+1< 91)
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "61 to 90 days",
CASE
when (DATEDIFF(dd,refdate,current_timestamp))+1 > 90
then
case
when syscred= 0 then sysdeb
when sysdeb= 0 then syscred * - 1
end
end "90 + days"
from JDT1,OCRD where JDT1.shortname = OCRD.cardcode and cardtype = 'c' and intrnmatch = '0'
ORDER BY OCRD.CARDCODE, taxdate
Would appreciate if you can help me to get a solution in it.
Regards,
KamleshDear Gordon,
While executing the followings modified query it giving an error of
Incorrect Syntax near the keyword 'to' and incorrect Syntax near 'Series'
the query is as under :
{select OCRD.cardcode 'Supplier Code',OCRD.cardname 'Name',sysdeb 'Debit Amount',syscred 'Credit Amount',
case l.transtype
when '13' then 'INV'
when '14' then 'AR CN'
when '24' then 'INCOMING'
else 'Other'
end 'Type',
j.BaseRef'Trans #',
case l.transtype
when '13' then
(Select Comments from OINV where OINV.Transid=j.Transid)
else '-'
end 'Inv.Rem.',
(Select SeriesName From NNM1 Where Series=j.DocSeries and ObjectCode=l.TransType)'Series',
to
(Select Isnull(SeriesName, 'Manual') From NNM1 Where Series=j.DocSeries and ObjectCode=l.TransType)'Series',
l.Ref1,
fccurrency 'BP Currency',
CONVERT(VARCHAR(10), l.refdate, 103)'Posting Date' ,
CONVERT(VARCHAR(10), l.duedate, 103) 'Due Date',
CONVERT(VARCHAR(10), l.taxdate, 103) 'Doc Date' ,
CASE
when (DATEDIFF(dd,l.refdate,current_timestamp))+1 < 31
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "0-30 days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 30
and (datediff(dd,l.refdate,current_timestamp))+1< 61)
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "31 to 60 days",
case when ((datediff(dd,l.refdate,current_timestamp))+1 > 60
and (datediff(dd,l.refdate,current_timestamp))+1< 91)
then
case
when syscred <> 0 then syscred * - 1
else sysdeb
end
end "61 to 90 days",
CASE
when (DATEDIFF(dd,l.refdate,current_timestamp))+1 > 90
then
case
when syscred= 0 then sysdeb
when sysdeb= 0 then syscred * - 1
end
end "90 + days"
from JDT1 l
Inner Join OJDT j On j.TransId=l.TransId
,OCRD where l.shortname = OCRD.cardcode and cardtype = 'c' and intrnmatch = '0'
ORDER BY OCRD.CARDCODE, l.taxdate}
Regards,
Kamlesh
Maybe you are looking for
-
ALE doesn't work - possiblity to notify anyone via e-mail...
Hi, at times our system doesn't send IDoc's via ALE. I can see that in transaction SM58. If we have that problem, we identificate that problem to late (10 hours later). Is there a possibility to send a mail or notfication if the interface doesn't wor
-
New windows not coming to forward focus.
I cant be the only one that is experiancing this, as the same thing happens on my new laptop. OSX has a very annoying habit that I cant get rid of. If I have Safari open, and click a link to download something, the download window doesnt always come
-
Robohelp scalability and speed
I am encountering scalability/speed issues with a 4000 file Robohelp 6 project. This has 2000 HTML files and 2000 images. This appears to be the result of Robohelp performing a number of background file scanning/parsing threads that prevent the user
-
X100e restore mbr for windows 7
Hi all, due to playing around with Linux I deleted my mbr. Is there a way to restore the mbr? Is there a tool to fix that? I tried using the Thinkvantage Recovery Tools, but what they want to do is to restore the whole system. But I just need a fix f
-
are there no other means to have facetime on my iphone4 bought from middle east?