‎2006 Jul 01 7:10 PM
HI Friends,
I have an internal table with some line and each line has a material number, quantity etc.....
I need to add quantites based on a condition and add the result to the first line which does not satisfy the condition and delete all the lines which satisfy the condition from the internal table.
My code is as follows however its giving me a short dump.
DATA : wa1_input line lone of i_input.
loop at i_input.
if xvbap-pstyv = 'TAL'
wa1_input-qty = wa1_input-qty + i_input-qty.
endif.
endloop.
read table i_input where xvbap-pstyv <> 'TAL'.
i_input-qty = i_input-qty + wa1_input-qty.
modify i_input.
Any help on this will be helpful.
Shejal.
‎2006 Jul 01 7:16 PM
Interesting requirement. Maybe this will work. I assume that PSTYV is in the internal tabe I_INPUT?
DATA : wa1_input like line of i_input.
clear wa1_input.
loop at i_input where pstyv = 'TAL'.
wa1_input-qty = wa1_input-qty + i_input-qty.
delete i_input.
endloop.
read table i_input with key pstyv <> 'TAL'.
if sy-subrc = 0.
i_input-qty = i_input-qty + wa1_input-qty.
modify i_input index sy-tabix.
endif.
Regards,
Rich Heilman
‎2006 Jul 01 7:16 PM
Interesting requirement. Maybe this will work. I assume that PSTYV is in the internal tabe I_INPUT?
DATA : wa1_input like line of i_input.
clear wa1_input.
loop at i_input where pstyv = 'TAL'.
wa1_input-qty = wa1_input-qty + i_input-qty.
delete i_input.
endloop.
read table i_input with key pstyv <> 'TAL'.
if sy-subrc = 0.
i_input-qty = i_input-qty + wa1_input-qty.
modify i_input index sy-tabix.
endif.
Regards,
Rich Heilman
‎2006 Jul 01 7:20 PM
This won't work.
read table i_input with key pstyv <> 'TAL'.
if sy-subrc = 0.
i_input-qty = i_input-qty + wa1_input-qty.
modify i_input index sy-tabix.
endif.Try this instead.
loop at i_input where pstyv <> 'TAL'.
i_input-qty = i_input-qty + wa1_input-qty.
modify i_input.
exit. " We only want to do this read once
Endloop.
Regards,
Rich Heilman
‎2006 Jul 01 7:21 PM
Thanks Rich,
No pstyv is not in the internal table of i_input.
Its in the XVBAP table od user exit MV45AFZZ for SO.
I have looped xvbap and have appended to i_input but the i_input table does not have PSTYV field.
once i get all the rows in my internal table from XVBAP i need to do this calculation ie, regarding quantities.
Shejal.
‎2006 Jul 01 7:24 PM
‎2006 Jul 01 7:27 PM
Thanks Rich,
I will try to change the code and will let you know if i need any help.
Shejal.
‎2006 Jul 01 7:17 PM
What is short dump?
Use
<b>MODIFY TABLE i_input.</b>
Regds
Manohar