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

AT END

Former Member
0 Likes
696

Hi

i have to use command : AT END OF DATE MATDEPTH

ENDAT

DATE IS OF DATA TYPE : DATS

MATDEPTH IS OF TYPE : CHAR

all data is collected in internal table.

at the moment i am just using AT END OF MATDEPTH.

can i use both date and matdepth to display the requirment.???

able to display data for a date and matdepth using AT end of command..

pls give sample code

Thxs,

Vind

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
662
1.No need to use both the fields in AT END
2.place the first 2 fields as MATDEPTH and DATE .
3.SORT ITAD BY MATDEPTH DATE .
4. then use AT END OF DATE.
5. Now it will work according to ur rewuirement

Hi

i have to use command : AT END OF DATE MATDEPTH

ENDAT

DATE IS OF DATA TYPE : DATS

MATDEPTH IS OF TYPE : CHAR

all data is collected in internal table.

at the moment i am just using AT END OF MATDEPTH.

can i use both date and matdepth to display the requirment.???

able to display data for a date and matdepth using AT end of command..

pls give sample code

Thxs,

Vind

3 REPLIES 3
Read only

Former Member
0 Likes
663
1.No need to use both the fields in AT END
2.place the first 2 fields as MATDEPTH and DATE .
3.SORT ITAD BY MATDEPTH DATE .
4. then use AT END OF DATE.
5. Now it will work according to ur rewuirement
Read only

Former Member
0 Likes
662

control breaks with two fields is not possible .

like AT END OF F1 F2.

You can treat the same independently like AT END OF F1. and AT END OF F2 in the same loop .

Alternate to this is <i>On change of F1 or F2.</i> " you can try this.

Demo code will be ..

data : begin of itab occurs 0,
       f1(4) type c,
       f2(4) type c,
       end of itab.
data : begin of Jtab occurs 0,
       f1(4) type c,
       f2(4) type c,
       f3(4) type c,
       end of Jtab.
DATA : CNT TYPE I.

DATA: GV_FLAG TYPE C.

       itab-f1 = 'A'.
       itab-f2 = '10'.
       APPEND ITAB.

       itab-f1 = 'A'.
       itab-f2 = '10'.
       APPEND ITAB.

       itab-f1 = 'A'.
       itab-f2 = '10'.
       APPEND ITAB.

       itab-f1 = 'B'.
       itab-f2 = '8'.
       APPEND ITAB.

       itab-f1 = 'B'.
       itab-f2 = '8'.
       APPEND ITAB.

       itab-f1 = 'B'.
       itab-f2 = '8'.
       APPEND ITAB.

      SORT ITAB BY F1 F2.  "use this 
       LOOP AT ITAB.
        CNT = CNT + 1.

        AT END OF F1.      "apply here 
        GV_FLAG = 'X'.
        ENDAT.

        IF GV_FLAG = 'X'.
        JTAB-F1 = ITAB-F1.
        JTAB-F2 = ITAB-F2.
        JTAB-F3 = CNT.
        APPEND JTAB.
        CLEAR JTAB.
        CLEAR: CNT , GV_FLAG.
        ENDIF.

       ENDLOOP.

       LOOP AT JTAB.
       WRITE:/ JTAB-F1 , JTAB-F2, JTAB-F3.
       ENDLOOP.

regards,

vijay

Read only

Former Member
0 Likes
662

Hi,

You can use Both fields, but these fields should be sorted before using in the AT END OF.

Regards

Sudheer