2015 Sep 11 4:38 PM
Hello All,
i have created a dynamic internal table as below: (Here Prod. Orders are dynamic in the internal table), now i am passing this dynamic internal table to ALV for display.
Now i want to merge similar operations into 1 row like below.
Any ideas will be helpful.
Regards,
Sree.
2015 Sep 11 4:55 PM
Hi
Before appending a row you should check if there's a record with the same operation and modify it
So I believe you should change your logic where you append the record in the dynamic internal table
Max
2015 Sep 11 4:55 PM
Hi
Before appending a row you should check if there's a record with the same operation and modify it
So I believe you should change your logic where you append the record in the dynamic internal table
Max
2015 Sep 11 5:28 PM
Hi,
Try,
Sort internal table by operations. Use collect statement Instead of append.
Hope it helpful,
Regards,
Venkat.
2023 Feb 13 10:02 AM
This. I signed up just to upvote this comment. Use collect instead of append to resolve the problem.
2015 Sep 11 5:51 PM
Hi,
Just use Collect ls_data into lt_data.
look to this example please,
this is the difference between collect ans append.
Append ls_data to lt_data.
After using collect statement
Collect ls_data into lt_data.
REPORT zibo_pg_test2.
TYPES: BEGIN OF st_ty,
operation TYPE c LENGTH 2,
prod1 TYPE i,
prod2 TYPE i,
prod3 TYPE i,
prod4 TYPE i,
END OF st_ty.
data ls_data TYPE st_ty.
data lt_data TYPE TABLE OF st_ty.
ls_data-operation = 10.
ls_data-prod1 = 100.
APPEND ls_data to lt_data.
CLEAR ls_data.
ls_data-operation = 10.
APPEND ls_data to lt_data.
CLEAR ls_data.
ls_data-operation = 10.
ls_data-prod3 = 90.
APPEND ls_data to lt_data.
CLEAR ls_data.
ls_data-operation = 10.
ls_data-prod4 = 75.
APPEND ls_data to lt_data.
CLEAR ls_data.
BREAK-POINT.
CLEAR lt_data.
ls_data-operation = 10.
ls_data-prod1 = 100.
COLLECT ls_data into lt_data.
CLEAR ls_data.
ls_data-operation = 10.
COLLECT ls_data into lt_data.
CLEAR ls_data.
ls_data-operation = 10.
ls_data-prod3 = 90.
COLLECT ls_data into lt_data.
CLEAR ls_data.
ls_data-operation = 10.
ls_data-prod4 = 75.
COLLECT ls_data into lt_data.
CLEAR ls_data.
Regards
Ibrahim
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |