Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Call a Web Service with Attachment from ABAP

Former Member
0 Kudos

Hello,

I am looking to build a little ABAP program to call a Web Service on a different machine (running WebSphere). I know that by itself is easy and well documented. However I want to have a binary attachment in the Web Service call (SOAP with Attachments). I want to take a PDF document which I created with SFP and submit that over to another machine.

1) Is SOAP with attachments supported in ABAP?

2) Does it require a specific Web AS 6.40 SP Stack

3) Does anyone has used this before. Is there anything I need to consider (e.g. encoding of the attachment)

4) Is there a maximum file size for the attachment

You help is appreciated. And if I get it running I can show it at TechEd

Cheers!

Matthias

7 REPLIES 7

Former Member
0 Kudos

Matthias,

I am trying to make a standard SOAP call from abap without an attachment. It sound like you have done this already. could you provide me with an example program or point me to a good example or "how to" document.

Thanks,

DSP

0 Kudos

Actually I have not pursued this further (but will do with a consultant in the next weeks).

I suggest you start here http://help.sap.com/saphelp_nw04/helpdata/en/9b/dad1ae3908ee44a5caf57e10918be9/content.htm

0 Kudos

Hello Matthias,

did you had sucess with the Consultant? The Documentation for <a href="http://help.sap.com/saphelp_webas620/helpdata/en/94/f8c8bae68811d6b2dc00508b5d5211/frameset.htm">Web AS 6.20</a> and also <a href="http://help.sap.com/saphelp_nw04/helpdata/en/bb/ddb33d2ae46b3be10000000a114084/frameset.htm">Web AS 6.40</a> points out that Attachments are NOT supported in Web Services for ABAP. Have you any other information?

Regards

Gregor

0 Kudos

Hi,

Are the webservice with attachments for ABAP supported in NW04s.

Or should we only go through an adapter / XI fir the filetransfer from or to ABAP.

Thanks and regards,

Antony.

Former Member
0 Kudos

Hello Mathias,

did you solve the problem by now ?

Best regards

Heinz

0 Kudos

Hello Matthias/Heinz,

I also need to send a URL or an attachment from CRM system to a third party system.

Please help if you have already got success with the same.

0 Kudos

Hi,

This is the code which you can use to build an RFC in SAP system which you can call from the 3rd party system to get the

attachments in the Binary or Hex format.

You need to know the business object type details etc for the tcode.

FUNCTION zattch_read.

DATA : p_botype LIKE tojtb-name,

v_tbx LIKE sy-tabix.

*include: RSSOCONS.

CLASS CL_GOS_DOCUMENT_SERVICE DEFINITION LOAD.

CREATE OBJECT rf.

is_object-instid = bo_id.

is_object-typeid = p_botype.

is_object-catid = 'BO'.

REFRESH et_links.

TRY.

CALL METHOD cl_binary_relation=>read_links_of_binrel

EXPORTING

is_object = is_object

ip_relation = 'ATTA'

IMPORTING

et_links = et_links.

catch

cx_obl_parameter_error into icx_obl_parameter_error.

exception_string = icx_obl_parameter_error->get_longtext( ).

catch cx_obl_internal_error into icx_obl_internal_error .

exception_string = icx_obl_internal_error->get_longtext( ).

catch

cx_obl_model_error into icx_obl_model_error.

exception_string = icx_obl_model_error->get_longtext( ).

ENDTRY.

LOOP AT et_links INTO et_links_s.

v_tbx = sy-tabix.

document_id = et_links_s-instid_b.

CALL FUNCTION 'SO_DOCUMENT_READ_API1'

EXPORTING

DOCUMENT_ID = document_id

  • FILTER = 'X '

IMPORTING

DOCUMENT_DATA = document_data

TABLES

OBJECT_HEADER = object_header

OBJECT_CONTENT = object_content

  • OBJECT_PARA =

  • OBJECT_PARB =

  • ATTACHMENT_LIST =

  • RECEIVER_LIST =

CONTENTS_HEX = CONTENTS_HEX1

EXCEPTIONS

DOCUMENT_ID_NOT_EXIST = 1

OPERATION_NO_AUTHORIZATION = 2

X_ERROR = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

APPEND DOCUMENT_DATA TO DOCUMENT_DATA1.

ENDLOOP.

ENDFUNCTION.