Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

ALV Tree

Former Member
0 Kudos
135

Hi,

I'm looking for traffic lights to be displayed for each record in the ALV hierarchcal list.

Like the color should be Red,Yello,Green to indicate status of each record.

I'm using cl_gui_alv_tree for creating Hierachical list.

Pls help

2 REPLIES 2

Former Member
0 Kudos
85

Hi,

Check the following program:

<b>BCALV_GRID_04</b> Illustrates the use of exceptions (lights or leds). According to the values of SFLIGHT-SEATSOCC, the lights are set to 1 (red), 2 (yellow) or 3 (green).

Hope this helps.

Reward if helpful.

Regards,

Sipra

Former Member
0 Kudos
85

Hi

Please try program 'SAPSIMPLE_TREE_CONTROL_DEMO', sample program of tree controls.

BCALV_TREE_01 ALV tree control: build up the hierarchy tree

BCALV_TREE_02 ALV tree control: event handling

BCALV_TREE_03 ALV tree control: use an own context menu

BCALV_TREE_04 ALV tree control: add a button to the toolbar

BCALV_TREE_05 ALV tree control: add a menu to the toolbar

BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/items

BCALV_TREE_DEMO Demo for ALV tree control

BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tree

BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tree

BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree

BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)

here's a piece of code:



add 1 to childnr.
concatenate 'child' childnr into childname.
NODE-NODE_KEY = childname.
NODE-ISFOLDER = 'X'.
NODE-EXPANDER = 'X'.
ITEM-NODE_KEY = childname.
move childname to vtab-childname.

add 1 to dateinr.
NODE-NODE_KEY = dateinr.
ITEM-NODE_KEY = node-node_key.
move dateinr to vtab-childname.
modify vtab from wa.
APPEND ITEM TO ITEM_TABLE.
APPEND NODE TO NODE_TABLE.
*Datum
clear item.
ITEM-NODE_KEY = NODE-NODE_KEY.
ITEM-ITEM_NAME = '2'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 10.
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = vtab-datum.
APPEND ITEM TO ITEM_TABLE.
*Größe
clear item.
ITEM-NODE_KEY = NODE-NODE_KEY.
ITEM-ITEM_NAME = '3'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 10.
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = vtab-len.
APPEND ITEM TO ITEM_TABLE.
*und los
CALL METHOD G_TREE->ADD_NODES_AND_ITEMS
EXPORTING
NODE_TABLE = NODE_TABLE
ITEM_TABLE = ITEM_TABLE
ITEM_TABLE_STRUCTURE_NAME = 'MTREEITM'
EXCEPTIONS
FAILED = 1
CNTL_SYSTEM_ERROR = 3
ERROR_IN_TABLES = 4
DP_ERROR = 5
TABLE_STRUCTURE_NAME_NOT_FOUND = 6.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.

Check this link

http://www.sap-img.com/abap/a-sample-tree-programming.htm

http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm

Reward all helpfull answers

Regards

Pavan

Message was edited by:

Pavan praveen