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

Populating IDoc

VikasB
Active Participant
0 Kudos
243

Hi all,

can any one pls provide me with sample code for populating IDoc with segments maintained in hierarchical level.

vikas.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Kudos
188

Refer to RBDSEMAT program.

else open program for any Tcode BD10, BD12, BD14 u will find the way to deal with sending of IDOC data.

5 REPLIES 5
Read only

Former Member
0 Kudos
189

Refer to RBDSEMAT program.

else open program for any Tcode BD10, BD12, BD14 u will find the way to deal with sending of IDOC data.

Read only

Former Member
0 Kudos
188

Hi Vikas ,

Please fidn the below sample code .

DATA: C_INVREV_SEGNAME(7) TYPE C VALUE 'Z1INVRV',

C_INVREV_MESTYPE(6) TYPE C VALUE 'ZINVRV',

C_INVREV_IDOC_TYPE(8) TYPE C VALUE 'ZINVRV01',

Z1INVRV LIKE Z1INVRV,

C_INVREV_DOCTYPE LIKE BKPF-BLART VALUE 'YY',

IDOC_CONTROL LIKE EDIDC,

T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,

IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.

*--- Move the document header into a structure

LOOP AT DOC_HEAD_TAB INTO DOC_HEAD.

ENDLOOP.

*--- Move the document item data into a structure

LOOP AT DOC_ITEM_TAB INTO DOC_ITEM WHERE NOT ( LIFNR IS INITIAL ).

ENDLOOP.

*--- Populate the IDoc segment’s field with the required data

CLEAR Z1INVRV.

Z1INVRV-LIFNR = DOC_ITEM-LIFNR. “Store vendor number for filter

Z1INVRV-XBLNR = DOC_HEAD-XBLNR. “Billing number

IDOC_DATA-SEGNAM = C_INVREV_SEGNAME. “Segment name

IDOC_DATA-SDATA = Z1INVRV. “Segment data

APPEND IDOC_DATA. “Populate IDoc internal table

Procedure

1.Get the required data

2. fill the all segment and append to the Idoc data internal table Idoc_data .

Please let me know if u have any queries . I hope this will solve the problem .

Rgds

Sree M

Read only

0 Kudos
188

hi,

thanks for ur reply.

but again i hv one question that, do we need to do any thing while populating the IDOC when the segments are defined as mandetory segments.

like what if my internal table do not contains any data and segment is mandetory segment

Read only

0 Kudos
188

Hi Vikas ,

what if my internal table do not contains any data and segment is mandetory segment?

You have to fill all the mandatory segments in the Idoc for this Please discuss with your Functional and Business scenario definitely will support to fill the Mandatory segments . Otherwise Idoc will give the Status as Syntax Error .Please ensure whether it is a mandatory or not in WE60.

.I hope so it will resolve ur query .

Rgds

Sree M

Read only

0 Kudos
188

Hi,

Goto WE60 tcode ,there give ur message and basic type,u will get the documentation of the required segments.

for mandatory segments u shouls always pass the data...

Regards,

Nagaraj