cancel
Showing results for 
Search instead for 
Did you mean: 

Default values for custom fields

Former Member
0 Kudos

Hi all,

I have a small problem and i am wondering whether you can help me.

I have created a new custom field having 3 drop down values in cprojects custom fields tab. Now, the business wants me to have a default value for the drop down ( one of the 3 values )every time a new project is created.

I think that there is some custom coding involved. But, i don't know where to code. Can someone please help?

Thanks

Mazin.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vanessa,

Thanks for the prompt answer.

I found the implementation for that badi dpr_attributes in transaction SE19 and i placed an external breakpoint for the same in the method SET_DEFAULTS_UPON_COPYING. I found out that this method is executed once when a new project is created.

This is perfect. But, since i am a newbie, i would like to know how to find the element to assign the default value i am trying for. Please let me know.

Best Regards,

Mazin

former_member184588
Active Participant
0 Kudos

Hello mazin,

you have to modify CS_ATTRIBUTES in order to change your attributes. You can see the example source code for this.


FIELD-SYMBOLS:
<ls_attributes_phase>   TYPE dpr_ts_phase_int.


ASSIGN cs_attributes TO <ls_attributes_phase>.

and then change the values in ls_attrubtes_phase (or the other corresponding things like projectdefinition or task)

For some other things regarding this topic just have a look at my latest postings or the postings of https://forums.sdn.sap.com/profile.jspa?userID=3716740 because there I am asking similiar questions and Matthias is really familiar with stuff like this.

cu, Vanessa

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Vanessa,

Thanks a lot, i solved my issue. A well deserved 10 points have been awarded.

I made my code changes in the method set_defaults_upon_copying. This gets activated whenever a project is created from a template .

Best Regards,

Mazin

former_member184588
Active Participant
0 Kudos

Hello Mazin,

I think you could try the BADI DPR_ATTRIBUTES there are two methods to set default values. One is SET_DEFAULTS_UPON_CREATION and the other is SET_DEFAULTS_UPON_COPYING.

Hope that helps,

Vanessa