cancel
Showing results for 
Search instead for 
Did you mean: 

Wd - ALV(LinkToUrl)

Former Member
0 Kudos

Hi all..

I am new to WD and am currently working on ALV.

I have a table display that has a link to url for the field 'belnr'.

When the user clicks on a particular belnr entry, I want the transaction 'FB03' to open with the respective belnr value filled in it.

How do I do this?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Take a look at this wiki which shows how to use UI elements in ALV component cells :

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/webDynproABAP-UsingUIelementsinALVcomponentcells

As far as Calling a Transaction is concerned, it is not possible to call a Transaction in Wd Abap on the click of button. For that , you have to make a Transactional IView in Portal and call the required Transaction from there.

Thanx.

Saurav.

Former Member
0 Kudos

hi.

thanks for your quick reply.

but, i m not using iviews, neither am i making use of a button click.

Its a column entry for belnr that has a link to url.

I have specified it as:

CALL METHOD lo_ltu->set_reference
          EXPORTING
            value = 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui?~transaction=FB03'.
        lo_column->set_cell_editor( lo_ltu ).

The above link transfers me to transaction FB03 when i click on any of the entries in column belnr.

What I want is, to record which belnr entry was clicked.

For eg: it has, 7100000000,7100000001,7100000003. and i click on 7100000000, the transaction FB03 should get opened in browser(till here i m done) plus the entry for belnr in FB03 should already be filled with 7100000000.

Hope I was clear.

Thanx!!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Now this is more of an ITS question than a Web Dynpro ABAP question, but it is possible to pass screen field values to the ITS via the URL

For instance this URL:

http://<hostname>:8000/sap/bc/gui/sap/its/webgui/!?sap-client=000&;language=EN&transaction=se37%20RS38L-NAME=BAPI_MDPROVIDER_GET_CUBES&~okcode=WB_EXEC

As part of the transaction URL you can also supply field values use the %20 to supply a space value. Then list the screen field name an dthe value you wnat to place into it.

Former Member
0 Kudos

Hi...

The technique that you told me helped partially.

I have used it as:

value = 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui/!?~transaction=fb03%20RF05L-GJAHR=2008%20RF05L-BELNR=7100000001%20RF05L-BUKRS=IN01'.

The problem that i get is, only the fiscal year is getting filled in the tcode FB03. Rest fields are left blank.

Am i going wrong in the use of seperators?

And secondly, now that i am hardcoding the values, it will work perfect.

But, how can i assign the values corresponding to the user click?

Thanks!

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

You have to use ; to separate the field/value pairs. Have a look at this WIKI page for an example:

https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=22375

As to how to build the URL with the actual field values - I would suggest that you just use CONCATENATE to combine the constants for the URL with the variable values.

Former Member
0 Kudos

Hi..

Thanks for the quick and helpful replies.

I am absolutely unaware of the terms Concatenate etc that you talked about regarding the url.

Could you please let me know of some related study material so that i can go through.

And i would be grateful if you would enlighten me regarding CONCATENATE.

Thanks,

prati.

Former Member
0 Kudos

CONCATENATE is a General ABAP Keyword to concatenate multiple strings into one.


For eg: Data: l_temp type string,
                    l_temp1 type stirng,
                    l_final type string.

l_temp   = 'https://'.
l_temp1 = 'www.sdn.sap.com'.

CONCATENATE l_temp l_temp1 into l_final.

Result: l_final = https://www.sdn.sap.com.

You can use the F1 help for ABAP keywords.

Edited by: Radhika Vadher on May 5, 2009 12:31 PM

Former Member
0 Kudos

The ABAP concatenate is fine.

Is it used with url's also?

I want to assign some variable value to the constants in the url... Is the same concatenate used there?

If yes, could you tell me how?

Thanks!

Former Member
0 Kudos

Hi Prati,

