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: 

Editable item in column of CL_GUI_COLUMN_TREE

Former Member
0 Kudos

Hello,

I’m using the class CL_GUI_COLUMN_TREE and I'm trying to set as editable an item of table the “item_table” of type mtreeitm.

I’ve tried both with the field editable of this table and with the method ITEM_SET_EDITABLE, but I always get a short dump.

The item class is “item_class_text”.

Can I set it as editable?

Thanks.

3 REPLIES 3

former_member193471
Active Contributor
0 Kudos

Could you send the code? So it would be understandable?

Thanks & Regards

Sathish Kumar

0 Kudos

I have asterisked (commented) the problematic lines, at the end of forms llena_tabla and inserta_nodos.

With these changes it works, but of course I can not edit the column "COL2"

----


  • Variables globales *

----


DATA: contain1 TYPE REF TO cl_gui_custom_container,

arbolalv1 TYPE REF TO cl_gui_column_tree.

----


  • Tablas internas *

----


DATA: i_objects TYPE objec_t,

i_structure TYPE struc_t.

DATA: it_nodos TYPE treev_ntab,

it_items LIKE STANDARD TABLE OF mtreeitm.

----


  • Programa principal

----


START-OF-SELECTION.

PERFORM crear_objetos.

PERFORM llena_tabla.

PERFORM inserta_nodos.

END-OF-SELECTION.

CALL SCREEN 0100.

----


  • Rutinas

*----


&----


*& Form crear_objetos

&----


  • text

----


FORM crear_objetos.

DATA: l_hierarchy_header TYPE treev_hhdr.

  • Container

CREATE OBJECT contain1

EXPORTING

container_name = 'CC1'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

l_hierarchy_header-heading = 'Estructura organizativa'.

l_hierarchy_header-width = 40.

  • Arbol ALV (Columna 0)

CREATE OBJECT arbolalv1

EXPORTING

parent = contain1

node_selection_mode = cl_gui_column_tree=>node_sel_mode_single

item_selection = 'X'

hierarchy_column_name = 'COL0'

hierarchy_header = l_hierarchy_header

EXCEPTIONS

lifetime_error = 1

cntl_system_error = 2

create_error = 3

failed = 4

illegal_node_selection_mode = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Columna 1

CALL METHOD arbolalv1->add_column

EXPORTING

name = 'COL1'

width = 60

header_text = 'Descripcion'

EXCEPTIONS

column_exists = 1

illegal_column_name = 2

too_many_columns = 3

illegal_alignment = 4

different_column_types = 5

cntl_system_error = 6

failed = 7

predecessor_column_not_found = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Columna 2

CALL METHOD arbolalv1->add_column

EXPORTING

name = 'COL2'

width = 20

header_text = 'Valor'

EXCEPTIONS

column_exists = 1

illegal_column_name = 2

too_many_columns = 3

illegal_alignment = 4

different_column_types = 5

cntl_system_error = 6

failed = 7

predecessor_column_not_found = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " crear_objetos

&----


*& Form llena_tabla

&----


  • text

----


FORM llena_tabla.

DATA: ls_struc TYPE struc,

ls_objec TYPE objec,

l_node TYPE treev_node,

l_item TYPE mtreeitm.

CALL FUNCTION 'HR_STRUCTURE_GET'

EXPORTING

root_plvar = '01'

root_otype = 'O'

root_objid = '50000150'

pathid = 'B002'

IMPORTING

result_objects = i_objects

result_structure = i_structure

EXCEPTIONS

plvar_not_found = 1

root_not_found = 2

path_not_found = 3

internal_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT i_structure INTO ls_struc.

  • Nodos

l_node-node_key = ls_struc-seqnr.

CONDENSE l_node-node_key.

l_node-n_image = '@BN@'. "ICON_ORG_UNIT

l_node-exp_image = '@BN@'. "ICON_ORG_UNIT

IF ls_struc-pup IS INITIAL.

l_node-isfolder = 'X'.

ELSE.

l_node-relatkey = ls_struc-pup.

CONDENSE l_node-relatkey.

ENDIF.

APPEND l_node TO it_nodos.

  • Columna 0

CLEAR l_item.

l_item-node_key = ls_struc-seqnr.

CONDENSE l_item-node_key.

l_item-item_name = 'COL0'.

l_item-class = cl_gui_column_tree=>item_class_text.

l_item-text = ls_struc-objid.

APPEND l_item TO it_items.

  • Columna 1

READ TABLE i_objects INTO ls_objec

WITH KEY objid = ls_struc-objid.

CLEAR l_item.

l_item-node_key = ls_struc-seqnr.

CONDENSE l_item-node_key.

l_item-item_name = 'COL1'.

l_item-class = cl_gui_column_tree=>item_class_text.

l_item-text = ls_objec-stext.

APPEND l_item TO it_items.

  • Columna 2

CLEAR l_item.

l_item-node_key = ls_struc-seqnr.

CONDENSE l_item-node_key.

l_item-item_name = 'COL2'.

l_item-class = cl_gui_column_tree=>item_class_text.

l_item-text = 'text'.

  • l_item-editable = 'X'.

APPEND l_item TO it_items.

ENDLOOP.

ENDFORM. " llena_tabla

&----


*& Form inserta_nodos

&----


  • text

----


FORM inserta_nodos.

CALL METHOD arbolalv1->add_nodes_and_items

EXPORTING

node_table = it_nodos

item_table = it_items

item_table_structure_name = 'MTREEITM'

EXCEPTIONS

failed = 1

cntl_system_error = 2

error_in_tables = 3

dp_error = 4

table_structure_name_not_found = 5

OTHERS = 6.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • CALL METHOD arbolalv1->item_set_editable

  • EXPORTING

  • node_key = '1'

  • item_name = 'COL2'

  • editable = 'X'

  • EXCEPTIONS

  • failed = 1

  • node_not_found = 2

  • item_not_found = 3

  • cntl_system_error = 4

  • no_item_selection = 5

  • editable_not_supported = 6

  • OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDFORM. " inserta_nodos

0 Kudos

Hello Manaus,

Did you get the solution for this problem ?>

Regards,

Shubhendu