17.08.2013 Views

Data Interfaces

Data Interfaces

Data Interfaces

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Asynchronous RFC with Return of <strong>Data</strong><br />

R/3 server A R/3 server B (same or other R/3)<br />

PROGRAM RS01.<br />

...<br />

CALL FUNCTION 'FUNC1'.<br />

DESTINATION 'B'<br />

STARTING NEW TASK 'ABC'<br />

PERFORMING FUNC1_RETURN ON END OF TASK.<br />

EXPORTING ...<br />

TABLES ...<br />

...<br />

FORM FUNC1_RETURN USING TASK.<br />

...<br />

RECEIVE RESULTS FROM FUNCTION FUNC1<br />

IMPORTING ...<br />

TABLES ...<br />

EXCEPTIONS ...<br />

...<br />

SET USER-COMMAND '...'.<br />

ENDFORM.<br />

...<br />

AT USER-COMMAND.<br />

...<br />

© SAP AG<br />

FUNCTION FUNC1.<br />

...<br />

ENDFUNCTION.<br />

In the above example, the called function module can return data or exceptions to the client program,<br />

although the function module has been started asynchronously. By using the PERFORMING addition,<br />

you ensure that the connection to the partner remains open.<br />

When the called function module is processed, the FORM routine specified after the CALL-FUNCTION<br />

parameter PERFORMING is called.<br />

The FORM routine must have a formal parameter (any name is allowed). This parameter is supplied<br />

automatically with the relevant task ID when the routine is called.<br />

By using RECEIVE RESULTS FROM FUNCTION ... in the FORM routine, you can get the<br />

asynchronously processed function module to return data and exceptions. By using the SET USER-<br />

COMMAND statement, you can start the program event directly.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!