Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Pogramm update for Vendor's bank account with duplicate No.

HI Guru's,

This program will perform the Vendor's bank account with

duplicate No. on both level on higher level as well company code level. but field lfa1-loevm not shwoing in the report..

if i put delection flag at company level or centrel level : lfa1-loevm.. will not showing in report.. how to modify any one can help me..

TABLES: lfa1,

lfb1,

lfbk,

t077y.

DATA: BEGIN OF fi_vendor,

bukrs LIKE lfb1-bukrs, "company code

vendor_no LIKE lfbk-lifnr, "Vendor No"

name LIKE lfa1-name1, "Vendor name

bank_no LIKE lfbk-bankn, "Bank account no.

bankc_key LIKE lfbk-banks, "Bank control key

bank_key LIKE lfbk-bankl, "Bank account

create_n LIKE lfa1-ernam, "Created by

createon LIKE lfa1-erdat, "Created on

acct_group LIKE lfa1-ktokk, "Vendor group name

deletion LIKE lfa1-loevm, "deletion flag

nodel LIKE lfa1-nodel, "Central deletion block

sperr LIKE lfa1-sperr, "Posting Block

no_account TYPE i.

DATA: END OF fi_vendor.

DATA: vendor LIKE lfb1-lifnr,

name LIKE lfa1-name1,

bank LIKE lfbk-bankn,

company LIKE lfb1-bukrs,

bc_key LIKE lfbk-banks,

b_key LIKE lfbk-bankl,

cre_by LIKE lfa1-ernam,

cre_on LIKE lfa1-erdat,

ven_group LIKE lfa1-ktokk,

dele LIKE lfa1-loevm,

nodel LIKE lfa1-nodel, "Central deletion block

sperr LIKE lfa1-sperr, "Posting Block

number TYPE i.

DATA: fi_vendor_dupli LIKE fi_vendor OCCURS 0 WITH HEADER LINE.

DATA: fi_vendor_dupli1 LIKE fi_vendor OCCURS 0 WITH HEADER LINE.

CONSTANTS: a1sg(5) VALUE 'AH',

w1sg(5) VALUE 'IMH',

n1sg(5) VALUE 'NUH',

t1sg(5) VALUE 'TTSH',

q1sg(5) VALUE 'HQ',

h1sg(5) VALUE 'PHARM',

e1sg(5) VALUE 'NETC',

p1sg(5) VALUE 'POLY',

d1sg(5) VALUE 'DIAG'.

  • Limiting the select option to company code.

*SELECT-OPTIONS: bukrs FOR lfb1-bukrs.

START-OF-SELECTION.

PERFORM bank_detail.

TOP-OF-PAGE.

PERFORM header_detail.

&----


*& Form BANK_DETAIL

&----


  • text

----


FORM bank_detail.

*To get the duplicate bank account.

SELECT lfbk~bankn COUNT( * ) INTO (bank, number)

FROM lfbk

INNER JOIN lfa1

ON lfa1lifnr EQ lfbklifnr

  • WHERE loevm NE 'X

GROUP BY lfbk~bankn.

IF sy-subrc EQ 0.

IF number > 1.

MOVE: bank TO fi_vendor_dupli-bank_no,

number TO fi_vendor_dupli-no_account.

APPEND fi_vendor_dupli.

CLEAR fi_vendor_dupli.

ENDIF.

ENDIF.

ENDSELECT.

*****************************************************************

*vendor created on higher level

LOOP AT fi_vendor_dupli.

SELECT alifnr abanks abankl abankn INTO

(vendor,bc_key, b_key, bank)

FROM lfbk AS a

INNER JOIN lfa1 AS c

ON alifnr EQ clifnr

WHERE a~bankn EQ fi_vendor_dupli-bank_no

AND c~loevm EQ space.

IF sy-subrc EQ 0.

CASE company.

WHEN 'A1SG'.

company = a1sg.

WHEN 'W1SG'.

company = w1sg.

WHEN 'N1SG'.

company = n1sg.

WHEN 'Q1SG'.

company = q1sg.

WHEN 'H1SG'.

company = h1sg.

WHEN 'E1SG'.

company = e1sg.

WHEN 'P1SG'.

company = p1sg.

