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: 

CL_GUI_LIST_TREE and Header

Former Member
0 Kudos

Hi,

I'm looking for a good solution for the follow request:

- Tree with some main-nodes with some formatted columns

- every main-node has some sub-nodes with an unformatted text (no titles)

- the columns form the main-nodes should have titles in the header

Of course the columns form the main-nodes don't match with the column of the sub-nodes.

I choused the <b>CL_GUI_LIST_TREE</b>, but I'm not able to create titles for the columns.

The class has the header parameters:

<b>WITH_HEADERS, HIERARCHY_HEADER and LIST_HEADER</b>.

The text in the header is in proportional font, so I can't format the text to match with the column.

I can't use CL_GUI_COLUMN_TREE because the columns of the sub-nodes don't match with the main-nodes.

Any good ideas?

Regards,

Stefan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Stefan,

You can check the follwing example: SAPTLIST_TREE_CONTROL_DEMO.

Regards,

Eric

7 REPLIES 7

Former Member
0 Kudos

Hi Stefan,

You can check the follwing example: SAPTLIST_TREE_CONTROL_DEMO.

Regards,

Eric

0 Kudos

Hi Eric,

thank you, but the demo has no headers.

I'm looking for a CL_GUI_LIST_TREE that has titles for the columns.

Regards,

Stefan

0 Kudos

Hi Stefan

Have you checked demo program: BCALV_TREE_DEMO for Heading -> Header => Items???

Kind Regards

Eswar

0 Kudos

Hi Eswar,

thank you for the report.

This report has columns, but the columns form the main-node and subnodes are the same (price, currency, etc.)

My request is that the subnodes has other columns than the mainnodes.

But it is very interesting the there is a class CL_GUI_ALV_TREE. I've thought there exits only Simple Tree, Columns Tree and List Tree.

What is the difference between the CL_GUL_ALV_TREE and the CL_GUI_COLUMN_TREE?

Regards,

Stefan

0 Kudos

Hi Stefan

I can understand what you mean, but the trick here is:

1. Create an internal table which holds the data of both parent and item information.

2. While creating parent node, pass the information related to parent and while creating child pass information related to childs.

3. So the output will be:

   Heading of all columns
   --> Parent Node 
     --> Child Nodes

Data w.r.t to the node will be displayed in the respective column under the heading that is meant for the same.

Hope below code gives you some idea:

FORM ADD_PARENT_NODE  USING    LS_COMP TYPE T_COMP
                               P_REL_KEY
                      CHANGING P_NODE_KEY.

DATA: L_NODE_TEXT TYPE LVC_VALUE,
      WA_COMP TYPE T_COMP.
DATA: L_MATNR LIKE MARA-MATNR.

DATA: LT_ITEM_LAYOUT TYPE LVC_T_LAYI,
      LS_ITEM_LAYOUT TYPE LVC_S_LAYI.

   LS_ITEM_LAYOUT-T_IMAGE = '@3P@'.
   LS_ITEM_LAYOUT-FIELDNAME = TREE1->C_HIERARCHY_COLUMN_NAME.
   LS_ITEM_LAYOUT-STYLE = CL_GUI_COLUMN_TREE=>STYLE_INTENSIFD_CRITICAL.
   APPEND LS_ITEM_LAYOUT TO LT_ITEM_LAYOUT.

   L_NODE_TEXT = L_MATNR = LS_COMP-MATNR.
   MOVE: LS_COMP-MATNR TO WA_COMP-MATNR,
         LS_COMP-STLNR TO WA_COMP-STLNR,
         LS_COMP-MAKTX TO WA_COMP-MAKTX,
         LS_COMP-PRICE TO WA_COMP-PRICE,
         LS_COMP-KONWA TO WA_COMP-KONWA,
         LS_COMP-KONDA TO WA_COMP-KONDA.
   PERFORM CONVERT_MATNR CHANGING L_MATNR.
   READ TABLE IT_MARA WITH KEY MATNR = L_MATNR.
   READ TABLE IT_6D WITH KEY PCAT6D = IT_MARA-PRDHA+4(6).
   MOVE: IT_MARA-PRDHA+4(6) TO WA_COMP-PCAT6D,
         IT_6D-Z6DDESC TO WA_COMP-Z6DDESC.

  CALL METHOD TREE1->ADD_NODE
    EXPORTING
          I_RELAT_NODE_KEY = P_REL_KEY
          I_RELATIONSHIP   = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          I_NODE_TEXT      = L_NODE_TEXT
          IS_OUTTAB_LINE   = WA_COMP
          IT_ITEM_LAYOUT   = LT_ITEM_LAYOUT
       IMPORTING
          E_NEW_NODE_KEY = P_NODE_KEY.

