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

Hard Coding in Call function

Former Member
0 Likes
1,003

hi all,

In a call function statement if we hardcode the parameter values, whether it will be a hard coding?

It should be avoided are not?

ex.

CALL FUNCTION ' REUSE_ALV_GRID_DISPLAY '

EXPORTING

STRUCTURE_NAME = ' MARA '

....................

In this ' MARA ' is a hardcode or not?

Regards,

Florian.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
788

Hi florian,

1. This would NOT mean as hard coding.

Bcos it is the format in which we want to display.

2. Hardcoding is hardcoding of variable values / business parameters.

Eg. if company code is 1000, and if we use this '1000'

directly in our code, then it is called hardcoding.

Another eg. would be of a particular material number. If

we directly use that material number in our variable, then

it is hardcoding.

regards,

amit m.

4 REPLIES 4
Read only

Former Member
0 Likes
789

Hi florian,

1. This would NOT mean as hard coding.

Bcos it is the format in which we want to display.

2. Hardcoding is hardcoding of variable values / business parameters.

Eg. if company code is 1000, and if we use this '1000'

directly in our code, then it is called hardcoding.

Another eg. would be of a particular material number. If

we directly use that material number in our variable, then

it is hardcoding.

regards,

amit m.

Read only

Former Member
0 Likes
788

It is Hardcoding, you can avoid doing this..

DATA: STR TYPE  DD02L-TABNAME .

STR = 'MARA'.

CALL FUNCTION ' REUSE_ALV_GRID_DISPLAY '
EXPORTING
STRUCTURE_NAME = STR

Read only

Former Member
0 Likes
788

Hi Florian,

It depends on ur rquirement whether to hard code or not. Maximum we should try to avoid hardcoding.

Moroever in call function , if you want to pass a structure the it shouldn't be in single quotes. It should be kept open.

Thanks & regards,

Ravi Amistapur

Read only

Former Member
0 Likes
788

Hi Florian,

Hard coding means .....I will explain in your case:

If suppose you expect the structure name to be more than one and anything may come in that place and if you are giving one value only among a set of values, Then we can say that it is hard coded.

If in your case the structure name is only MARA then you can give it directly as you mentioned in the code above. This is not considered as hard coding

Regards,

Swapna.