Code to call url in abap program

code to call url in abap program using cl_http requests and save the outcome to a location  in a file

See the below program
REPORT zbrowser .
TABLES : sscrfields.
INCLUDE .
CONSTANTS: htmlcntl_eventid_on_navigate TYPE i VALUE 1.
CONSTANTS: htmlcntl_eventid_navigate_com TYPE i VALUE 2.
DATA : h_html_ctrl TYPE cntl_handle,
repid TYPE sy-repid,
dynnr TYPE sy-dynnr,
cmd TYPE sy-ucomm,
flag,disp.
DATA : it_exclude LIKE TABLE OF rsexfcode WITH HEADER LINE.
SELECTION-SCREEN : FUNCTION KEY 1,
FUNCTION KEY 2,
FUNCTION KEY 3,
FUNCTION KEY 4,
FUNCTION KEY 5.
General Browser to View
Files/Pictures & WebPages
© 2005 SAP AG 2
SELECTION-SCREEN COMMENT 45(50) comment1.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 2(28) comment2 FOR FIELD url.
SELECTION-SCREEN POSITION 31.
PARAMETERS : url(1064) LOWER CASE .
SELECTION-SCREEN PUSHBUTTON 79(4) open USER-COMMAND open.
SELECTION-SCREEN END OF LINE.
INITIALIZATION.
comment1 = 'ABAP INTERNET EXPLORER'.
comment2 = 'Enter URL/Filename To Open :'.
open = icon_transfer .
sscrfields-functxt_05 = icon_sap.
sscrfields-functxt_04 = icon_booking_stop.
sscrfields-functxt_03 = icon_refresh.
sscrfields-functxt_02 = icon_arrow_right.
sscrfields-functxt_01 = icon_arrow_left.
repid = sy-repid.
dynnr = '1000'.
it_exclude-fcode = 'ONLI'.
APPEND it_exclude.
it_exclude-fcode = 'INFO'.
APPEND it_exclude.
*Changing GUI status
CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
EXPORTING
p_status = sy-pfkey
p_program = repid
TABLES
p_exclude = it_exclude.
CALL FUNCTION 'CONTROL_INIT' .
IF sy-subrc <> 0.
EXIT.
ENDIF.
CALL FUNCTION 'HTMLCNTL_CREATE'
EXPORTING
owner_repid = repid
link_repid = repid
dynnr = dynnr
handle = h_html_ctrl
EXCEPTIONS
control_install_error = 1
create_error = 2
General Browser to View
Files/Pictures & WebPages
© 2005 SAP AG 3
OTHERS = 3
IF sy-subrc <> 0.
EXIT.
ENDIF.
CALL FUNCTION 'HTMLCNTL_INIT'
EXPORTING
h_control = h_html_ctrl
left = 1
top = 2
width = 143
height = 37
register_event_on_navigate = 'X'
cb_form_navigate_complete = 'ON_CONTROL_EVENT'
EXCEPTIONS
cntl_system_error = 1
cntl_error = 2
dp_create_error = 3
dp_install_error = 4
dp_error = 5
create_browser_error = 6
init_error = 7
OTHERS = 8
IF sy-subrc <> 0.
EXIT.
ENDIF.
CALL FUNCTION 'CONTROL_FLUSH'.
AT SELECTION-SCREEN.
cmd = sscrfields-ucomm.
CASE cmd.
WHEN 'OPEN'.
PERFORM load_html_page.
CALL FUNCTION 'CONTROL_FLUSH'.
WHEN 'FC01'. "BACK
CALL FUNCTION 'HTMLCNTL_GO_BACK'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc <> 0.
EXIT.
ENDIF.
General Browser to View
Files/Pictures & WebPages
© 2005 SAP AG 4
PERFORM get_current_url.
WHEN 'FC02'. "FORWARD
CALL FUNCTION 'HTMLCNTL_GO_FORWARD'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc <> 0.
EXIT.
ENDIF.
PERFORM get_current_url.
WHEN 'FC03'. "REFRESH
CALL FUNCTION 'HTMLCNTL_DO_REFRESH'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc <> 0.
EXIT.
ENDIF.
PERFORM get_current_url.
WHEN 'FC04'. "STOP
CALL FUNCTION 'HTMLCNTL_STOP'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WHEN 'FC05'. "GO TO HOME
CALL FUNCTION 'HTMLCNTL_GO_HOME'
EXPORTING
h_control = h_html_ctrl.
IF sy-subrc <> 0.
EXIT.
ENDIF.
PERFORM get_current_url.
CALL FUNCTION 'CONTROL_FLUSH'.
WHEN OTHERS.
General Browser to View
Files/Pictures & WebPages
© 2005 SAP AG 5
CALL FUNCTION 'CONTROL_DISPATCH'
EXPORTING
fcode = cmd.
CALL FUNCTION 'CONTROL_FLUSH'.
ENDCASE.
CLEAR cmd.
CALL FUNCTION 'CONTROL_FLUSH'.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR url.
PERFORM get_file_name.
PERFORM load_html_page.
*& Form get_page_name
Get Page Name
FORM get_file_name.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = ' '
def_path = 'C: '
mask = ',.,..'
mode = 'o'
title = 'Browse to Open'
IMPORTING
filename = url
RC =
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDFORM. " get_page_name
*& Form load_html_page
TO load the file (URL)
General Browser to View
Files/Pictures & WebPages
© 2005 SAP AG 6
FORM load_html_page.
CALL FUNCTION 'HTMLCNTL_SHOW_URL'
EXPORTING
h_control = h_html_ctrl
url = url.
IF sy-subrc <> 0.
EXIT.
ENDIF.
flag = 'X'.
ENDFORM. " load_html_page
*& Form get_current_url
Get Current URL
FORM get_current_url.
CALL FUNCTION 'HTMLCNTL_GET_CURRENT_URL'
EXPORTING
h_control = h_html_ctrl
IMPORTING
url = url.
ENDFORM. " get_current_url
Callback form for the event 'NavigateComplete'
callback on_control_event.
CALL FUNCTION 'CONTROL_GET_EVENT_PARAM'
EXPORTING
h_control = h_html_ctrl
param_id = 0
CHANGING
return = url.
PERFORM get_current_url.
endcallback.
Reward Points if it is helpful
Thanks
Seshu

Similar Messages

  • 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

  • CALLING BAPI in ABAP program

    Hi,
    I want to call BAPI_MATERIAL_AVAILABILITY in ABAP program. Please give me some sample code how i can do this??? Please help

    hi,
    REPORT  YATP.
    DATA: LV_TABIX  LIKE SY-TABIX,
            LT_WMDVSX LIKE BAPIWMDVS OCCURS 0 WITH HEADER LINE,
            LT_WMDVEX LIKE BAPIWMDVE OCCURS 0 WITH HEADER LINE.
    data ET_PROCUREMENT_ITEM LIKE BBPPOGN.
      LV_TABIX = SY-TABIX.
      CLEAR: LT_WMDVSX, LT_WMDVEX.
      REFRESH: LT_WMDVSX, LT_WMDVEX.
    Fill communication table
      LT_WMDVSX-REQ_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
      LT_WMDVSX-REQ_QTY  = ET_PROCUREMENT_ITEM-QUANTITY.
      APPEND LT_WMDVSX.
    Availability check with check rule '03'
      CALL FUNCTION 'BAPI_MATERIAL_AVAILABILITY'
           EXPORTING
                PLANT      = 'ALB1'
                MATERIAL   = '100000223'
                UNIT       = 'EA'
                CHECK_RULE = '03'
           TABLES
                WMDVSX     = LT_WMDVSX
                WMDVEX     = LT_WMDVEX
           EXCEPTIONS
                OTHERS     = 1.
      IF SY-SUBRC EQ 0.
        READ TABLE LT_WMDVEX WITH KEY
                             COM_DATE = ET_PROCUREMENT_ITEM-DELIV_DATE.
        IF SY-SUBRC EQ 0.
          ET_PROCUREMENT_ITEM-AVAIL_QTY = LT_WMDVEX-COM_QTY.
        ENDIF.
      ENDIF.
      write :/ et_procurement_item-avail_qty.
      Loop at lt_wmdvex.
      write : / lt_wmdvex-COM_QTY,
              lt_wmdvex-BDCNT,
               lt_wmdvex-REQ_QTY.
    endloop.
    This is my program  but no value written  for WMDVEX.

  • How do we call smartforms in abap program or web services

    how do we call smartforms in abap program or web services
    How many types of smartforms are there?
    points will be rewarded

    Hi
    See this sample program
    Using the fun module smartform is called from the program
    Calling SMARTFORMS from your ABAP program
    REPORT ZSMARTFORM.
    Calling SMARTFORMS from your ABAP program.
    Collecting all the table data in your program, and pass once to SMARTFORMS
    SMARTFORMS
    Declare your table type in :-
    Global Settings -> Form Interface
    Global Definintions -> Global Data
    Main Window -> Table -> DATA
    http://sapr3.tripod.com
    TABLES: MKPF.
    DATA: FM_NAME TYPE RS38L_FNAM.
    DATA: BEGIN OF INT_MKPF OCCURS 0.
    INCLUDE STRUCTURE MKPF.
    DATA: END OF INT_MKPF.
    SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.
    SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.
    MOVE-CORRESPONDING MKPF TO INT_MKPF.
    APPEND INT_MKPF.
    ENDSELECT.
    At the end of your program.
    Passing data to SMARTFORMS
    <b>call function 'SSF_FUNCTION_MODULE_NAME'
    exporting
    formname = 'ZSMARTFORM'</b>
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    FM_NAME = FM_NAME
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3.
    if sy-subrc <> 0.
    WRITE: / 'ERROR 1'.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    call function <b>FM_NAME</b>
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    CONTROL_PARAMETERS =
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    GS_MKPF = INT_MKPF
    EXCEPTIONS
    FORMATTING_ERROR = 1
    INTERNAL_ERROR = 2
    SEND_ERROR = 3
    USER_CANCELED = 4
    OTHERS = 5.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Is it possible to call website from ABAP Program?

    Hi Experts,
           Is it possible to call website from ABAP Program?
    It is very Urgent Help me.
    Regards,
    Ashok.

    Hi,
    Check the following program:
    REPORT ZURL NO STANDARD PAGE HEADING.
    DATA: BEGIN OF URL_TABLE OCCURS 10,
    L(25),
    END OF URL_TABLE.
    URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
    URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
    LOOP AT URL_TABLE.
      SKIP. FORMAT INTENSIFIED OFF.
      WRITE: / 'Single click on '.
      FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
      WRITE: URL_TABLE. HIDE URL_TABLE.
      FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
      WRITE: 'to go to', URL_TABLE.
    ENDLOOP.
    CLEAR URL_TABLE.
    AT LINE-SELECTION.
    IF NOT URL_TABLE IS INITIAL.
      CALL FUNCTION 'WS_EXECUTE'
           EXPORTING
                program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
                commandline     = URL_TABLE
                INFORM         = ''
              EXCEPTIONS
                PROG_NOT_FOUND = 1.
      IF SY-SUBRC <> 0.
         WRITE:/ 'Cannot find program to open Internet'.
      ENDIF.
    ENDIF.
    Regards,
    Bhaskar

  • Calling Actions in ABAP Programming.

    Hi,
    Is it possible to call ACTIONS in ABAP programming?
    Regards,

    Hi Pushpa,
    The receiver type is the workflow you want to start, when the event occurs, of corresponding object type.
    I Never had the need to develop at workflow level, but search a little in the foruns and you'll find a lot of info about this. I also advice you to open new threads when asking new questions: It's more appropriate and will bring you more answers
    Kind regards,
    Garcia

  • Calling BSP from abap program by interfacing EP

    Dear Friends...
    I am cslling a BSP... from an ABAP program... for that I have used this class and also a function module to ckeck.. actually from the abap program it invoks the BSP page very nicely and as my logic for invoking the BSP is a part of the Business Object and it is associated with the Enterprise portal so... when i reach the ep and trigger that business object to instantiate the BSP page from my calling logic of abap... it goes to the ITS and port 80 or something and didnt produce the BSP.. and only the blank screen was there...kindly help me how i am supposed to instantiate the BSP from properly from ABAP by interfacing the EP... my code is given below...
    data :
    lv_url type string.
    concatenate
    'http://sapdevbp.sbic.co.za:8041/sap(bD1lbiZjPTIwMA==)'
    '/bc/bsp/sap/z_updatemng/bp.htm?bpid=' object-key-businesspartnerid
    into lv_url.
    call method cl_gui_frontend_services=>execute
    exporting
    document = lv_url
    exceptions
    others = 1.
    please help....
    me...
    regards
    Naim

    hi ,
    you can try using FM CALL_BROWSER in your report(ABAP code)to call bsp,like
    data url(200) type c.
    url = 'http://<server>.<domain><port>:'.
    concatenate url '/sap/bc/bsp/sap/' into url.
    concatenate url 'your_bsp_app_name/your_start_page.bsp' into url.
    concatenate url '?sap-user=<userid>' into url.
    concatenate url '&sap-password=<passowrd>' into url.
    CALL FUNCTION 'CALL_BROWSER'
      EXPORTING
        URL                          = url
       WINDOW_NAME                  = ' '
       NEW_WINDOW                   = ' '
       BROWSER_TYPE                 =
       CONTEXTSTRING                =
    EXCEPTIONS
       FRONTEND_NOT_SUPPORTED       = 1
       FRONTEND_ERROR               = 2
       PROG_NOT_FOUND               = 3
       NO_BATCH                     = 4
       UNSPECIFIED_ERROR            = 5
       OTHERS                       = 6
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    For this to work you have to enable SSO on your server.
    you can check if it is enabled or not by runnning the BSP application "SYSTEM" ,page "SSO2TEST.htm" .
    Follow the instructions on the page for testing.
    This may not be a great way as your userid password are passed via URL,still it works
    Cheers!

  • How to call view in abap program

    HI,
       Is that possible to call & display view in the abap program.
    Thanks & Regards
    Guhapriyan

    Hi,
    You can declare a view using the tables statement itself.
    For example -
    tables AUFKV.
    Regards,
    Anand Mandalika.

  • Call workflow from ABAP program

    created a zbusiness object (ZPRODH)with
    one key field product hierarchy,
    one attribute level number and
    one method display.
    I tested that zobject and using this object created workflow to display product hierarchy ,it is displaying it. now I have to call it from one abap program.
    In the abap program I am calling the funcion module, I
    CALL FUNCTION 'SWW_WI_START_SIMPLE'
    EXPORTING
    TASK = TASK
    IMPORTING
    WI_ID = WI_ID
    TABLES
    AGENTS = AGENTS
    WI_CONTAINER = WI_CONTAINER.
    It is calling the workflow and subrc is 0, but not passing the value to the workflow. Because of that the method is not working, any idea?
    Thanks in advance

    ttpa,
    Please check this thread:
    Re: Workflow from abap program
    Also check that your Fm do requires any explicit commit or not?
    Hope it will help u
    Cheers
    Jai

  • How to create relationship to call PO13 in ABAP program.

    Hi,
    Could anybody help me how to create relationship (like PO13) in abap program. Do we have any Function modules or any other way?
    Regards,
    Ram.

    Hi,
    You can use function module RH_INSERT_INFTY. There are plenty of threads of the forum on how to use it.
    Donnie

  • Call an URL with ABAP program (Method POST)

    Hi everyone,
      I need to call an URL for example "www.google.com?q=hello" with ABAP using POST method.
      Like the FM "Call_Browser", but my variable q=hello need to be passed with POST method.
    Any idea ?
    Thanks.

    here is one example I use from abap to call a web browser ITS solution with a project number, I guess you can adapt the it for your purpose?
          check <data>-pspid is not initial.
          concatenate gv_pfs_link
                      'zpfs2?~okcode=PROJ_SEL&zpspid=<###>&sel_action=X'
          into lv_url.
          replace '<###>' with <data>-pspid into lv_url.
          condense lv_url no-gaps.
          cl_gui_frontend_services=>execute(
            exporting document = lv_url ).

  • How to call Webservice in abap Program

    Hi Guys,
    How can i call a abap webservice located in another server(CRM) in Bpc BADI.Is this web service is thing is possible??

    Hi,
    For calling a web service first you have to Create Proxy object using web service URL or WSDL file.
    and create logical port for that URL.
    This will generate Class and method in your system.
    After that you can use this class and method to call this web service.
    Regards,
    Arpit

  • Call variant from ABAP program

    Hi all,
    The users have created a variant that they use when they run their report.  When they select the variant it works fine, but they want the program to run the variant for them.  Can anyone give me some ideas as to where I can go to see some sample code, so I can try to figure out how to do this, please?
    Thanks

    Hi,
    you can use function module below to get the values for the variant user has created
    AT SELECTION-SCREEN OUTPUT. 
    CALL FUNCTION 'RS_VARIANT_CONTENTS'
          EXPORTING
            report               = Report Name
            variant              = Variant name
          TABLES
            valutab              = it_valutab
          EXCEPTIONS
            variant_non_existent = 1
            variant_obsolete     = 2
            OTHERS               = 3.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Then LOOP AT IT_VALUTAB INTO WA_VALUTAB WHERE SELNAME = 'YOUR FIRST SELECT OPTION NAME such as S_VBELN'.
               MOVE WA_VALUTAB-SIGN,WA_VALUTAB-OPTION, WA_VALUTAB-LOW, WA_VALUTAB-HIGH to the corresponding fields of your select option i.e. S_VBELN.
        APPEND S_VBLEN.
       ENDLOOP.
    Similarly Loop at IT_VALUTAB for the remaining fields on the selection screen and append the values in the select options.
    Please award points if it solves your problem.
    Cheers
    sharmistha

  • 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>

  • Call winhelp from ABAP programs

    Hi,
    I'm trying to display a windows help file in my ABAP application.
    The idea: by pressing the info-button it should display the file "Info.chm".
    I can display the file, if it is placed locally on the client machine, but I
    want to store it in the system somehow, so that it is available to all of the
    users.
    How can I place it in some repository, and later call the HtmlHelp Application?
    I saw an old example calling
    CALL FUNCTION 'WIN_HELP' FROM 'SAP_GUI'
    but it doesn't work anymore.
    Best regards,
    Stanimir

    Brad,
    I created the object in the SAP Web repository, transaction SMW0.  These are the attributes of the object.
    Z_SAP_HELP     fileextension     .chm
    Z_SAP_HELP     filename     C:\Temp\SAP_help.chm
    Z_SAP_HELP     filesize     28686
    Z_SAP_HELP     mimetype     chm
    Z_SAP_HELP     version          00001
    I created a new Mine type: chm  with extension  *.chm
    I associated %SystemRoot%\hh.exe as the editor for Mime type chm.
    This worked fine for me, but my colleague was unable to successfully run SHOW_WEB_OBJECT until he also set up the editor associated with Mime type chm.  Is there a way to systemically set up the association between a mime type and the editor so that each person does not have to go through this process?
    Thanks
    Bruce

