06-15-2011 12:07 PM
Hi, expert ,
Someone can guide me how to get som of qty column in table control ?
I created a screen with a table control and has a qty quantity field .
I want to show total of qty in a field .
my code like this ...
PROCESS AFTER INPUT.
LOOP AT I_tab.
CHAIN.
FIELD I_tab-COUNTQTY MODULE caculate_total_qty .
endchain.
MODULE UPDATE_TOTAL_QTY .
ENDLOOP.
but, when I Back to the previous screen
It's caculate again so I always get wrong Total quantity .
anyone can help me ...
06-15-2011 12:26 PM
Hi,
In the PBO event only we have to right the code like below.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB INTO wa WITH CONTROL FLIGHTS.
module cal_qty."call the module here
ENDLOOP.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE ITAB LINES LINES.
FLIGHTS-LINES = LINES.
clear tot_qty screen field name."here you should clear the Total qty screen field name
ENDMODULE.
Module cal_qty.
tot_qty screen field name = tot_qty screen field name + wa-qty .
endmodule.
regards,
Dhina..
06-15-2011 12:26 PM
Hi,
In the PBO event only we have to right the code like below.
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB INTO wa WITH CONTROL FLIGHTS.
module cal_qty."call the module here
ENDLOOP.
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'SCREEN_100'.
DESCRIBE TABLE ITAB LINES LINES.
FLIGHTS-LINES = LINES.
clear tot_qty screen field name."here you should clear the Total qty screen field name
ENDMODULE.
Module cal_qty.
tot_qty screen field name = tot_qty screen field name + wa-qty .
endmodule.
regards,
Dhina..
06-16-2011 1:22 AM
Dear Dhina ,
Thanks for your reply
It's work
I have Solved my problem .
Edited by: TitusFang on Jun 16, 2011 2:41 AM
Edited by: TitusFang on Jun 16, 2011 2:49 AM
06-16-2011 2:06 AM
Hi , Dhina
I have another question .
I use internal table data in table control to update database table .
The data in the db will be change ,
but each record I want to delete in table control , it's still exist in database .
my code is
WHEN 'SAVE'
MODIFY YDSGBT53 FROM TABLE I_YDSGBT53 .
COMMIT WORK .
END CASE
How to fix my code and let it can change and delete data in database ?
or
when I delete record in table control I must to delete data in the database too .
Edited by: TitusFang on Jun 16, 2011 3:21 AM
06-16-2011 5:53 AM
Hi,
once you press the delete button append wht record your deleting in one internal table. then while saving
just check wherether the internal table is not initial write loop the internal table use
DELETE ztable FROM TABLE del_itab.
Regards,
Dhina..
06-16-2011 6:26 AM