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

Problem with control break statement...?

aarif_baig
Active Participant
0 Likes
1,232

Hi abapers,

I am having some problem with control break statement..

My requirement is as follows:

there is a select option on selection screen for state

Now suppose field REGIO = 34.

This 34 can be for a sate in india as well in any other

but the difference is there code which is LAND1

i am doing this very well

But now my problem is that

I have to do grouping BaseD on regio and land1

6 REPLIES 6
Read only

Former Member
0 Likes
793

HI,

The LAND1 field should be precceding field of REGIO in itab. Now you can group the data LAND wise and Region wise.

Sort Itab by LAND1 REGIO.
Loop at itab.

AT new Regio.

ENDAT.

AT END of Regio.

ENDAT.


ENDLOOP.

Read only

Former Member
0 Likes
793

When using control breaks, it is very important to maintain the field hierarchy. For your requirement, since the region code is dependent on LAND1 field, LAND1 field should be declared as the first field in the table/structure which should be followed by REGIO. When you want to use a control break on REGIO, the logic would check for a combination of LAND1 and REGIO which results in a unique combination.

Read only

Former Member
0 Likes
793

Hi,

Before going for the control break statements you have sort u r internal table..this is a prerequisite to use control break statement..like

check your internal table structure also..

when we use control events,suppose if use connid the fields before the connid also take it as key fields.based on the the records will be grouped..

sort itab by field1 ...field n.

eg:

sort itab by carrid connid.

loop at itab into fs_itab

at new connid.

endat.

endloop.

Did u sort ur internal table or not....

Regards

Kiran

Edited by: Kiran Saka on Feb 7, 2009 9:19 AM

Edited by: Kiran Saka on Feb 7, 2009 9:21 AM

Read only

Former Member
0 Likes
793

Hi,

For control break statements ,first sort the table by the fields you want to use.

When u use a field in control break,then it will see the left handside fields of field you mentioned,

so,the field sequence should be looked into while using these control statements.

Read only

Former Member
0 Likes
793

hi,

If your internal table has fields field1, field2, field3, then in order for your output be triggered at field3, it must be

at new field3, here the output is triggered for every field preceeding the field mentioned in the control break statement.

So check in the debugger if there is any change of field value even before the field you mentioned in the control break statement.

Thanks

Sharath

Edited by: Sharath Panuganti on Feb 7, 2009 9:42 AM

Read only

Former Member
0 Likes
793

hi,,

u decalre the table like this

begin of internal table,

regio,

landi,

.......

end of internal table

u can sort the internal table based in the keys..ie:here regio land1.in this order.so now if u use an at new statement within the loop,and if ur using land1 as the at new statement,then whener there is a change in the value of fields upto land1(that is land1 and above)it will break.