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 breaks with in internal table

anupam_srivastava2
Participant
0 Likes
1,041

Hi all

I have used control breaks with in my internal table

SORT T_QUOT BY ERNAM.

BREAK-POINT.

LOOP AT T_QUOT INTO H_QUOT .

AT NEW ERNAM.

H_DISP-ERNAM = H_QUOT-ERNAM.

CLEAR V_CNT.

ENDAT.

V_CNT = V_CNT + 1.

AT END OF ERNAM.

SUM.

H_DISP-ORDER = H_QUOT-ORDER.

H_DISP-LOST = H_QUOT-LOST.

H_DISP-OPEN = H_QUOT-OPEN.

H_DISP-TOTAL = V_CNT.

APPEND H_DISP TO T_DISP.

ENDAT.

In this even though there is no end of ernam, it enters. I am working on 4.6c version. can any body tell why it would be behaving this way.

regards

AJ

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,022

what is the order of fields in your int table.

make ERNAM the first field

Your ernam field should be first field of internal table.

Clear ernam before appending. Because I feel you should have to do the total for each ernam.

EX: H_DISP-TOTAL = V_CNT.

Clear: ernam.

APPEND H_DISP TO T_DISP.

8 REPLIES 8
Read only

Former Member
0 Likes
1,023

what is the order of fields in your int table.

make ERNAM the first field

Read only

Former Member
0 Likes
1,022

Your requirement is not clear could you please elaborate the same.

Read only

varma_narayana
Active Contributor
0 Likes
1,022

Hi ..

If the ERNAM is the First field of ur internal table then it works properly.

So check the declaration of ITAB and Change it accordingly. i.e make the ERNAM as the First field.

Reward if Helpful.

Read only

Former Member
0 Likes
1,022

Your ernam field should be first field of internal table.

Clear ernam before appending. Because I feel you should have to do the total for each ernam.

EX: H_DISP-TOTAL = V_CNT.

Clear: ernam.

APPEND H_DISP TO T_DISP.

Read only

Former Member
0 Likes
1,022

Your ernam field should be first field of internal table.

Clear ernam before appending. Because I feel you should have to do the total for each ernam.

EX: H_DISP-TOTAL = V_CNT.

Clear: v_cnt.

APPEND H_DISP TO T_DISP.

Read only

Former Member
0 Likes
1,022

Hi

see this program you can undestran easily

  • Using AT FIRST , AT NEW, AT THE END OF , AT LAST.

DATA: BEGIN OF ITAB OCCURS 0,

F1 TYPE I,

F2(6) TYPE C,

F3(10) TYPE N,

F4(16) TYPE P DECIMALS 2,

END OF ITAB.

DATA: SUB_TOT(10) TYPE P DECIMALS 3.

**--1

ITAB-F1 = 1.

ITAB-F2 = 'ONE'.

ITAB-F3 = 10.

ITAB-F4 = '1000.00'.

APPEND ITAB.

CLEAR ITAB.

ITAB-F1 = 1.

ITAB-F2 = 'ONE'.

ITAB-F3 = 20.

ITAB-F4 = '2000.00'.

APPEND ITAB.

CLEAR ITAB.

ITAB-F1 = 1.

ITAB-F2 = 'ONE'.

ITAB-F3 = 30.

ITAB-F4 = '3000.00'.

APPEND ITAB.

CLEAR ITAB.

*--2

ITAB-F1 = 2.

ITAB-F2 = 'TWO'.

ITAB-F3 = 10.

ITAB-F4 = '1000.00'.

APPEND ITAB.

CLEAR ITAB.

ITAB-F1 = 2.

ITAB-F2 = 'TWO'.

ITAB-F3 = 20.

ITAB-F4 = '2000.00'.

APPEND ITAB.

CLEAR ITAB.

*-- 3

ITAB-F1 = 3.

ITAB-F2 = 'THREE'.

ITAB-F3 = 10.

ITAB-F4 = '1000.00'.

APPEND ITAB.

CLEAR ITAB.

ITAB-F1 = 3.

ITAB-F2 = 'THREE'.

ITAB-F3 = 20.

ITAB-F4 = '2000.00'.

APPEND ITAB.

CLEAR ITAB.

SORT ITAB BY F1.

LOOP AT ITAB.

AT FIRST.

WRITE: /35 ' MATERIAL DETAILS:'.

ULINE.

ENDAT.

AT NEW F1.

WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.

ULINE.

ENDAT.

WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.

SUB_TOT = SUB_TOT + ITAB-F4.

AT END OF F1.

ULINE.

WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.

CLEAR SUB_TOT.

ENDAT.

AT LAST.

SUM.

ULINE.

WRITE: 'SUM:', ITAB-F4.

ULINE.

ENDAT.

ENDLOOP.

<b>Reward if useful</b>

Read only

Former Member
0 Likes
1,022

Hi , AJ.

I have met the some problems when using SUM in at end of. But I can't understand your purpose fully.

Could you give me more information?For example , share your code , or tell us the structure of the internal table ERNAM.

SUM only counts the numeric fields, like P, I, F. And the results will in H_QUOT.

I think your code is right,.If you have solved this problem,please reply me.

Read only

0 Likes
1,022

I had to Put ERNAM as the first field in order , in my internal table

cheers

AJ