Skip to Content

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

BDC program - avoid duplicate records

Hello Experts,

I m doing BDC .My query is not working

My req is if company code,Pur Org.,A/c Grp & name1 is same as in the database i.e. if vendor having same these 4 fields in the databse as in the excel, this particular record will not get uploaded .

In it_success is the internal table with records to be uploaded after some validations.

PLz check where i m wrong

loop at i_lfa1.

loop at i_lfb1 where lifnr = i_lfa1-lifnr.

loop at i_lfm1 where lifnr = i_lfb1-lifnr.

main_table-lifnr = i_lfa1-lifnr.

main_table-bukrs = i_lfb1-bukrs.

main_table-ekorg = i_lfm1-ekorg.

main_table-KTOKK = i_lfa1-KTOKK.

main_table-name1 = i_lfa1-name1.

append main_table.

endloop.

endloop.

endloop.

loop at it_success.

loop at main_table where ( bukrs = it_success-bukrs_001

and EKORG = it_success-EKORG_002

and KTOKK = it_success-KTOKK_003

and name1 = it_success-name1_006 ).

MOVE-CORRESPONDING it_success TO it_error.

APPEND it_error.

delete main_table.

if sy-subrc eq 0.

delete it_success.

e_fret-type = 'E'.

e_fret-name = it_error-NAME1_006.

e_fret-message = 'Vendor Name already exists '.

append e_fret.

endif.

endloop.

endloop.

Ravi

Edited by: Julius Bussche on Oct 1, 2008 9:30 AM

Please use meaningfull subject titles.

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