cancel
Showing results for 
Search instead for 
Did you mean: 

Tableview column as link

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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 Developer’s Journal: Part XI - Table View Iterators,Thomas Jung</a>

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Hi Raja,

In my case it would be the link on side cliente... The link would be a result (maybe a bu_partner) and clicking on, i will go to another bso with a tableview with some details of the client.

Thanks at all.

Regards, Mon

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

kindly clarify whether you want onclick (server roundtript) or onclientclick (clientside) for your cell, based on your answers i will post a sample coding.

Regards

Raja

Former Member
0 Kudos

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

athavanraja
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

athavanraja
Active Contributor
0 Kudos

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

divya_nayudu
Participant
0 Kudos

Can you please tell what attributes to set in TableView (in .BSP view) for getting a LINK in the first column of a table ???

Answers (3)

Answers (3)

0 Kudos

Mon,

Try putting a initial check before using link_event.

link_event ?= event.

If link_event is not initial.

CASE event_id.

Mani

Former Member
0 Kudos

hi Mon,

To set a link in a tableview u can check the bsp application.

SBSPEXT_htmlb/tableviewtypes.bsp

Regards

Aashish

Former Member
0 Kudos

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

Former Member
0 Kudos

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