2008 Mar 12 7:04 AM
Hi All,
We have requirement that we have to do validations while processing of IDOC i.e. using User EXIT.
i can access the data and can do validations final i can update the tables data coming from user exit , but I'm not able to update the Segment field data.
here we can directly update the database , but i'm not able change the IDOC segment values .
for example
FOR cond_a IDOC
THE USER EXIT==>EXIT_SAPLVKOI_002
FUNCTION EXIT_SAPLVKOI_002.
*"----
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(IDOC_CONTROL) LIKE EDIDC STRUCTURE EDIDC
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" TABLES
*" IDOC_DATA STRUCTURE EDIDD
*" EXCEPTIONS
*" APPLICATION_ERROR
*"----
i can acess the segement values using IDOC_DATA and validations are done .
but how can i update this segmnent values that must apper in IDOCS again .if we see in we05.
Regards
Nandan.
2008 Mar 12 8:14 AM
Hi Nadan ,
Yes we can change segment data of an Idoc in the Exits.
Below is the code to change the Idoc segment data .
Here I took E1EDK04 as example I read the data from E1EDK04 and I change the segment data
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edk04. "#EC *
IF sy-subrc EQ 0.
MOVE: is_edidd-sdata TO is_e1edk04.
ENDIF.
IF l_betrg = c_betrg.
is_e1edk04-mwskz = C_TAX20.
is_e1edk04-txjcd = c_txjcd.
ELSEIF l_betrg = c_betrg1.
is_e1edk04-mwskz = C_TAX21.
is_e1edk04-txjcd = wa_ekpo-txjcd.
ENDIF.
LOOP AT t_idoc_data
WHERE docnum = i_idoc_contrl-docnum.
CASE t_idoc_data-segnam .
WHEN c_segnam_e1edk04.
MOVE is_e1edk04 TO is_edidd-sdata.
MODIFY t_idoc_data FROM is_edidd.
ENDCASE.
ENDLOOP.
Please let me know if u have any Queries .
Rgds
Sree m
Hi All,
We have requirement that we have to do validations while processing of IDOC i.e. using User EXIT.
i can access the data and can do validations final i can update the tables data coming from user exit , but I'm not able to update the Segment field data.
here we can directly update the database , but i'm not able change the IDOC segment values .
for example
FOR cond_a IDOC
THE USER EXIT==>EXIT_SAPLVKOI_002
FUNCTION EXIT_SAPLVKOI_002.
*"----
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(IDOC_CONTROL) LIKE EDIDC STRUCTURE EDIDC
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" TABLES
*" IDOC_DATA STRUCTURE EDIDD
*" EXCEPTIONS
*" APPLICATION_ERROR
*"----
i can acess the segement values using IDOC_DATA and validations are done .
but how can i update this segmnent values that must apper in IDOCS again .if we see in we05.
Regards
Nandan.
2008 Mar 12 8:14 AM
Hi Nadan ,
Yes we can change segment data of an Idoc in the Exits.
Below is the code to change the Idoc segment data .
Here I took E1EDK04 as example I read the data from E1EDK04 and I change the segment data
READ TABLE t_idoc_data INTO is_edidd
WITH KEY segnam = c_segnam_e1edk04. "#EC *
IF sy-subrc EQ 0.
MOVE: is_edidd-sdata TO is_e1edk04.
ENDIF.
IF l_betrg = c_betrg.
is_e1edk04-mwskz = C_TAX20.
is_e1edk04-txjcd = c_txjcd.
ELSEIF l_betrg = c_betrg1.
is_e1edk04-mwskz = C_TAX21.
is_e1edk04-txjcd = wa_ekpo-txjcd.
ENDIF.
LOOP AT t_idoc_data
WHERE docnum = i_idoc_contrl-docnum.
CASE t_idoc_data-segnam .
WHEN c_segnam_e1edk04.
MOVE is_e1edk04 TO is_edidd-sdata.
MODIFY t_idoc_data FROM is_edidd.
ENDCASE.
ENDLOOP.
Please let me know if u have any Queries .
Rgds
Sree m
2008 Mar 12 9:02 AM
Hi,
i have done this coding already
LOOP AT IDOC_DATA.
CASE IDOC_DATA-SEGNAM.
WHEN 'E1KOMG'.
Y_E1KOMG = IDOC_DATA-SDATA.
WHEN 'Z1YE1KOMG'.
Y_Z1YE1KOMG = IDOC_DATA-SDATA.
WHEN 'E1KONH'.
Y_E1KONH = IDOC_DATA-SDATA.
WHEN 'E1KONP'.
Y_E1KONP = IDOC_DATA-SDATA.
ENDCASE.
ENDLOOP.
after some validaytions
LOOP AT IDOC_DATA.
CASE IDOC_DATA-SEGNAM.
WHEN 'E1KOMG'.
move Y_E1KOMG to IDOC_DATA-SDATA.
ENDCASE.
ENDLOOP.
after , if i see the idoc in we05 .
changes are not replicated in segments.
2008 Mar 12 9:20 AM
Hi,
From your Code snippet, i can see that you have not written modify statement inside the loop, to update the changed data into the segment required.
Please debug at that place and use modify statement.
Regards,
Ramesh
2008 Mar 13 2:20 PM