‎2007 Sep 26 5:08 PM
Dear All,
Will you please let me know what's wrong in the following code?
form zf_caluc .
CASE sy-ucomm.
WHEN 'CALUC'.
loop at gt_alv into gs_alv.
gv_calc = gs_alv-bdmng - gs_alv-enmng.
if gv_calc > 300.
exit.
elseif gv_calc < 300.
gs_alv-labst = gv_calc.
endif.
append gs_alv to gt_alv.
modify gt_alv from gs_alv .
endloop.
when 'back'.
LEAVE PROGRAM.
ENDCASE.
Thanks in Advance,
Ranjan
endform. " zf_caluc
Title was edited by:
Alvaro Tejada Galindo
‎2007 Sep 26 5:13 PM
form zf_caluc .
CASE sy-ucomm.
WHEN 'CALUC'.
loop at gt_alv into gs_alv.
gv_calc = gs_alv-bdmng - gs_alv-enmng.
if gv_calc > 300.
exit.
elseif gv_calc < 300.
gs_alv-labst = gv_calc.
endif.
<b>append gs_alv to gt_alv.
modify gt_alv from gs_alv .</b> * Either do an APPEND or MODIFY. Y Both?
endloop.
when 'back'.
LEAVE PROGRAM.
ENDCASE.
‎2007 Sep 26 5:13 PM
form zf_caluc .
CASE sy-ucomm.
WHEN 'CALUC'.
loop at gt_alv into gs_alv.
gv_calc = gs_alv-bdmng - gs_alv-enmng.
if gv_calc > 300.
exit.
elseif gv_calc < 300.
gs_alv-labst = gv_calc.
endif.
<b>append gs_alv to gt_alv.
modify gt_alv from gs_alv .</b> * Either do an APPEND or MODIFY. Y Both?
endloop.
when 'back'.
LEAVE PROGRAM.
ENDCASE.
‎2007 Sep 26 5:14 PM
At first look....This is wrong...
append gs_alv to gt_alv.
modify gt_alv from gs_alv .
If you are appending gs_alv to gt_alv...Why are you modifiying gt_alv from gs_alv???
Anyway...What's the error your getting???
Greetings,
Blag.
‎2007 Sep 27 8:16 AM
Hi KCR,
if you APPEND to a table you are LOOPing AT, this will loop forever. The EXIT condition gv_calc > 300 may be never fulfilled because it is no defined that gs_alv-bdmng - gs_alv-enmng will ever be more than 300.
Honestly: Nothing is wrong with the code. It's just a bit useless.
Regards,
Clemens