If you check the example that i have shown, it has 2 variables l_temp and l_temp1 which stores some values. We have to simply use the variables names to merge the strings.

I am unable to understand what you are trying to ask other than this .

Former Member
0 Kudos

I am posting my code along with my query:


DATA:  po_num TYPE belnr_d VALUE 71000000,
           comp_code TYPE bukrs VALUE 'IN02'.
           fiscal TYPE gjahr VALUE 2008.

CALL METHOD lo_ltu->set_reference
          EXPORTING
value = 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=IN01;RF05L-GJAHR=2008;RF05L-BELNR=7100000000'.

Now, how do i assign the constant in url (eg: RF05L-GJAHR ) with fiscal.

I hope i am clear.

Thanks!

Edited by: prati_k on May 5, 2009 9:14 AM

Former Member
0 Kudos

If im understanding your query correctly, you are trying to construct the URL value and the values for

RF05L-BUKRS,

RF05L-GJAHR and

RF05L-BELNR will be changing and apart from this the rest of the URL is going to be constant.

If so you can do it this way.

concatenate 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=' comp_code 
';RF05L-GJAHR='  fiscal 
';RF05L-BELNR=' po_num into value.

Radhika

Former Member
0 Kudos

Hey Radhika,

Tthat was perfect..I m done with it and it's working!

Thank you.

Just wanted to ask, if there is any way of recording which particular po_num (having a link to url) ,the user has clicked on in a table and also the corresponding comp_code and fiscal year.

Regards,

Prati.

Edited by: prati_k on May 5, 2009 10:45 AM

Former Member
0 Kudos

Hi Prati,

You can try this.

In your action method for Link to url write the following code.

" Create importing parameter 'CONTEXT_ELEMENT' type if_wd_context_element.

    DATA: ls_stru TYPE wd_this->element_node name.

" get contents of the entire row.
  context_element->get_static_attributes(
                                      IMPORTING static_attributes = ls_stru  ).

Former Member
0 Kudos

hi.

the solution you told me is ok.

but, i have some confusion.

How do we get to know,exactly which belnr entry is clicked by the user, and fetch the values for the same?

Hope you are getting me.

Thanks!

Former Member
0 Kudos

If you wish to take a look at my code:

method ONACTIONHOTSPOTS .

