Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

how to get sum of quantity column in table control

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 ...

Former Member
replied

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..

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question