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

AT NEW...

Former Member
0 Likes
378

Hi,

How does at end works with the below code>

LOOP AT i_crhd into x_crhd.

at new arbpl.

v_resource = x_crhd-arbpl.

LOOP AT i_afko into x_afko.

at new plnbez.

v_matcode = x-afko-plnbez.

READ TABLE i_mseg into x_mseg with key x_afko-aufnr.

IF sy-subrc eq 0.

IF x_mseg-bwart eq '101'.

v_menge_101 = v_menge_101 + x_mseg-menge.

ELSEIF i_mseg-bwart = '102'.

v_menge_102 = v_menge_102 + i_mseg-menge.

ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

Thanks a lot!

Hi,

How does at end works with the below code>

LOOP AT i_crhd into x_crhd.

at new arbpl.

v_resource = x_crhd-arbpl.

LOOP AT i_afko into x_afko.

at new plnbez.

v_matcode = x-afko-plnbez.

READ TABLE i_mseg into x_mseg with key x_afko-aufnr.

IF sy-subrc eq 0.

IF x_mseg-bwart eq '101'.

v_menge_101 = v_menge_101 + x_mseg-menge.

ELSEIF i_mseg-bwart = '102'.

v_menge_102 = v_menge_102 + i_mseg-menge.

ENDIF.

ENDIF.

ENDLOOP.

ENDLOOP.

Thanks a lot!

2 REPLIES 2
Read only

Former Member
0 Likes
362

Hi,

At end will appera for inner loop first and then outer loop.

Please note that At end will appear inside respective loops.

Regards,

Siddhesh S.Tawate

Read only

Sm1tje
Active Contributor
0 Likes
362

at end of <field>.

this means when table is sorted by a (key) field, that when looping over internal table and the last record from this particular field is reached, than it will go into AT END OF section.