Blog

Display Custom Fields In The Header Area of FB60 and FV60

Some SAP clients need extra information added in to a standard SAP process. Here we’ll explore how to add custom fields in the header areas of t-codes FB60 and FV60. FB60 is for posting vendor invoices and FV60 is for parking vendor invoices. In this sample, we’ll be adding in two custom fields.

From research, I found that BAdi BADI_FDCB_SUBBAS01 would work for the initial requirement. I decided to use BADI_FDCB_SUBBAS04 since some of the 01,02s are used by SAP. Go to t-code SE19 to create a BAdi implementation. It’s a classic BAdi rather than a new BAdi. Choose a name and click change. It will ask you to create it and give it the name of the BAdi, which we’d put BADI_FDCB_SUBBAS04.

Picture 1

We get a screen that tells us the two methods that the BAdi has and the name of the implementing class.

Picture 2

The methods should be double clicked and each filled in as follows:

method IF_EX_BADI_FDCB_SUBBAS04~PUT_DATA_TO_SCREEN_OBJECT.
* fill interface attributes from importing paramters
me->if_ex_badi_fdcb_subbas04~invfo = im_invfo.
endmethod.

method IF_EX_BADI_FDCB_SUBBAS04~GET_DATA_FROM_SCREEN_OBJECT.
* fill export parameters from interface attributes
ex_invfo = me->if_ex_badi_fdcb_subbas04~invfo.
endmethod.

On the subscreens tab, we define a program and screen call based on screen 10 since it’s for Vendor Basic Data and we’re adding to vendor screens.

Picture 3

We then must activate the BAdi implementation so that in the Runtime Behavior section, it says Implementation is called. Note: at this point, it will not work. You need to add your new fields to BKPF, VBKPF, and BSEG via append structures. For BKPF, you open the table in SE11. You then click the Append Structure… button at the top and the appends for BKPF will show up. You then click the piece of paper at the top to create.

Picture 4

It will ask you to name your append structure. You fill out the short description, the z fields, give it an enhancement category, and activate. If everything works fine, it will say active. Do this for all three tables.

Picture 5

At this point, it will still not be working. We still have to create our program and screen. Create a program via SE80 and create a custom screen for it. Create the screen however specified and then fill in the flow logic. Note: In PAI, you must put each field that you define after FIELD:

Picture 6

You may wonder how INVFO has these fields, and that’s because it’s also enhanced when you add the append structure to BSEG. On the main program, you’ll fill out all the modules and create some data definitons:

REPORT  zf_vendor_invoice.
************************************************************************
*                       T A B L E S                                    *
************************************************************************
TABLES invfo.
************************************************************************
*                  D A T A     D E F I N I T I O N                     *
************************************************************************
DATA: o_bad    TYPE REF TO if_ex_badi_fdcb_subbas04.

*name of the badi reference
*----------------------------------------------------------------------*
***INCLUDE LZF_VENDOR_INVOICEO01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_9200  OUTPUT
*&---------------------------------------------------------------------*
*       Create a subscreen object and get data from the screen
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
CALL METHOD cl_exithandler=>get_instance_for_subscreens
CHANGING
instance                      = o_bad
EXCEPTIONS
no_reference                  = 1
no_interface_reference        = 2
no_exit_interface             = 3
data_incons_in_exit_managem   = 4
class_not_implement_interface = 5
OTHERS                        = 6.
IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* object created  ?
CHECK NOT o_bad IS INITIAL.
* get data from main screen
CALL METHOD o_bad->get_data_from_screen_object
IMPORTING
ex_invfo = invfo.
ENDMODULE.                 " STATUS_9200  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_9200  INPUT
*&---------------------------------------------------------------------*
*       Put data into the screen
*----------------------------------------------------------------------*
MODULE user_command_0100
INPUT.
CHECK NOT o_bad IS INITIAL.
* put data to main screen
CALL METHOD o_bad->put_data_to_screen_object
EXPORTING
im_invfo = invfo.
ENDMODULE.                    "user_command_9200 INPUT
*&---------------------------------------------------------------------*
*&      Module  RECEIVE_ACTUAL_DATA  INPUT
*&---------------------------------------------------------------------*
*       Get data from screen
*----------------------------------------------------------------------*
MODULE receive_actual_data INPUT.
*  object created  ?
CHECK NOT o_bad IS INITIAL.
* get data from main screen
CALL METHOD o_bad->get_data_from_screen_object
IMPORTING
ex_invfo = invfo.
ENDMODULE.                 " RECEIVE_ACTUAL_DATA  INPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK_TCODE  INPUT
*&---------------------------------------------------------------------*
*       check the t-code – We want it to show up for FB60 and FV60, but

