How to call a dynamic URL on 'button press' event, in MVC-based BSP

Hi,
My requirement is as below:
On selecting a row in table view, and pressing a button, I need to open a browser.
The Browser URL depends on the row selected.
The key field from table view, is added at the end of the URL string.
Shortly, I can say that, I am getting a value on row selection & want to pass it to button event.
In Views Section, there are 2 tags- (1)table view & (2)button.
Right now, I have put the code for getting the key field, in DO_HANDLE_DATA method.
In Button's OnClientClick method, I have called the Javascript to open the browser.
If I now write the code to concatenate the key field value to form the dynamic URL in 'OnClick' method,
it will be called only after the browser is opened.
(as OnClick event is executed only after OnClientClick event is executed)
Could anyone please tell me what event (and in which tag) can be used to solve this.
Is there any event which is triggered, as soon as the row is selected, &  before the button press event is triggered ?
Would really appreciate responses made to this query.
Thanks,
Nisha Vengal.

Hi Nisha,
The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
function fn_button()
           htmlbSL(this,2,'b_row_selection:onInputProcessing()');
           window.open("new_page",target="BLANK");
Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
Try this out and let us know if it works for you.
Regards,
Saurabh

Similar Messages

  • CRM5.2 UI-Call a dynamic URL on button click

    Hi all, 
               My requirement is to call a dynamic url on the click of a button in the overview page. I have added a custom button in  the method  IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS , and the related code in do_handle_event.I have created a custom method for the button event. I have enhanced a custom controller and created an attribute.In the custom method created for the button event, I have written the code for retrieving the parameters to be passed to the url.
    In the layout of the view associated with the display view , I have written the following code for calling the URL in a new window.
    <%
    DATA: lr_cuco_EMA TYPE REF TO ZL_BP_CONT_BPCONT_IMPL,
          lv_url TYPE string,
          lv_url1 type string,
          lv_count type i.
      lr_cuco_EMA ?= controller->get_custom_controller( 'ZBP_CONT/BPCONT' ).
      check lr_cuco_EMA is bound.
      if lr_cuco_EMA->gv_VALUE is not initial.
      if lr_cuco_EMA->gv_COUNT IS NOT INITIAL.
      clear lr_cuco_EMA->gv_COUNT.
      endif.
      LV_URL = lr_cuco_EMA->gv_VALUE.
      Concatenate 'http:/' LV_URL  into LV_URL1.
      Concatenate '"http:/' LV_URL '"' into LV_URL.
        lv_count = lr_cuco_EMA->gv_COUNT mod '2'.
        if lv_count Ne 0.
      lv_url = lv_url1.
    endif.
      %>
         <scrpt language="Javascript">
            window.open(<%= lv_url%>).focus();
          </script>
       <%
             lr_cuco_EMA->gv_COUNT = lr_cuco_EMA->gv_COUNT + 1.
             clear lr_cuco_EMA->gv_value.
             clear lv_count.
             clear lv_url.
             clear lv_url1.
             ENDIF.
    %>
    But here my URl is getting called alternate times.If I do not write the code  by using the variable GV_COUNT the url is getting called only the first time of the button click  and to call the URL again you need to navigate back to the search page and again back to the overview page and click on the button.
    Can anyone help me regarding this? I want the URL to be called in a new page on every button click.
    Thanks in Advance,
    Chandana

    Hi Nisha,
    The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.
    function fn_button()
               htmlbSL(this,2,'b_row_selection:onInputProcessing()');
               window.open("new_page",target="BLANK");
    Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.
    Try this out and let us know if it works for you.
    Regards,
    Saurabh

  • HOW TO CALL APPROVAL WORK FLOW ON BUTTON CLICK EVENT OF VISUAL WEB PART?

    Hiall,
    I created an OOB an approval work flow I want to start that approval work flow through visual web  part button click event
    In work flow Settings I selected to manually start .Is this possible ? if possible please guide me how to do this
    Thanking you,
    Arun  kumar

    Hi,
    If you have an instance of SPListItem, and know the workflow association name, you can start it. First you need to find workflow assocation instance and tell SPSite.SPWorkflowManager to start your workflow.
    See this for more information:
    http://blog.mmasood.com/2012/06/programatically-start-workflow.html
    Please remember to up-vote or mark the reply as answer if you find it helpful.

  • How do I execute a 'remote' when-button-pressed trigger?

    I am using Forms 6 in an 8i/10g environment. I have a data block (COMPACT) which is on canvas MAIN. Compact has an item (button) called CREATE_COMPACT, with a when-button-pressed trigger. I also have an error canvas which has a button called RESTART, so they can restart the entire build after an error. The restart code is exactly the same as the create_compact code, and, after the restart, I want the focus to be the main canvas, so I would like to just have the restart when-button-pressed trigger shift focus to the CREATE_COMPACT trigger and execute it. I have tried:
    go_item( 'Compact.Create_Compact' );
    do_key( 'Enter' );
    This switched me to CREATE_COMPACT but did not execute the trigger. I then tried:
    execute_trigger( 'Compact.Create_Compact' );
    and then:
    execute_trigger( 'Create_Compact' );
    but neither of these work. I get error FRM-40700 no such trigger. Is there any way to do this short of copying code or creating a pl/sql procedure?
    thanks

    do_key('ENTER') will execute the code in a KEY-ENTER trigger so I suggest you move your code into the KEY-ENTER trigger. On your when-button-pressed trigger you should also use do_key('ENTER');

  • How to read URL by button action event

    Hi,
    Can some one please show me how to add a ...... I call it URL reader to the action of a button of another class?
    Lets say I have a url reader class and the following code
    public void uRLReader() throws Exception {
             // URL concatenation
             String url1 = "http://";
             String url2 = "";
             String url3 = ".google.com";
             URL google = new URL(url1+url2+url3);
             BufferedReader in = new BufferedReader(
                            new InputStreamReader(
                            google.openStream()));
             String inputLine;
             while ((inputLine = in.readLine()) != null)
                 System.out.println(inputLine);
             in.close();
            }Now I also got another class in the same package "class2", it has a button. Similarly, another class which has a JTextField. Now when some one writes 1 and hit the button I want "1" to get inserted into url in "url2" position. In other words any thing that is entered in the JTextField should be inserted into "url2" position.
    I am not very much familiar with java so this is all I could write. I used a string concatenation to break the url. Can some please show me how do I add this to the button of another class and the button to JTextFiled of another class?
    Thank you

    First of all, change your method so that url2 is an argument of the method:
    public void uRLReader(String url2) throws Exception {and remove the declaration of url2 from the body of the method.
    Then, write and ActionListener class (it could be an anonymous inner class) to read the textfield you want, then invoke uRLReader, passing that text as an argument.
    That's basically it.

  • How to pass the dynamic URL of web services in JAVASCRIPT in ADOBE

    Hi,
    In the below scenario how do i pass the URL dynamically  from context's importing parameters instead of hard coding.
    var cURL = "http://................" ;
    var service = SOAP.connect(cURL);
    xfa.connectionSet.connectionname.execute(0);
    B'coz the URL is going to be different in Dev, Test, Prod system. In this case i can't hardcode the URL  as explained in previous treads. Or please provide the possible alternatives.
    Any help is highly appreciated.
    Regards,
    Sathish

    Hi,
    Got the solution for
    var cURL = "http://................" ;
    var service = SOAP.connect(cURL);
    xfa.connectionSet.connectionname.execute(0);
    I tried with
    var cURL = xfa.form.data.PAGE2.SubFormPage.IM_URL.rawValue ;
    var service = SOAP.connect(cURL);
    xfa.connectionSet.connectionname.execute(0);
    xfa - Root Node
    form - Model
    data - Form Design Root Node
    PAGE2 - Page Name
    SubFormPage - Sub Form inside the page
    IM_URL.rawValue - Importing field to Adobe{ which i dragged from Data view into sub form(SubFormPage) & set the field as invisible so that it won't be available to user}
    Working as expected.
    Thanks,
    Sathish

  • How to call this out by clicking button from other file??

    The following coding is easy and workable...!! i wonder how do i call this out by clicking button from other file... please help!!
    import java.awt.geom.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.print.PrinterJob;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    public class Receipt extends JPanel implements Printable, ActionListener {
    final static Color bg = Color.white;
    final static Color fg = Color.black;
    final static Color red = Color.red;
    final static Color white = Color.white;
    final static BasicStroke stroke = new BasicStroke(2.0f);
    final static BasicStroke wideStroke = new BasicStroke(8.0f);
    final static float dash1[] = {10.0f};
    final static BasicStroke dashed = new BasicStroke(1.0f,
    BasicStroke.CAP_BUTT,
    BasicStroke.JOIN_MITER,
    10.0f, dash1, 0.0f);
    final static JButton button = new JButton("Print");
    public Receipt() {
         setBackground(bg);
    button.addActionListener(this);
    public void actionPerformed(ActionEvent e) {
    if (e.getSource() instanceof JButton) {  
    PrinterJob printJob = PrinterJob.getPrinterJob();
    printJob.setPrintable(this);
    if (printJob.printDialog()) {
    try {
    printJob.print();
    catch (Exception ex) {
    ex.printStackTrace();
    public void paintComponent(Graphics g) {
         super.paintComponent(g);
         Graphics2D g2 = (Graphics2D) g;
         drawShapes(g2);
    public void drawShapes(Graphics2D g2){
    g2.drawString("Hello world",50,50);
    public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
    if (pi >= 1) {
    return Printable.NO_SUCH_PAGE;
         drawShapes((Graphics2D) g);
    return Printable.PAGE_EXISTS;
    public static void main(String s[]){
         JFrame f = new JFrame();
         JPanel panel = new JPanel();
         panel.add(button);
         f.getContentPane().add(BorderLayout.SOUTH, panel);
         f.getContentPane().add(BorderLayout.CENTER, new Receipt());
         f.setSize(580, 500);
         f.show();

    The following coding is easy and workable...!! i wonder how do i call
    this out by clicking button from other file... please help!!Copy the code from your main() method and put it into the actionPerformed() method of the other class. If you do not need to reference the instance of Receipt from the othe class, it is that easy.

  • How to call dos commands through HTMLDB buttons

    HI,
    How do i call DOS commands through HTMLDB buttons, or on any process?
    can anyone help me on this?
    THANKS!
    BROKEN

    This article explains how to execute shell commands from whitin pl/sql using java (in the database).
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    It is for Oracle8i but should still work. This still looks like a good way to go.
    ~Dietmar.

  • How to call a Procedure throguh a BUTTON

    I want to call a procedure through a button; WHEN BUTTON PRESSED TRIGGER.
    Plz tell how it would be...?

    Ghulam Yassen wrote:
    I want to call a procedure through a button; WHEN BUTTON PRESSED TRIGGER.
    Plz tell how it would be...?Without more information, it's hard to provide exact solution...
    just call a procedure in a button or anywhere simply follow this code
    procedure_name;Hope this helps

  • Calling a function in WHEN-BUTTON-PRESSED

    Hello,
    i have in when-button-pressed a line containing
    select pachet_salarizare.ani_vechime(data_min, to_number(to_char(sysdate,'YYYY')), to_number(to_char(sysdate,'MM'))) into ani_vechime from dual;so i call a function which is in pachet_salarizare package (package created in program units, in Forms).
    when compiling, i get: function 'PACHET_SALARIZARE.ANI_VECHIME' mai not be user in SQL.
    how can i deal with this? i need the result of that function in a variabie, ani_vechime.
    Thanks!

    Uh, thank you. i thought it's not possible what i wanted..
    but strange why cannot be called function in select statements
    Regards,

  • Why am I getting this error?  How do I add confirm message to button press?

    Using Java Studio Creator.
    I do not understand why I am getting the following page error:
    Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error.
    Exception Details: java.lang.IndexOutOfBoundsException
    Index: 0, Size: 0
    Possible Source of Error:
    Class Name: java.util.ArrayList
    File Name: ArrayList.java
    Method Name: RangeCheck
    Line Number: 546
    ======================================================================
    I have a page that works.
    It has a button that is created in the session bean code with the following java:
    button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
    button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
    button.setId( "applyUndates" );
    button.setType( "submit" );
    button.setTitle( "Apply updates.");
    button.setValue( "Apply" );
    button.setStyle(style);
    children.add(button);
    When the button is pushed, it calls the following session bean method:
    public void mainApply(ActionEvent actionEvent)
    updateScheduleData();
    scheduleAdjustFlag = 1;
    dataApplied = true;
    dataSaved = false;
    addControls();
    This all works just fine - no errors
    ====================================================================
    I wanted to add confirmation to the button press, so I removed the action listener for this button and added
    a javascript function call for the onclick method
    button = (HtmlCommandButton)application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
    style = "text-align: center; font-family: 'Arial','Helvetica',sans-serif; " + font + " height: 22px; width: 115px";
    // Commented out this line button.setActionListener( application.createMethodBinding("#{ScheduleEditSessionBean.mainApply}", new Class[]{ActionEvent.class} ));
    button.setOnclick("confirmApply()"); // Added this line.
    button.setId( "applyUndates" );
    button.setType( "submit" );
    button.setTitle( "Apply updates.");
    button.setValue( "Apply" );
    button.setStyle(style);
    children.add(button);
    I added a dummy button to the page that has the following call to execute the mainApply method in the sessioon bean.
    The button action just calls the mainApply() method in the session bean
    public String mainApplyBtn_action() {
    seb.mainApply();
    return null;
    Added the javascript to the page that simply pushes the dummy button if confirmed.
    function confirmApply()
    if( confirm( 'Are you sure you want to Apply these changes?' ) )
    form1["form1:mainApplyBtn"].click();
    The session bean method looks like this it is the same method as before, but without the action event argument.
    public void mainApply()
    lsb.logMsg( "<ScheduleEditBean.mainApply> Main apply pushed" );
    updateScheduleData();
    scheduleAdjustFlag = 1;
    dataApplied = true;
    dataSaved = false;
    addControls();
    ==================================================================================
    Now, when I push the original 'Apply' button, I get the confirmation box just like I expected.
    But when I confirm the question, I get the error at the top of this post.
    If I push the 'dummy button' directly, I do not get the error.
    I do not understand why I should be gettng this error.
    Can anyone give me a clue as to why this change would cause the problem?
    The error is related to an ArrayList.
    I use several of these on the page, but they should be filled with data in the preRender method of the page.
    Can anyone suggest a way that I can add confirmation to a button that is created under program control?
    Thanks

    Make use of the fact that when an onclick event of a button returns 'false', the action will not be taken.
    Pseudocode:<h:commandButton value="submit" action="#{myBean.action}" onclick="return confirm('Are you sure?');" />

  • How to call  a javascript method after the PPR event has finished  ?

    Hi!
    How can we make a javascript method get called after the processing of ADF PPR event?
    My specific use case is,
    I want to call a javascript function after the data in the table is loaded...
    In 10g, that is not a problem, as the data used to get loaded directly during onLoad, and so i would call my js function on load;
    but in 11g , the table data is being loaded through PPR which is initiated onload, and so i needed to call my function after the PPR Response processing has been done; for which I need the name of the event triggered at that instance.
    Is it possible to do this?
    Regards,
    Samba

    Hey, I got it.
    I handled the ADF Controller's PREPARE_RENDER_ID phase of the lifecycle, and then called the
    script to get Executed.
    The code :
        public void afterPhase(PagePhaseEvent pagePhaseEvent) {
            FacesPageLifecycleContext ctx = (FacesPageLifecycleContext)pagePhaseEvent.getLifecycleContext();
                 if (pagePhaseEvent.getPhaseId() == Lifecycle.PREPARE_RENDER_ID) {
                    if(AdfFacesContext.getCurrentInstance().isPostback() )
                        afterRender();
        }is written in lifecycle listener , and my backing bean extended this listener ,
    and in the afterRender() method I did this :
       public void  afterRender(){
                System.out.println("AFTER RENDER CALLED");
               FacesContext context = FacesContext.getCurrentInstance();
               ExtendedRenderKitService service = (ExtendedRenderKitService)Service.getRenderKitService(context, ExtendedRenderKitService.class);
               service.addScript(context, "translate();");
           }That's it.
    It did work, magnificently.
    Thanks for the idea.
    Regards,
    Samba

  • How to Redirect to a URL on Button Click

    Hi all,
    I am new to Apex and have a following Requirement
    On the page I have a Field P3_CASE_ID and a Button P3_SUBMIT.
    When I click the Submit Button, It should Open a new window
    https://customer.peoplesoft.com/psp/C1PRD_2/EMPLOYEE/CRM/c/CALLCENTER.RC_CASE_SW.GBL?Page=RC_CASE_SW&Action=U&CASE_ID=
    Above String should be Concatneted with value from P3_CASE_ID.
    Say if I enter P3_CASE_ID as 123456 then a new window should be opened with following URL
    https://customer.peoplesoft.com/psp/C1PRD_2/EMPLOYEE/CRM/c/CALLCENTER.RC_CASE_SW.GBL?Page=RC_CASE_SW&Action=U&CASE_ID=123456
    How to do it...?
    I tried following in Optional URL Redirect for the button.
    javascript:popupURL('
    https://customer.peoplesoft.com/psp/C1PRD_2/EMPLOYEE/CRM/c/CALLCENTER.RC_CASE_SW.GBL?Page=RC_CASE_SW&Action=U&CASE_ID=&P3_CASE_ID.');
    But the P3_CASE_ID is not appended to the URL.
    Thanks and Regards
    Kesav
    Message was edited by:
    user619016

    Here is some code I think you will find helpful.
    http://www.oracle.com/technology/products/database/application_express/howtos/how_to_create_custom_popups.html

  • Calling a Dynamic URL in a BSP

    Hi all,
    We are calling a BW Web Report from a BSP application . Presently we have hardcoded the BW Web Report but when we move from Devlopement to Quality and subsequently to Production we would need to pass the respective URL’s.
    One way of achieving the above, is to write Case statements specific to Development, Quality and Production System -IDs, Is there any other way in which we pass the  URL’s dynamically to the BSP.
    Thanx in advance.

    to dynamically construct BW web report url you can do the following
    call the following FM
    CALL FUNCTION 'TH_GET_VIRT_HOST_DATA'
       EXPORTING
         protocol             = 1 " 1 for http 2 for https
         virt_idx             = 0
      LOCAL                = 1
      IMPORTING
        hostname             = server
        port                 = port
      EXCEPTIONS
        not_found            = 1
        internal_error       = 2
        OTHERS               = 3 .
    now you can use something like below.
    concatenate `http://` server `:` port
    `/sap/bw/BEx?sap-language=EN&bsplanguage=EN&CMD=LDOC&INFOCUBE=<cubename>&QUERY=<queryname>` into bwurl.
    Hope this is clear. If not do get back.
    please note that if you are using webdispatcher then you may have to follow a different approach.
    Regards
    Raja

  • How to call web service on a button click in Web UI

    Hi Experts,
    I have a requirement to call/consume external web service on a button click in CRM web UI. Can someone help me with the code sample for invoking web service from crm web ui?
    Thanks in advance.
    Cheers,
    Sumit Mittal

    Consuming external web service directly without xi system in between.
    u2022     SE80
    u2022     Create Enterprise Service-> Choose object type as u201CService Consumeru201D
    u2022     Select URL HTTP destination in the next step
    u2022     Give the WSDL url in the url point
    u2022     Give any package name or store it in the local object.
    u2022     Corresponding proxies and data types will be generated inside the enterprise service tag
    Code sample for invoking the service via report.
    u2022     Create an object of the client proxy type here itu2019s io_clientproxy.
    u2022     Declare input and output parameters as per the structure of the service input/output parameters.
    u2022     Fill in input parameters what your service expect and call the object methods for relevant task.
    REPORT  ZWEBSERVICE_CREATNUPDATE.
    DATA: io_clientproxy TYPE REF TO zzco_user_data_service .
    DATA: output_crnup TYPE zzcreate_or_update_user_data1,
          input_crnup TYPE zzcreate_or_update_user_data_1.
    DATA :
           ls_param_crnup_in TYPE zzcreate_or_update_user_data, " CU input
           ls_param_crnup TYPE zzcreate_or_update_user_data_r, "CU Response
           ls_return_crnup  TYPE zzcrm_user, " CU Response
           ls_arg0 TYPE zzcrm_user.
    ls_arg0-first_name = 'shashank'.
    ls_arg0-last_name = 'testw/ouserid'.
    ls_arg0-org_name = 'Test_Org'.
    "ls_arg0-USER_ID = '369713'.
    ls_param_crnup_in-arg0 = ls_arg0.
    input_crnup-parameters = ls_param_crnup_in.
    TRY.
        CREATE OBJECT io_clientproxy
          EXPORTING
            logical_port_name = 'LP4'.
      CATCH cx_ai_system_fault .
    ENDTRY.
    TRY.
        CALL METHOD io_clientproxy->create_or_update_user_data
          EXPORTING
            input  = input_crnup
          IMPORTING
            output = output_crnup.
      CATCH cx_ai_system_fault .
      CATCH cx_ai_application_fault .
    ENDTRY.
    ls_param_crnup = output_crnup-parameters.
    ls_return_crnup = ls_param_crnup-return.
    IF ls_return_crnup IS INITIAL.
      WRITE : 'User creation failed'.
    ELSE.
      WRITE :  'Process Status : ',ls_return_crnup-process_status,
               /'User Id : ',ls_return_crnup-user_id,
                       /'First Name :',ls_return_crnup-first_name,
               /'Last Name :',ls_return_crnup-last_name,
               /'Org Name : ',ls_return_crnup-org_name.
    ENDIF.

Maybe you are looking for