cancel
Showing results for 
Search instead for 
Did you mean: 

Issue faced while passing variable between 2 different applications

Former Member
0 Kudos

Hi i need some help.--

Issue is the window.open is always picking up an old value of V_TARGET_URL ( 1 run old).

Code attached below

<htmlb:button id = "b_edit"

text = "Edit"

onClick = "onInputProcessing(b_edit)"

onClientClick = "setEdit();" />

function setEdit()

{

window.open("<%= V_TARGET_URL%>");

}

WHEN 'b_edit'.

  • Construct the Target URL

call method runtime->construct_bsp_url

exporting

in_protocol = 'http'

in_application_ns = runtime->application_namespace

in_application = runtime->application_name

in_page = '**/targetapplicationname/maintainrole.htm'

importing

out_abs_url = v_target_url.

CONCATENATE runtime->application_name '/**/' INTO w_app_name.

REPLACE w_app_name IN v_target_url WITH space.

  • Set Server side cookie to store the source BSP appl detail

v_cookie = 'srcappname/listresult.htm'.

CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie

EXPORTING

name = 'source_bsp'

application_name = 'NONE'

application_namespace = 'NONE'

username = sy-uname

session_id = 'NONE'

data_value = v_cookie

data_name = 'sbsp'

expiry_time_rel = 36.

  • Pass the User ID via URL

CONCATENATE v_target_url '?w_uniqueid_enter=' w_uniqueid_enter INTO v_target_url.

Regards

Bhavana

View Entire Topic
Former Member
0 Kudos

Hi Raja

This was already done earlier but i get the same issue of old url being picked since v_target_url ABAP scripting is called before OnInput processing

On Input processing everything as u had mentioned

This code mentioend below not required ...

((( * Set Server side cookie to store the source BSP appl detail

v_cookie = 'srcappname/listresult.htm'.

CALL METHOD cl_bsp_server_side_cookie=>set_server_cookie

EXPORTING

name = 'source_bsp'

application_name = 'NONE'

application_namespace = 'NONE'

username = sy-uname

session_id = 'NONE'

data_value = v_cookie

data_name = 'sbsp'

expiry_time_rel = 36.

)))

and then i m population v_target_url as below ..

  • Pass the User ID via URL

CONCATENATE v_target_url '?w_uniqueid_enter=' w_uniqueid_enter INTO v_target_url.

endif.

ENDIF.

Layout:

<htmlb:button id = "b_edit"

text = "Edit"

onClientClick = "setEdit();" />

<% if V_TARGET_URL is not initial. %>

function setEdit()

{

window.open("<%= V_TARGET_URL%>");

}

<% endif. %>

... now it gives me a Javascript error..at this point below...

raja_thangamani
Active Contributor
0 Kudos

Try the below code:

<htmlb:button id = "b_edit"
text = "Edit"
onClientClick = "setEdit();" />

<script type="text/javascript">

function setEdit()
{
<% if V_TARGET_URL is not initial. %>

window.open("<%= V_TARGET_URL%>");

<% endif. % >
}

</script>

Raja T

Former Member
0 Kudos

Hi raja

I shall explain a little in more detail now...

there is a tableview , 2 buttons below it edit and delete ,...the pages for edit and delete are in a different application ,

now to build the url depending on which button was clicked it has to go into the oninput processing where i put the code in Case b_edit and b_delete , to go to 2 different pages on the differnt application , taking along with it the userid which waas clicked for editing / deleting ( this user id i m reading from the tableview row selection like u said )....

Now issue is i am not able to open a new application since like u said it goes into client side scripring before it goes into Server side event...

I am ina fix..... This is the complete problem...... Please tell me if you know any way to ge t out of this tricky situation....

raja_thangamani
Active Contributor
0 Kudos

Dude,

I understood your requirement.

Did you try the below code?


<htmlb:button id = "b_edit"
text = "Edit"
onClientClick = "setEdit();" />
 
<script type="text/javascript">
 
function setEdit()
{
<% if V_TARGET_URL is not initial. %>
 
window.open("<%= V_TARGET_URL%>");
 
<% endif. % >
}
 
</script>

Raja T

Former Member
0 Kudos

i tried . it didnt work... it is opening the target Url of last run .....that is it opens it before the Oninput processing is triggered and picks up the last selected V_TARGET_URL.. ,,,,

How i have been trying on this issue for past 2 days,,,,

raja_thangamani
Active Contributor
0 Kudos

Sorry i didnt test the above code...

Here is the code which will solve your problem..I tested in my system also. Its working perfectly..

