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

SORTING AND CONTROL STATEMENTS

Former Member
0 Likes
621

HI ALL,

I have statements like this

SORT I_OUT_REC BY BUKRS LIFNR STAT WAERS BELNR. " xblnr.

LOOP AT I_OUT_REC.

...............

At one time in loop i require the priority to be given to the second field i.e; LIFNR. i dont want to loop th I_OUT_REC again and sorting with LIFNR first as that takes a considerable amount of time.Is there any way out

4 REPLIES 4
Read only

Former Member
0 Likes
597

U ca use where in Loop statement.

SORT i-out_rec by lifnr.
LOOP AT i_out_rec where lifnr  = ....

Read only

Former Member
0 Likes
597

use SORT <table> STABLE by lifnr

in side the loop.

Hope this solves ur problem.

Message was edited by:

sai ramesh

Read only

Former Member
0 Likes
597

Hi,

Since you have already sorted the int table by BUKRS LIFNR...

the second priority will be given to LIFNR field automatically. But what you wants to do at LIFNR level?

Do you wants to display something on LIFNR level.

like Totals for individual Vendor.

Then Use control break statements on Vendor like AT NEW LIFNR write Vendor no and Name and AT END OF LIFNR do SUm. it will give totals.

Regards,

Anji

Read only

Former Member
0 Likes
597

actually there are three IF conditions in the loop out of which two if conditions require the table to be sorted using BUKRS.Now The third IF condition requires the table to sorted using LIFNR.Is there any way i coul do it without using the looping again?