This is in addition to the blog which I have always used for any custom field addition
http://scn.sap.com/docs/DOC-25692
So if you haven't still gone through that blog you must first visit that one .
I would like to add a couple of more points as below which I found myself struggling with and a short summary of what all I have done with this functionality .
Config Section 1. We have the below options for adding header and Item level fields ..
It shows you a pop up and you can add your custom field in the relevant document type for both header and item sections . Since the field has to be stored in database we add at 2 Append structures .
Note: Display fields means they would not be stored in the Backend .
![]()

Config Section 2 : Once you added in the above then you should define the properties related to this field . You can only control 4 properties in this either by checking the box (Field Editable , Field Visible , Field required , Filed Posteditable)
![]()
FAQ :
1. How to add at other places not specified in config ? We do not have an option to add for a business partner transaction .. There is a separate Note which talks about it . please find below the same. Following the instructions in the note helps you add fields on to the business partner transaction .
1386310 - Creating SRM business partner field extensions
2. How to edit the property based on some conditions ? Create a class and method . You can copy the reference class used by SAP and modify it further.
3. How to copy dynamic classes and methods ? Go to config section 2 and click on option : " Display Standard Metadata Tables for Header Fields" When you open it scroll to check the relevant field or any field for the business doc type for example I am checking for PO

Copy the field and the method and add it as an input in " Configure Control for Fields on Header Level"
and add your own method to it as shown below :
Code snippet: I am trying to HIDE a field for only a particular object type
SELECT SINGLE * FROM ztable
WHERE subobj_category EQ lv_object_type
AND process_type EQ lv_process_type
AND fieldname EQ iv_field_name.
IF sy-subrc EQ 0.
cs_metadata-visible = abap_false.
cs_metadata-enabled = abap_false.
ENDIF.
Limitation :
1. We can not position a field .. SAP has some internal mechanism of putting the custom field at the end of the standard field either right or left container . If you still want to do it add the fields in Webdynpro in an enhancement and then in layout section decide where to position them ..
2. We can add a custom field but the default value cannot be set .. it has to be done in DOC_CHANGE if you can build it on some condition like when initial let value be X . OR use a webdynpro component to do that in the WDDOINIT method .
Hope this helps . Do share your experience as well so I can better this document .
Regards
Vinita