‎2010 Feb 15 9:29 AM
How can I accomodate more than 2 fields in control break statement?
e.g. if I want to have control on these fields land1 plant , how can I use it in At statement?
Thanks
‎2010 Feb 15 9:36 AM
You need to handle them both separately.
AT ... LAND1.
ENDAT.
AT ... PLANT.
ENDAT.
Processing will go to AT ... -> ENDAT block each time it fulfill condition in AT operand (i.e NEW, LAST, FIRST etc).
If you want to use both field as one, you will need to create another field and hold there concatenation of LAND1 and PLANT.
Then you can catch it same way
AT ... JOIN_FIELD. "join field here hold value of LAND1 + PLANT
ENDAT.
Regards
Marcin
‎2010 Feb 15 9:36 AM
You need to handle them both separately.
AT ... LAND1.
ENDAT.
AT ... PLANT.
ENDAT.
Processing will go to AT ... -> ENDAT block each time it fulfill condition in AT operand (i.e NEW, LAST, FIRST etc).
If you want to use both field as one, you will need to create another field and hold there concatenation of LAND1 and PLANT.
Then you can catch it same way
AT ... JOIN_FIELD. "join field here hold value of LAND1 + PLANT
ENDAT.
Regards
Marcin
‎2010 Feb 15 9:43 AM
Hey Marcin,
If you define the table as:
DATA:
BEGIN OF ITAB OCCURS 0,
LAND TYPE LAND1,
WERKS TYPE WERKS_D,
END OF ITAB.Then AT NEW WERKS will be triggered whenever there is change in either LAND or WERKS:
LOOP AT ITAB.
AT NEW WERKS.
ENDAT.
ENDLOOP.So
If you want to use both field as one, you will need to create another field and hold there concatenation of LAND1 and PLANT
is not required.
Correct me if i am wrong
BR,
Suhas
Edited by: Suhas Saha on Feb 15, 2010 3:14 PM
‎2010 Feb 15 10:04 AM
Hi Suhas,
Then AT NEW WERKS will be triggered whenever there is change in either LAND or WERKS:
I don't think so.
Let's say we have below data. Then AT NEW WERKS will get triggered.
LAND WERKS
01 4030 "<- here (LAND is the same)
01 4030
01 4031 "<- here
01 4031
01 4032 "<- here
01 4032
02 5030 "<- here only LAND and WERKS changes togeter
02 .....
Regards
Marcin
‎2010 Feb 15 10:05 AM
‎2010 Feb 15 10:08 AM
Hi Marcin,
But[ SAP documentation |http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb381a358411d1829f0000e829fbfe/content.htm]says:
FIRST
First line of the internal table
LAST
Last line of the internal table
NEW <f>
Beginning of a group of lines with the same contents in the field <f> and in the fields left of <f>
END Of <f>
End of a group of lines with the same contents in the field <f> and in the fields left of <f>BR,
Suhas
‎2010 Feb 15 10:22 AM
NEW <f>
Beginning of a group of lines with the same contents in the field <f> and in the fields left of <f>
Exactly, in the above example whenever WERKS have same value for all rows, LAND will always have same too, not vice versa.
LAND WERKS
01 4030 "<- begining of line with same content of WERKS and same content of LAND (field left of WERKS)
01 4030
01 4031
I just say what I know from authopsy
Regards
Marcin
‎2010 Feb 15 10:30 AM
Hi,
Suhas is correct here. Here 'At new WERKS' will be triggered if there is a change in LAND1 or WERKS or BOTH.
In general, At new (f) will ne triggered if there is a change in any of the field contents declared before the field used in at new statement.
Regards,
Ganga
‎2010 Feb 15 10:42 AM
>
> Hi,
>
> Suhas is correct here. Here 'At new WERKS' will be triggered if there is a change in LAND1 or WERKS or BOTH.
>
> In general, At new (f) will ne triggered if there is a change in any of the field contents declared before the field used in at new statement.
>
> Regards,
> Ganga
Ok I get what you mean, but one correction. If WEKRS changes this means that either same LAND1 is used or new LAND1 applies.
So correct is that AT NEW WERKS is executed whenever WERKS or BOTH change (beacasue when LAND1 changes WERKS must change too).
@Suhas,
Apologizes for insisting on my theory. I simply misunderstood you.
Regards
Marcin
‎2010 Feb 15 10:45 AM
Hey Marcin,
No apologies please. In fact i should have re-phrased my statement correctly.
Cheers,
Suhas
‎2010 Feb 15 10:50 AM
Whoever faults, it's good we can agree on correct anwser, as there should be only one right:)
Cheers
Marcin
‎2010 Feb 15 1:28 PM
‎2010 Feb 15 9:51 AM
Control break statement considers every unique combination to the left of the field as a new entry. You just need to ensure that the data is sorted before using control breaks.
‎2010 Feb 15 9:54 AM
hi,
the control break statements. work corresponding to the first column in the internal table.
if it is the second column in the internal tablee.
then it will consider the value of the first column and then the second column,.
regards,
sakshi.
‎2010 Feb 15 10:31 AM
Before applying the control break statements,
Please read the documentation and try once.