cancel
Showing results for 
Search instead for 
Did you mean: 

Global Definations - Default Value?

Former Member
0 Kudos

Hi Experts,

Here, in this existing Samrtform, the ABAPer has declared the Global Definations like,

<i><u><b>Variable Name...Type....Associate Type..Default Value</b></u></i>

1-MY_NAME....TYPE...ADRC-NAME1...Space

2-GS_VBAK...TYPE...VBAK.............Space

3-KOMK....LIKE.....KOMK......(Nothing mentioned)

4-GT_VBAP...TYPE....t_vbap....(Nothing Mentioned)

(t_vbap is defined in TYPES of Global Definations)

So,

1- The ''Space'' What it wuld do in the first statement above?

2-Why nothing was mentioned in Third statement?

3-Why LIKE was used over TYPE, What it makes difference?

4-Again Why nothing was mentioned in Fourth statement?

ThanQ.

Message was edited by:

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Here are your answers.

<b>1- The ''Space'' What it wuld do in the first statement above?.</b>

SPACE initialize the variables with BLANK value ( it is different that DEFAULT value ).

This way when you call the smartform without passing any value to this variable, the values will be defaulted with what is assing in "Dafault Value"

So, for example the first variable is define like this

<b><u>Variable Name...Type....Associate Type..Default Value</u></b>

1-MY_NAME....TYPE...ADRC-NAME1...'SRINIVAS'.

Now, if you call the smartform without passing the value of variable MY_NAME, it will get the default value 'SRINIVAS'.

<b>2 - Why nothing was mentioned in Third statement?</b>

If you do not define any value in "Default Value", and if you call smartform without passing value, the variable gets default value.

Check this link to see what is the default value of different ABAP data type.

http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2fd9358411d1829f0000e829fbfe/frameset.htm

Let,s say in your example you have defined

GS_VBAK...TYPE...VBAK.............Space. In this case all the fields in GS_VBAK gets blank value.

But instead if you define GS_VBAK...TYPE...VBAK ( without space ), all the fields of GS_VBAK gets default value. This means that all DATS fields gets '00000000', all TIME fields gets '000000', all AMOUNT fields gets '0.00'.

All fields with CHAR or NUMC type will get BLANK value, whether it give default value as SPACE or not assing any values.

<b>3-Why LIKE was used over TYPE, What it makes difference?</b>

LIKE means the datatype of the variable is similar to the referenced variable.

TYPE means it is a predefined data type.

Check these link for more information.

Type - http://help.sap.com/saphelp_46c/helpdata/en/fc/eb2ff3358411d1829f0000e829fbfe/frameset.htm

Like - http://help.sap.com/saphelp_46c/helpdata/en/9b/239fa610de11d295390000e8353423/frameset.htm

<b>4-GT_VBAP...TYPE....t_vbap....(Nothing Mentioned )</b>

I already gave the answer in second point. Again since t_vbap is defined in global definition, you can use it with TYPE addition.

Let me know if you need any other information.

Regards,

RS

Former Member
0 Kudos

ThanQ RS.

Answers (0)