‎2005 Jun 23 1:32 PM
Hello,
I get a strange error when calling a method with
a parameter of type String. With debug the varaible use
as parameter has the correct value, using explicit value
the method its work.
Here some code for a better understanding:
This way is not working
<i>
Call Method g_tree->add_node
Exporting node_key = l_tm_child
<b>relative_node_key = l_tm_parent</b>
relationship = cl_simple_tree_model=>relat_last_child
isfolder = ' '
text = l_child_text.</i>
where l_tm_parametr is of type String and has value 'BMECAT'
But with expicit value will work :
Exporting node_key = l_tm_child
<b>relative_node_key = 'BMECAT'</b>
relationship = cl_simple_tree_model=>relat_last_child
isfolder = ' '
text = l_child_text.</i>
Anyone knows what's the problem?
I've met this problem once more when comparing String?
Many Thanks!
kojo
Message was edited by: Bogdan Cojocaru
‎2005 Jun 23 1:50 PM
Hi Bogdan,
The parameter for the method is of type TV_NODEKEY which is a Character field of 12 positions. You can't use type string for this.
Kind regards,
John.
‎2005 Jun 23 1:47 PM
Hello,
don't understand your problem ... but I declare relative_node_key as type lvc_nkey.
maybe that will help you
Regards
Frédéric
‎2005 Jun 23 1:50 PM
Hi Bogdan,
The parameter for the method is of type TV_NODEKEY which is a Character field of 12 positions. You can't use type string for this.
Kind regards,
John.
‎2005 Jun 23 2:07 PM
Hello John,
The type for parameter relative_node_key is TM_NODEKEY which data type is STRING ( in method cl_simple_tree_model->add_node).But thank you anyway
One thing that I notice at debug is the hex value differs
for 'BMECAT1' is <b>424D4543415431</b>
and for varible l_tm_parent is <b>424D454341543120</b>.
Another thing to say is that before calling method I make
a concatenation between 'BMECAT' and 1 into l_tm_parent.
( actually the value is BMECAT1 ).
Thank you!
Bogdan
ps. sorry for my english
<b></b>
‎2005 Jun 23 2:16 PM
‎2005 Jun 24 5:25 AM
Check this one
&----
*& Form CREATE_ALVTREE_HIERARCHY
&----
text
----
Builds ALV tree display, (inserts nodes, subnodes etc)
----
form create_alvtree_hierarchy.
data: ls_sflight type sflight,
lt_sflight type sflight occurs 0.
data: ld_ebeln_key type lvc_nkey,
ld_ebelp_key type lvc_nkey.
clear: wa_usrtab.
wa_usrtab-disname = 'Contacts'.
perform add_user_node using wa_usrtab
''
changing ld_ebeln_key.
If p_friend EQ ' '.
loop at it_messfriends into wa_messfriends
where friend ne sy-uname.
perform add_user_line using wa_messfriends
ld_ebeln_key
changing ld_ebelp_key.
endloop.
ELSE.
loop at it_usrtab into wa_usrtab
where bname ne sy-uname.
perform add_user_line using wa_usrtab
ld_ebeln_key
changing ld_ebelp_key.
endloop.
endif.
calculate totals
call method gd_userlist->update_calculations.
this method must be called to send the data to the frontend
call method gd_userlist->frontend_update.
endform. " CREATE_ALVTREE_HIERARCHY
<b>* Add node
call method gd_userlist->add_node
EXPORTING
i_relat_node_key = <b>p_relate_key</b>
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = ld_node_text
is_outtab_line = ps_usrtab
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = p_node_key.</b>
http://www.sapdevelopment.co.uk/saptalk/saptalkincf01.htm
Thanks & Regards,
Judith.
U can reward points for the answers that are helpful and that solved ur problem and Please close the thread.
Message was edited by: Judith Jessie Selvi
‎2005 Jun 24 6:38 AM
Hi,
I figure the cause of the error
using concatenate on 'BMECAT' and an integer, an extra character is added at the end of the string
But If the integer is converteted to N (numeric chars)
the concatenate works fine.
Thank you!
Bogdan
‎2005 Jun 24 9:15 AM
Bogdan,
please set your message as solved by yourself.
Frédéric