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
Similar Messages
-
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 -
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 -
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 advancettpa,
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 -
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
Naimhi ,
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 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
BHi,
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,
StanimirBrad,
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 -
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?
ThanksHi,
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 -
Call SXPG _ CALL _ SYSTEM from ABAP program
Hi,
Someone may help me? I need to call the function module SXPG _ CALL _ SYSTEM from ABAP program for to encrypt a file.
I created the command by SM49 , but I don't know how I can call it from ABAP program.
Thanks
Maria CHi Maria.
This is a possible code you can use:
DATA: log LIKE TABLE OF btcxpm WITH HEADER LINE.
Can contain STDOUT, STDERR
commandname =
CALL FUNCTION SXPG_CALL_SYSTEM
IMPORTING
COMMANDNAME = commandname
PARAMETERS = parameters
EXPORTING
STATUS = status
TABLES
EXEC_PROTOCOL = log
EXCEPTIONS
NO_PERMISSION = 1
COMMAND_NOT_FOUND = 2
PARAMETERS_TOO_LONG = 3
SECURITY_RISK = 4
WRONG_CHECK_CALL_INTERFACE = 5
PROGRAM_START_ERROR = 6
PROGRAM_TERMINATION_ERROR = 7
X_ERROR = 8
PARAMETER_EXPECTED = 9
TOO_MANY_PARAMETERS = 10
ILLEGAL_COMMAND = 11
OTHERS = 12.
The following are the comments of the parameters taken from:
http://help.sap.com/saphelp_40b/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/content.htm
Parameters
IMPORTING Parameters
Parameter name
Use
COMMANDNAME
The name of the definition of the external command, as specified in the maintenance function (transaction SM69).
PARAMETERS
Arguments for the external command as specified by the definition in the R/3 System and by the calling program or user.
These arguments are checked for impermissible characters, such as the ; under UNIX. Problems are registered with the SECURITY_RISK exception.
EXPORTING Parameters
Parameter name
Use
STATUS
Returns the final status of the execution of the external command:
· Value O: The external command was started and ran to end successfully.
· Value E: An error occurred; the external command was not run successfully.
Tables Parameters
Parameter name
Use
EXEC_PROTOCOL
Contains the STDOUT and STDERR output of the external command and any output from the target host system.
Exceptions
Exception name
Meaning
X_ERROR
Reserved for future use.
NO_PERMISSION
The AUTHORITY-CHECK of the users authorization for the authorization object S_LOG_COM failed. The user is not authorized to carry out the command named with the specified arguments on the target system.
COMMAND_NOT_FOUND
Command name, as identified by COMMANDNAME and OPERATINGSYSTEM, has not been defined in the maintenance function (transaction SM69).
PARAMETERS_TOO_LONG
The combined argument string (ADDITIONAL_PARAMETERS and the DEFINED_PARAMETERS, as returned in ALL_PARAMETERS) exceeds the limit of 128 characters in length.
SECURITY_RISK
Either:
· The command contains impermissible characters. These are characters with potentially dangerous properties, such as ; under UNIX.
· The command definition specifies that an extra-check function module be run. This function module has rejected execution of the command.
WRONG_CHECK_CALL_
INTERFACE
The command definition specifies that an extra-check function module is to be run. Either this function module is missing, or the interface defined for this function module does not match that of the standard R/3 function module SXPG_DUMMY_COMMAND_CHECK. For more information, please see SXPG_DUMMY_COMMAND_CHECK: Interface for Extra-Check Function Modules.
TOO_MANY_PARAMETERS
The command definition specifies that user-specified arguments for the external command are not allowed. However, an additional string of command arguments was specified.
PARAMETER_EXPECTED
The command definition includes the placeholder character ?, which signifies that additional user-defined arguments are required. However, no additional arguments string was supplied.
PROGRAM_START_ERROR
An error occurred while starting the external command. The R/3 system field SY-MSGV1 contains additional information on the problem.
PROGRAM_TERMINATION_
ERROR
An error occurred while trying to obtain the return code of the external program. The R/3 system field SY-MSGV1 contains additional information on the problem.
ILLEGAL_COMMAND
The external command definition was modified "illegally". That is, the command was not modified by means of the maintenance function (transaction SM69).
The modified command is registered in the system log in its substituted form. The message is registered under the system log ID "LC".
OTHERS
Catch any new exceptions added to this function module.
Hope this will be useful.
Sandro Lombardo -
Call to Java web service from abap program
HI,
I want to call to Java WS from abap program and i read some post how to do that in release of NW 6.4 but I want to know what is the simplest way to do that in release 7.0 .
Many Thanks,
NinaHi Uwe,
Thank you.
I have WSDL or URL how i can call to them ,in the example that you send i don't find the place that it called.
Do i have to create proxy for that ?
BR
Nina -
Execute webdynpro from abap program and return to the caller program
Guys,
I have a question here.
I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing
the webdynpro application or using CALL TRANSACTION statement.
But, is there anyways that we can call the webdynpro application from abap program by supplying data to the webdynpro and display to the user from the portal, and then
once the user do some manipulation on the data, can we transfer back the data to the caller abap program?hey ,
you can pack any web-dynpro program in tranasaction code and run it from R/3 and not via portal :
search in " SAPTECHNICAL" how to do so - for some reason i cant post a link here
than you can use call transaction .
regards
ASA -
Procedure to Call Workflow Object from ABAP program in Se38
Hi All,
I have one scenario like i have to call one Workflow object from ABAP program in SE38.The scenario is like below.....
I have to select some records from database table.For example there are 100 records in the internal table.
For all that records i have to invoke Workflow for getting approval from the authorized persons. Once Approval has come to program, It will post one document in SAP and process ends.
Please suggest me how to move forward with this scenario.
Regards
Manas Ranjan PandaHi,
So you want to start a workflow from an ABAP, if an event exists for that particular workflow then the best way is to use fm SAP_WAPI_CREATE_EVENT,
to start a workflow from an ABAP you can use fm SAP_WAPI_START_WORKFLOW.
Kind regards, Rob Dielemans -
Calling oracle procedure from ABAP program
There is a requirement to call the oracle stored procedure with some input parameter from ABAP program.
Suppose we have order number which is entered by the user in ABAP program.
This order number needs to be passed to oracle stored procedure as an input parameter in the same ABAP program.
We can call the oracle stored procedure without parameter using the following syntax
exec sql
execute procedure <procedure name>
end exec.
But do not know how to execute the oracle stored procedure with some input parameter?Apologies , following is the correct code.
This will definetly solve your problem.
DATA scarr_carrid TYPE scarr-carrid.
SELECT-OPTIONS s_carrid FOR scarr_carrid NO INTERVALS.
DATA s_carrid_wa LIKE LINE OF s_carrid.
DATA name TYPE c LENGTH 20.
TRY.
EXEC SQL.
CREATE FUNCTION selfunc( input CHAR(3) )
RETURNING char(20);
DEFINE output char(20);
SELECT carrname
INTO output
FROM scarr
WHERE mandt = '000' AND
carrid = input;
RETURN output;
END FUNCTION;
ENDEXEC.
LOOP AT s_carrid INTO s_carrid_wa
WHERE sign = 'I' AND option = 'EQ'.
TRY.
EXEC SQL.
EXECUTE PROCEDURE selfunc( IN :s_carrid_wa-low,
OUT :name )
ENDEXEC.
WRITE: / s_carrid_wa-low, name.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure execution` TYPE 'I'.
ENDTRY.
ENDLOOP.
EXEC SQL.
DROP FUNCTION selfunc;
ENDEXEC.
CATCH cx_sy_native_sql_error.
MESSAGE `Error in procedure handling` TYPE 'I'.
ENDTRY.
Reward points if usefull.
Thanks and regards,
Veerendranath. -
Any program for calling bapi from ABAP step by step
any program for calling bapi from ABAP step by step
points will be rewarded,
thank you,
Jagrut BharatKumar ShuklaHi Jagrut,
BAPI stands for Business API(Application Program Interface).
A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
You can make your function module remotely enabled in attributes of Function module but
A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
The following standardized BAPIs are provided:
Reading instances of SAP business objects
GetList ( ) With the BAPI GetList you can select a range of object key values, for example, company codes and material numbers.
The BAPI GetList() is a class method.
GetDetail() With the BAPI GetDetail() the details of an instance of a business object type are retrieved and returned to the calling program. The instance is identified via its key. The BAPI GetDetail() is an instance method. BAPIs that can create, change or delete instances of a business object type
The following BAPIs of the same object type have to be programmed so that they can be called several times within one transaction. For example, if, after sales order 1 has been created, a second sales order 2 is created in the same transaction, the second BAPI call must not affect the consistency of the sales order 2. After completing the transaction with a COMMIT WORK, both the orders are saved consistently in the database.
Create( ) and CreateFromData! ( )
The BAPIs Create() and CreateFromData() create an instance of an SAP business object type, for example, a purchase order. These BAPIs are class methods.
Change( )
The BAPI Change() changes an existing instance of an SAP business object type, for example, a purchase order. The BAPI Change () is an instance method.
Delete( ) and Undelete( ) The BAPI Delete() deletes an instance of an SAP business object type from the database or sets a deletion flag.
The BAPI Undelete() removes a deletion flag. These BAPIs are instance methods.
Cancel ( ) Unlike the BAPI Delete(), the BAPI Cancel() cancels an instance of a business object type. The instance to be cancelled remains in the database and an additional instance is created and this is the one that is actually canceled. The Cancel() BAPI is an instance method.
Add<subobject> ( ) and Remove<subobject> ( ) The BAPI Add<subobject> adds a subobject to an existing object inst! ance and the BAPI and Remove<subobject> removes a subobject from an object instance. These BAPIs are instance methods.
ex BAPI:
API_SALESORDER_CREATEFROMDAT1
BAPI_SALESORDER_CREATEFROMDAT2
You can get good help form the following links,
BAPI-step by step
http://www.sapgenie.com/abap/bapi/example.htm
list of all bapis
http://www.planetsap.com/LIST_ALL_BAPIs.htm
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
Also refer to the following links..
www.sappoint.com/abap/bapiintro.pdf
www.sap-img.com/bapi.htm
www.sap-img.com/abap/bapi-conventions.htm
www.planetsap.com/Bapi_main_page.htm
www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://sap-img.com/bapi.htm
<b>EG::</b>
<b>Here is the step by step procedure for creating BAPIs.</b>
There are 5 different steps in BAPI.
- Create BAPI Structure
- Create BAPI Function Module or API Method.
- Create BAPI object
- Release BAPI Function Module.
- Release BAPI object.
Step1. Creating BAPI Structure:
- Go to <SE11>.
- Select Data Type & Enter a name.
- Click on Create.
- Note: Always BAPI should be in a development class with request number (Not Local Object).
- Select Structure & hit ENTER.
- Enter the fields from your database. Make sure that the first field is the Primary Key Field.
- Then SAVE & ACTIVATE.
Step 2. Creating BAPI module:
- Enter TR.CODE <SE37>.
- Before entering any thing, from the present screen that you are in, select the menu
Goto -> Function Groups -> Create Group.
Enter a name (Note: This name Must start with ZBAPI)
Let this screen be as it is and open another window and there, enter TR.CODE <SE80).
Click on the Third ICON that says Inactive Objects.
Select the group that you just created and click on Activate.
Notice that the group you created will disappear from the list of inactive objects.
- Go back to ><SE37> screen and enter a name and hit <ENTER>. Then enter the group name that you just created and activated.
NOTE: When you release a function module the respective group will be attached to that particular application. It cannot be used for any other application. NEVER include an already existing group that is attached to another module.
Now click on the first Tab that says [ATTRIBUTES] and select the radio button that says remote-enabled module since we will be accessing this from any external system.
Then click on the second tab that says [IMPORT].
Enter a PARAMETER NAME, TYPE and the structure you created in the first step. Also select the check box Pa. All remotely enabled functional modules MUST be Pa enabled, where Pa means Passed by Value and if you dont select Pa, then that means it will be passed by reference..
Then click on tab that says [EXPORT].
Enter the following as is in the first three fields
RETURN TYPE BAPIRETURN (These 3 field values are always same)
Here also select Pa meaning Pass by value.
Note: BAPIRETURN contains structure with message fields.
Then SAVE and ACTIVATE.
Step 3. Creating BAPI object:
- Enter Tr.Code <SWO1> (Note. It is letter O and not Zero).
- Enter a name and then click on create. Enter details.
NOTE: Make sure that that Object Type and Program name are SAME.
- Enter Application M, if you are using standard table Mara. If you are using your own database then select Z at the bottom.
- Then hit <ENTER>.
- Now we have to add Methods. High light METHODS and then select the following from the menu:
Goto Utilities -> API Methods -> Add Methods.
- Enter function Module name and hit <ENTER>.
- Select the second FORWARD ARROW button (>)to go to next step.
- Check if every thing looks ok and again click on FORWARD ARROW button (>).
- Then select YES and click on <SAVE>.
- Now on a different screen goto TR.CODE <SE37>. Enter Function Module name and select from the top menu Function Module -> Release -> Release.
- Goback to TR.CODE <SWO1>.
Here select the menu combination shown below in the same order.
- Edit -> Change Release Status -> Object Type Component -> To Implemented.
- Edit -> Change Release Status -> Object Type Component -> To Released.
- Edit -> Change Release Status -> Object Type -> To Implemented.
- Edit -> Change Release Status -> Object Type -> To Released.
- Then click on <SAVE>.
- Then click on Generate Button (4th button from left hand side looks like spinning wheel).
- Then Click on the button that says PROGRAM to see the source code.
To check if this is present in work flow goto TR.CODE <BAPI>.
Here it shows business object repository.
- First click on the middle button and then select ALL and hit ENTER.
- Goto tab [ALPHABETICAL] and look for the object that you created. This shows that the BAPI object has been created successfully
<b>Reward pts if found usefull :)</b>
regards
Sathish -
Calling external web service from ABAP Program
Hi All,
Can somebody point me to the documentation where how to call an external (3rd party) web service from ABAP program is explained?
Thanks & Regards,
-Smitawhich version of R/3 you are using. if you are on was 6.40 its very simple, there are delivered tools to generate client proxy for consuming webservice. if you are on wa 6.20 you can use cl_http_client to achieve the same. check out the following weblogs.
/people/durairaj.athavanraja/blog/2005/07/12/send-sms-to-india-from-abap
/people/thomas.jung3/blog/2005/05/13/calling-webservices-from-abap-via-https
/people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap
Regards
Raja
Maybe you are looking for
-
JavaScript files are not being updated while updating managed solution over Dynamics CRM Online
Hi Support, While I am updating a managed solution over Dynamics CRM 2013 Online, JavaScript files are not being updated and is showing the source as of the last version of the managed solution. I tried the same versions of solution on my CRM 2013 o
-
Airport client Update 2009-02 buggy?10++min system start, OS bogged down
I installed the Airport Client update a little over a week ago via Software Update. Since then I've had intermittent problems with the airport connection being dropped, but a larger problem is that the system (especially Safari) seems to slow down to
-
How to play IFO files in MSI Media Center III?
Read the topic. We all can play avi, mpg, mpeg and other file types, but is there a way to play DVD files from a HD? MSI Media Center III recognizes the VOB's as separate files, not as w whole movie. I see no IFO support in MSI Media Center III, or m
-
Hi all, I need to find all the subsets of a particular column in a table. For eg : Table is increment Fields are slno number, incr_month varchar2(5) Values are 1 JAN 2 FEB 3 MAR 4 APR 5 MAY My requirement is I need the above data in the fol. way JAN
-
How to upgrade my ancient Mac OS X 10.4.11
I'm trying to figure out how to upgrade my ancient Mac OS X 4. Its seems as though I need 5 first, but I can't find a download for it. Any help? thank you