How to add a custom field using the SAP Screen Painter

There are times when you need to add custom fields to the standard SAP tables and screens for handling non-standard business process functionality. But once you have added the field to the SAP dictionary, how do you add the field to the appropriate screen? For instance, what if you need to add a field to the Order Entry screen for Order Types CR/DR (Credit/Debit memos) or ZRE (Returns).  All of this can be done using the SAP Screen Painter.

The SAP Screen Painter

The SAP Screen Painter transaction code SE80 – Screen Painter will bring up the screen painter program. You can access all types of SAP objects using the SAP Screen Painter. Click on the [Repository Browser] button and then select “Program” from the drop down list. Type SAPMV45A into the next field and press the [Display] icon to the right. You will now see all of the objects associated with the program SAPMV45A – Sales Order Processing.

Screen Objects with Attributes, Element List and Flow Logic

Click on the right arrow next to the object “Screens” which will display a list of all of the screen numbers along with a description for each. Scroll down till you get to Screen: 4902 – Description: 4.0: Subscreen: Overview – TC – Entry Credit/Debit memo and double-click on the screen number. To the right you will now see the screen tabs for Attributes, Element list and Flow logic which are associated with screen number 4902.

Screen Painter – Layout

Press on the [Layout] button which will bring up a graphical representation of the screen that we have chosen. This is where you can modify the screen layout using various graphical elements. Screen number 4902 contains a table list which various fields displayed as columns in the table. This is where we want to add our new custom field VBAP-ZZFIELD.

Screen Painter: Dict./Program Fields

Click on the icon at the top of the screen with the description Dictionary/Program Fields Window F6. This will display the Dictionary/Program Fields that are available.

Type in the Table/Field Name: VBAP-ZZFIELD and press the [Get from Program] button. Once the field is displayed click on the line and press the Execute button. At this point you simply drag the cursor to the right of the last column to the right and drop. This will create and position the new column as the last column in the table.

Creating a column text header

Once the new column for the field is created you will want to create a column text header. Click on the [Text] icon and drag it above the newly created column to create the header text object for the column. Double-click the head text and type in the header text “ZZ Field” that will appear at the top of the column. This can be any text description you want to appear directly above the new column. You can also adjust the other attributes that are available for the text object.

Click the [Save] button to save the changes and create a transport object which can be moved to other systems in your SAP landscape for testing.

Adding your new field to the Flow Logic

Of course, you will have to add the field to the Flow Logic to make the new column visible and functional. Click on the [Flow Logic] button to return to the program logic area which handles the dialog screen flow. Switch into change mode by clicking the [Display <-> Change] icon. Locate the CHAIN, ENDCHAIN where the other VBAP fields are coded and add the statement FIELD: VBAP-ZZFIELD.

Press the [Save] button to save your changes. Check your code syntax and test your changes to verify that everything passes SAP checking. Don’t forget to press the [Activate] button to make your modifications active.

Testing your changes

It is easy to test your changes by using transaction code VA01 – Create Sales Order and type in one of the order types CR/DR or ZRE and press Enter. Scroll over to the far right of the order entry table and you will see the new ZZ Field as the last column in the table.

Conclusion

That is really all there is to adding a new field to a program screen. Of course, there is a lot more to writing dialog programs but this should get you started.

Leave a Reply

Your email address will not be published. Required fields are marked *

*