‎2010 May 20 10:08 AM
Hi,
Good day guys
Ive got a two tables one which is lt_afvc and another is ct_claim. ct_claim is deep stracture.
each one got two records. i need to check one by one records.
ive got a prob when looping the second record with ct_claim. ive put the exit after modify first record .bcoz i need to check one record by record. after exit the second loop, its goes the first loop for the second record, it pass the second record then comes to second loop. here my prob starts. bcoz here ct_claim passes the again first record instead of second record. how to check record by record.
Ive tried with index.but it doesnt workout.
loop at lv_afvc into wa
if wa-larnt = 'hm'.
if wa_wty_ind = 'x'.
loop ct_claim into wa1
wa1-item_type = 'fr'.
modify ct_claim from wa1.
exit.
endloop.
endloop
could u plz any one give me guide?
Regards
Chandu
‎2010 May 20 10:47 AM
Hello,
My perception is that you are having problem in handling inner loop.
Your outer loop runs by sequnce 1 2... n then for the 1st record your inner loop starts with 1st record.
but for the 2nd record of outer loop your inner loop should start with 2nd record.
If this is the case then you should store the sy-tabix value inside the inner loop and then start
your inner loop from that index onwards. This can be coded as below..
data l_t type sy-tabix.
loop at lv_afvc into wa
if wa-larnt = 'hm'.
if wa_wty_ind = 'x'.
loop ct_claim into wa1 from l_t
l_t = sy-tabix.
wa1-item_type = 'fr'.
modify ct_claim from wa1.
exit.
endloop.
endloop
‎2010 May 20 10:15 AM
If you are just looking to compare one record by record, instead of nested loops you must be using a read statement on the second internal table with a common key field between the two internal tables.
loop at lv_afvc into wa
if wa-larnt = 'hm'.
if wa_wty_ind = 'x'.
read table ct_claim into wa1 with key field = wa-field.
if sy-subrc = 0.
wa1-item_type = 'fr'.
modify ct_claim from wa1.
endif.
endif.
endif.
endloop.
Vikranth
‎2010 May 20 10:32 AM
thank you for reply. if you go read statement.. its reads the first record..wht about second record.
ct_claim_item got two records
Regards
chandu
‎2010 May 20 10:47 AM
Hello,
My perception is that you are having problem in handling inner loop.
Your outer loop runs by sequnce 1 2... n then for the 1st record your inner loop starts with 1st record.
but for the 2nd record of outer loop your inner loop should start with 2nd record.
If this is the case then you should store the sy-tabix value inside the inner loop and then start
your inner loop from that index onwards. This can be coded as below..
data l_t type sy-tabix.
loop at lv_afvc into wa
if wa-larnt = 'hm'.
if wa_wty_ind = 'x'.
loop ct_claim into wa1 from l_t
l_t = sy-tabix.
wa1-item_type = 'fr'.
modify ct_claim from wa1.
exit.
endloop.
endloop
‎2010 May 20 10:51 AM
Hi ,
Try like this.
loop at lv_afvc into wa
if wa-larnt = 'hm'.
if wa_wty_ind = 'x'.
loop ct_claim into wa1 where item_type NE 'fr'. " I made the chage to this line only.
wa1-item_type = 'fr'.
modify ct_claim from wa1.
exit.
endloop.
endloop
Regards,
Smart
‎2010 May 20 11:02 AM
thts wrong condtion as per spec. i need to check record by record with two tables then modify..
thank you for reply.