Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP script variable caluclation incorrect

Former Member
0 Likes
325

I have a SAP script and within that i have the following code written:

/:	 	IF &CHOICE& = '1'
/:	 	PERFORM GET_FINAL IN PROGRAM ZTEST
/:	 	USING     &RPBEN_DA-PERNR&
/:	 	USING     &RPBEN_DA-TCCST&:	 	
/:	 	CHANGING  &FINAL&
/:	 	ENDPERFORM

now I want to modify the value of &FINAL&... I need to some calculation and based on that I want to set the values for ex:

I want to do something like this :

/:                v_num = 2.
/:                 V_test = FINAL * V_num.

But when I debug v_test is coming out to be zero and FINAL does have a value in it. can you please tell me what I might be doing wrong here.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
295

SAPScript standard process: In your subroutine for the perform, you must read your input table of type itcsy....calculate all your values in the subroutine......

like:

form GET_FINAL tables in_par structure itcsy
                                     out_par structure itcsy.

read table in_par index 1.  
   lv_pernr = in_par-value.   "first USING
read table in_par index 2.
lv_TCCST = in_par-value.   "2nd USING value

* do your stuff.

read table out_par index 1.
  out_par-value = some_field. "first changing value FINAL
modify out_par index 1.   
read table out_par index 2.    "your VTEST becomes a changing parameter
out_par-value = your other calculations
modify out_par index 2.
endform.

Edited by: BreakPoint on Mar 14, 2011 7:11 PM

1 REPLY 1
Read only

Former Member
0 Likes
296

SAPScript standard process: In your subroutine for the perform, you must read your input table of type itcsy....calculate all your values in the subroutine......

like:

form GET_FINAL tables in_par structure itcsy
                                     out_par structure itcsy.

read table in_par index 1.  
   lv_pernr = in_par-value.   "first USING
read table in_par index 2.
lv_TCCST = in_par-value.   "2nd USING value

* do your stuff.

read table out_par index 1.
  out_par-value = some_field. "first changing value FINAL
modify out_par index 1.   
read table out_par index 2.    "your VTEST becomes a changing parameter
out_par-value = your other calculations
modify out_par index 2.
endform.

Edited by: BreakPoint on Mar 14, 2011 7:11 PM