Skip to Content
avatar image
-3
Former Member

count of records itab based on multiple conditions

I need count the records from itab with various conditions , my itab is as below


cycle date

01 01/02/2010

02 04/01/2010

01 03/01/2010

03 06/01/2010

04 07/01/2010

02 04/01/2010

03 06/01/2010

01 01/02/2010

03 05/01/2016

02 04/01/2010

03 06/01/20107


for each cycle there will one or two dates , so i need count the records and display as below.

cycle date no records

01 01/02/2010 2
01 03/01/2010 1
02 04/01/2010 3
03 06/01/2010 3
03 05/01/2016 1
04 07/01/2010 1 I know AT NEW can be used , but not vey sure how it is useful in this scenarios.

Thanks for your inputs

NK

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 08 at 06:36 PM
    -2

    You could to sort your internal table by date field.. And to do something like:

    loop at it_tab into ls_tab.

    if ls_tab-date ne lv_date_old.

    append initial line to it_out assigning field-symbol(<out>).

    move-corresponding ls_tab to <out>.

    endif.

    add 1 to <out>-counter.

    lv_date_old = ls_tab-date.

    endloop.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 08 at 06:41 PM
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 08 at 06:44 PM
    -3

    Why not create a 2nd itab with COLLECT for output ?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 09 at 01:18 AM
    -3

    achived through ATNEW and ONCHANGE of .

    Add comment
    10|10000 characters needed characters exceeded