04-27-2006 8:57 AM
Hello experts,
I am currently having a problem on how to go about this. What I need to do is to group equipments with their respective subordinates. Just like a parent-child relationship and display that using ALV. Now here is my problem, when I loop through the itab it looks like this:
EQUNR | HEQUI
000000000000002448 |
000000000000900599 |
000000000000000164 | 000000000000000168
000000000000000165 |
000000000000000166 |
000000000000000167 |
000000000000000168 |
Now, if an equipment(equnr) has a value in HEQUI, it means that it is a child equipment of the value found in HEQUI. In my example, equipment 000000000000000164 is a child equipment of equipment 000000000000000168. Now, how can I display this using ALV in a format similar to this:
EQUIPMENT PARENT DESCRIPTION...
000000000000000168
000000000000000164 000000000000000168
Help would be greatly appreciated as well points being rewarded.Thanks again guys!
Message was edited by: viraylab
Message was edited by: viraylab
04-27-2006 9:23 AM
create 2 more itabs.
Data: itab1 like itab0, (ur current)
itab2 like itab0.
itab1[] = itab0[]
loop at itab0.
if not itab0-hequi is initial.
read table itab1 with table key itab1-equinr = itab0-hequi.
if sy-subrc = 0.
itab2-equnr = itab1-equnr.
itab2-hequi = itab1-hequi.
append itab2.
endif.
itab2-equnr = itab0-equnr.
itab2-hequi = itab0-hequi.
append itab2.
endloop.
In the end display itab2.
Hope this helps
Rohit
Dont forget about points.
04-27-2006 9:04 AM
You should use the ALV TREE controls (ALV / SIMPLE / COLUMN tree Controls). Take a look DWDM examples for tree controls and choose the appropriate one.
Regards,
Ravi
04-27-2006 9:06 AM
hi viray,
this can be done using hierarchial list, for reference check BALVHD01. that matches your requirement. for this you need to have two internal tables, one id for parent, the other is for child.check the example...
Regards
vijay
04-27-2006 9:08 AM
04-27-2006 9:09 AM
Hi Viraj,
You can do this using any ALV , simple or OO.
Just populate ur itab with the records u need to display and use it in REUSE_ALV_GRID_DISPLAY..
if u need any help as far as ALV is concerned,
i shall send u some tutorial documents..
Regards,
Tanveer.
Mark helpful answers.
04-27-2006 9:23 AM
create 2 more itabs.
Data: itab1 like itab0, (ur current)
itab2 like itab0.
itab1[] = itab0[]
loop at itab0.
if not itab0-hequi is initial.
read table itab1 with table key itab1-equinr = itab0-hequi.
if sy-subrc = 0.
itab2-equnr = itab1-equnr.
itab2-hequi = itab1-hequi.
append itab2.
endif.
itab2-equnr = itab0-equnr.
itab2-hequi = itab0-hequi.
append itab2.
endloop.
In the end display itab2.
Hope this helps
Rohit
Dont forget about points.