Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg: hard coding..

Former Member
0 Likes
487

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

3 REPLIES 3
Read only

Former Member
457

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

Read only

Former Member
0 Likes
457

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

Read only

SergioFerrari
Active Contributor
0 Likes
457

This message was moderated.