on 02-24-2006 8:35 AM
Hi Forum,
I show an itab in a tableview, and i want to what i have to do for what one of the columns results appears like a link. This link can be clicking to appear a new page.
Anybody has an example of this? os a suggestion?
Thanks in advanced, regards.
Mon
Hi,
Try the following code according to your ITAB.
clear p_style.
clear p_class.
field-symbols: <news> type any.
data: inews type zes_abap_news_line.
data: inews type ref to zes_abap_news_line.
case p_column_index.
when 1.
assign p_row_data_ref->* to <news>.
move <news> to inews.
inews ?= p_row_data_ref.
p_replacement_bee = cl_htmlb_link=>factory(
id = p_cell_id
reference = inews-link_string
reference = inews->link_string
target = '_TOP'
text = inews-event_desc ).
text = inews->event_desc ).
endcase.
and, also Check the following weblog for any further Help.
/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
<a href="/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators a Developers Journal: Part XI - Table View Iterators,Thomas Jung</a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello again!
Anybody how to use the attribute onItemClick of the tableviewcolumn¿? Because maybe i can use it:
<htmlb:tableViewColumn columnName = "CONTRACT"
title = "Nº de contrat"
sort = "SERVER"
wrapping = "true"
onItemClick = "oninputprocessing()"
horizontalAlignment = "LEFT" >
</htmlb:tableViewColumn>
But i dont know how to use this event on inputproccesing..
any idea¿?
Thanks indded!
Mon
what sort of clickable link you want, client side or server side one? if its client side one you have to use itableview iterator and for the column where you want link you have to use cl_htmlb_link=>factory method as suggested by others.
if its server side = then you can use onCellClick
and capture the event in oninputprocessing for further processing
onItemClick => Use this attribute to set an event handler when
the table row is clicked.
Hope this is clear and let us know what you want.
Regards
Raja
ok. o what you want is , bu_partner column should be a link and on click of that another window should open , taking input as the clicked cell value and show some further details about bu_partner.
in the iterator
when 'BU_PARTNER' . (column name)
data: target_page type string .
concatenate 'detail.htm?bu_partner=' <variable holding cell value' into target_page .
p_replacement_bee = cl_htmlb_link=>factory(
id = p_cell_id
reference = target_page
target = '_blank'
text = <variable holding the cell value ).
Hope this is clear.
Regards
Raja
Thanks Raja!
It sounds good..but i have some doubts.
Have i to do something in the column of the tableview where i place the link...for example call to the oninputprocessing or javascript...¿? or only with the name of the column is enough as u said when u wrote:
when 'BU_PARTNER' . (column name)
I have to declare on the event the iterator and the bee¿? when u wrote
in the iterator
Thanks for ur help guy!
Regards,
Mon
Hi Raja!,
I think that the option i need is onclientclick...but u can evaluate if it is necesary for this case:
When i click on the items (bu_partners) of this column a new page will be opened and on this page , in the event oninicialization i will call to a funcion to get the details of the bu_partner and it will show in a tableview on the display...
Thanks in advance, and regards!!!
Mon
you can do this with clientclick and for this you need to implement tableview iterator.
If you are not familiar with tableview iterators check out the following weblogs.
/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
/people/thomas.jung3/blog/2004/09/15/bsp-150-a-developer146s-journal-part-xi--table-view-iterators
in your iterator class
define a attribute:
M_ROW_REF / instance attribute/public/type ref to / DATA
in the IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START method add the following line.
m_row_ref ?= p_row_data_ref.
in the IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START method add the following code.
DATA: wf_text TYPE string ,
wf_url TYPE string .
FIELD-SYMBOLS: <fs> TYPE ANY ,
<l_field> TYPE ANY .
ASSIGN m_row_ref->* TO <fs>.
CASE p_column_key.
WHEN 'BU_PARTNER'.
ASSIGN COMPONENT p_column_key OF STRUCTURE <fs> TO <l_field>.
wf_text = <l_field> . "wf text will hold current cell value
CONCATENATE 'targetbspapplication/page.htm?bu_partner=' wf_text INTO wf_url .
CALL METHOD cl_htmlb_link=>factory
EXPORTING
id = p_cell_id
reference = wf_url
target = '_blank' " this would make the page to open in new window
text = wf_text
RECEIVING
element = p_replacement_bee .
Hope this is clear.
Regards
Raja
Message was edited by: Durairaj Athavan Raja
Raja!!!
Thanks man! I got it!!
Your code works prefectly. Only i have to add a line in the event onCreate:
CREATE OBJECT iterator TYPE ZCLASS_BSP.
And in my attribute pages i use:
<b>iterator</b> type <b>IF_HTMLB_TABLEVIEW_ITERATOR</b>
In the class, ZCLASS_BSP, when i am going to call to the new page i have this:
CONCATENATE 'decision.htm?bu_partner=' wf_text INTO wf_url .
Because the page is in the same bsp application...
Thanks again Raja and regards!
Mon.
PD: I have one doubt, i dont understand this line:
ASSIGN m_row_ref->* TO <fs>.
Tx.
if your application is a stateful application place the CREATE OBJECT iterator TYPE ZCLASS_BSP.
in oninitialization event.
ASSIGN m_row_ref->* TO <fs>.
this is to get the data of the current row into the <fs>
to understand more about ASSIGN m_row_ref->* TO <fs>.
check out the ABAP key word documentation for "Create DATA"
Regards
Raja
Mon,
Try putting a initial check before using link_event.
link_event ?= event.
If link_event is not initial.
CASE event_id.
Mani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Mon,
To set a link in a tableview u can check the bsp application.
SBSPEXT_htmlb/tableviewtypes.bsp
Regards
Aashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
I have started to declare the events on the event oninputprocessing and i have a runtime error..because the cast between the event link and the event of the manager...
So how can i solve¿?
This is the code:
CLASS CL_HTMLB_LINK DEFINITION LOAD.
IF event_id = cl_htmlb_manager=>event_id.
DATA: event TYPE REF TO cl_htmlb_event,
link_event TYPE REF TO cl_htmlb_link.
event ?= cl_htmlb_manager=>get_event( runtime->server->request ).
IF event_id = cl_htmlb_manager=>event_id.
link_event ?= event.
CASE event_id.
*
*
ENDCASE.
ENDIF.
ENDIF.
Thanks in advance..and regards,
Mon
use porperty linkClickTarget="_self" of <htmlb:tableviewcolumn>.
In ur internal table for this coulumn values should be hyperlinks like "http://www.google.com".
Cheers
Ankur
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.