Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

lINK BETWEEN AFKO AND AFVC

Former Member
0 Kudos

Hi,

How to link afko with afvc, i know the common field is AUFPL, but AFVC is table for operation, so how to choose exact row from multiple row. My coding is as follows

SELECT * into corresponding fields of table itab1 FROM afko as a

INNER JOIN afvc as b ON aaufpl = baufpl

INNER JOIN afru as c ON brueck = crueck

inner join afpo as d on daufnr = aaufnr

inner join crhd as e on eOBJID = BARBID

WHERE aaufnr = itab-aufnr AND cSTOKZ NE 'X'

AND cSTZHL = '0' AND cBUDAT IN P_DATE AND c~LTXA1 <> ''.

Regards

1 ACCEPTED SOLUTION

former_member387317
Active Contributor

Hi Khushi,

AFKO ==> AUFNR is the only Primary Key

AFVC ==> AUFPL and APLZL together is the primary Key...

AUFPL you will get from AFKO and You can pass it to AFVC...

For One AUFNR you may get several records in AFVC depending on the Number of Activity / Operations attched to given production Order..

You can pass the counter (it refers the Operation/Activity)... along with AUFPL to AFVC to get unique record..

By Seeing your Select Query... I can say you should include

RMZHL while joining AFVC and AFRU.... in Join Condition....

SELECT * into corresponding fields of table itab1 FROM afko as a
INNER JOIN afvc as b ON a~aufpl = b~aufpl
INNER JOIN afru as c ON b~rueck = c~rueck

AND
b~RMZHL = c~RMZHL

inner join afpo as d on d~aufnr = a~aufnr
inner join crhd as e on e~OBJID = B~ARBID
WHERE a~aufnr = itab-aufnr AND c~STOKZ NE 'X'
AND c~STZHL = '0' AND c~BUDAT IN P_DATE AND c~LTXA1 ''.

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

5 REPLIES 5

Former Member
0 Kudos

hai khusshi afvc table is for both network and orders , both are stored with same 12 char numbers but the differenece is in control key field STEUS which differentiate between both

m.a

Former Member
0 Kudos

Hi,

I wanted to ask that is there any other field to compare between afko and afvc ( other than aufnr) to extract exact record.

Regards,

0 Kudos

To find links between 2 tables, its always better to go to Tcode SQVI and do a table join.

Once you get the common fields, go to SE11 and check for correctness of the link by trying different input values.

pk

Former Member
0 Kudos

AFKO-APLZT = AFVC-APLZL

AFKO-AUFPL = AFVC-AUFPL

former_member387317
Active Contributor

Hi Khushi,

AFKO ==> AUFNR is the only Primary Key

AFVC ==> AUFPL and APLZL together is the primary Key...

AUFPL you will get from AFKO and You can pass it to AFVC...

For One AUFNR you may get several records in AFVC depending on the Number of Activity / Operations attched to given production Order..

You can pass the counter (it refers the Operation/Activity)... along with AUFPL to AFVC to get unique record..

By Seeing your Select Query... I can say you should include

RMZHL while joining AFVC and AFRU.... in Join Condition....

SELECT * into corresponding fields of table itab1 FROM afko as a
INNER JOIN afvc as b ON a~aufpl = b~aufpl
INNER JOIN afru as c ON b~rueck = c~rueck

AND
b~RMZHL = c~RMZHL

inner join afpo as d on d~aufnr = a~aufnr
inner join crhd as e on e~OBJID = B~ARBID
WHERE a~aufnr = itab-aufnr AND c~STOKZ NE 'X'
AND c~STZHL = '0' AND c~BUDAT IN P_DATE AND c~LTXA1 ''.

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya