Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

out bound idoc creation urgent!!!!!!!!!!!!

Hi experts,

I am given a task to create an out bound IDOC which would be input to TIBCO, which must be triggered every time Good issue transaction is completed by either VT02N or VL02N transaction up pressing SAVE.

IDOC is to have fields from Customize tables apart from standard SAP tables, so was asked to create an own IDOC ( eg: Z--Idoc).

Please tell me how to create the idoc, and also the method to trigger it and how to populate the IDOC ( program etc).

Use full inputs would be promtly rewarded.

Regards,

Ram.

Former Member replied

Hi,

In order to create an outbound IDOC we need to follow the below steps.

WE31 - Create Segment (then release it)

WE30 - Create Idoc (then release it)

WE81 - Create Message class

WE82 - Assign the message type with basic IDOC type

WE21 - Define Ports (If not already defined)

WE20 - Partner Profiles (Assign Message Type in the outbound parameters of receiving partner)

Now the program for sending IDoc.

REPORT zdemo_idoc.

**********************Data Declaration**********************

DATA: i_vbak TYPE TABLE OF [Segment Name]

w_vbak TYPE [Segment Name],

w_edidc TYPE edidc, [Workarea for Control Records]

w_edidd TYPE edidd, [Workarea for Data Records]

i_edidd TYPE TABLE OF edidd, [Internal table for Data Records]

t_idoc_comm_control TYPE edidc OCCURS 0 WITH HEADER LINE.

**********************Select Statements**********************

SELECT vbeln

ernam

kunnr

FROM vbak

INTO CORRESPONDING FIELDS OF TABLE i_vbak

WHERE vbeln = '0000000012'.

**********************Control Records************************

w_edidc-rcvprt = 'LS'. [Partner Type of Receiver]

w_edidc-rcvpor = [Receiver port (SAP System, EDI subsystem)]

w_edidc-rcvprn = [Partner Number of Recipient]

w_edidc-mestyp = [Message Type]

w_edidc-doctyp = [IDoc Type]

***********************Data Records***************************

  • Move data records from internal table to the edidd structure.

LOOP AT i_vbak INTO w_vbak.

w_edidd-segnam = [Segment Name].

w_edidd-segnum = 1.

w_edidd-sdata = w_vbak.

w_edidd-hlevel = 1.

APPEND w_edidd TO i_edidd.

CLEAR w_edidd.

ENDLOOP.

**********************Send the IDOC***************************

  • Function Module to send the IDOC to the receiving port.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = w_edidc

TABLES

communication_idoc_control = t_idoc_comm_control

master_idoc_data = i_edidd

EXCEPTIONS

error_in_idoc_control = 1

error_writing_idoc_status = 2

error_in_idoc_data = 3

sending_logical_system_unknown = 4

OTHERS = 5.

COMMIT WORK. [Important statement for outbound IDOC.]

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

WRITE :/ 'Operation Unsuccessful'.

ELSE.

WRITE :/ 'operation successful'.

ENDIF.

Now about triggering the IDoc from VT02N or VL02N, you need to do the NACE settings which will a output type assigned to your program which will trigger the IDoc when you save it.

And I guess TIBCO is a middle ware to do conversion which will have certain Mapping rules to map the fields from your IDoc with the Endusers fields.

Do ask is any help required as I have worked on TIBCO.

Reward if helpful

Regards,

Arati.

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question