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

Can we chnge segment data of IDOC while processing using EXITS ?

Former Member
0 Likes
1,867

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,400

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.

4 REPLIES 4
Read only

Former Member
0 Likes
1,401

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

Read only

0 Likes
1,400

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.

Read only

0 Likes
1,400

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

Read only

Former Member
0 Likes
1,400

Thanks for all