Modifying INVOIC01

Question: I have to modify INVOIC01 in the user exit exit_saplvedf_002.

Header level changes :

Seller ContactName = E1EDKT1 - E1EDKT2[0] – TDLINE where E1EDKT1 –TDID = ‘ZE14’

Item level changes :

Get MWSKZ from E1EDP01 - E1EDP04 – MWSKZ
Get KTEXT from E1EDP01 - E1EDP04 – KTEXT
If MWSKZ = S2
E1EDP01 - E1EDP04 – KTEXT = "WellServiceTax".

Tax Exemption
If there is a tax value (E1EDP01 - E1EDP04 – MWSBT) > ZERO for any condition for the line item update E1EDP01 - E1EDP04 – MWSKZ = NE

I am very new to IDOCs. Please provide the code

Answer:
Here is some example code for this exit. Hopefully you can work out what to do from here:

*----------------------------------------------------------------------*
* INCLUDE ZXEDFU02 *
*----------------------------------------------------------------------*
* Title : zxedfu02 *
* *
* Description : USER EXIT TO POPULATE INVOIC IDOC *
* *
* Creation Date : 14-JUL-2003 *
*----------------------------------------------------------------------*

describe table int_edidd lineS w_index.
READ TABLE INT_EDIDD index w_index into w_edidd.

case w_edidd-segnam.
when 'E1EDKA1'.
move w_edidd-sdata to w_e1edka1.
* If no cust acc, then this is a non-EDI order, so fill in the acc num
if w_e1edka1-parvw = 'RG' and w_e1edka1-ihrez is initial.
select single expnr from edpar into w_expnr
where kunnr = dobject-parnr
and parvw = 'EK'
and inpnr = w_e1edka1-partn.
if sy-subrc = 0.
w_e1edka1-ihrez = w_expnr.
endif.
endif.
* Get customer sold to party.
select single expnr from edpar into w_expnr
where kunnr = dobject-parnr
and parvw = 'AG'
and inpnr = w_e1edka1-partn.
if sy-subrc = 0.
w_e1edka1-lifnr = w_expnr.
endif.
move w_e1edka1 to w_edidd-sdata.
modify int_edidd from w_edidd index w_index.
when 'E1EDP02'.
move w_edidd-sdata to w_e1edp02.
if w_e1edp02-qualf = '002'.
select single kwmeng from vbap into w_menge
where vbeln = w_e1edp02-belnr
and posnr = w_e1edp02-zeile.
if sy-subrc = 0.
w_e1edp02-ihrez = w_menge.
move w_e1edp02 to w_edidd-sdata.
modify int_edidd from w_edidd index w_index.
endif.
endif.
endcase.
Copyright ?2007 - 2008 www.jt77.com