But still you need to construct the Target url while selecting the Tableview Row.


<htmlb:button id = "b_edit"
text = "Edit"
onClientClick = "setEdit('<%= V_TARGET_URL%>');" />

<script type="text/javascript">
function setEdit(url)
{
if(url != null)
{
alert(url);
window.open(url).focus();
}
}
</script>

<b>Event Handling:</b>


* event handler for checking and processing user input and
* for defining navigation


  DATA: TV          TYPE REF TO CL_HTMLB_TABLEVIEW,
        EVENT       TYPE REF TO CL_HTMLB_EVENT,
        TABLE_EVENT TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  FIELD-SYMBOLS <I> LIKE LINE OF SELECTED_IND.

  TV ?= CL_HTMLB_MANAGER=>GET_DATA( REQUEST = REQUEST
                                    NAME    = 'tableView'
                                    ID      = 'tv' ).
  IF TV IS NOT INITIAL.
    TABLE_EVENT = TV->DATA.
    CLEAR  SELECTED_IND.
    SELECTED_IND = TABLE_EVENT->PREVSELECTEDROWINDEXTABLE.

    IF TABLE_EVENT->EVENT_TYPE EQ CL_HTMLB_EVENT_TABLEVIEW=>CO_ROW_SELECTION.
      READ TABLE  SELECTED_IND WITH KEY TABLE_LINE = TABLE_EVENT->ROW_INDEX
        TRANSPORTING NO FIELDS.
      IF SY-SUBRC EQ 0.
        DELETE  SELECTED_IND INDEX SY-TABIX.
      ELSE.
        APPEND INITIAL LINE TO  SELECTED_IND ASSIGNING <I>.
        <I> = TABLE_EVENT->ROW_INDEX.
      ENDIF.
    ENDIF.
    DATA:V_COUNT(10).

    DESCRIBE TABLE SELECTED_IND LINES V_COUNT.
    IF V_COUNT EQ 1.

* Construct your Target URL here..

    ENDIF.
  ENDIF.

Raja T

Former Member
0 Kudos

I have 2 questions for u now

1) can we define 2 times

2) will this work for 2 buttons--- Edit and delete ( 2 URL´s i mean )

Former Member
0 Kudos

Hi Raja

It now opens Blank.com , back to square one since it doesnt goto Oninput processing at all to read the target URL...

Also if this worked.. how do u propose to contrust 2 different URL´s on 2 different buttons,, ( Edit and Delete )

raja_thangamani
Active Contributor
0 Kudos

Dude..YOu didnt get my point..

It now opens Blank.com , back to square one since it doesnt goto Oninput processing at all to read the target URL...

--->The Target URL will get constructed when you select the Row of Tableview..So while Clicking the Button, it has to open the window...

-->Can you please post your code here..so that i can suggest the modification if you still dont get my points...

Also if this worked.. how do u propose to contrust 2 different URL´s on 2 different buttons,, ( Edit and Delete )

-->Again you need to construct both Edit & delete url when the particular Row is selected..

Raja T

Message was edited by:

Raja Thangamani

raja_thangamani
Active Contributor
0 Kudos

+I have 2 questions for u now

1) can we define --> Answered with point 2

2) will this work for 2 buttons--- Edit and delete ( 2 URL´s i mean )

For Edit & Delete:


<htmlb:button id = "b_edit"
text = "Edit"
onClientClick = "Open_URL('<%= V_EDIT_TARGET_URL%>');" />
 
<htmlb:button id = "b_delete"
text = "Delete"
onClientClick = "Open_URL('<%= V_DELETE_TARGET_URL%>');" />

<script type="text/javascript">
function Open_URL(url)
{
if(url != null)
{

window.open(url).focus();
}
}
</script>

Raja T

raja_thangamani
Active Contributor
0 Kudos

I got what you are saying..about Blank page...If the Target URL is initial. Disable the buttons as follows: Same applies to Delete also..


<% If V_TARGET_URL is initial.
v_disabled = 'true'.
endif.
%>
<htmlb:button id = "b_edit"
text = "Edit"
disabled = "<%= v_disabled %>"
onClientClick = "Open_URL('<%= V_EDIT_TARGET_URL%>');" />

Raja T

Message was edited by:

Raja Thangamani

Former Member
0 Kudos

Thanks a lotttttttttt...

You r simply a genius..

Thanks again..

Shall assign u all points for this answer..

raja_thangamani
Active Contributor
0 Kudos

Please close the other thread also..

Raja T