"display url.       

  DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
  DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
  DATA lo_value TYPE REF TO cl_salv_wd_config_table.
  DATA lt_columns TYPE salv_wd_t_column_ref.

  DATA ls_column LIKE LINE OF lt_columns.
  DATA lo_column TYPE REF TO cl_salv_wd_column.
  DATA lo_ltu TYPE REF TO cl_salv_wd_uie_link_to_url.

  lo_cmp_usage = wd_this->wd_cpuse_alv( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.
  lo_interfacecontroller = wd_this->wd_cpifc_alv( ).
  lo_value = lo_interfacecontroller->get_model( ).
  CALL METHOD lo_value->if_salv_wd_table_settings~set_read_only(
                                   EXPORTING value = abap_true ).
  CALL METHOD lo_value->if_salv_wd_column_settings~get_columns(
                                  RECEIVING value = lt_columns ).

  LOOP AT lt_columns INTO ls_column.
    lo_column = ls_column-r_column.
    CASE ls_column-id.
      WHEN 'BELNR'.
        CREATE OBJECT lo_ltu.
        CALL METHOD lo_ltu->set_text_fieldname
          EXPORTING
            value = 'BELNR'.

              lo_column->set_cell_editor( lo_ltu ).
    ENDCASE.
  ENDLOOP.

*****************************************************************************************************************
DATA: context_element TYPE REF TO if_wd_context_element,
      ls_stru TYPE wd_this->element_output.

       context_element->get_static_attributes(
                                      IMPORTING static_attributes = ls_stru  ).

data: s1 type string value 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=',
      s2 TYPE string VALUE ';RF05L-GJAHR=',
      s3 TYPE string VALUE ';RF05L-BELNR='.

data: val TYPE string.

CONCATENATE s1 ls_stru-bukrs s2 ls_stru-gjahr s3 ls_stru-belnr INTO val.

        CALL METHOD lo_ltu->set_reference
          EXPORTING value = val.

endmethod.

Former Member
0 Kudos

1.Goto Methods tab

2.Create a new Event Handler method. Select Event OnClick.

3. In this method place this code


" Create importing parameter 'CONTEXT_ELEMENT' type if_wd_context_element.
 
    DATA: ls_stru TYPE wd_this->element_node name.
 
" get contents of the entire row.
  context_element->get_static_attributes(
                                      IMPORTING static_attributes = ls_stru  ).

ls_stru-belnr will have the required belnr value.

Hope it helps!

Regards.

Radhika.

Former Member
0 Kudos

hi.

I wrote the code that sets the link for the field belnr, in the WDDOINIT method.

I created the method as per you told and placed the following code in it.

method HOTSPOT_CLICK .

DATA lo_ltu TYPE REF TO cl_salv_wd_uie_link_to_url.
DATA: context_element TYPE REF TO if_wd_context_element,
      ls_stru TYPE bseg.

         context_element->get_static_attributes(
                                      IMPORTING static_attributes = ls_stru  ).

data: s1 type string value 'http://INBDQ-S-RD2.in.abb.com:8001/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=',
      s2 TYPE string VALUE ';RF05L-GJAHR=',
      s3 TYPE string VALUE ';RF05L-BELNR='.

data: val TYPE string.

CONCATENATE s1 ls_stru-bukrs s2 ls_stru-gjahr s3 ls_stru-belnr INTO val.

        CALL METHOD lo_ltu->set_reference
          EXPORTING value = val.

endmethod.

When i run it, there is a hotspot created, i mean the belnr fields come in blue and underlined.

But, there is no action taking place when i click it.

Regards,

Prati.

Former Member
0 Kudos

you Can Try this it will be more easy...

FOLLOW THIS STEP ::

IN INIT METHOD

DATA : USER_COL_LINK TYPE REF TO cl_salv_wd_uie_link_to_action,

LR_COLUMN type ref to cl_salv_wd_column.

LR_COLUMN = L_VALUE->if_salv_wd_column_settings~get_column( 'EBELN' ).

CREATE OBJECT USER_COL_LINK.

USER_COL_LINK->set_text_fieldname( 'EBELN' ).

LR_COLUMN->set_cell_editor( USER_COL_LINK ).

*NOW MAKE ONE ONCLICK METHOD OF TYPE EVENT HANDLER....

*WHENEVER USER CLICK ANY ONE OF THE NO.

IT WILL LEAD U TO THIS METHOD.

method ONCLICK .

data: lr_node type ref to if_wd_context_node,

lt_event_properties type table of IF_MAIN=>element_event_properties,

ls_event_properties type IF_MAIN=>element_event_properties.

field-symbols: <l_value> type any.

  • fill internal table

ls_event_properties-name = 'COLUMN_ID'.

ls_event_properties-value = r_param->column.

append ls_event_properties to lt_event_properties.

ls_event_properties-name = 'INDEX'.

ls_event_properties-value = r_param->index.

append ls_event_properties to lt_event_properties.

ls_event_properties-name = 'ATTRIBUTE'.

ls_event_properties-value = r_param->attribute.

append ls_event_properties to lt_event_properties.

assign r_param->value->* to <l_value>.

ls_event_properties-name = 'VALUE'.

ls_event_properties-value = <l_value>.

append ls_event_properties to lt_event_properties.

  • navigate to context node EVENT_PROPERTIES (THIS NODE CONTAIN TWO ATTRIBUTE ( 0..N ) NAME AND VALUE)

lr_node = wd_context->get_child_node( 'EVENT_PROPERTIES' ).

  • bind internal table to context node

lr_node->bind_table( lt_event_properties ).

*wd_this->fire_submit_plg( ).

endmethod.

Former Member
0 Kudos

Hi.

Thanks!

But, i am working with link_to_url.

The code you gave me is working with link to an action.

I guess you had asked me about the lo_ltu type ref, in a mail.

If yes, It is as follows:

DATA lo_ltu TYPE REF TO cl_salv_wd_uie_link_to_url.

Regards,

prati.

Former Member
0 Kudos

Please HELP!

Former Member
0 Kudos

hi,

i am doing the same thing i have user table. i have set up link to the each user like i said before.

it is also going to the su01d transaction ( i want whenever user click on the user name it should open it's profil in su01d)

i want ur help.how u can able to insert the field value through URL. i have made open internet services....

my url is different than yours like

http://icux1945.d52.lilly.com:8000/sap/bc/gui/sap/its/ztest_zb002?sap-client=100

do u have used transaction iview ?

Former Member
0 Kudos

hi!

Even I am stuck up on the same issue.

I have belnr column with link to url. and when user clicks on one particular, i want tcode fb03 to open with respective fields filled.

Inserting field values , i could do , only when the values were to be hardcoded.

The code goes as:

CALL METHOD lo_ltu->set_reference
                        EXPORTING value = 'http://<host>:<port>/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=IN01;RF05L-GJAHR=2008;RF05L-BELNR=7100000000'.

OR:

DATA:  po_num TYPE belnr_d VALUE 71000000,
       comp_code TYPE bukrs VALUE 'IN02',
       fiscal TYPE gjahr VALUE 2008.

data: s1 type string value 'http://<host>:<port>/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=',
      s2 TYPE string VALUE ';RF05L-GJAHR=',
      s3 TYPE string VALUE ';RF05L-BELNR='.

data: val TYPE string.

CONCATENATE s1 comp_code s2 fiscal s3 po_num INTO val.

        CALL METHOD lo_ltu->set_reference
          EXPORTING value = val.

Hope it is of help to you.

Regards,

prati.

Former Member
0 Kudos

thanks Prati,

i just want to know that Do u have made any thing like "internet services" or transaction code "fb03" . or it was already Der ???

as in my case i have made "ztest_zb002" internet services. i don't have enogh knowledege on internet services . Do we need to declare the parameters into that services which we want to transfer???

Former Member
0 Kudos

hi.

I have no idea regarding the ITS, m new to it.

As in my code, FB03 is a standard transaction.

regards,

Prati.

Former Member
0 Kudos

HI,

Prati. i am Done with it.

i can call transaction su01d with respective user-id click by the user on the screen.

i use OKCODE to skip the su01d's selection screen.

i suggest you instead of link to url go for link to action it will be more easy...

i am writing IF U WOULD LIKE TO GO FOR IT.

Edited by: Raju.. on May 10, 2009 9:03 AM

Former Member
0 Kudos

*code to create link on perticular coloumn (WDDOITNIT method)

DATA : USER_COL_LINK TYPE REF TO cl_salv_wd_uie_link_to_action,

LR_COLUMN type ref to cl_salv_wd_column.

LR_COLUMN = L_VALUE->if_salv_wd_column_settings~get_column( 'BNAME' ).

CREATE OBJECT USER_COL_LINK.

USER_COL_LINK->set_text_fieldname( 'BNAME' ).

LR_COLUMN->set_cell_editor( USER_COL_LINK ).

*for retriving the value click by the user. make onclick method of type handler type it will be called whenever user click

*any of the id of a column (ONCLICK method).

data : v_index type i.

v_index = r_param->index. "r_param will automatically gen. with method

*you have the index of the raw which waS clicked by the user.

data : temp_node type ref to if_wd_context_node,

OUT_TABLE TYPE TABLE OF IF_MAIN=>ELEMENT_IT_USR_OUT, "IN UR CASE IT WILL BE ELEMENT_<NODE-NAME>

SELECTED_RAW TYPE IF_MAIN=>ELEMENT_IT_USR_OUT.

temp_node = WD_context->get_child_node( 'IT_USR_OUT' ).

TEMP_NODE->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = OUT_TABLE ).

READ TABLE OUT_TABLE INDEX v_index INTO SELECTED_RAW.

*GET THE FIELD YOU WANT TO TRANSFER AND GENERATE URL AS.....

data: lo_window_manager type ref to if_wd_window_manager.

data: lo_api_component type ref to if_wd_component.

data: lo_window type ref to if_wd_window.

data: ld_url type string.

data: s1 type string value 'http://<host>:<port>/sap/bc/gui/sap/its/webgui?~transaction=fb03%20RF05L-BUKRS=',

s2 TYPE string VALUE ';RF05L-GJAHR=',

s3 TYPE string VALUE ';RF05L-BELNR=',

DATA : FINAL_URL TYPE STRING.

*I HAVE WRITE THIS IN NOTEPAD SO IF CONCATENATE NOT WORK THAN DECLARE EACH VARIABLE AS STRING USE IT.

CONCATENATE S1 SELECTED_RAW-BUKRS S2 SELECTED_RAW-GJAHR S3 SELECTED_RAW-BELNR '&~OKCODE=SRCH' INTO FINAL_URL.

lo_api_component = wd_comp_controller->wd_get_api( ).

lo_window_manager = lo_api_component->get_window_manager( ).

CALL METHOD lo_window_manager->CREATE_EXTERNAL_WINDOW

EXPORTING URL = FINAL_URL "'http://www.sapdev.co.uk'

RECEIVING WINDOW = lo_window.

lo_window->open( ).

Edited by: Raju.. on May 10, 2009 9:09 AM

Former Member
0 Kudos

Hi..

Its done.

Thank you so much!!

Regards,

Prati.

Answers (4)

Answers (4)

Former Member
0 Kudos

The query is further extended.

arjun_thakur
Active Contributor
0 Kudos

Hi Prati,

Refer the following code to make one column of the ALV as LinkToAction (I think LinkToAction will be a better option then LinkToUrl).


data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_alv_first( ).
  if l_ref_cmp_usage->has_active_component( ) is initial.
    l_ref_cmp_usage->create_component( ).
  endif.

  data l_salv_wd_table type ref to iwci_salv_wd_table.
  l_salv_wd_table = wd_this->wd_cpifc_alv_first( ).
  data l_table type ref to cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).
  data l_column type ref to cl_salv_wd_column.

 data linkview type ref to cl_salv_wd_uie_link_to_action.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'BELNR' ).
  create object linkview.
  linkview->set_text_fieldname( 'BELNR' ).
  l_column->set_cell_editor( linkview ).

Now create a event handler method On_click and associate with the ON_CLICK event of the alv.

Now in that method, write the required logic. You can't call transaction directly, you need to create a transaction iview for it.

Also refer this article for clearity: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/bd28494a-0801-0010-45a3-fc359d82....

I hope it helps.

Regards

Arjun

Former Member
0 Kudos

Hi,

When you get the Mode object reference of the ALV(lovalue type ref to cl_salv-wd-config_table).

Then get the column settings and get the column refernce of the BELNR.

declare object of type CL_SALV_WD_UIE_LINK_TO_URL and cretae thi object reference for this column.

Implement the ALV ON_CLICK event for that ALV and write the necessary code.

Please check out this link

If you are running this in Portal then calling Tcode this way will be of use. Please check the above link for reference.

Regards,

Lekha

Former Member
0 Kudos

Hi

You will have to create an action for the link to url.

1. Goto Methods tab

2. Create a new method,

Method Type - Event Handler

Event - OnClick.

3. Now write the code to call the required transaction in this event handler method.

Regards,

Radhika.