‎2009 Oct 02 9:29 AM
Hi,
I have written a perform statement like this:
PERFORM add_value USING wa_var1
wa_var2.
FORM add_value
data: wa_var3(2) type c.
wa_var3 = wa_var1 + wa_var2.
ENDFORM.
this perform i want to call manny times in a same program with different USING values.
Like:
PERFORM add_value USING wa_var4
wa_var5.
this gives an syntax error .
how to solve this...
‎2009 Oct 02 9:33 AM
1. you havent define the using in your Form.
PEFORM ADD_VALUE using w_var1 w_var2 changing w_var3. " w_var3 holds the output
PEFORM ADD_VALUE using w_var4 w_var5 changing w_var6. " w_var6 holds the output
form add_value USING V1 type any
V2 type any
changing V3 type ANY.
V3 = V1 + V2.
endform.
2. you can try using macros as well.
‎2009 Oct 02 9:32 AM
My glass sphere is out for cleaning so i cant figure out what kind of syntax error you're getting. But i guess its because of your weired type setting or var3.
‎2009 Oct 02 9:52 AM
Community is not bothered abt your sarcasm
Edited by: mayank verdia on Oct 2, 2009 10:52 AM
‎2009 Oct 02 10:43 AM
It is kind of funny though. However basically Rainer is right, and what he's trying to say here is : To help, 'we' need info on the actual problem, without having to guess or (like is done in some of the previous postings) code it ourself and find out.
‎2009 Oct 02 11:11 AM
‎2009 Oct 02 12:02 PM
Hello Mayank,
And do you suggest that the "responsible" community members shoot arrows into the dark.
The question you have asked falls in the "ABAP Basics" category which you can understand by reading the compiler "error" message. Why bother us then?
Good Luck !!
Suhas
‎2009 Oct 03 7:13 PM
Kindly dont reply if you find it wrong!! ...
Let moderators reply to me.
Regards,
Mayank
‎2009 Oct 02 9:32 AM
FORM add_value USING wa_var1 wa_var2 "Use using parameters in FORM also
data: wa_var3(2) type c.
wa_var3 = wa_var1 + wa_var2.
ENDFORM.
Check this sap help it will help you,
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db977635c111d1829f0000e829fbfe/frameset.htm
Edited by: Kartik Tarla on Oct 2, 2009 2:05 PM
‎2009 Oct 02 9:33 AM
1. you havent define the using in your Form.
PEFORM ADD_VALUE using w_var1 w_var2 changing w_var3. " w_var3 holds the output
PEFORM ADD_VALUE using w_var4 w_var5 changing w_var6. " w_var6 holds the output
form add_value USING V1 type any
V2 type any
changing V3 type ANY.
V3 = V1 + V2.
endform.
2. you can try using macros as well.
‎2009 Oct 02 9:51 AM
Hi Soumya,
what you have mentioned seems to be correct.
I too have written like this.
PERFORM add_value USING wa_var1 wa_var2 CHANGING wa_var3.
FORM add_value USING p_wa_var1 p_wa_var2
CHANGING p_wa_var3.
ENDFROM.
My question is if i want to use same routine add_value with different USING like wa_var4 wa_var6 ,
when i call this routine second time in my report than how do i use it.
you are saying like :
FORM add_value USING V1 type any
V2 type any
changing V3 type ANY.
V3 = V1 + V2.
ENDFORM.
will your logic will run for all different variables i use in USING clause when ever i call this routine.
‎2009 Oct 02 10:11 AM
yes it will
and by the way.. you can ALSO use macros as:
define add_value.
&3 = &1 + &2.
enddefine.now call the macro as :
add_value var1 var2 var3. " automatically set var1 to &1 va2 to &2 and var3 to &3. so you get he result in var3
add_value var4 var5 var6. output in var6
there may be lil syntax error, as i am not in front of SAP now.
‎2009 Oct 02 11:55 AM
Hi Mayank,
You need to make yourself clear with the theory part of whatever you are going to code, so It would be better if you go through the sap documemtation on subroutines then you would gain much better understanding abt the code that people have suggested above
‎2009 Oct 02 9:34 AM
Hi,
Your Subroutine should have the correct parameters to match the call
FORM add_value USING wa_var1
wa_var2.
Regards,
Himanshu