Application Development 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: 

Create IDOCs

Former Member
0 Kudos
96

Hi,

I need some help..

I want to know what FM should i use to make an Zprogram to create WPUUMS IDOCs.

Thanks in advance.

Best regards

3 REPLIES 3

former_member583013
Active Contributor
0 Kudos
42

<b>MASTER_IDOC_DISTRIBUTE</b> if i'm not wrong -:)

Greetings,

Blag.

0 Kudos
42

Hi,

The function module to populate data into Idoc is <b>master_idoc_distribute.</b>

Here is a sample program.

&----


*& Report ZNARIDOC *

*& *

&----


*& *

*& *

&----


REPORT ZIDOC.

DATA: it_edidc LIKE edidc OCCURS 0 WITH HEADER LINE.

DATA: it_edidd LIKE edidd OCCURS 0 WITH HEADER LINE.

DATA: wa_edidc LIKE edidc.

DATA: wa_yseg LIKE zvendor.

DATA: it_lfa1 LIKE lfb1 OCCURS 0 WITH HEADER LINE.

START-OF-SELECTION.

*it_lfa1-lifnr = '0000000027'.

*it_lfa1-bukrs = '0001'.

*append it_lfa1.

*clear it_lfa1.

*

it_lfa1-lifnr = '0000000030'.

it_lfa1-bukrs = '0001'.

append it_lfa1.

clear it_lfa1.

  • control record

wa_edidc-rcvprn = 'YRL810'. " recieving logical system..

wa_edidc-rcvprt = 'LS'. " Partner type of the recieving system.

wa_edidc-rcvpor = 'YP810'.

wa_edidc-mestyp = 'ZVMSG'.

wa_edidc-idoctp = 'ZKIDOC'.

wa_edidc-direct = 1.

*Build data Record

LOOP AT it_lfA1.

MOVE : it_lfa1-lifnr TO wa_Yseg-lifnr,

it_lfa1-bukrs TO wa_yseg-bukrs.

MOVE : 'ZVENDOR' TO it_edidd-segnam,

wa_yseg TO it_edidd-sdata.

APPEND it_edidd.

CLEAR : it_edidd,wa_yseg.

ENDLOOP.

  • Calling FM to create Outbound Iodc.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = wa_edidc

  • OBJ_TYPE = ''

  • CHNUM = ''

TABLES

communication_idoc_control = it_edidc

master_idoc_data = it_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.

ELSE.

COMMIT WORK.

READ TABLE it_edidc INDEX 1.

WRITE:/10 it_edidc-docnum.

ENDIF.

Segment definiton :

lifnr lifnr

bukrs bukrs

Regards,

Varun.

ferry_lianto
Active Contributor
0 Kudos
42

Hi Yukimai,

You can call this FM <b>IDOC_INPUT_POS_SALES_ACCOUNT</b> to process IDoc WPUUMS.

Hope this will help.

Regards,

Ferry Lianto