Skip to Content

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

BP searching problem

Dear Friends,

Good morning,

I m working on a problem in that, I have to separate records based on 7 searching criteria then it will be consider as 100% matching and if matched only 6 searching criteria it will considered as 90% matching, I m supposed to segregate those records which are 100% match and 90% match, , I have the data in internal table but that are 100% match, I m not retrieving the 90% match,

I can give you the criteria:

Partner, (it is not searching field)

Title,

Initials,

Name_last

Idnumber

Idtype

Istype

account

Types: begin of L_ST_BP_P, " Structre for person linking.

partner like but000-partner, " BP ID

title like but000-title, " Title

initials like but000-initials, " Initials

surname like but000-Name_last,"Surname

idnumber like but0id-idnumber,"ID Number

idtype like but0id-type," ID type

rbcode like but0is-istype,"RB CODE for Industry type

f50code like but0is-istype,"FB 50 Code for Industry type

acc_num like zbut0000flclso-zzacc_num, "Account number

end of l_st_bp_p.

Types: begin of L_ST_BP_E, "Structure for Enterprise linking

legal_ent like but000-legal_enty, "Enterprise type

idnumber like but0id-idnumber, "Company Registration number

name_org like but000-name_org1, " Cutomer/Enterprise Name

f50code like but0is-istype, "F50 code,

rbcode like but0is-istype, "RB Code,

sic like but0is-istype, " SIC Code,

idnum like but0is-IND_SECTOR, "ID Number,

psic like but0is-ISDEF, "Primary SIC code,

end of l_st_bp_e.

Data: i_but000 type standard table of but000 with header line, " General data internal table

i_but0id type standard table of but0id with header line, " BP ID data internal table

i_but0is type standard table of but0is with header line, " Industry data internal table

i_profile type standard table of ZBUT0000FLCLSO with header line. " Product profile internal table.

Data: but000_wa LIKE LINE OF i_but000,

but0id_wa like line of i_but0id,

but0is_wa like line of i_but0is,

profile_wa like line of i_profile.

Data: lv_indix type sy-tabix.

Data: i_bp_p type standard table of l_st_bp_p with header line. "Internal table for person.

  • General data table

  • Data selection from BUT000 table and no indexed maintained.

Select * from but000

into table i_but000.

    • BP id number table

    • Data selection from BUT0ID table no indexed maintained.

select * from but0id

into table i_but0id.

    • BP Industry table

    • Data selection from BUT0ID table no indexed maintained.

select * from but0is

into table i_but0is.

    • BP partner profile table

    • Data Selection from ZBUT0000FLCLSO table no indexed maintained.

select * from ZBUT0000FLCLSO

into table i_profile.

Sort i_but000 by partner title initials name_last.

loop at i_but000 into but000_wa.

lv_indix = sy-tabix.

lv_indix = lv_indix + 1.

Read table i_but000 into but000_wa index lv_indix.

if sy-subrc eq 0.

move-corresponding but000_wa to i_bp_p.

append i_bp_p.

endif.

endloop.

if sy-subrc eq 0.

Sort i_but0id by idnumber type.

loop at i_but0id into but0id_wa.

lv_indix = sy-tabix.

lv_indix = lv_indix + 1.

Read table i_but0id into but0id_wa index lv_indix.

if sy-subrc eq 0.

move-corresponding but0id_wa to i_bp_p.

append i_bp_p.

endif.

endloop.

endif.

if sy-subrc eq 0.

Sort i_but0is by istype.

loop at i_but0is into but0is_wa.

lv_indix = sy-tabix.

lv_indix = lv_indix + 1.

Read table i_but0is into but0is_wa index lv_indix.

if sy-subrc eq 0.

move-corresponding but0is_wa to i_bp_p.

append i_bp_p.

endif.

endloop.

endif.

if sy-subrc eq 0.

Sort i_profile by zzacc_num.

loop at i_profile into profile_wa.

lv_indix = sy-tabix.

lv_indix = lv_indix + 1.

Read table i_profile into profile_wa index lv_indix.

if sy-subrc eq 0.

move-corresponding profile_wa to i_bp_p.

append i_bp_p.

endif.

endloop.

endif.

loop at i_bp_p.

write : / i_bp_p-partner.

endloop.

Can you help me to sort out this problem please

Thanking you

Regards,

Naim

Tags:
replied

Hi Naim,

You said if it matches all 7 criteria, it is 100% match. But to say 90% match what are the 6 fields to consider? I assumed it to be the first 6 fields i.e. excluding 'account' field.

Now to display 90% match (6 search criteria fields i.e. without field 'account'), please add the following code.

After the following code block...

****Existing Code*************************************

if sy-subrc eq 0.

Sort i_but0is by istype.

loop at i_but0is into but0is_wa.

lv_indix = sy-tabix.

lv_indix = lv_indix + 1.

Read table i_but0is into but0is_wa index lv_indix.

if sy-subrc eq 0.

move-corresponding but0is_wa to i_bp_p.

append i_bp_p.

endif.

endloop.

endif.

****Existing Code*************************************

Declare new internal table I_BP_90 which is similar to I_BP_P.

DATA: I_BP_90 TYPE STANDARD TABLE OF L_ST_BP_P WITH HEADER LINE.

Add the following code...

****New Code*************************************

  • Moving I_BP_P to I_BP_90 as I_BP_P contains fields

  • matching 6 criteria

I_BP_90[] = I_BP_P[].

clear: I_BP_90.

****New Code*************************************

Now you can display I_BP_90 whereever you want.

  • BPs matching 90% Criteria

LOOP AT I_BP_90.

WRITE : / I_BP_90-PARTNER.

ENDLOOP.

Hope this helps.

Thanks.

Ajay Kiran

0 View this answer in context

Helpful Answer

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