Skip to Content
-3

count of records itab based on multiple conditions

Jan 08 at 06:27 PM

63

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded

What have you tried yourself?

0
Former Member

Would be nice to

  • write a date definition like MM/DD/YYYY at the beginning
  • write date in technical notation like YYYYMMDD
  • write long date format like 01/jan/2010
0
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Murillo Mamud 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.

Share
10 |10000 characters needed characters left characters exceeded
Horst Keller
Jan 08 at 06:41 PM
5
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 08 at 06:44 PM
-3

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Oh no, no COLLECT for that task ...

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

achived through ATNEW and ONCHANGE of .

Show 2 Share
10 |10000 characters needed characters left characters exceeded

ON CHANGE of? Oh my ...

0

You know that ON CHANGE OF has been obsolete for a very long time.? Why are you using obsolete code? What version of ABAP are you on - 2.1?

0