on 04-17-2007 7:17 PM
can any one say how to use ITCSY structure for summation?
Hi,
<b>script code</b>
/:PERFORM get_date IN PROGRAM zreport
/:USING &VAL1&
/:USING &VAL2&
/:CHANGING &S_DATE&
/:ENDPERFORM
<b>
The ABAP Code would be</b>
REPORT zreport.
TABLES ztab.
FORM get_date TABLES in_tab STRUCTURE ITCSY out_tab
STRUCTURE ITCSY .
data: val1 type i.
READ TABLE in_tab INDEX 1.
val1 = in+tab1-value. " Moving the value to a temporary variable
IF sy-subrc EQ 0.
READ TABLE out-tab INDEX 1.
if sy-subrc = 0.
out_tab-value = in_tab-val2 + val1. " Caliculating the value
MODIFY out_tab INDEX 1.
ENDIF.
ENDFORM.
Regards
Sudheer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Prakash,
For using routine in the sapscript v have to use itcsy.
i have given a demo pgm for ur reference.
/: PERFORM SUM IN PROGRAM ZPROGRAM
/: USING &VAR1&
/: USING &VAR2&
/: CHANGING &RESULT&
/: ENDPERFORM
In the program(ZPROGRAM), we need to write the form ....
FORM SUM TABLES INTAB STRUCTURE ITCSY
OUTTAB STRUCTURE ITCSY.
data: field1 type i,
field2 type i,
result type i.
TO read the values from the ITAB you have to use this logic.
READ TABLE INTAB WITH KEY NAME = 'VAR1'.
IF SY-SUBRC = 0.
FIELD1 = INTAB-VALUE.
ENDIF.
READ TABLE INTAB WITH KEY NAME = 'VAR2'.
IF SY-SUBRC = 0.
FIELD2 = ITAB-VALUE.
ENDIF.
RESULT = V_FIELD1 + V_FIELD2.
READ TABLE OUTTAB INDEX 1.
IF SY-SUBRC = 0.
OTAB-VALUE = RESULT.
MODIFY OUTTAB INDEX 1 .
ENDIF.
ENDFORM.
~~Guduri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.