Skip to Content
0
Former Member
Dec 27, 2012 at 06:45 AM

Joining AFIH and OBJK table for PM order

803 Views

Hi Experts,

I need to join the Table AFIH and OBJK and I have joining condition

AFIH-OBKNR = OBJK-OBKNR. the reason I need to join this two table because the user will maintain the equipment number in AFIH-EQUNR for single equipment but for multiple equipment they will maintain the equipment in object list where it will go to base table of OBJK-OBKNR. but the condition for multiple equipment number the object list from both table will be have some values so

READ TABLE IT_AFIH INTO WA_AFIH WITH KEY AUFNR = WA_AUFK-AUFNR BINARY SEARCH.



IF SY-SUBRC = 0.





WA_ZSCEOVERVIEW-PRIOK = WA_AFIH-PRIOK.

WA_ZSCEOVERVIEW-OBKNR = WA_AFIH-OBKNR.

WA_ZSCEOVERVIEW-EQUNR = WA_AFIH-EQUNR.



ENDIF.

*





READ TABLE IT_OBJK INTO WA_OBJK WITH KEY OBJVW = 'A' BINARY SEARCH.



IF SY-SUBRC = 0.



IF WA_OBJK-OBKNR IS NOT INITIAL.



WA_ZSCEOVERVIEW-ZOBJEK_OBKNR = WA_OBJK-OBKNR.

WA_ZSCEOVERVIEW-OBZAE = WA_OBJK-OBZAE.

WA_ZSCEOVERVIEW-OBJVW = WA_OBJK-OBJVW.

WA_ZSCEOVERVIEW-ZOBJEK_EQUNR = WA_OBJK-EQUNR.



ENDIF.

ENDIF.



IF WA_ZSCEOVERVIEW-EQUNR IS NOT INITIAL.

MOVE WA_ZSCEOVERVIEW-EQUNR TO WA_ZSCEOVERVIEW-ZZEQUIPMENT.



ELSEIF WA_ZSCEOVERVIEW-ZOBJEK_EQUNR IS NOT INITIAL.



MOVE WA_ZSCEOVERVIEW-ZOBJEK_EQUNR TO WA_ZSCEOVERVIEW-ZZEQUIPMENT.

ENDIF.

but I am getting value only from AFIH equipment number but not from OBJK. hence kindly let me know what went wrong please.