cancel
Showing results for 
Search instead for 
Did you mean: 

Child/Parent Relationship Query

larryenet
Participant
0 Kudos

I'm using SAP BO 9.0

I use a query to view the BP Code child/parent relationships here:

SELECT T0.[ItemCode], T0.[CardCode], T0.[Substitute] FROM OSCN T0 WHERE T0.[CardCode] ='ENET-TD'

Result:

#Item No.BP CodeBP Catalog Number
10061003020-CORENET-TDCWDM-SFP-1470-ENCY
20061003020-ENCENET-TDCWDM-SFP-1470-ENCY
30061003021-CORENET-TDCWDM-SFP-1490-ENCY
40061003021-ENCENET-TD0061003021-ENCY

I need it to include more than one BP Code [CardCode]. The BP Codes [CardCode] I need included are ENET-TD, C000156, C000310, C000312.

I also need it to include all parts that don’t have any BP Codes [CardCode], Item Group, and Description

 

Here is an example of the query needed:

#

Item No.

Item Group

BP Code

BP Catalog Number

BP Code

BP Catalog Number

BP Code

BP Catalog Number

BP Code

BP Catalog Number

Description

1

0061003024-ENC

104

ENET-TD

1234567890-ENC

C000156

XJ4470

C000310

ECM-0061003024-ENC

C000312

ENE-0061--3024-ENC

1000BASE-CWDM SFP 1GE 2G FC 1550nm 80km DOM SMF LC Connector

Thank you in advance for your help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try this

SELECT T0.[ItemCode], T0.[ItemName], T3.[ItmsGrpNam], T1.[Substitute], T2.[CardCode], T2.[CardName] FROM OITM T0  INNER JOIN OSCN T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN OCRD T2 ON T0.[CardCode] = T2.[CardCode] INNER JOIN OITB T3 ON T0.[ItmsGrpCod] = T3.[ItmsGrpCod] where T2.cardcode in ( 'ENET-TD', 'C000156', 'C000310', 'C000312')

larryenet
Participant
0 Kudos

Hello

I tried and this is the result:

Former Member
0 Kudos

Try this

SELECT T0.[ItemCode], T0.[ItemName], T3.[ItmsGrpNam], T1.[Substitute], T2.[CardCode], T2.[CardName] FROM OITM T0  INNER JOIN OSCN T1 ON T0.[ItemCode] = T1.[ItemCode] INNER JOIN OCRD T2 ON T1.[CardCode] = T2.[CardCode] INNER JOIN OITB T3 ON T0.[ItmsGrpCod] = T3.[ItmsGrpCod] where T2.cardcode in ( 'ENET-TD', 'C000156', 'C000310', 'C000312')

larryenet
Participant
0 Kudos

Thank you very much!! It worked!!

larryenet
Participant
0 Kudos

I also need the query to include all of the Items that do not have any BP Codes, so basically all of the items in our database. I would expect those fields to be blank, so I know I need to update them.

Former Member
0 Kudos

Use this

SELECT T0.[ItemCode], T0.[ItemName], T3.[ItmsGrpNam], T1.[Substitute], T2.[CardCode], T2.[CardName]

FROM OITM T0  left outer  JOIN OSCN T1 ON T0.[ItemCode] = T1.[ItemCode] left outer JOIN OCRD T2 ON T1.[CardCode] = T2.[CardCode] INNER JOIN OITB T3 ON T0.[ItmsGrpCod] = T3.[ItmsGrpCod]

Note: If you want to see only particular BP master then add this where T2.cardcode in ('Cardcode1','Cardcode2','Cardcode3',...........)

larryenet
Participant
0 Kudos

This is very good. It worked again!! You are awesome!!!

Answers (0)