*     hide it for any other screen that hits this enhancement
*----------------------------------------------------------------------*
MODULE check_tcode OUTPUT.
IF sy-tcode <> 'FB60' AND sy-tcode <> 'FV60' AND sy-tcode <> 'FB03'.
LOOP AT SCREEN.
IF   screen-name = 'INVFO-ZZE_DAT'
OR screen-name = 'INVFO-ZZE_LOC'
OR screen-name = 'DATE'
OR screen-name = 'LOCATION'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDMODULE.                 " CHECK_TCODE  INPUT

Once this is activated, you will see the screen fields(Event Date and Event Location):

Picture 7

You can also look at any document created and see those fields held in BKPF or VBKPF.

Adding custom fields to many SAP screens follow the same procedure. Knowing how to do this will help you add value to your customer and provide them the ability to have some custom information added in to a standard process.

 

 
About the Author:

Brandi Setzler is a Principal Consultant at Sparq and has been with the company for 14 years. She’s spent her career specializing in SAP ABAP. Brandi has led remote teams and worked as a developer for several clients as well as trained new employees to work in the space. She lives for her family, which includes a husband, two children, three french bulldogs, and two bearded dragons.

Related Blogs
See All Blogs
Blog
Mar 18, 2024

Unlocking Gen AI’s Full Potential: The Crucial Role of Quality Data

In an era where artificial intelligence (AI) promises to revolutionize industries and redefine competitive landscapes, generative AI stands out for its ability to create new content, from text to images, videos and beyond. This article explores the pivotal role of high-quality data in generative AI efficacy, examines the preparedness of companies for adopting these technologies and outlines essential steps for building a robust data foundation.

Read More
Blog
Mar 13, 2024

Navigating Readiness & Expense for Section 1071 Compliance

After 14 years, Section 1071 of the Consumer Financial Protection Bureau (CFPB) moved from the back burner in bank lending under the Dodd-Frank Act. The question about 1071 remains: will it come onto the front burner considering the legal challenges and injunctions that have delayed its implementation for years? We believe that there are many areas to consider as a bank assesses their compliance readiness, which should be driving discussions across these executive responsibilities. Read on for key readiness focus areas and questions for discussion.

Read More
Blog
Feb 12, 2024

From Legacy to Leading Edge: Advancing Healthcare Through Legacy App Modernization

The modernization of legacy applications in the healthcare industry represents a particularly acute concern, more so than in any other sector. This article explores why legacy application modernization is a significantly bigger issue in healthcare compared to other industries and outlines strategic steps healthcare organizations can take to address this pressing challenge.

Read More
Blog
Feb 12, 2024

How Can Banks Improve Products for Small Businesses?

Banks are recognizing the growing needs of small businesses are intimately tied to both technological advancements and shifts in consumer behavior. In doing so, they're beginning to tailor their business banking solutions to meet these emerging requirements. In this article, Delivery Executive Kevin Ashworth shares six tools that banks can use to improve their products for small businesses.

Read More
See All Blogs
noun-arrow-2025160 copy 2
noun-arrow-2025160 copy 2
See All Blogs