Skip to end of metadata
Go to start of metadata

Author: Smita Gupta

Submitted: 13 Nov 2008
Related Links:

Description

IDOC is an intermediate document which is used for data transfer among logical systems or between clients or customers.These documents can be triggered automaically while doing any activity through transaction codes.

For e.g. :- In a transaction IW21 while saving an notification type an idoc can be triggered to send the recent saved data to client or logical system.

 Steps for triggereing an IDOC:-

  1. First try to find out the name of BAPI ,that is triggered by SAP system while clicking save.
  2. For this first go to transaction SE24 ,type CL_EXITHANDLER , under this find out GET_INSTANCE ,double click on it and find  
    CALL METHOD cl_exithandler=>get_class_name_by_interface
  3. Here put a breakpoint and run the transaction IW21 and get the value of variable name exit_name,this will tell the name of bapi,which is NOTIF_EVENT_POST.
  4. Now goto SE19,there provide z.. name of implentation for NOTIF_EVENT_POST.
  5. Now goto Interface Tab and click on method CHECK_DATA_AT_POST.
  6. Now this is the method where following code can be provided for triggering an IDOC. 
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
TYPES: ty_idoc_edidc TYPE edidc,
       ty_idoc_edidd TYPE edidd.

DATA: idoc_edidc TYPE ty_idoc_edidc,
      wa_idoc_edidc TYPE ty_idoc_edidc,
      master_cntrl_data TYPE STANDARD TABLE OF ty_idoc_edidc,
      idoc_edidd TYPE STANDARD TABLE OF ty_idoc_edidd,
      wa_idoc_edidd TYPE ty_idoc_edidd.

TYPES: BEGIN OF qmel_struc,
        qmnum TYPE qmel-qmnum,
        qmart TYPE qmel-qmart,
        qmtxt TYPE qmel-qmtxt,
        equnr TYPE equi-equnr,
        sttxt TYPE riwo00-sttxt,
       END OF qmel_struc.

DATA: wa_qmel_struc TYPE e1nthdr.

CLEAR idoc_edidc.

idoc_edidc-rcvpor = 'A000000023'. " Port No.
idoc_edidc-rcvprt = 'LS'.  " Logocal System
idoc_edidc-mestyp = 'INOTIF'. " Message Type
idoc_edidc-idoctp = 'INOTIF01'. " Idoc Type
idoc_edidc-rcvprn = 'ESUIDES'. " Partner Type

wa_qmel_struc-qmnum = is_new_viqmel-qmnum.
wa_qmel_struc-qmart = is_new_viqmel-qmart.
wa_qmel_struc-qmtxt = is_new_viqmel-qmtxt.
wa_qmel_struc-equnr = is_new_viqmel-equnr.
wa_qmel_struc-sttxt = 'osno'.

wa_idoc_edidd-segnam = 'E1NTHDR'. "Segment Name

wa_idoc_edidd-sdata = wa_qmel_struc.
CLEAR wa_qmel_struc.

APPEND wa_idoc_edidd TO idoc_edidd.
CLEAR wa_idoc_edidd.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
  EXPORTING
    master_idoc_control            = idoc_edidc
  TABLES
    communication_idoc_control     = master_cntrl_data
    master_idoc_data               = idoc_edidd
  EXCEPTIONS
    error_in_idoc_control          = 1
    error_writing_idoc_status      = 2
    error_in_idoc_data             = 3
    sending_logical_system_unknown = 4
    OTHERS                         = 5.