‎2007 Feb 17 5:32 AM
HI,
could any one tel me what exactly mean by hard coding, and how to avoid that, if you give us one or two exampls that would be great.
Thanx in advance.
Akshitha
‎2007 Feb 17 5:42 AM
Hi,
Hard Coding is a style of coding where in you would have done the coding with only 1 business scenario in mind.
Ex : IF VBAK-VKORG EQ 'ZDOM'.
.........
ENDIF.
Hence this code will only work when Sales Org equals 'ZDOM' and the Code will need a change everytime when the same business logic has to be mapped to other Sales Organisations.
Instead when you say IF VBAK-VKORG EQ W_VKORG.
and retrieve the value of W_VKORG from a table (which should be maintained ), the code will never need a change and each time a new Sales Org needs the same business logic, an entry should be maintained in the Table and automatically the code will work.
regards,
Mahesh
‎2007 Feb 17 5:48 AM
As rightly said by Mahesh, in majority of cases we can avoid hard coding by using Tables.
In case of reports, we can avoid hardcoding by defining the fields on the selection screen. We can either get the required values from the user or can populate those fields with some values in the AT SELECTION-SCREEN OUTPUT event. Here user has an option to overwrite these values if required.
Thanks
‎2014 Sep 29 7:51 PM