‎2009 Feb 07 7:39 AM
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
‎2009 Feb 07 7:48 AM
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.
‎2009 Feb 07 7:52 AM
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.
‎2009 Feb 07 8:18 AM
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
‎2009 Feb 07 8:26 AM
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.
‎2009 Feb 07 8:37 AM
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
‎2009 Feb 07 10:32 AM
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.