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

Deep stracture problem

Former Member
0 Likes
618

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
593

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

5 REPLIES 5
Read only

Former Member
0 Likes
593

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

Read only

0 Likes
593

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

Read only

Former Member
0 Likes
594

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

Read only

Former Member
0 Likes
593

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

Read only

0 Likes
593

thts wrong condtion as per spec. i need to check record by record with two tables then modify..

thank you for reply.