ALE-IDOC Scenario using Custom IDOC

...Previous

Defining the Z Segment type

Tcode – WE31 

Defining the Basic Type

T Code WE30 

 

Click on New 

 

This will take you to next screen as follows 

 

Here you have connected the basic type to the segment type.

 Enter again and this will take you to screen as follows  

 

This shows the relation between the basic and the segment types. 

Next you need to make the entry of the segment in the system table.

Tcode : WE81 

 

Next is the following entry which is required. 

 

Here you are specifying the message type and the basic type and the release version. 

This is all about the configuration you need to do on the sender side.

Now on the sender side you also need a program that will fetch the required data, couple it in the IDOC format and post it. 

Here is a small piece of code that could be useful.

*&---------------------------------------------------------------------*
*& Report  ZSACH_CUST_IDOC                                             *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*
report  zsach_cust_idoc                         .
parameters :            p_logsys like tbdlst-logsys.
data : gen_segment like edidd-segnam value 'ZSACH'.
data : control_dat like edidc,
      gen_data like z1hdr .
tables :zsach1.
data: begin of inttab occurs 0,
        lname type z1hdr-lname,
        fname type z1hdr-fname,
      end of inttab.
data :
      int_edidd like edidd occurs 0 with header line,
      int_edidc like edidc occurs 0 with header line.
select * from zsach1 into corresponding fields of table inttab.
if sy-subrc ne 0.
  message 'no data' type 'I'.
  exit.
endif.
control_dat-mestyp = 'ZSACH'.
control_dat-idoctp = 'ZSACH'.
control_dat-rcvprt = 'LS'.
control_dat-rcvprn =  p_logsys.

loop at inttab.
  gen_data-lname = inttab-lname.
  gen_data-fname = inttab-fname.
*  GEN_DATA-SSN = INTTAB-SSN.
*  GEN_DATA-DOB = INTTAB-DOB.
  int_edidd-segnam = gen_segment.
  int_edidd-sdata = gen_data.
  append int_edidd.
endloop.
call function 'MASTER_IDOC_DISTRIBUTE'
  exporting
    master_idoc_control                  = control_dat
*   OBJ_TYPE                             = ''
*   CHNUM                                = ''
  tables
    communication_idoc_control           = int_edidc
    master_idoc_data                     = int_edidd
 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.
else.
  loop at int_edidc.
    write :/ 'IDOC GENERATED',int_edidc-docnum.
  endloop.
  commit work.
endif.

Continued...

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image