2014 Jun 24 8:58 PM
Hello! Lemme explain my cenario:
I've got this structure, in my infocube
DAD SON
1 1
1 2
1 3
2 1
2 2
__________
TOTAL: X 5
I have the total for my sons but not for my dads(which X = 2 in that case). The total for the son is calculated using a keyfigure that comes even from my source system, each fills 1 for each line Ive got. Now, I need the total for the DAD ocurrences. Im really new in ABAP and such, how do I manage to work on it?
Thanks a lot!
2014 Jun 25 7:48 AM
Hi Andrade,
Hope you are getting these values in an internal table. If so, what you need to do is to copy the values of your internal table to a temporary internal table. Then sort table based on the field DAD. Then delete the adjacent duplicates from the temp. table and final number of count in the temp table will give you the DAD count. For example if ITAB is the internal table where you are getting the above data. Then do as follows:
itab_temp[] = ITAB[].
SORT itab_temp BY DAD ASCENDING.
DELETE ADJACENT DUPLICATES FROM itab_temp COMPARING dad.
DESCRIBE TABLE itab_temp LINES lv_count.
The variable lv_count will contain the number of dad.
Regards,
Abijith
Hello! Lemme explain my cenario:
I've got this structure, in my infocube
DAD SON
1 1
1 2
1 3
2 1
2 2
__________
TOTAL: X 5
I have the total for my sons but not for my dads(which X = 2 in that case). The total for the son is calculated using a keyfigure that comes even from my source system, each fills 1 for each line Ive got. Now, I need the total for the DAD ocurrences. Im really new in ABAP and such, how do I manage to work on it?
Thanks a lot!
2014 Jun 25 7:48 AM
Hi Andrade,
Hope you are getting these values in an internal table. If so, what you need to do is to copy the values of your internal table to a temporary internal table. Then sort table based on the field DAD. Then delete the adjacent duplicates from the temp. table and final number of count in the temp table will give you the DAD count. For example if ITAB is the internal table where you are getting the above data. Then do as follows:
itab_temp[] = ITAB[].
SORT itab_temp BY DAD ASCENDING.
DELETE ADJACENT DUPLICATES FROM itab_temp COMPARING dad.
DESCRIBE TABLE itab_temp LINES lv_count.
The variable lv_count will contain the number of dad.
Regards,
Abijith
2014 Jun 25 2:44 PM
Thank you!
Imma try something similar, to create a new keyfigure and fill 1 on it for each single dad occurrence I find, using the temp table. Like this I think I can also show the subtotals.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |