Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

internal table searching.

naimkhans_babi
Active Participant
0 Likes
658

Dear firends,

I m working on problem, I have to segregate certain fields based on the matching criterial if the match is 100% successful(match 7 out of 7 fields) i need to move to the internal table. the following code is giving me exact 100% match records. if i search 6 out of 7 records in need to move it to the another internal table. here i have done 50% task but as not matching one field can be n e field from 7 fields so how i perform 6 out 7 match field search on a internal table.. would you like to give me n e suggestion for that. i have given you the code. please help me to sort out this thing...

thanking you.

regards

Naim

sort i_bp_p by title initials name_last idnumber idtype f50code rbcode. "acc_num.

data: wa_i_bp_p_read1 like wa_i_bp_p.

loop at i_bp_p into wa_i_bp_p.

lv_tabix = sy-tabix.

lv_tabix = lv_tabix + 1.

read table i_bp_p index lv_tabix into wa_i_bp_p_read1

comparing idnumber

idtype

title

initials

name_last

f50code

rbcode

transporting partner

idnumber

idtype

title

initials

name_last

f50code

rbcode.

if sy-subrc = 0.

move-corresponding wa_i_bp_p_read1 to i_bp_p100.

append i_bp_p100.

clear i_bp_p100.

move-corresponding wa_i_bp_p to i_bp_p100.

append i_bp_p100.

clear i_bp_p100.

endif.

endloop.

sort i_bp_p100 by partner.

delete adjacent duplicates from i_bp_p100.

loop at i_bp_p100.

write : /10 i_bp_p100-partner,

20 i_bp_p100-title,

30 i_bp_p100-initials,

40 i_bp_p100-name_last,

53 i_bp_p100-idnumber,

70 i_bp_p100-idtype,

85 i_bp_p100-rbcode,

95 i_bp_p100-f50code.

  • 105 i_bp_p-acc_num.

endloop.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
624

You can also use

SEARCH itab FOR g.

for searching an internal table.

It has got Additions:

1. ... ABBREVIATED

2. ... STARTING AT line1

3. ... ENDING AT line2

4. ... AND MARK

Cheers,

Thomas.

4 REPLIES 4
Read only

Former Member
0 Likes
624

hii

sice you are searching the data abse there is a quite a load on database..

so use binary search

read table i_bp_p index lv_tabix into wa_i_bp_p_read1

<b>BINARY SEARCH</b>.

Read only

Former Member
0 Likes
625

You can also use

SEARCH itab FOR g.

for searching an internal table.

It has got Additions:

1. ... ABBREVIATED

2. ... STARTING AT line1

3. ... ENDING AT line2

4. ... AND MARK

Cheers,

Thomas.

Read only

rahulkavuri
Active Contributor
0 Likes
624
  LOOP AT T_VBRK_VBRP.

    READ TABLE T_VBAK WITH KEY VBELN = T_VBRK_VBRP-AUBEL.

    IF SY-SUBRC = 0.

      T_BOM = T_VBRK_VBRP.
      APPEND T_BOM.

    ENDIF.

  ENDLOOP.


  DELETE T_BOM WHERE UEPOS = '000000'.
  DELETE T_VBRK_VBRP WHERE UEPOS <> '000000'.

Look at the code above, it follows the same requirement u have done in ur code but no, it works fine too without usin adjacent duplicates

Read only

dani_mn
Active Contributor
0 Likes
624

You have to Put 7 read statments in loop and check

sy-subrc.

In first read match all the seven fields and check

subrc <> 0

then read with 6 and so on.

Hopes this help.

Regards,

Wasim Ahmed