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 outbound

Former Member
0 Likes
1,072

Hi,

I want the sample function module code for creating a custom idoc.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
986

Hi,

tables : zmara_01,

edidd,

edidc.

constants : c_mestyp type edidc-mestyp value 'ZAJI_MSG',

c_idoctp type edidc-idoctp value 'ZAJI_IDOC',

c_imtyp type edidc-cimtyp value 'Z_ACC_GL_POSTING01',

c_seg1 type edidd-segnam value 'E1BPACHE08',

c_seg2 type edidd-segnam value 'E1BPACGL08',

c_seg3 type edidd-segnam value 'E1BPACCR08',

c_seg4 type edidd-segnam value 'Z1BPACCR08',

c_seg5 type edidd-segnam value 'E1BPEXTC'.

  • Work Area for EDIDC

data wa_edidc like edidc.

  • Internal tabel

data i_edidc like edidc occurs 0 with header line.

data i_edidd like edidd occurs 0 with header line.

  • Internal table for ZMARA_01

data i_mara like zmara_01 occurs 0 with header line.

parameters : p_rcvprn type edoc_stat-rcvprn obligatory,"Partner Number of Receiver

p_rcvprt type edoc_stat-rcvprt obligatory."Partner Type of Receiver

start-of-selection.

  • Fill the Control Reord

wa_edidc-mandt = sy-mandt.

wa_edidc-mestyp = c_mestyp.

wa_edidc-idoctp = c_idoctp.

  • wa_edidc-cimtyp = c_imtyp.

wa_edidc-rcvprn = p_rcvprn.

wa_edidc-rcvprt = p_rcvprt.

wa_edidc-credat = sy-datum.

wa_edidc-cretim = sy-uzeit.

append wa_edidc to i_edidc.

select * from zmara_01 into table i_mara.

  • Fill the data record

loop at i_mara.

i_edidd-segnam = 'ZAJI_MSG'.

i_edidd-sdata = i_mara-matnr.

append i_edidd.

endloop.

  • Call the ALE Function Module

call function 'MASTER_IDOC_DISTRIBUTE'

exporting

master_idoc_control = wa_edidc

tables

communication_idoc_control = i_edidc

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 eq 0.

loop at i_edidc.

write:/ 'Succesfully created Idoc', i_edidc-DOCNUM.

endloop.

else.

message i000(FC) with 'No idoc has been created'.

endif.

Regards,

Younus

<b>Reward Helpful Answers:-)</b>

Hi,

I want the sample function module code for creating a custom idoc.

6 REPLIES 6
Read only

Former Member
0 Likes
986

Hi

In SE37 Tcode

enter IDOCOUTPUT*

take any message type and

search IDOC_OUTPUT_<message type>

like <b>IDOC_OUTPUT_ORDRSP</b>

you will get lot of std fun modules related to IDOC

see any of the fun module code and desing your custom code

Reward points if useful

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Read only

0 Likes
986

Hi,

I din't find even a single entry for IDOCOUTBOUND*

Message was edited by:

rk reddy

Read only

Former Member
0 Likes
986

Hi,

create the data elements and the segments in WE31 and then create the IDOC type in WE30 Tcodes. define message type and assign the IDOC type to message type.

First define the Partner profile (WE20) and assign the outbound/inbound paramters.

next define the prot using We21 Tcode .

defien the Process code and attach it to the Mesage type and Idoc type.

Attach the Fun module to the Process code and write the code

Example Function Module: IDOC_INPUT_ORDERS (Standard FM to create Sales Order).

Regards

null

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
986

Hi

<b>

Go TO SE37 Tcode -> Give IDOCOUTBOUND*

you will get lot of Standard FMs related to IDOC</b>

Regards,

Sree

Read only

Former Member
Read only

Former Member
0 Likes
987

Hi,

tables : zmara_01,

edidd,

edidc.

constants : c_mestyp type edidc-mestyp value 'ZAJI_MSG',

c_idoctp type edidc-idoctp value 'ZAJI_IDOC',

c_imtyp type edidc-cimtyp value 'Z_ACC_GL_POSTING01',

c_seg1 type edidd-segnam value 'E1BPACHE08',

c_seg2 type edidd-segnam value 'E1BPACGL08',

c_seg3 type edidd-segnam value 'E1BPACCR08',

c_seg4 type edidd-segnam value 'Z1BPACCR08',

c_seg5 type edidd-segnam value 'E1BPEXTC'.

  • Work Area for EDIDC

data wa_edidc like edidc.

  • Internal tabel

data i_edidc like edidc occurs 0 with header line.

data i_edidd like edidd occurs 0 with header line.

  • Internal table for ZMARA_01

data i_mara like zmara_01 occurs 0 with header line.

parameters : p_rcvprn type edoc_stat-rcvprn obligatory,"Partner Number of Receiver

p_rcvprt type edoc_stat-rcvprt obligatory."Partner Type of Receiver

start-of-selection.

  • Fill the Control Reord

wa_edidc-mandt = sy-mandt.

wa_edidc-mestyp = c_mestyp.

wa_edidc-idoctp = c_idoctp.

  • wa_edidc-cimtyp = c_imtyp.

wa_edidc-rcvprn = p_rcvprn.

wa_edidc-rcvprt = p_rcvprt.

wa_edidc-credat = sy-datum.

wa_edidc-cretim = sy-uzeit.

append wa_edidc to i_edidc.

select * from zmara_01 into table i_mara.

  • Fill the data record

loop at i_mara.

i_edidd-segnam = 'ZAJI_MSG'.

i_edidd-sdata = i_mara-matnr.

append i_edidd.

endloop.

  • Call the ALE Function Module

call function 'MASTER_IDOC_DISTRIBUTE'

exporting

master_idoc_control = wa_edidc

tables

communication_idoc_control = i_edidc

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 eq 0.

loop at i_edidc.

write:/ 'Succesfully created Idoc', i_edidc-DOCNUM.

endloop.

else.

message i000(FC) with 'No idoc has been created'.

endif.

Regards,

Younus

<b>Reward Helpful Answers:-)</b>