04-03-2006 9:26 AM
hi folks,
i need to add 2 fields in the sap script..how do i do it? there is a command "summing", but does anyone know its syntax ?
Thanks,
aditi
04-03-2006 9:30 AM
hi,
SUMMING: Adding program symbols
Program symbols can be added with the SUMMING command. The command only needs to be defined once. Each time that the specified symbol is edited, its current value is added to the sum field. Several program symbols can also be added in a sum field.
Syntax:
/:SUMMING program symbol INTO sum symbol
As SAP script cannot define sum fields dynamically, the sum symbol must be in a structure of the calling program, which was declared with TABLES.
regards
vijay
04-03-2006 9:48 AM
The SUMMING command is used for accumulating a total value for a program symbol. The command should be specified just once. Then, each time the specified program symbol is formatted, its current value is added into the total symbol. Several program symbols may all be added into a single total symbol.
Syntax:
<b>/: SUMMING program_symbol INTO total_symbol</b>
SAPscript cannot create the field for the total dynamically. The symbol used must be defined in a TABLES structure in the calling program.
regards
vinod
04-03-2006 9:53 AM
Hi aditi,
You can use SUMMING command to perform summing operation of fields in SAPScript.The syntax has already been given by Vijay...
You can use PERFORM statement to perform summing operation.
syntax:
/: PERFORM function_name in program_name
/: using &income&
/: changing &sum&
/: endperform.
In the program "program_name", call the function
form function_name TABLES in_var type ITCSY outvar type ITCSY.
endform.
**in_var contains fields NAME & VALUE.in_var contains variable sent in the using addition of the earlier PERFORM Statement(in this case, it will be income)
out_var contains the summed values and this value will be sent back to SAPScript(in this case it will be sum).
I will give an example..
form add_income tables in_tab structure itcsy out_tab structure itcsy.
global = global + in_tab-value.
loop at out_tab.
out_tab-value = global.
modify out_tab index sy-tabix.
endloop.
endform.
Hope you got the needed stuff from this.
Regards,
Sylendra.
12-11-2006 7:36 AM
12-11-2006 7:39 AM
02-18-2010 11:58 AM
Dear Prasad,
Thank you very much. i also getting solution by your post. but sorry i have no chance to give point for you
any how thanks again.