Application Development and Automation 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: 
Read only

Outbound Interface

Former Member
0 Likes
691

Hi all,

I want to develop coding for Outbound interface, but not aware of the process.

Kindly help me to do that.

Thanks,

Sunaina

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
572

Hi Sunaina,

I dont know ur functional requirement, but as per my understanding I can give u the general idea and hope this will work.

If its helpful then reward me with points.

<b>Outbound Process:</b>

First, ask your XI team to generate a message interface for you of type <b>outbound</b> and include the structure in the way they want you to send data to them.

<b>To create space for outbound:</b>

Once the message interface is created by them, you can generate the same in transaction SPROXY. Search for your interface namespace and then right click on it and say create.

Give the appropriate package and prefix to it -> Generate the proxy, save and activate.

Now you can create a report and then according to the structure generated by XI, you can populate your internal table to be passed back.

<b>ABAP Part:</b>

Call the method of the proxy in your report and send the data to XI.

Example:

DATA: o_notif TYPE REF TO zpmo_co_mi_peregrine_quick_fil, "Proxy class object

o_excep_handler TYPE REF TO cx_root. "Exception class object

TRY.

  • Create the object of outbound proxy class

CREATE OBJECT o_notif.

  • Call the execute_asynchronous of proxy with output table containing

  • information of created notifications

CALL METHOD o_notif->execute_asynchronous

EXPORTING

output = wa_output.

COMMIT WORK.

CATCH cx_root INTO o_excep_handler .

CLEAR wa_return.

REFRESH it_return.

wa_return-type = c_error. " Catching

wa_return-id = c_err_id.

wa_return-number = c_number.

wa_return-message = o_excep_handler->get_text( ).

APPEND wa_return TO it_return.

CLEAR wa_return.

ENDTRY.

<b>Sending errors with alerts:</b>

IF it_bapiret2[] IS NOT INITIAL.

  • Raise an alert

CALL FUNCTION 'Z_XI0_POLL_TO_UWL'

EXPORTING

systemoforigin = input-mt_peregrine_notification_req-message_header-system_of_origin

interfaceid = c_intid

TABLES

bapi_return = it_bapiret2

EXCEPTIONS

no_alertcateg_found = 1

alert_not_created = 2

no_message_passed = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE i137 . " Error in Raising Alert

ENDIF.

ELSE.

MESSAGE s156 . " Data sent successfully

ENDIF.

Regards,

Rahman

3 REPLIES 3
Read only

Former Member
0 Likes
572

Hi Sunaina,

What is your functional requirement?

Regards,

Atish

Read only

Former Member
0 Likes
573

Hi Sunaina,

I dont know ur functional requirement, but as per my understanding I can give u the general idea and hope this will work.

If its helpful then reward me with points.

<b>Outbound Process:</b>

First, ask your XI team to generate a message interface for you of type <b>outbound</b> and include the structure in the way they want you to send data to them.

<b>To create space for outbound:</b>

Once the message interface is created by them, you can generate the same in transaction SPROXY. Search for your interface namespace and then right click on it and say create.

Give the appropriate package and prefix to it -> Generate the proxy, save and activate.

Now you can create a report and then according to the structure generated by XI, you can populate your internal table to be passed back.

<b>ABAP Part:</b>

Call the method of the proxy in your report and send the data to XI.

Example:

DATA: o_notif TYPE REF TO zpmo_co_mi_peregrine_quick_fil, "Proxy class object

o_excep_handler TYPE REF TO cx_root. "Exception class object

TRY.

  • Create the object of outbound proxy class

CREATE OBJECT o_notif.

  • Call the execute_asynchronous of proxy with output table containing

  • information of created notifications

CALL METHOD o_notif->execute_asynchronous

EXPORTING

output = wa_output.

COMMIT WORK.

CATCH cx_root INTO o_excep_handler .

CLEAR wa_return.

REFRESH it_return.

wa_return-type = c_error. " Catching

wa_return-id = c_err_id.

wa_return-number = c_number.

wa_return-message = o_excep_handler->get_text( ).

APPEND wa_return TO it_return.

CLEAR wa_return.

ENDTRY.

<b>Sending errors with alerts:</b>

IF it_bapiret2[] IS NOT INITIAL.

  • Raise an alert

CALL FUNCTION 'Z_XI0_POLL_TO_UWL'

EXPORTING

systemoforigin = input-mt_peregrine_notification_req-message_header-system_of_origin

interfaceid = c_intid

TABLES

bapi_return = it_bapiret2

EXCEPTIONS

no_alertcateg_found = 1

alert_not_created = 2

no_message_passed = 3

OTHERS = 4.

IF sy-subrc NE 0.

MESSAGE i137 . " Error in Raising Alert

ENDIF.

ELSE.

MESSAGE s156 . " Data sent successfully

ENDIF.

Regards,

Rahman

Read only

Former Member
0 Likes
572

Hi sunaina, check this sample code for out bound interface program...

DATA: Begin of imara occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

meins(3) type c,

end of imara.

data: begin of imakt occurs 0,

maktx like makt-maktx,

end of imakt.

DATA: wamas_con LIKE edidc,

imas_data LIKE edidd OCCURS 0 WITH HEADER LINE,

icom_con LIKE edidc OCCURS 0 WITH HEADER LINE.

PARAMETERS: e_matnr LIKE mara-matnr,

e_msgtyp LIKE edidc-mestyp,

e_rcvprn LIKE edidc-rcvprn.

  • retrive app. data from DB

SELECT matnr mtart mbrsh meins FROM mara INTO TABLE imara WHERE

matnr = e_matnr.

SELECT maktx FROM makt INTO TABLE imakt WHERE

matnr = e_matnr.

*Master idoc control record

wamas_con-rcvprt = 'LS'.

wamas_con-rcvprn = e_rcvprn.

wamas_con-idoctp = 'YMATMAS1'.

wamas_con-mestyp = e_msgtyp.

  • master idoc data records

LOOP AT imara.

imas_data-segnam = 'Y1MARA'.

move imara to imas_data-sdata .

APPEND imas_data.

ENDLOOP.

LOOP AT imakt.

imas_data-segnam = 'Y1MAKT'.

imas_data-sdata = imakt.

APPEND imas_data.

ENDLOOP.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = wamas_con

  • OBJ_TYPE = ''

  • CHNUM = ''

TABLES

communication_idoc_control = icom_con

master_idoc_data = imas_data

  • EXCEPTIONS

  • ERROR_IN_IDOC_CONTROL = 1

  • ERROR_WRITING_IDOC_STATUS = 2

  • ERROR_IN_IDOC_DATA = 3

  • SENDING_LOGICAL_SYSTEM_UNKNOWN = 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.

COMMIT WORK.

reward points if useful.

regards,

pavan.