How to call  URL from BADDI??

Hi,
I have a requirement to call URL from BADI, i tried to use 'CALL BROWSER' function module,
it works when we are working in GUI, but for portal/PCUI it gives sy-subrc = 2 ( Front end Error)
How to call a pop up page or URL from poral??
Thanks,
Manoj
Edited by: Manoj Lakhanpal on Sep 27, 2010 10:27 AM

Hi!
I'm using this code for calling a browser, you might try out as well...
MOVE 'http://www.sap.com' TO command.
    CONCATENATE 'url.dll,FileProtocolHandler'
                command
           INTO command
       SEPARATED BY space.
    MOVE 'rundll32' TO lv_application.
    CALL METHOD cl_gui_frontend_services=>execute
       EXPORTING
         APPLICATION            = lv_application
         PARAMETER              = command
       EXCEPTIONS
         CNTL_ERROR             = 1
         ERROR_NO_GUI           = 2
         BAD_PARAMETER          = 3
         FILE_NOT_FOUND         = 4
         PATH_NOT_FOUND         = 5
         FILE_EXTENSION_UNKNOWN = 6
         ERROR_EXECUTE_FAILED   = 7
         others                 = 8
Regards
Tamá

Similar Messages

  • How to call url from abap in background

    Hi,
    I could open url but it opens browser window
    i saw several threads on how to cal url in background but no good answer
    kindly help
    thanks
    B

    Hi,
    Try the following (primitive) example, it calls an url and display the result on screen.
    Hope this will help you.
    <pre>
    REPORT  test.
          CLASS lcx_http_client DEFINITION
          Minimal Error Handling
    CLASS lcx_http_client DEFINITION INHERITING FROM cx_static_check.
      PUBLIC SECTION.
        INTERFACES:
          if_t100_message.
        DATA:
           mv_method TYPE string,                               "#EC NEEDED
           mv_subrc  TYPE i.                                    "#EC NEEDED
        METHODS:
          constructor
            IMPORTING iv_method TYPE string  OPTIONAL
                      iv_subrc  TYPE i       OPTIONAL
                      iv_msgid  TYPE symsgid DEFAULT '00'
                      iv_msgno  TYPE i       DEFAULT 162.
    ENDCLASS.                    "lcx_http_client DEFINITION
          CLASS lcx_http_client IMPLEMENTATION
    CLASS lcx_http_client IMPLEMENTATION.
      METHOD constructor.
        super->constructor( ).
        mv_method = iv_method.
        mv_subrc  = iv_subrc.
        if_t100_message~t100key-msgid = iv_msgid.
        if_t100_message~t100key-msgno = iv_msgno.
        if_t100_message~t100key-attr1 = 'MV_METHOD'.
        if_t100_message~t100key-attr2 = 'MV_SUBRC'.
      ENDMETHOD.                    "constructor
    ENDCLASS.                    "lcx_http_client IMPLEMENTATION
          CLASS lcl_http_client DEFINITION
          Facade for if_http_client
    CLASS lcl_http_client DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          get_http_client_by_url
            IMPORTING iv_url           TYPE string
                      iv_proxy_host    TYPE string OPTIONAL
                      iv_proxy_service TYPE string OPTIONAL
                      PREFERRED PARAMETER iv_url
            RETURNING value(ro_http_client) TYPE REF TO lcl_http_client
            RAISING lcx_http_client.
        DATA:
          mr_http_client TYPE REF TO if_http_client.
        METHODS:
          send
            RAISING lcx_http_client,
          receive
            RAISING lcx_http_client,
          close
            RAISING lcx_http_client,
          get_response_header_fields
            RETURNING value(rt_fields) TYPE tihttpnvp,
          get_response_cdata
            RETURNING value(rv_data) TYPE string.
    ENDCLASS.                    "lcl_http_client DEFINITION
          CLASS lcl_http_client IMPLEMENTATION
    CLASS lcl_http_client IMPLEMENTATION.
      METHOD get_http_client_by_url.
        DATA: lv_subrc TYPE sysubrc.
        CREATE OBJECT ro_http_client.
        cl_http_client=>create_by_url( EXPORTING url                 = iv_url
                                                 proxy_host          = iv_proxy_host
                                                 proxy_service       = iv_proxy_service
                                       IMPORTING client              = ro_http_client->mr_http_client
                                       EXCEPTIONS argument_not_found = 1
                                                  plugin_not_active  = 2
                                                  internal_error     = 3
                                                  OTHERS             = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'GET_HTTP_CLIENT_BY_URL' iv_subrc = lv_subrc.
      ENDMETHOD.                    "get_http_client_by_url
      METHOD send.
        DATA: lv_subrc TYPE sysubrc.
        mr_http_client->send( EXCEPTIONS http_communication_failure = 5
                                         http_invalid_state         = 6
                                         http_processing_failed     = 7
                                         http_invalid_timeout       = 8
                                         OTHERS                     = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'SEND' iv_subrc = lv_subrc.
      ENDMETHOD.                    "send
      METHOD close.
        DATA: lv_subrc TYPE sysubrc.
        CALL METHOD mr_http_client->close
          EXCEPTIONS
            http_invalid_state = 10
            OTHERS             = 999.
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'CLOSE' iv_subrc = lv_subrc.
      ENDMETHOD.                    "close
      METHOD receive.
        DATA: lv_subrc TYPE sysubrc.
        mr_http_client->receive( EXCEPTIONS http_communication_failure = 9
                                            http_invalid_state         = 10
                                            http_processing_failed     = 11
                                            OTHERS                     = 999 ).
        CHECK sy-subrc <> 0.
        lv_subrc = sy-subrc.
        RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'RECEIVE' iv_subrc = lv_subrc.
      ENDMETHOD.                    "receive
      METHOD get_response_header_fields.
        mr_http_client->response->get_header_fields( CHANGING fields = rt_fields ).
      ENDMETHOD.                    "get_response_header_fields
      METHOD get_response_cdata.
        rv_data = mr_http_client->response->get_cdata( ).
      ENDMETHOD.                    "get_response_cdata
    ENDCLASS.                    "lcl_http_client IMPLEMENTATION
    PARAMETERS: p_url   TYPE string DEFAULT 'http://www.google.com' LOWER CASE,
                p_phost TYPE string DEFAULT 'your_proxy_here'       LOWER CASE,
                p_pserv TYPE string DEFAULT '8080'                  LOWER CASE.
    *===================================================================================
    START-OF-SELECTION.
      TRY .
          DATA: gt_data          TYPE string_table,
                gv_data          TYPE string,
                gr_http_client   TYPE REF TO lcl_http_client,
                go_cx            TYPE REF TO lcx_http_client.
          "Initialize the http client
          gr_http_client =
            lcl_http_client=>get_http_client_by_url( iv_url           = p_url
                                                     iv_proxy_host    = p_phost
                                                     iv_proxy_service = p_pserv ).
          "Call the specified URL and retrieve data from the response
          gr_http_client->send( ).
          gr_http_client->receive( ).
          gv_data = gr_http_client->get_response_cdata( ).
          "Its over....
          gr_http_client->close( ).
          "Display result
          REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN gv_data WITH cl_abap_char_utilities=>newline.
          SPLIT gv_data AT cl_abap_char_utilities=>newline INTO TABLE gt_data.
          LOOP AT gt_data INTO gv_data.
            WRITE: / gv_data.
          ENDLOOP.
        CATCH lcx_http_client INTO go_cx.
          MESSAGE go_cx TYPE 'S' DISPLAY LIKE 'E'.
      ENDTRY.
    </pre>

  • Calling url from a form - err using ".value" method

    I'm trying to call url from a form, which seems to be the subject of many of these Posts.
    I have a form with a combo box/LOV and a button. The LOV will read a url into the combo box from a table of url's.
    I used the following code in the "OnClick" Java Script Event Handler section, which I pieced together from other posts in this and other forums. (i.e. I'm a pl/sql programmer trying to use Java Scripts for the first time).
    OnClick
    var X = FORM_DRWING.DEFAULT.A_DRILLDOWN_PATH.value;
    run_form(x);
    When I attempt to run this form from the "manage" window, I get a run time error "FORM_DRWING is undefined" upon clicking the button. FORM_DRWING "IS" the name of the form!
    The runform() function in the "before displying form" pl/sql code section is
    htp.p('<script language="JavaScript1.3">
    < !--
    function runForm(v_link)
    window.open(V_LINK);
    //-->
    </script>');
    This code was from yet another Post.
    Any help would be appreciated.
    Thanks, Larry
    null

    Hi Larry,
    the problem could be that you need to preface your form with 'document.'.
    i.e.
    var X = document.FORM_DRWING.DEFAULT.A_DRILLDOWN_PATH.value;
    Regards Michael

  • Related documents or links on how to call webservices from WDJ

    Hi all
    i need documents & links on how to call webservices from Webdynpro for Java.
    if anybody send the documents on sample scenarios on the same then it is the great help to me...
    Thanks
    Sunil

    Hi Sunil,
    May these links help you.
    http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/frameset.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/64/0e0ffd314e44a593ec8b885a753d30/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/d2/0357425e060d53e10000000a155106/frameset.htm
    and  the below thread to call weservices in java.
    Re: How to call a web service from Java
    Regards,
    Supraja

  • How get browser URL from portlet JSR-168?

    I use Oracle Portal. And I have problem.
    How get browser URL from portlet JSR-168?

    Normaly it is
    http://server:port/portletContextRoot
    Did you create the portlet with JDeveloper? When you dpeloy the portlet to your application server, JDeveloper should output the URL of the portlet test page in the deployment output feedback.

  • Call url from ABAP program

    Hi friends,
    Can we call a web URL from a ABAP program?
    Is there anyway its possible ? if yes how?
    Please provide the solution.
    Thanks & Regards
    kapil

    Hi Kapil,
    <b>Look at the below example program:-</b>
    REPORT  zget_mayors_for_cities.
    DATA: it_citymayors TYPE TABLE OF zcitymayors,
          wa_citymayors LIKE LINE OF it_citymayors,
          mayor TYPE full_name,
          trash TYPE string.
    PARAMETERS: s_city TYPE s_city LOWER CASE.
    SELECT * FROM zcitymayors INTO TABLE it_citymayors
      WHERE city LIKE s_city.
    * HTTP Client according to
    * /people/thomas.jung3/blog/2005/07/01/bsp-create-a-weather-magnet-using-xml-feed-from-weathercom
    DATA: client TYPE REF TO if_http_client,
          <b>url TYPE string,</b>
          xml TYPE xstring,
          c_xml TYPE string,
          city TYPE string.
    * Converter
    DATA: l_convin   TYPE REF TO cl_abap_conv_in_ce.
    LOOP AT it_citymayors INTO wa_citymayors.
    * Use the Progress Indicator to show the user which City is processed
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          percentage = sy-index
          text       = wa_citymayors-city.
      city = wa_citymayors-city.
    * Spaces have to be replaced by _ in the URL
      REPLACE FIRST OCCURRENCE OF space IN city WITH '_'.
    <b>  CONCATENATE
        'http://de.wikipedia.org/wiki/Spezial:Export/' city
           INTO url.</b>
    ****Create the HTTP client
      TRY.
    <b>      CALL METHOD cl_http_client=>create_by_url
            EXPORTING
              url    = url
            IMPORTING
              client = client
            EXCEPTIONS
              OTHERS = 1.</b>
          client->send( ).
          client->receive( ).
          xml = client->response->get_data( ).
          client->close( ).
        CATCH cx_root.
          WRITE: / 'HTTP Connection error: ', city.
      ENDTRY.
    * Wikipedia does not provide a encoding with the returned XML
    * so we have to do the conversion manually
      TRY.
          CALL METHOD cl_abap_conv_in_ce=>create
            EXPORTING
              encoding = 'UTF-8'
              input    = xml
              endian   = 'L'
            RECEIVING
              conv     = l_convin.
          CALL METHOD l_convin->read
            IMPORTING
              data = c_xml.
        CATCH cx_root.
          WRITE: / 'Problem during Character conversion: ', city.
      ENDTRY.
    ****Transform XML to ABAP Values
      TRY.
          CALL TRANSFORMATION zwikipedia_mayor_to_abap
          SOURCE XML c_xml
          RESULT mayor = mayor.
        CATCH cx_root.
          WRITE: / 'Data loss during transformation: ', city.
      ENDTRY.
    * Some Mayors already have pecial Pages
      REPLACE FIRST OCCURRENCE OF '[[' IN mayor WITH ''.
      REPLACE FIRST OCCURRENCE OF ']]' IN mayor WITH ''.
    * Some Mayors are members of a Party
      SPLIT mayor AT '(' INTO mayor trash.
      wa_citymayors-mayor = mayor.
      WRITE: / wa_citymayors-city.
    * Update Database
      IF NOT wa_citymayors-mayor IS INITIAL.
        UPDATE zcitymayors FROM wa_citymayors.
        WRITE: wa_citymayors-mayor.
      ENDIF.
    ENDLOOP.
    Look at the below thread for more info:-
    /people/gregor.wolf3/blog/2006/06/29/use-data-from-wikipedia
    Regards
    Sudheer

  • How to call ExportCollectionActionListener from bean

    In my scenario, I have to get a confirmation from user as "Are you sure you want to export table data to excel document?"
    And when user clicks "YES", the data should be exported.
    And I'm trying to achieve this using bean method, where in I can know whether user clicked "YES" or "NO".
    But in here, how to call the "ExportCollectionActionListener" ?

    check [url https://blogs.oracle.com/jdevotnharvest/entry/invoking_af_exportcollectionactionlistener_from_java]Invoking af:exportCollectionActionListener from Java 

  • How to call Servlet from jsp page and how to run this app using tomcat..?

    Hi ,
    I wanted to call servlet from jsp action i.e. on submit button of JSP call LoginServlet.Java file.
    Please tell me how to do this into jsp page..?
    Also i wanted to execute this application using tomcat.
    Please tell me how to do this...? what setting are required for this...? what will be url ..??
    Thanks.

    well....my problem is as follows:
    whenever i type...... http://localhost:8080/appName/
    i am getting 404 error.....it is not calling to login.jsp (default jsp)
    but when i type......http://localhost:8080/appName/login.do........it executes servlet properly.
    Basically this 'login.do' is form action (form action='/login.do').....and i wanted to execute this from login jsp only.(from submit button)
    In short can anyone please tell me how to diaplay jsp page using tomcat 5.5
    plz help me.

  • How to call WDA from PCUI link.............

    Hi friends,
    I want to call a custom WDA from a standard PCUI button. Can someone tell me how to call this.
    Once the stndard button in PCUI view is clicked, my WDA has to be displayed.
    thanks in advance,
    Niraja

    Hi,
    As said by Thomas, the WDA is just like another HTML page with URL. So what you can do is Put an entry for the button in the action list. Then in application layout  put an entry for the new WDA application(specify it as popup). select the page type as HTML.
    This is more PCUI work than a WDA work.
    Thanks,
    selvakumar M.

  • Calling URL  from Web IC

    Hi All,
       I have to call a URL from the Navigation bar of Web IC.
    I have already created a navigation bar profile and links created. but how to call a particular URL either in the personalized or standard area of the Navbar!.
    is there anything i have to do with transaction launcher?.
    or else any method to attach the URL to the navbar link!.
    please help!.
    Thank you,
    sudeep v d.

    Hi Johannes,
    I got the problem solved. there is an option
    'Define URLs and Parameters' in the Transaction Launcher.
    ( CRM version 4.0 ).
    where you have to create an ID and define the corresponding URL.
    as the next step you have to goto to transaction auncher wizard and input this ID + Navbar ID, class name etc.
    Regards,
    sudeep v d.

  • How to call servlet from jsp

    i m trying to call it from jsp using
    <a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
    but its giving error..
    type Status report
    message HTTP method GET is not supported by this URL
    description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

    i m trying to call it from jsp using
    <a href="../purchaseP?orderno=<%=pno%>"><%=pno%></a>
    but its giving error..
    type Status report
    message HTTP method GET is not supported by this URL
    description The specified HTTP method is not allowed
    for the requested resource (HTTP method GET is not
    supported by this URL).Are you implementing the doGet or doPost method in your servlet? If you are calling from a hyperlink then it needs to be implementing the GET method. To access the POST method use a html form.

  • How to call LSMW from a Report program

    Hi,
    I have a requirment of extending vendor master data (Companycode data and Purchasing Organization data ) through Tcode XK02 using LSMW.Also I need to generate an error log file for validating the data from flat file and  must have an export option of the error log file.
    Can you help me how to proceed on this in steps.
    Also pls let me know how to call LSMW transaction through a Report.
    Based on the selection criteria I need to maintain two source structues,one for companycode data and the other for Purchasing Orgnization data for uploading  data thru LSMW.How to do this?
    pls respond ASAP,
    Thanks,
    Nagendra

    Hi,
    create 2 LSMW object (under same project and subproject)..
    one for extended vendor master data for company code data and other for  extended purchase organization data for company code data.
    Now check the radio buttons and based on that populate ur LSMW object.
    Store project
      project = < >.
    Store subproject
      subproj = < >.
    Store object
      object  = '6GSC022_TS3'.
    if r_ccode = 'X'.
    Store object
      object  = < >.
    else.
    Store object
      object  = < >.
    endif.
    Call the function module to display object (LSMW) maintenance screen
      CALL FUNCTION '/SAPDMC/LSM_OBJ_STARTER'
        EXPORTING
          project        = project
          subproj        = subproj
          object         = object
        EXCEPTIONS
          no_such_object = 1
          OTHERS         = 2.
    Generating error log:
    After the checking the field if u think for this u need to generate error message then In the Maintain Field Mapping and Conversion Rules option under the required field write the following code:
    data: v_msgtxt(100) type c.
    message  <msg ID>    <message type>   <message no>
                     with   <var1>  <var2>
                     into v_msgtxt.
    write v_msgtxt.
    Follow the next step in LSMW object till you reach the option  Convert Data.
    After you execute this option you will get the desired message here.
    Regards,
    Joy.

  • How to call methods from within run()

    Seems like this must be a common question, but I cannot for the life of me, find the appropriate topic. So apologies ahead of time if this is a repeat.
    I have code like the following:
    public class MainClass implements Runnable {
    public static void main(String args[]) {
    Thread t = new Thread(new MainClass());
    t.start();
    public void run() {
    if (condition)
    doSomethingIntensive();
    else
    doSomethingElseIntensive();
    System.out.println("I want this to print ONLY AFTER the method call finishes, but I'm printed before either 'Intensive' method call completes.");
    private void doSomethingIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    private void doSomethingElseIntensive() {
    System.out.println("I'm never printed because run() ends before execution gets here.");
    return;
    }Question: how do you call methods from within run() and still have it be sequential execution? It seems that a method call within run() creates a new thread just for the method. BUT, this isn't true, because the Thread.currentThread().getName() names are the same instead run() and the "intensive" methods. So, it's not like I can pause one until the method completes because they're the same thread! (I've tried this.)
    So, moral of the story, is there no breaking down a thread's execution into methods? Does all your thread code have to be within the run() method, even if it's 1000 lines? Seems like this wouldn't be the case, but can't get it to work otherwise.
    Thanks all!!!

    I (think I) understand the basics.. what I'm confused
    about is whether the methods are synced on the class
    type or a class instance?The short answer is; the instance for non-static methods, and the class for static methods, although it would be more accurate to say against the instance of the Class for static methods.
    The locking associated with the "sychronized" keyword is all based around an entity called a "monitor". Whenever a thread wants to enter a synchronized method or block, if it doesn't already "own" the monitor, it will try to take it. If the monitor is owned by another thread, then the current thread will block until the other thread releases the monitor. Once the synchronized block is complete, the monitor is released by the thread that owns it.
    So your question boils down to; where does this monitor come from? Every instance of every Object has a monitor associated with it, and any synchronized method or synchonized block is going to take the monitor associated with the instance. The following:
      synchronized void myMethod() {...is equivalent to:
      void myMethod() {
        synchronized(this) {
      ...Keep in mind, though, that every Class has an instance too. You can call "this.getClass()" to get that instance, or you can get the instance for a specific class, say String, with "String.class". Whenever you declare a static method as synchronized, or put a synchronized block inside a static method, the monitor taken will be the one associated with the instance of the class in which the method was declared. In other words this:
      public class Foo {
        synchronized static void myMethod() {...is equivalent to:
      public class Foo{
        static void myMethod() {
          synchronized(Foo.class) {...The problem here is that the instance of the Foo class is being locked. If we declare a subclass of Foo, and then declare a synchronized static method in the subclass, it will lock on the subclass and not on Foo. This is OK, but you have to be aware of it. If you try to declare a static resource of some sort inside Foo, it's best to make it private instead of protected, because subclasses can't really lock on the parent class (well, at least, not without doing something ugly like "synchronized(Foo.class)", which isn't terribly maintainable).
    Doing something like "synchronized(this.getClass())" is a really bad idea. Each subclass is going to take a different monitor, so you can have as many threads in your synchronized block as you have subclasses, and I can't think of a time I'd want that.
    There's also another, equivalent aproach you can take, if this makes more sense to you:
      static final Object lock = new Object();
      void myMethod() {
        synchronized(lock) {
          // Stuff in here is synchronized against the lock's monitor
      }This will take the monitor of the instance referenced by "lock". Since lock is a static variable, only one thread at a time will be able to get into myMethod(), even if the threads are calling into different instances.

  • How to call BAPI from ABAP Inbound Proxy

    Hi All
    Can some one provide/giude  a sample code on how to call a BAPI from generated Method (Inbound Proxy) and how are the table parameters passed from Proxy to BAPI.
    Thanks
    Ravi/

    Hello Ravi,
    In the proxy before calling the BAPI, construct the table, fill it with the appropiate values by lopping over the proxy request object. Now use this table for calling BAPI
    Cheers,
    Naveen

  • How to call RFC from Power Builder

    Hi,
    I am using Power Builder Tools and I want to know how can i call RFC from Power Builder
    Thanks for ur reply

    Hi,
    Although I have not worked with Powerbuilder, I am sure if you have a certain level of proficiency with it, you will be able to code your logic that will call your wrappers written in VB/C/.NET etc. Check out the wonderful weblog by Thomas Jung on integrating ActiveX controls with ABAP Control Framework at https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/995. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
    Do get back if you have further queries.
    Regards
    Message was edited by: Shehryar Khan

Maybe you are looking for