How Group 10 sets of records per group of Internal Table in ABAP.
Good Afternoon All,
I have one internal table which have 400 records ,i need to group these records in set of 10 records .
for example:
ID value
2 100
1 95
3 90
4 85
6 80
7 75
8 70
10 65
9 60
----------------------------------
Total : 720---------------------------------------1st group
-------------------------------
11 59
13 58
12 55
14 54
15 52
18 51
16 50
17 49
19 40
20 39
-------------------------------
Total : 507 -----------------------2nd Group
------------------------------
..........
..........
........
please help me ....how i get this in abap.
Thanks
Answer Posted / prakash
CLEAR:lv_lines,lv_n,lv_mod,lwa_final,lv_p,lv_ch,lv_a,lv_b..
SORT lit_final BY vtweg vkorg vkbur pltyp matnr.
DESCRIBE TABLE lit_final LINES lv_lines.
lv_p = lv_lines / 10.
lv_ch = lv_p.
SPLIT lv_ch AT '.' INTO lv_a lv_b.
IF lv_b NE '00'.
lv_n = lv_a + 1.
ELSE.
lv_n = lv_a.
ENDIF.
lv_mod = lv_lines MOD 10.
lit_finaltp[] = lit_final[].
DO lv_n TIMES.
lit_final[] = lit_finaltp[].
REFRESH : lit_finalt[],lit_finaltp[].
CLEAR : lwa_finaltt.
LOOP AT lit_final INTO lwa_final.
IF sy-tabix LE 10.
APPEND lwa_final TO lit_finalt.
MOVE-CORRESPONDING lwa_final TO lwa_finaltt.
CLEAR lwa_final.
ELSE.
APPEND lwa_final TO lit_finaltp.
CLEAR lwa_final.
ENDIF.
ENDLOOP.
lit_final[] = lit_finalt[].
ENDDO.
You have to do the sum in a variable and print the sum
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What are the 3 types of tables in sap? : abap data dictionary
What is the definition of modification in an sap system and how do they impact an upgrade?
What are the value tables?
What is an update task? : abap modularization
How to create any functions?
What are data classes? What are the various data classes available for selection? : abap data dictionary
What is view? Explain the different types of view?
What are the differences between domain and data element?
Define subtype ? : abap hr
Explain the table, which contain the details of all the name of the programs and forms?
What are the different types of luws?
Explain how to write a bdc - how do you go about it?
in bdcsome times we get the ok code for "enter" wrongly instead of '/00'.what is the reason.how we can exceed this problem.
What are internal tables? How do you get the number of lines in an internal table?
What is the function of the correction system? : abap data dictionary