‎2009 Jul 16 9:54 PM
Hi,
I am writing the below piece of code and it was throwing syntax error that 'actual parameters and formal parameters are not equal'.
its really irritating, can any one solve this.
data: var1 type i value 5,
var2 type i value 10.
perform form1
using var1:
'1',
'2',
'3',
changing var2.
*&---------------------------------------------------------------------*
*& Form FORM1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_VAR1 text
* -->P_0019 text
*----------------------------------------------------------------------*
form FORM1
using p_var1
p_no
changing p_var2.
Thanks
‎2009 Jul 17 6:04 AM
Hi jaya,
You can use the perform statement as you want but you can not use changing becuase you are passing the value 1,2 nad 3 directly to p_no and these values wiil be woked as constant for p_no (you can check this also in debugging) that is why you can not use statement changing.
2 Program is giving the syntax error beacuse after colon you are passing the value 1,2 and 3 and these values are passed to variable p_no , when you declare new actual parameter 'var2', perform stetement still consider that this is the value which need to pass to the vaiable p_no and does not accept it as a actual parameter.
3 if you will use like this then it can accept var2 as a actual parameter and will not give any error.
perform form1
using var1
var2:
'1',
'2',
'3'.
write: 'test'.
&----
*& Form FORM1
&----
text
----
-->P_VAR1 text
-->P_0019 text
----
form FORM1
using p_var1
p_no
p_var2.
endform.
in the above code both the actual and formal parameters are same (3), so whenever you want to pass the value directly to any variable of subroutine then keep it at the end of perform statement.
Hope this will clear to you, if not then plz let me know.
‎2009 Jul 16 10:03 PM
Dont understand what you are trying to do. Are 1, 2 and 3 different values of var1?
‎2009 Jul 16 10:05 PM
yes one by one those should be passed.
If i dont have changing then it will work, but if i have changing then its not.
perform form1
using var1:
'1',
'2',
'3'.
* changing var2.
*&---------------------------------------------------------------------*
*& Form FORM1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_VAR1 text
* -->P_0019 text
*----------------------------------------------------------------------*
form FORM1
using p_var1
p_no.
* changing p_var2.
endform. " FORM1
‎2009 Jul 16 10:07 PM
‎2009 Jul 16 10:11 PM
‎2009 Jul 16 10:13 PM
do 3 times.
ur code for setting the var1 value here***
perform form1
using var1
changing var2.
enddo.
‎2009 Jul 17 1:09 AM
I am still working on that why it was not working? is there any restriction that we should not use changing?
‎2009 Jul 17 3:06 AM
Hi Jaya sri,
Check your modified program. It works. I have just added some logic inside subroutine.
I hope that it solves your problem.
Thanks
Venkat.OREPORT ztest_notepad.
DATA: var1 TYPE i VALUE 5,
var2 TYPE i VALUE 10.
PERFORM form1 USING var1
'1'
'2'
'3'
CHANGING var2.
WRITE var2.
*&---------------------------------------------------------------------*
*& Form FORM1
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_VAR1 text
* -->p_value_1 text
* -->p_value_2 text
* -->p_value_3 text
* <--P_VAR2 text
*----------------------------------------------------------------------*
FORM form1 USING p_var1
p_value_1
p_value_2
p_value_3
CHANGING p_var2.
p_var2 = p_var2 + p_var1 + p_value_1 + p_value_2 + p_value_3.
ENDFORM. " FORM1
‎2009 Jul 17 3:51 AM
HI VENKAT,
Thanks for your code, but what you wrote is general approach. I dont want to mention those number of formal parameters. Did you check my previous code, in the similar way it should work even if i use CHANGING parameter.
Thanks
Jaya
‎2009 Jul 17 6:40 AM
Try this way,
REPORT ztest_notepad.
DATA: var1 TYPE i VALUE 5,
var2 TYPE i VALUE 10.
PERFORM: form1 USING: var1 '1' CHANGING var2,
form1 USING: var1 '2' CHANGING var2,
form1 USING: var1 '3' CHANGING var2.
FORM form1 USING p_var1
p_no
CHANGING p_var2.
p_var2 = p_var2 + p_var1.
ENDFORM. venkat.O
‎2009 Jul 16 10:03 PM
Hi,
Your Syntax is wrong.
Step 1 Write
Perform get_details using var1 var2
changing var3 var4.
Step 2 Double Click on the above line in editor, Body of the Perform will be automatically created in Program.
FORM test USING p1 TYPE string
p2 TYPE string
CHANGING value(p3) TYPE string
value(p4) TYPE string.
...
ENDFORM
Plz look in following link.
thanks and Regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Jul 16, 2009 11:05 PM
‎2009 Jul 17 6:04 AM
Hi jaya,
You can use the perform statement as you want but you can not use changing becuase you are passing the value 1,2 nad 3 directly to p_no and these values wiil be woked as constant for p_no (you can check this also in debugging) that is why you can not use statement changing.
2 Program is giving the syntax error beacuse after colon you are passing the value 1,2 and 3 and these values are passed to variable p_no , when you declare new actual parameter 'var2', perform stetement still consider that this is the value which need to pass to the vaiable p_no and does not accept it as a actual parameter.
3 if you will use like this then it can accept var2 as a actual parameter and will not give any error.
perform form1
using var1
var2:
'1',
'2',
'3'.
write: 'test'.
&----
*& Form FORM1
&----
text
----
-->P_VAR1 text
-->P_0019 text
----
form FORM1
using p_var1
p_no
p_var2.
endform.
in the above code both the actual and formal parameters are same (3), so whenever you want to pass the value directly to any variable of subroutine then keep it at the end of perform statement.
Hope this will clear to you, if not then plz let me know.
‎2009 Jul 17 6:53 AM
Hi,
You have wrongly used Chain Operator i.e. ':'
In your Code you have used after variable Var1.
perform form1
using var1: <------- Your Chain Operator.
'1',
'2',
'3'.
Instead it should be place after Word PERFORM.
Actual Postion Of Chain Operator.
l
l
v
PERFORM : form1 USING: var1 '1' CHANGING var2,
form1 USING: var1 '2' CHANGING var2,
form1 USING: var1 '3' CHANGING var2.
I Hope This help you.
Thanks and Regards,
Shreemohan