Skip to Content
avatar image
Former Member

Default values for custom fields

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 31, 2008 at 12:27 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Oct 31, 2008 at 06:56 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 04, 2008 at 06:09 AM

    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

    Add comment
    10|10000 characters needed characters exceeded