03-24-2010 6:16 AM
Hi All,
I have extended the standard IDOC and tried to populate the custom segment as child segment of parent segment of E1MASTM using user exit . But this custom segment appended at the end of all segments in a idoc ,instead of child segment of E1MASTM and got the status 26. ( Outbound )
Code as below.
LOOP AT idoc_data .
CASE idoc_data-segnam.
when 'E1MASTM'.
lc_wa_e1mastm = idoc_data-sdata.
select single verid
from MKAL
into l_verid
where matnr = lc_wa_e1mastm-matnr
and werks = lc_wa_e1mastm-werks
and STLAL = lc_wa_e1mastm-stlal
and STLAN = lc_wa_e1mastm-stlan.
IF sy-subrc eq 0.
idoc_data-segnam = 'ZE1MASTM'.
idoc_data-sdata = l_verid.
append idoc_data .
clear idoc_data.
ENDIF.
ENDCASE.
endloop.
Thanks - Vinay.
Edited by: Vinay parakala on Mar 24, 2010 7:24 AM
03-24-2010 3:13 PM
Hi Vinay parakala
Code what you are using is wrong one...
Try with this code
Data: lv_edidd LIKE edidd.
Data: c_ZE1MASTM LIKE z1edl44 VALUE 'ZE1MASTM'.
Data: lr_ZE1MASTM LIKE ZE1MASTM .
LOOP AT idoc_data .
CASE idoc_data-segnam.
when 'E1MASTM'.
lc_wa_e1mastm = idoc_data-sdata.
select single verid
from MKAL
into l_verid
where matnr = lc_wa_e1mastm-matnr
and werks = lc_wa_e1mastm-werks
and STLAL = lc_wa_e1mastm-stlal
and STLAN = lc_wa_e1mastm-stlan.
IF sy-subrc eq 0.
lr_ZE1MASTM-verid = l_verid.
Endif.
lv_edidd-segnam = c_ZE1MASTM.
lv_edidd-sdata = lr_ZE1MASTM.
APPEND lv_edidd TO idoc_data.
clear : l_verid.
ENDIF.
ENDCASE.
endloop.
Above Code will solve your problem...Let me know if you have any question on this...
Thanks
Ramesh
302 290 5677
Edited by: Ramesh on Mar 24, 2010 8:43 PM
03-24-2010 9:08 AM
Vinay,
Try copying ur code in BTE: CS000160
---
Reddy
03-24-2010 1:07 PM
Hi VV reddy,
I think CS000160 is for inbound processing. Please clarify me.
Thanks,
Vinay.
03-24-2010 9:18 AM
Hi VInay,
Try inserting the custom segment into the idoc_data table directly after the E1MASTM segment, instead of appending.
Cheers
Alex
03-24-2010 3:13 PM
Hi Vinay parakala
Code what you are using is wrong one...
Try with this code
Data: lv_edidd LIKE edidd.
Data: c_ZE1MASTM LIKE z1edl44 VALUE 'ZE1MASTM'.
Data: lr_ZE1MASTM LIKE ZE1MASTM .
LOOP AT idoc_data .
CASE idoc_data-segnam.
when 'E1MASTM'.
lc_wa_e1mastm = idoc_data-sdata.
select single verid
from MKAL
into l_verid
where matnr = lc_wa_e1mastm-matnr
and werks = lc_wa_e1mastm-werks
and STLAL = lc_wa_e1mastm-stlal
and STLAN = lc_wa_e1mastm-stlan.
IF sy-subrc eq 0.
lr_ZE1MASTM-verid = l_verid.
Endif.
lv_edidd-segnam = c_ZE1MASTM.
lv_edidd-sdata = lr_ZE1MASTM.
APPEND lv_edidd TO idoc_data.
clear : l_verid.
ENDIF.
ENDCASE.
endloop.
Above Code will solve your problem...Let me know if you have any question on this...
Thanks
Ramesh
302 290 5677
Edited by: Ramesh on Mar 24, 2010 8:43 PM
03-24-2010 4:28 PM
Hi Ramesh,
Thanks for your response ! But I am getting the same problem with your code also. Please help.
Thanks
Vinay.
03-24-2010 5:36 PM
Hi Vinay
Did you define data type correctly
Data: c_ZE1MASTM LIKE ZE1MASTM VALUE 'ZE1MASTM'.
let me know what is the error
Thanks
RAMESH
You can call me 302 290 5677