Skip to Content
0
Former Member
Jul 23, 2008 at 10:58 PM

EDI - IDoc - User Exit - Code - Problem - Help - Wanted

10 Views

Hi EDI Experts,

I have extended ORDERS05 IDOC twice.

ZVKSEG1 is the the segment under extended idoc ZVKORDRS05. This is for one partner.

Z1DATESH01 is the segment under extended idoc Z1ORDER05. This is for another partner.

I have completed the configuration thing in WE82 for both the extensions.

Now the requirement is, whenever a PO is created for the first partner - 100290, the IDoc generated should contain the extra segment ZVKSEG1 and whenever PO is created for the second partner - 10099,the Idoc generated should contain the extrasegment Z1DATESH01.

Using WE20, i have added the extended IDoc type in both the partner profiles under ORDERS message type.

Now i've written the user exit for this using EXIT_SAPLEINM_002.

 tables: edidc.

data: z_edidd like edidd occurs 0 with header line.
data: y1dath01 like z1datesh01.
data: yvkseg1 like zvkseg1.

if edidc-rcvprn = '10099'.
z_edidd[] = int_edidd[].

loop at z_edidd.

if z_edidd-segnam  = 'E1EDK01'.
read table z_edidd  with key segnam  = 'Z1DATESH01'.
if sy-subrc <> 0.

y1dath01-DELDATE = sy-datum.
clear z_edidd.

z_Edidd-sdata = y1dath01.
z_Edidd-segnam = 'Z1DATESH01'.

append z_edidd.

endif.
endif.

endloop.

 int_edidd[] = z_edidd[].

elseif edidc-rcvprn = '100290'.
z_edidd[] = int_edidd[].

loop at z_edidd.

if z_edidd-segnam  = 'E1EDK01'.
read table z_edidd  with key segnam  = 'ZVKSEG1'.
if sy-subrc <> 0.

yvkseg1-name1 = 'ZVK Chemicals'.
clear z_edidd.

z_Edidd-sdata = yvkseg1.
z_Edidd-segnam = 'ZVKSEG1'.

append z_edidd.

endif.
endif.

endloop.

 int_edidd[] = z_edidd[].
endif.

Could you please go through the code and tell me where did i go wrong. The extra segments are not being created for both the partners.

I created PO using ME21n once for each vendor.

Please help me out guys.

Thanks,

Matt