REPORT ZMM_BANKDETAILS .
TABLES : LFA1,
LFB1,
LFBK.
SELECT-OPTIONS : S_LIFNR FOR LFA1-LIFNR,
S_BUKRS FOR LFB1-BUKRS,
S_ERDAT FOR LFA1-ERDAT.
*----INTERNAL TABLE FOR BASIC LIST.
TYPES : BEGIN OF IT_LFA1,
LIFNR TYPE LFA1-LIFNR,
NAME1 TYPE LFA1-NAME1,
ADRNR TYPE LFA1-ADRNR,
END OF IT_LFA1.
*------INTERNAL TABLE FOR SECONDARY LIST.
TYPES : BEGIN OF IT_LFBK,
LIFNR TYPE LFBK-LIFNR,
BANKS TYPE LFBK-BANKS,
BANKN TYPE LFBK-BANKN,
END OF IT_LFBK.
DATA : I_LFA1 TYPE STANDARD TABLE OF IT_LFA1 WITH HEADER LINE.
DATA : I_LFBK TYPE STANDARD TABLE OF IT_LFBK WITH HEADER LINE.
DATA : W_LIFNR LIKE LFA1-LIFNR.
*------INITIALIZATION.
INITIALIZATION.
*-------AT SELECTION SCREEN.
AT SELECTION-SCREEN.
*----START-OF-SELECTION.
START-OF-SELECTION.
SELECT A~LIFNR A~NAME1 A~ADRNR INTO TABLE I_LFA1 FROM
LFB1 AS B INNER JOIN LFA1 AS A
ON B~LIFNR EQ A~LIFNR WHERE
B~BUKRS IN S_BUKRS AND
A~LIFNR IN S_LIFNR.
APPEND I_LFA1.
CLEAR I_LFA1.
*----TOP-OF-PAGE
TOP-OF-PAGE.
WRITE : 'VENDOR NO' COLOR 1, 15 'NAME' COLOR 2, 45 'ADDRESS' COLOR 3.
ULINE.
*----END-OF-SELECTION.
END-OF-SELECTION.
SORT I_LFA1 BY LIFNR.
*---delete duplicate records
DELETE ADJACENT DUPLICATES FROM I_LFA1.
*--display basic list--
LOOP AT I_LFA1.
WRITE : / I_LFA1-LIFNR, 15 I_LFA1-NAME1, 40 I_LFA1-ADRNR.
*---hiding vendor number
HIDE I_LFA1-LIFNR.
ENDLOOP.
*---AT LINE-SELECTION.
AT LINE-SELECTION.
REFRESH I_LFBK.
SELECT BANKS BANKN INTO (I_LFBK-BANKS, I_LFBK-BANKN) FROM LFBK
WHERE LIFNR = I_LFA1-LIFNR.
I_LFBK-LIFNR = I_LFA1-LIFNR.
APPEND I_LFBK.
CLEAR I_LFBK.
ENDSELECT.
IF SY-SUBRC NE 0.
WRITE : 'NO BANK ACCOUNT FOR THIS VENDOR'.
ENDIF.
*---displaying secondary list--
LOOP AT I_LFBK.
WRITE : / I_LFBK-LIFNR, 10 I_LFBK-BANKS, 25 I_LFBK-BANKN.
ENDLOOP.
*---top-of-page for secondary list--
TOP-OF-PAGE DURING LINE-SELECTION.
WRITE : 'VENDOR NO' COLOR 1, 15 'COUNTRY' COLOR 2,
25 'A/C NO.' COLOR 3.
ULINE.

Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com