‎2008 Jun 16 4:38 AM
Hi ABAPers and developers alike,
Just for discussion pusposes, I would like your feedback on the following:
1) What is hardcoding in ABAP programming?
2) Why do you hardcode?
3) What are the disadvantages of hardcoding in ABAP?
4) Would elimination of hardcoding make the program run faster (see sample code below)
* which would have faster runtime between the code variations?
* code 1:
if V_1 = 'A'.
...
elseif V_1 = 'B'.
...
endif.
* code 2:
constants:
c_a type c value 'A',
c_b type c value 'B'.
if V_1 = c_a.
...
elseif V_1 = c_b
...
endif.
5) Why NOT to hardcode?
I appreciate your inputs regarding this. Thanks.
~ Eric
‎2008 Jun 16 4:45 AM
first code is faster. in second code retrieving the values of c_a and c_b takes some time .
Generally Hardcode means...assigning CONSTANT VALUES..
Like...
SELECT * from MARA where MATNR EQ '00000000456'.
‎2008 Jun 16 4:46 AM
Hi hard coding is nothing but....passing the value directly to the parameters of the statemtn.
instead of passing value directly...we can first initialize the value with the variable...then that variable will assign to the parameter of the statement..
suppose we need to passed the value more than 2 or 3 times in the program...
in future if we want to change the value...we need to do changes explicitly in the program where exactly we passed that value...that is some what hectic..
so if we pass the variable...simply we can change one time at the variable value...automatically where ever this variable is using there all the places will be effected..
regards,
venkat n