ENDFORM.                    " ADD_PARENT_NODE

*&---------------------------------------------------------------------*
*&      Form  ADD_CHILD_NODE
*&---------------------------------------------------------------------*
FORM ADD_CHILD_NODE  USING    LS_COMP TYPE T_COMP
                              P_REL_KEY
                     CHANGING P_NODE_KEY.

DATA: L_NODE_TEXT TYPE LVC_VALUE,
      WA_COMP TYPE T_COMP.

DATA: LT_ITEM_LAYOUT TYPE LVC_T_LAYI,
      LS_ITEM_LAYOUT TYPE LVC_S_LAYI.

   LS_ITEM_LAYOUT-T_IMAGE = '@3R@'.
   LS_ITEM_LAYOUT-FIELDNAME = TREE1->C_HIERARCHY_COLUMN_NAME.
   APPEND LS_ITEM_LAYOUT TO LT_ITEM_LAYOUT.

   L_NODE_TEXT = LS_COMP-COMP.
   MOVE: LS_COMP-COMP   TO WA_COMP-COMP,
         LS_COMP-MAKTX1 TO WA_COMP-MAKTX1,
         LS_COMP-MENGE  TO WA_COMP-MENGE,
         LS_COMP-DATAB  TO WA_COMP-DATAB,
         LS_COMP-DATBI  TO WA_COMP-DATBI,
         LS_COMP-KONWA  TO WA_COMP-KONWA,
         LS_COMP-KBETR  TO WA_COMP-KBETR,
         LS_COMP-LOEVM_KO TO WA_COMP-LOEVM_KO,
         LS_COMP-PCAT6D TO WA_COMP-PCAT6D,
         LS_COMP-Z6DDESC TO WA_COMP-Z6DDESC,
         LS_COMP-ERNAM TO WA_COMP-ERNAM.

  CALL METHOD TREE1->ADD_NODE
    EXPORTING
          I_RELAT_NODE_KEY = P_REL_KEY
          I_RELATIONSHIP   = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          I_NODE_TEXT      = L_NODE_TEXT
          IS_OUTTAB_LINE   = WA_COMP
          IT_ITEM_LAYOUT   = LT_ITEM_LAYOUT
       IMPORTING
          E_NEW_NODE_KEY = P_NODE_KEY.

ENDFORM.                    " ADD_CHILD_NODE

If you observe, information passed for parent and child can have common and uncommon which will be displayed in their respective columns.

Kind Regards

Eswar

Former Member
0 Kudos

hi

good

go throgh this links, i hope these ll help you to solve your problem

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITREE/BCCITREE.pdf

try like this also

-


ITEM-NODE_KEY = 'New1'.

ITEM-ITEM_NAME = '1'.

ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.

ITEM-LENGTH = 4. " the width of the item is 4 characters

ITEM-IGNOREIMAG = 'X'. " see documentation of Structure

" TREEV_ITEM

ITEM-USEBGCOLOR = 'X'. " item has light grey background

ITEM-T_IMAGE = '@01@'. " icon of the item

ITEM-TXTISQINFO= 'X'. "qucik info..

APPEND ITEM TO ITEM_TABLE.

thanks

mrutyun^

0 Kudos

Hi,

thanks for the link for the PDF-documentation.

However I don't found a solution in this document for my request.

Regards,

Stefan

<b>Info to all: I'm not able to rewards points at the moment! I get an error message. I will reward points when this is possible!</b>