on 01-26-2008 1:38 PM
Hi Friends,
Is it possible to call web service from ABAP-SAP 4.6 c..If yes Could you please let me know how.
Thanks in Advance.
Murali Krishna K
Edited by: Murali Krishna Kakarla on Jan 26, 2008 7:09 PM
Edited by: Murali Krishna Kakarla on Jan 26, 2008 7:11 PM
Both SAP standard function modules, HTTP_GET and HTTP_POST are available on 4.6c and we use them regularly to call .NET web services.
Terry
Edited by: Terry West on Feb 4, 2008 12:34 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Terry,
So these function modules must use the SAPHTTPA RFC destination which uses the exe saphttp.exe ?
How much abap code lines do you have for a web service call ?
Do you have to code the call specifically for each different web service ?
Are you able to use the WSDL ?
Nice job if you have coded your own private SOAP runtime !
But I don't think this is an easy solution for everybody...
Regards,
Olivier
>
> Hi Terry,
>
> So these function modules must use the SAPHTTPA RFC destination which uses the exe saphttp.exe ?
>
> How much abap code lines do you have for a web service call ?
> Do you have to code the call specifically for each different web service ?
> Are you able to use the WSDL ?
>
> Nice job if you have coded your own private SOAP runtime !
>
> But I don't think this is an easy solution for everybody...
>
> Regards,
>
> Olivier
Yes, SAPHTTPA (runs on application server) and/or SAPHTTP (runs on front-end pc), one of which, is required for HTTP communication. So far, nothing too elaborate as far as SOAP goes, but the logic is simplistic. Here's some sample code:
DEST = 'SAPHTTPA'.
TRANSLATE HOST TO LOWER CASE.
MYURL = 'wssrvTest/Service.asmx/GetByOrderItem'.
CONCATENATE HOST MYURL INTO MYURL.
REQUEST_HEADERS-DATA =
'Content-type: application/x-www-form-urlencoded'.
APPEND REQUEST_HEADERS.
CLEAR REQUEST_HEADERS.
*........Convert Order Number to External Format........................
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ORDER
IMPORTING
OUTPUT = ORDER.
*........Convert Item Number to External Format.........................
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = ITEM
IMPORTING
OUTPUT = ITEM.
*........Convert Material Number to External Format.....................
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = MATERIAL
IMPORTING
OUTPUT = MATERIAL.
CONCATENATE 'sOrder=' ORDER
INTO REQUEST_BODY-DATA.
APPEND REQUEST_BODY.
CLEAR REQUEST_BODY.
CONCATENATE '&sItem=' ITEM
INTO REQUEST_BODY-DATA.
APPEND REQUEST_BODY.
CLEAR REQUEST_BODY.
CONCATENATE '&sMaterial=' MATERIAL
INTO REQUEST_BODY-DATA.
APPEND REQUEST_BODY.
CLEAR REQUEST_BODY.
CALL FUNCTION 'HTTP_POST'
EXPORTING
ABSOLUTE_URI = MYURL
RFC_DESTINATION = DEST
BLANKSTOCRLF = 'X'
TABLES
RESPONSE_ENTITY_BODY = RESPONSE_BODY
REQUEST_ENTITY_BODY = REQUEST_BODY
RESPONSE_HEADERS = RESPONSE_HEADERS
REQUEST_HEADERS = REQUEST_HEADERS
EXCEPTIONS
CONNECT_FAILED = 1
TIMEOUT = 2
INTERNAL_ERROR = 3
TCPIP_ERROR = 4
DATA_ERROR = 5
SYSTEM_FAILURE = 6
COMMUNICATION_FAILURE = 7
OTHERS = 8.
CHECK SY-SUBRC = 0. "more appropriate msg goes here
LOOP AT RESPONSE_BODY.
IF RESPONSE_BODY+0(7) <> '<string' AND
RESPONSE_BODY+0(8) <> '</string' AND
RESPONSE_BODY+0(5) <> '<?xml'.
SPLIT RESPONSE_BODY-DATA AT '=' INTO FIELD_NAME FIELD_VALUE.
TRANSLATE FIELD_NAME TO UPPER CASE.
CASE FIELD_NAME.
WHEN 'HEIGHT'.
HEIGHT = FIELD_VALUE.
WHEN 'WIDTH'.
WIDTH = FIELD_VALUE.
WHEN 'LENGTH'.
LENGTH = FIELD_VALUE.
WHEN 'WEIGHT'.
WEIGHT = FIELD_VALUE.
WHEN 'QTY'.
QTY = FIELD_VALUE.
ENDCASE.
ENDIF.
ENDLOOP.
Hope this helps...
Terry
Edited by: Terry West on Feb 4, 2008 3:08 PM
Hi Terry,
Thanks for the exemple. Nice but a little too complicated for my taste. I prefer, for the time being (before upgrade from R/3 4.7 to ECC 6.0) to use a .NET connector translator from RFC call to web service.
It will be easier (for us) to convert to native web service call after upgrade.
Regards,
Olivier
>
> Hi Terry,
>
> Thanks for the exemple. Nice but a little too complicated for my taste. I prefer, for the time being (before upgrade from R/3 4.7 to ECC 6.0) to use a .NET connector translator from RFC call to web service.
> It will be easier (for us) to convert to native web service call after upgrade.
>
> Regards,
>
> Olivier
Hello Olivier,
What exactly are the steps to that go into what you're describing above?
Thanks,
Terry
Hi Terry,
Thank you very much for your response.
I tried the following code..but nothing is happening..
Please let me know what should i have before write this code..
1) Do i need to install SAP Java connectore..
If yes what is that..and how to install
2) Please let me know what else i need to do.
If possible could please let me know step by step implementation to do this.
Hi Murali,
the best thing would be upgrading to WAS 6.40 .
Regards
Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
4.6c is "ancient" - it has no built-it HTTP service and no concept of "web service". You can, however, plug XI/PI in between and use that as middleware.
Markus
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes Markus is right : you need some kind of connector to "translate" from RFC call to web service call.
PI/XI can be used for that but thare are also other solutions.
For example we often use a specific .NET program developped with help from the SAP .NET connector.
From SAP 4.7 it is viewed as a registered RFC server et it is a web service client.
It works perfectly and if you don't already have PI/XI, it's much lighter to implement.
the downsode, of course, is that you need skilled .NET programmers.
Regards,
Olivier
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.