Skip to Content
Technical Articles
Author's profile photo Andi Mauersberger

SAP S/4HANA Business Partner – Implement Custom Field Check

Sometimes it is needed to have a custom specific field check at standard fields or custom fields.

In this blog I will describe a way to check field values after input


The purpose of this blog is to create a custom Function Module with a simple check logic as example. This Function Module will be assigned to BDT setup.

Target audience: Functional Experts

Version: SAP S/4HANA On Premise 1610 and higher

At this example I will implement a field check on a free text field to limit possible entries.

If you start transaction BP you can see field “Express Station” at customer level.

Target is to limit possible field values to entries starting with “E”. If a value is entered which doesn’t start with “E” a error message should appear.

Screen Analysis

If you want to use standard functionality you can enter your custom field field check at view level only. Therefor you need to determine the corresponding BDT-view by using BDT Analyzer.

How to use BDT Analyzer please have a look at my blog post

SAP S/4HANA Business Partner BDT Analyzer usage

BDT View

Field “Express Station” is assigned to BDT view CVIC93. You can access BDT view directly via BDT Analyzer or with transaction BUS3.

Standard field check is implemented at Function Module CVIC_BUPA_PAI_CVIC93. To implement an additional check you can use “Further Checks” assignment.

Create check Function Module

With this example I’ve created Function Module Z_CVIC_BUPA_PAI_CVIC93

FUNCTION z_cvic_bupa_pai_cvic93.
*"*"Local Interface:
  DATA: lt_kna1         TYPE TABLE OF kna1,
        ls_kna1         LIKE LINE OF lt_kna1,
        table_name_kna1 TYPE  fsbp_table_name    VALUE 'KNA1',
        false           TYPE boole-boole        VALUE ' '.

  CHECK cvi_bdt_adapter=>is_direct_input_active( ) = false.

* get kna1 data
      i_table_name = table_name_kna1
      e_data_table = lt_kna1[]

  READ TABLE lt_kna1 INTO ls_kna1 INDEX 1.

  IF ls_kna1-bahne(1) NE 'E' AND NOT ls_kna1-bahne IS INITIAL.

        arbgb       = 'ZCVI'
        msgty       = 'E'
        txtnr       = '001'
        tbfld_strg  = 'GS_KNA1-BAHNE'
        repeat_show = '1'
        sicht       = 'CVIC93'.



To process error message you have to create your own Message Class or use an existing one. At this Message Class create your own message which shall be called in case of error.

Assign Check Function Module to BDT view

Access BDT view CVIC93 with transaction or via BDT Analyzer.

Navigate to “Further Checks” and add your Function Module.

Test at BP transaction

Run BP transaction and navigate to screen “Customer: General Data” and enter any value which doesn’t start with “E”.

After pressing <ENTER> system checks field value additionally with custom check and gives back an error message. Cursor is placed at the field “Express Station”.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Deep Kripalsingh Tanwar
      Deep Kripalsingh Tanwar

      Thanks for the blog. BDT falls under classical extensions, and as per SAP's suggestion, it's advised not to use classical extensions. Any suggestion on what is alternative for BDT, to achieve what is mentioned in this blog. It's exceedingly difficult to explain to the client that SAP is still providing these options to make changes in the system when the SAP max attention team is saying not to use BDT to make changes. What approach partners are supposed to take.

      Author's profile photo Andi Mauersberger
      Andi Mauersberger
      Blog Post Author

      May be there is a missunderstanding. Which should be used is Visual Configuration tool (IMG: Cross-Application Components->SAP Business Partner->Business Partner->Basic Settings->Screen Configuration->Configure Screens). This tool is generating BDT settings which are not easy to track and correct.

      At the end BDT is the main area to configure BP transaction.

      Author's profile photo Pallavi Bamzai
      Pallavi Bamzai

      Andi - would you also have an example where class cl_md_bp_maintain=>MAINTAIN_NON_CORE_VALUE is used to capture customers own tables to capture custom fields to be passed to cl_md_bp_maintain=>maintain?