Maybe you are looking for

  • Apple TV monitor question

    Okay here is a tough one. I have an Apple TV, a MacBook, a wireless keyboard, and a Samsung HD flat screen TV, 42". Can i use the Samsung flatscreen as a monitor [42"] for the MacBook, using the wirelesss Apple TV? For example if I wanted to use the 

  • System settings for XI

    Hi, Could some one please explain me on the important steps/settings to do for accessing XI system at remote from our laptop ? Would be better if someone provides in a step-by-step process? Regards, Alex.

  • ICR Process 002 - Ledger Definition Problem

    Hello,           For accounts where the flag "Only Balances in Local Currency" has been set, the special ledger line item for that account is in Local Currency rather than Document currency. Proper reconcilliation is then no longer possible due to di

  • Unexpected Results Query of Queries

    assume you have a query named q1 with more than 1 record. What would expect to q2 to look like? <cfquery name="q2" dbtype="query"> select count(*) as abc from q1 where 1 = 2 </cfquery> If you run it, were your expections met? Mine certainly were not.

  • Can we modify a Standard Smartform?

    Hi Folks, Please clear the following doubts:- 1.Can we modify a Std Smartform.It is allowing us to change the logo and all the windows too.If so let me know the logic behind it as I was in a thought that whatever it may be we can't modify any sap sta