‎2009 Aug 06 10:10 AM
Hi Experts,
I'm creating a SHPMNT04-IDoc for deliveries. For each position in the delivery, I want to modify the position no. (E1EDL24-POSNR) when the position type (E1EDL26-PSTYV) is eq "ZHUM".
I 'm editing a segment like this:
DESCRIBE TABLE idoc_data LINES lc_va_line.
READ TABLE idoc_data INDEX lc_va_line.
MOVE idoc_data-sdata TO lc_wa_e1edl24.
......
MOVE lc_wa_e1edl24 TO idoc_data-sdata.
MODIFY idoc_data INDEX lc_va_line.
CLEAR idoc_data.... but how can I test a value in the substructure E1EDL26 and modify a value in the upper-structure E1EDL24 ?
Thanks a lot for support.
Regards,
David.
‎2009 Aug 06 10:24 AM
I hope you want help on the coding to modify the segment E1EDL24-POSNR then do like this..
Loop at Idoc_data.
If idoc_data-segnam = 'E1EDL24'.
READ TABLE idoc_data with key segnam = 'E1EDL26'.
if sy-subrc = 0.
MOVE idoc_data-sdata TO lc_wa_e1edl26.
if lc_wa_e1edl26-pstyv = 'zhum'.
modify the sgement E1EDL24
endif.
endif.
endif.
endloop.
‎2009 Aug 06 10:24 AM
I hope you want help on the coding to modify the segment E1EDL24-POSNR then do like this..
Loop at Idoc_data.
If idoc_data-segnam = 'E1EDL24'.
READ TABLE idoc_data with key segnam = 'E1EDL26'.
if sy-subrc = 0.
MOVE idoc_data-sdata TO lc_wa_e1edl26.
if lc_wa_e1edl26-pstyv = 'zhum'.
modify the sgement E1EDL24
endif.
endif.
endif.
endloop.
‎2009 Aug 07 7:42 AM
Hi guys,
thank you for your answers.
@ Alexander :
I used your coding like this:
IF segment_name EQ 'E1EDL24'.
DESCRIBE TABLE idoc_data LINES lc_va_line.
READ TABLE idoc_data INDEX lc_va_line.
MOVE idoc_data-sdata TO lc_wa_e1edl24.
READ TABLE idoc_data WITH KEY segnam = 'E1EDL26'.
IF sy-subrc = 0.
MOVE idoc_data-sdata TO lc_wa_e1edl26.
IF lc_wa_e1edl26-pstyv = 'ZHUM'.
lc_wa_e1edl24-posnr = lc_wa_e1edl24-posnr + 9010.
ENDIF.
ENDIF.
MOVE lc_wa_e1edl24 TO idoc_data-sdata.
MODIFY idoc_data INDEX lc_va_line.
CLEAR idoc_data.
ENDIF.... I think there is a problem when I update de internal table "idoc_data" with "MOVE lc_wa_e1edl24 TO idoc_data-sdata" because after reading the E1EDL26 segment, I've got another index. What do you think ?
Regards,
David
‎2009 Aug 07 8:34 AM
‎2009 Aug 07 8:54 AM
As Gordon said, use one variable and assign the index value for the E1EDL24 read and use that in modify statement.
‎2009 Aug 06 10:30 AM
hi,
there is an easier way to solve this.
data: lc_wa_e1edl24 type e1edl24.
data: lc_wa_e1edl26 type e1edl26.
field-symbold: <idoc_data> type edidd.
loop at idoc_data assigning <idoc_data>.
case <idoc_data>-segnam.
when 'E1EDL24'
lc_wa_e1edl24 = <idoc_data>-sdata.
... do your changes (remember posnr)
<idoc_data>-sdata = lc_wa_e1edl24. "you don´t need to modify idoc_data.
when 'E1EDL26'.
lc_wa_e1edl26 = <idoc_data>-sdata.
... do your chnages. (use posnr)
<idoc_data>-sdata = lc_wa_e1edl26. "you don´t need to modify idoc_Data
endcase.
endloop.
i think this should help you !
Edited by: Gordon Breuer on Aug 6, 2009 11:31 AM