on 07-02-2007 9:48 AM
Hi experts,
How can i do mathematical operations in sap script ?
my code is:
&netval& = &netval& - &fre_chrg&.
but it is not working.
what is the correct way?
thanks.
Hi,
You can not do any mathematical calculations in Script directly.
However, this can be done by using subroutine. You can either define a subroutine in the driver program or in any other program. And then you can call this subroutine in your script.
/:PERFORM calculate IN PROGRAM zcalculate
/:USING &fre_chrg&
/:CHANGING &netval&
/:ENDPERFORM
Regards,
Kate
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Write a perform and do the calculations
Eg:
/:PERFORM f_clac IN PROGRAM Zcaluclation_scr
/:USING &your fields&
/:CHANGING &ouput filed&
/:ENDPERFORM
The report :
REPORT Zcaluclation_scr.
FORM f_calc input type itcsy
output type itcsy.
your code
ENDFORM.
rewards if useful,
regards,
nazeer
Message was edited by:
nazeer shaik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can't do mathematical operations in Script
You have to write a Subroutine program using PERFORM.. statement see the sample code
How to call a subroutine form SAPscripts
The Form :
/:PERFORM CDE_CENT IN PROGRAM ZKRPMM_PERFORM_Z1MEDRUCK
/:USING &EKKO-EBELN&
/:CHANGING &CDECENT&
/:ENDPERFORM
The report :
REPORT zkrpmm_perform_z1medruck .
DATA : BEGIN OF it_input_table OCCURS 10.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_input_table.
déclaration de la table output_table contenant les
variables exportées
DATA : BEGIN OF it_output_table OCCURS 0.
INCLUDE STRUCTURE itcsy.
DATA : END OF it_output_table.
DATA : w_ebeln LIKE ekko-ebeln,
w_vbeln LIKE vbak-vbeln,
w_zcdffa LIKE vbak-zcdffa.
*----
*
FORM CDE_CENT
*
*----
*
FORM cde_cent TABLES input output.
it_input_table[] = input[].
it_output_table[] = output[].
READ TABLE it_input_table INDEX 1.
MOVE it_input_table-value TO w_ebeln.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = w_ebeln
IMPORTING
output = w_ebeln.
SELECT SINGLE zcdffa FROM ekko
INTO w_zcdffa
WHERE ebeln = w_ebeln.
it_output_table-name = 'CDECENT'.
MOVE w_zcdffa TO it_output_table-value.
MODIFY it_output_table INDEX 1.
output[] = it_output_table[].
ENDFORM.
Reward points for useful Answers
Regards
Anji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.