Hello Ashish - Yes. It considers the sequence. For this actual parameter in the PERFORM statement this is the corresponding formal parameter in the FORM statement.
Hello sir, call by refernce and call by value topic doubt chasing me till now😅 now get an idea. I have a doubt. I tried both by value and by reference, but finally it consider the numbers that we taken in the formal parameters. How it will be. As per the topic, call by value is performing opeartion without effecting the actual parameters, but here the output was displayed based on the input we taken in the formal parameters, not in the actual parameters, it means values we taken in the formal parameter section overrides the actual parameter inputs isn't it.
Very Good Question - Just took the example of APPEND Program. There are different-2 values for Order Number and Payment Mode. We are calling single subroutine multiple times to pass the different-2 values of Order Number and Payment Mode. In this whole process, Ultimately Formal parameters is playing a vital role to use the different-2 values and reduce the code redundancy.
Hello sir, as output is pass by reference so that's why output of formal and actual parameter is same.. Upto this point I cleared. But what if output is pass by value? Will it be the result like Formal output 90 And actual output 30.. Because when I took the output as pass by value still the value of output for both actual and formal parameter is same.. Please explain me this. Since from yesterday I've been studying this but don't understand
Hello Bhushan, below is the answer of your question. 1) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT. FORM SUM USING PV_INPUT1 PV_INPUT2 CHANGING PV_OUTPUT. PV_OUTPUT = PV_INPUT1 + PV_INPUT2. ENDFORM. Pass by Reference : Suppose I am providing input - 10 , 20 . In the Debugging Mode, check the values of PV_OUPUT and LV_OUTPUT together, as soon the value of PV_OUTPUT changes, it immediately reflects in to LV_OUTPUT , as it is pass by reference. 2) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT. FORM SUM USING PV_INPUT1 PV_INPUT2 CHANGING VALUE (PV_OUTPUT) PV_OUTPUT = PV_INPUT1 + PV_INPUT2. ENDFORM. Pass by Value for CHANGING Suppose I am providing input - 10 , 20 . In the Debugging Mode, check the values of PV_OUPUT and LV_OUTPUT together, as soon the value of PV_OUTPUT changes, it will not reflect in to LV_OUTPUT , as it is pass by value. Once you come out from the FORM and ENDFORM, result will be copied to LV_OUTPUT. So in this case because of CHANGING keyword, results passed to LV_OUTPUT. For better understanding , do the same thing to USING now. Pass by Value for USING 3) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT. FORM SUM USING VALUE(PV_INPUT1) USING( PV_INPUT2) CHANGING VALUE (PV_OUTPUT) PV_INPUT1 = 40. PV_INPUT2 = 50. PV_OUTPUT = PV_INPUT1 + PV_INPUT2. ENDFORM. In the Debugging Mode, Check the values of P_INPUT1 , P_INPUT2 , PV_INPUT1 , PV_INPUT2 - Assigning the new values to PV_INPUT1 and PV_INPUT2 will not impact P_INPUT1 and P_INPUT2 and even when you come out from the subroutine, the value of P_INPUT1 and P_INPUT2 will not change, as they are the part of USING. So, CHANGING and USING is itself very important keywords.
@@sapabapbyrahulmehta Thanks a lot sir. I know just to say thanks is not sufficient because for each of my doubts you always there to reply me. Not only me you always reply to everyone. Thank you so much sir
We never told the system that p_input1 = pv_input1, then how does it understand that ? Is it going by order in which these parameters are written ?
Hello Ashish - Yes. It considers the sequence. For this actual parameter in the PERFORM statement this is the corresponding formal parameter in the FORM statement.
Hello sir, call by refernce and call by value topic doubt chasing me till now😅 now get an idea. I have a doubt.
I tried both by value and by reference, but finally it consider the numbers that we taken in the formal parameters. How it will be.
As per the topic, call by value is performing opeartion without effecting the actual parameters, but here the output was displayed based on the input we taken in the formal parameters, not in the actual parameters, it means values we taken in the formal parameter section overrides the actual parameter inputs isn't it.
Very Good Question - Just took the example of APPEND Program. There are different-2 values for Order Number and Payment Mode. We are calling single subroutine multiple times to pass the different-2 values of Order Number and Payment Mode. In this whole process, Ultimately Formal parameters is playing a vital role to use the different-2 values and reduce the code redundancy.
is there any difference between pass by reference and pass by address?
and what if we added value after changing .. what is the impact ?
Pass by reference and pass by address both are same.
Hello sir, as output is pass by reference so that's why output of formal and actual parameter is same.. Upto this point I cleared. But what if output is pass by value?
Will it be the result like
Formal output 90
And actual output 30..
Because when I took the output as pass by value still the value of output for both actual and formal parameter is same..
Please explain me this.
Since from yesterday I've been studying this but don't understand
Hello Bhushan, below is the answer of your question.
1) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT.
FORM SUM USING PV_INPUT1 PV_INPUT2 CHANGING PV_OUTPUT.
PV_OUTPUT = PV_INPUT1 + PV_INPUT2.
ENDFORM.
Pass by Reference :
Suppose I am providing input - 10 , 20 . In the Debugging Mode, check the values of PV_OUPUT and LV_OUTPUT together, as soon the value of PV_OUTPUT changes, it immediately reflects in to LV_OUTPUT , as it is pass by reference.
2) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT.
FORM SUM USING PV_INPUT1 PV_INPUT2 CHANGING VALUE (PV_OUTPUT)
PV_OUTPUT = PV_INPUT1 + PV_INPUT2.
ENDFORM.
Pass by Value for CHANGING
Suppose I am providing input - 10 , 20 . In the Debugging Mode, check the values of PV_OUPUT and LV_OUTPUT together, as soon the value of PV_OUTPUT changes, it will not reflect in to LV_OUTPUT , as it is pass by value. Once you come out from the FORM and ENDFORM, result will be copied to LV_OUTPUT.
So in this case because of CHANGING keyword, results passed to LV_OUTPUT.
For better understanding , do the same thing to USING now.
Pass by Value for USING
3) PERFORM SUM USING P_INPUT1 P_INPUT2 CHANGING LV_OUTPUT.
FORM SUM USING VALUE(PV_INPUT1) USING( PV_INPUT2) CHANGING VALUE (PV_OUTPUT)
PV_INPUT1 = 40.
PV_INPUT2 = 50.
PV_OUTPUT = PV_INPUT1 + PV_INPUT2.
ENDFORM.
In the Debugging Mode, Check the values of P_INPUT1 , P_INPUT2 , PV_INPUT1 , PV_INPUT2 - Assigning the new values to PV_INPUT1 and PV_INPUT2 will not impact P_INPUT1 and P_INPUT2 and even when you come out from the subroutine, the value of P_INPUT1 and P_INPUT2 will not change, as they are the part of USING.
So, CHANGING and USING is itself very important keywords.
@@sapabapbyrahulmehta Thanks a lot sir. I know just to say thanks is not sufficient because for each of my doubts you always there to reply me. Not only me you always reply to everyone. Thank you so much sir
hello sir you use the pass by value only in using parameters in subroutine but how to use pass by value in subroutine without parameter?pz sir reply
Hello - In without parameters subroutine, there is no significance of pass by value as we are not passing any parameters.
@@sapabapbyrahulmehta tq sir 🙏