cancel
Showing results for 
Search instead for 
Did you mean: 

how to add the values in script

Former Member
0 Kudos

hi guru,

i have one column in main window where my output is quantities(g_quantity) stores.

ex . 34,786 and 38,876

i want to add this two values and display in footer ,how to achieve this

can somebody explain me clearly..

i am awaiting for ur reply

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi

use PERFORM <form> IN PROGRAM <prog>

/: USING &INVAR1&

/: USING &INVAR2&

......

/: CHANGING &OUTVAR1&

......

/: ENDPERFORM

and Use BOTTOM ENDBOTTOM to print the value in the Footer of the FOOTER WIINDOW

surya

sridhar_meesala
Active Contributor
0 Kudos

Hi,

Create a footer window in the page. Now in the print program write

/: &g_quantity&

Hope it helps you.

Thanks,

Sri.

Former Member
0 Kudos

hi,

g_quantity variable contains different different values in one column like ex 15,14,23

i want to add all these values and then display into final total in below.

15

14

13

12

12

12

17

18

tatal 56

how to add this logic in my itcsy structure.

kindly let me know

Former Member
0 Kudos

hi ,

so much probleam i am facing.

actually i am writing like this ...in itcsy

FORM get_grandtotal TABLES in_tab1 STRUCTURE itcsy

out_tab1 STRUCTURE itcsy.

DATA: lc1 TYPE string,

lc2 TYPE string,

ls_tab TYPE itcsy,

l_tabix TYPE sy-tabix.

data : l_value(10).

statics l_final(10).

Read table in_tab1 WITH KEY name = 'G_TOTAL'.

IF sy-subrc EQ 0.

l_value = in_tab1-value.

ENDIF.

REPLACE ',' INTO l_value WITH ''.

CONDENSE l_value NO-GAPS.

Read table out_tab1 WITH KEY name = 'L_FINAL'.

out_tab1-value = l_final.

l_final = l_final + l_value.

CONDENSE l_final.

lc1 = l_final+0(2).

lc2 = l_final+2(3).

CONCATENATE lc1 lc2 INTO l_final SEPARATED BY ','.

out_tab1-value = l_final.

CLEAR ls_tab.

LOOP AT out_tab1 INTO ls_tab.

l_tabix = sy-tabix.

CASE ls_tab-name.

WHEN 'l_final'.

ls_tab-value = l_final.

MODIFY out_tab1 FROM ls_tab INDEX l_tabix.

ENDCASE.

ENDLOOP.

*Modify outt_tab index 1.

but here i am getting material number value in_tab1 why??????

i want g_total value..

please give me details.

Former Member
0 Kudos

hi

/: PERFORM ADD IN PROGRAM ZADD

/: USING &Value1&

/: USING &value2&

/: CHANGING &g_total&

/: EndPERFORM

in the Program ZADD.

FORM ADD TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

READ TABLE in_par INDEX 1.

l1 = in_par-value.

READ TABLE in_par INDEX 2.

l2 = in_par-value.

l3 = l1 + l2.

MOVE l3 TO out_par-value.

MODIFY out_par INDEX 1.

endform.

Former Member
0 Kudos

HI,

till my probleam didnot solve.

actually in form itself i am getting values as declaring variable &g_total&.

i want to use that value and then do the addition and prepare another variable &g_gtotal&

how to write in same perform...

find below code how i am getting the g_total value

so tell me how to do grand total using g_total values.????

FORM get_total TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA: lv_menge(20),

lv_gpreis(20),

g_total(20),

g_total1(20).

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.