WHEN 'D1SG'.

company = d1sg.

WHEN 'T1SG'.

company = t1sg.

ENDCASE.

MOVE: company TO fi_vendor_dupli1-bukrs,

vendor TO fi_vendor_dupli1-vendor_no,

bc_key TO fi_vendor_dupli1-bankc_key,

b_key TO fi_vendor_dupli1-bank_key,

bank TO fi_vendor_dupli1-bank_no,

fi_vendor_dupli-no_account TO

fi_vendor_dupli1-no_account.

APPEND fi_vendor_dupli1.

CLEAR fi_vendor_dupli1.

ENDIF.

ENDSELECT.

CLEAR company.

ENDLOOP.

****************************************************************

*Vendor created under company code level eg. employee group.

SELECT alifnr bbanks bbankl bbankn

INTO (vendor,bc_key, b_key, bank)

FROM lfb1 AS a

INNER JOIN lfbk AS b

ON alifnr EQ blifnr

FOR ALL ENTRIES IN fi_vendor_dupli1

WHERE a~lifnr EQ fi_vendor_dupli1-vendor_no.

IF sy-subrc EQ 0.

IF company NE space.

MOVE: vendor TO fi_vendor_dupli1-vendor_no,

bc_key TO fi_vendor_dupli1-bankc_key,

b_key TO fi_vendor_dupli1-bank_key,

bank TO fi_vendor_dupli1-bank_no.

MODIFY fi_vendor_dupli1.

ENDIF.

ENDIF.

ENDSELECT.

*****************************************************************

LOOP AT fi_vendor_dupli1.

SELECT name1 ernam erdat ktokk loevm nodel sperr

FROM lfa1

INTO (name, cre_by, cre_on, ven_group, dele, nodel,

sperr)

WHERE loevm EQ space

AND lifnr = fi_vendor_dupli1-vendor_no.

MOVE: name TO fi_vendor_dupli1-name,

cre_by TO fi_vendor_dupli1-create_n,

cre_on TO fi_vendor_dupli1-createon,

ven_group TO fi_vendor_dupli1-acct_group,

dele TO fi_vendor_dupli1-deletion,

nodel TO fi_vendor_dupli1-nodel,

sperr TO fi_vendor_dupli1-sperr.

DELETE ADJACENT DUPLICATES FROM fi_vendor_dupli1

COMPARING vendor_no.

MODIFY fi_vendor_dupli1 TRANSPORTING name

bukrs

create_n

createon

acct_group

vendor_no

deletion

nodel

sperr.

ENDSELECT.

ENDLOOP.

**************************************************************

SORT fi_vendor_dupli1 BY bank_no vendor_no.

DATA: cnt TYPE i.

LOOP AT fi_vendor_dupli1.

SELECT SINGLE * FROM t077y WHERE ktokk EQ

fi_vendor_dupli1-acct_group

AND spras EQ 'EN'.

  • WRITE: /1 fi_vendor_dupli1-bukrs,

WRITE: /5 fi_vendor_dupli1-vendor_no,

15 fi_vendor_dupli1-name,

50 t077y-txt30,

70 fi_vendor_dupli1-bank_no,

90 fi_vendor_dupli1-bankc_key,

95 fi_vendor_dupli1-bank_key,

105 fi_vendor_dupli1-create_n,

115 fi_vendor_dupli1-createon,

128 fi_vendor_dupli1-deletion,

134 fi_vendor_dupli1-nodel,

158 fi_vendor_dupli1-sperr.

ENDLOOP.

ULINE.

ENDFORM. "BANK_DETAIL

&----


*& Form HEADER_DETAIL

&----


  • text

----


FORM header_detail.

  • WRITE: /1 'Company',

WRITE: /40 sy-title,

110 'Page',sy-pagno.

SKIP TO LINE 3.

WRITE: /5 'Vendor No',

15 'Vendor Name',

50 'Acct Group',

70 'Bank Account',

87 'Country',

95 'Bank Key',

105 'Create By',

115 'Create on',

127 'Del.Flag',

130'Central deletion flag',

155'Block for Post.'.

ULINE.

ENDFORM. "HEADER_DETAIL

regards

JK

Tags:
Not what you were looking for? View more on this topic or Ask a question