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

idoc with message type

Former Member
0 Likes
1,509

i need an example how to use the message type in IDOC

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
867

Hi, this may help you

Message Type:

A message type represents the application message exchanged between R/3 systems and R/3 and an external system. A message type characterises the data sent across systems and relates to the structure of the data called an IDOC type.

Diff. with IDOC type

An IDoc type specifies the structure of the data.

A message type specifies the meaning of the data

Diff. b/w IDOC type and IDOC

An IDoc type is the definition of a specific data structure.

An IDoc is an actual instance of data based on an IDoc type. Therefore, there can be many IDocs created from a single IDoc type.

Every idoc type will have Message Type.

It mean Idoc will be recognised By message type.

For ex : MATMAS03 is idoc type, and its message type MATAMS.

There are different message type for every master data. suppose for vendor master CREMAS is the message type, for customer mast DEBMAS like these there many message type for other type of master data.

To recognise the particular idoc, we use message types.

We82 is the TCode where IDoC type is attached to Mesage tYpe.

Refer to this related thread

Reward If Helpful.

Regards Madhu.

3 REPLIES 3
Read only

Former Member
0 Likes
867

Hi Manohar,

This is custom IDoc prgm.Award points if useful

IDocs Standalone program

This Prgm will upload data in flat file into internal table and sends that data to inbound system

REPORT ZMMMC9403_UPLOAD_MATERIAL_IDOC.

*1.Create parameters/select-options for input data. i.e., empno, message type, logical system.

parameters : p_mestyp like edmsg-msgtyp default 'zmsgkk',

p_logsys like tbdlst-logsys obligatory.

*2.Create Data objects for control record, data record and database table.

data : c_segment like edidd-segnam value 'ZKSEGTYPE', "Data record (IDoc)-Segment type

c_idoctp like edidc-idoctp value 'ZKIDOC'. "Control record (IDoc)-Basic type

data : begin of itab occurs 0,

zsno like zkiran-zsno,

zsname like zkiran-zsname,

end of itab.

data : w_itab like itab.

data : s_segment like zksegtype.

data : i_edidd like edidd occurs 0 with header line.

data : i_control_record like edidc.

data : i_comm_idoc like edidc occurs 0 with header line.

*3. Select the data from flatfile/corresponding tables into internal table for a defined condition.

*select single zsno zsname from zemp into corresponding fields of it_zemp where empno = p_empno.

call function 'GUI_UPLOAD' "since the data is coming from flatfile, GUI_UPLOAD is used

exporting

filename = 'C:\DATA.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

tables

data_tab = itab.

*4. create control record into internal table.

i_control_record-mestyp = p_mestyp. "Message Type

i_control_record-idoctp = c_idoctp. "Basic type

****

i_control_record-rcvprt = 'LS'. "Partner Type of Receiver

i_control_record-rcvprn = p_logsys. "Partner Number of Recipient

*5. create data record into internal table.

*i_edidd-segnam = c_segment.

loop at itab into w_itab.

s_segment-zsno = w_itab-zsno. "Application Data

s_segment-zsname = w_itab-zsname.

i_edidd-sdata = s_segment.

i_edidd-segnam = c_segment.

append i_edidd.

endloop.

*6. Process ALE Service Layer using the function module MASTER_IDOC_DISTRIBUTE. It returns the corresponding IDoc No.s.

call function 'MASTER_IDOC_DISTRIBUTE'

exporting

master_idoc_control = i_control_record

tables

communication_idoc_control = i_comm_idoc

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.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

*7. Display Communication IDocs.

loop at i_comm_idoc.

write : / 'Communication IDoc No. is : ', i_comm_idoc-docnum.

endloop.

*8. Commit Work.

commit work.

Read only

Former Member
0 Likes
867

use WE82, WE81

Regards,

venkat

Read only

Former Member
0 Likes
868

Hi, this may help you

Message Type:

A message type represents the application message exchanged between R/3 systems and R/3 and an external system. A message type characterises the data sent across systems and relates to the structure of the data called an IDOC type.

Diff. with IDOC type

An IDoc type specifies the structure of the data.

A message type specifies the meaning of the data

Diff. b/w IDOC type and IDOC

An IDoc type is the definition of a specific data structure.

An IDoc is an actual instance of data based on an IDoc type. Therefore, there can be many IDocs created from a single IDoc type.

Every idoc type will have Message Type.

It mean Idoc will be recognised By message type.

For ex : MATMAS03 is idoc type, and its message type MATAMS.

There are different message type for every master data. suppose for vendor master CREMAS is the message type, for customer mast DEBMAS like these there many message type for other type of master data.

To recognise the particular idoc, we use message types.

We82 is the TCode where IDoC type is attached to Mesage tYpe.

Refer to this related thread

Reward If Helpful.

Regards Madhu.