cancel
Showing results for 
Search instead for 
Did you mean: 

how to add and display into final output

Former Member
0 Kudos

hi,

i want just one input from you.in my below prgram i am multiplying and displaying the value in my form output.

in my form my values are 34.98,45.87and 76.86

my requirement is to add the above values and diaplay into footer as grand total.

what extra logic i have to add in my below program???

please help?

FORM get_total TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: lv_menge(20),

lv_gpreis(20),

g_total(20),

g_final(20),

g_grandtotal.

DATA: lc1 TYPE string,

lc2 TYPE string,

ls_tab TYPE itcsy,

l_tabix TYPE sy-tabix.

READ TABLE in_tab WITH KEY name = 'RESBD-MENGE'.

IF sy-subrc EQ 0.

lv_menge = in_tab-value.

ENDIF.

READ TABLE in_tab WITH KEY name = 'RESBD-GPREIS'.

IF sy-subrc EQ 0.

lv_gpreis = in_tab-value.

ENDIF.

REPLACE ',' INTO lv_gpreis WITH ''.

CONDENSE lv_gpreis NO-GAPS.

READ TABLE out_tab WITH KEY name = 'G_TOTAL'.

IF sy-subrc EQ 0.

g_total = lv_menge * lv_gpreis.

out_tab-value = g_total.

CONDENSE g_total.

*

  • lc1 = g_total+0(2).

  • lc2 = g_total+2(3).

*

  • CONCATENATE lc1 lc2 INTO g_total SEPARATED BY ','.

  • out_tab-value = g_total.

CLEAR ls_tab.

LOOP AT out_tab INTO ls_tab.

l_tabix = sy-tabix.

CASE ls_tab-name.

WHEN 'G_TOTAL'.

ls_tab-value = g_total.

MODIFY out_tab FROM ls_tab INDEX l_tabix.

ENDCASE.

ENDLOOP.

ENDIF.

ENDFORM.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Sahu,

Declare a global variable in the form and keep adding the results to that, finally display the same.

Hope this helps you

-Sujatha

Former Member
0 Kudos

HI

What is the Problem that ur facing can u explain it clearlly.

surya