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

No default value for Parameter

Former Member
0 Likes
2,771

Hi all,

In SAP 5.0, I have the following statement in one program.

PARAMETERS P_VALUT LIKE KKBC-VALUTYP OBLIGATORY DEFAULT 0.

But the problem is, the parameters is not filled with the default value provided.

Can anyone tell me why this happens...and what is the work around for this?

Thanking you in anticipation.

Deep

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,132

Hi,

As this is of type MUNC for blank or '0' it will give only space.

U can give that by using C.

<b>parameter: p_typ(1) type c default '0'.</b>

Hope u got this.

12 REPLIES 12
Read only

Former Member
0 Likes
2,132

Hello.

PARAMETERS P_VALUT LIKE KKBC-VALUTYP OBLIGATORY DEFAULT <b>'0'</b>.

Give like this .

Vasanth

Read only

Former Member
0 Likes
2,132

Hi

I think it wont accept zero as default value you can use 1 as default

Regards

Shiva

Read only

Former Member
0 Likes
2,132

KKBC-VALUTYP is a numeric. As numeric are also char type only the difference is it accepts digits..so use single quotes..as ..

DEFAULT ' 0'.

Read only

Former Member
0 Likes
2,132

The default value g should be a literal, since the value is placed in the parameter p so early in the SUBMIT sel statement that a field g would not actually have a value.

PARAMETERS : P_VALUT(1) type c default '0'.

PARAMETERS: NUMBER(4) TYPE P DEFAULT 999.

PARAMETERS: NUMBER1(4) TYPE P DECIMALS 2 DEFAULT '123.45'.

you are referring to a numc data type which will not hold default value 0 .

regards,

vijay

Read only

Former Member
0 Likes
2,132

Hi,

You can not get the 0 as a Default value in the selection screen because the data type for this KKBC-VALUTYP is NUMC, so we can not get the 0 as a first charecter.

Regards

Sudheer

Read only

Former Member
0 Likes
2,133

Hi,

As this is of type MUNC for blank or '0' it will give only space.

U can give that by using C.

<b>parameter: p_typ(1) type c default '0'.</b>

Hope u got this.

Read only

0 Likes
2,132

Hi all,

thanks a lot for ur response.

I need this field as an OBLIGATORY and need the default value as '0'. Even if I use as literal its not working.

But in SAP 4.6 this works well.

Any idea ?

Read only

0 Likes
2,132

I declare a field as mandatory that means the value is required in this parameter/select option.

so this is valid when i say a legitimate value in the default section.

now if i say a field mandatory and put a default 0 will not be the criteria cause

user removes the 0 and tries to process then he cannot run till a valid value is given there since u have given obligatory .

in order to run i need to give a value other than 0 to run it .

so why do i maintain a default 0 when im not using it? i have no idea why he has to maintain this scenario.

regards,

vijay

Read only

0 Likes
2,132

As you can see, VALUTYP is Valuation view in cost controlling. And there are three valuation views configured in system : 0, 1 and 2. The report need to be prepared for Legal valuation ( VALUYP = 0 ) by default.

When the user runs the report, by default it should run for legal valuation (0). This is the requirement.

We can remove the obligatory addition and set the value in initialisation. But in SAP version 4.6C the same code worked fine. But oce upgraded to 5.0 this default value is not getting populated. I would like to knw the reason if any.

Thanks for you response....Thanks alot.

Deep

Read only

0 Likes
2,132

Hi Deeps,

The VALUTYP has a data type NUMC. And the initial value for Type NUMC is 0. Thats why it is not getting populated. If u populate it with the value like 1 or 2 that time it will get populated. You cannot populate selection screen 0 as default for type n. You need to type it on selection screen manually.

e.g.:

PARAMETERS P_VALUT TYPE VALUTYP OBLIGATORY DEFAULT 1.

Hope it will clear your doubt.

Ashvender

Read only

0 Likes
2,132

Im working on 4.6c

PARAMETERS : P_VAULT(1) TYPE C OBLIGATORY DEFAULT '0'.
DATA : VAULT LIKE KKBC-VALUTYP.


VAULT = P_VAULT. "CONVERTING TO STD DATATYPE
WRITE:/ VAULT.

so when i want to run the valuation code assign the value of vault to the selection/

cause for enduser we will show him a char variable to enter 0/1/2

but internally we use this KKBC-VALUTYP which is NUMC.

how about that ?

see if this works for u in 5.0

regards,

vijay

Read only

Former Member
0 Likes
2,132

Hi Deeps ,

it does not accept 0 as a value , even if you enter 0 in the parameter and press enter , the value disappears , so i dont think you can assign 0 as a default value for it.

Regards

Arun