Enterprise Resource Planning Blog Posts by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Andi_M
Product and Topic Expert
Product and Topic Expert
0 Kudos
5,712

Introduction

If you create or update a Business Partner with customer or supplier role you may get the message to enter a VAT registration number if Business Partner is located within the EU. You will get a message pop-up like this

01-Message.png

This message is controlled by customizing setting of country definition and check rules at

IMG:ABAP Platform->General settings->Set Countries->Define Countries/Regions

02-country setup.png

Unfortunately this is a general country specific setting. Independent on type of Business Partner, Person or Organization, VAT registration number is checked.

If you want to control this check routine by your own logic, you can follow my instructions below.

 

Target

In my example implementation I would like to switch off this check for Business Partners of type Person only.

 

Solution Overview

The solution is quite simple if you know where to step in. May be you know already that BP transaction is controlled by events of BDT (Business Data Toolset). I will create a Function Module with my check logic and assign this to BDT event "DCHCK" where all Business Partner check routines a assigned to.

Event DCHCK is called at two situations:

  1. Execute data check at BP transaction by using button
    04-Check Button.png
  2. Save Business Partner data

 

Realization

Create Function Module

I created a Function Module Z_CVIC_TEST without any parameters. As an example you can use my coding below:

 

FUNCTION z_cvic_test.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------

  DATA: lv_carbgb TYPE sy-msgid,
        lv_ctxtnr TYPE sy-msgno,
        lv_msgty  TYPE sy-msgty,
        lv_varbgb TYPE sy-msgid,
        lv_vtxtnr TYPE sy-msgno,
        lv_cancel TYPE boole_d VALUE 'X'.

  lv_carbgb = 'CMD_API'.
  lv_ctxtnr = '007'.
  lv_varbgb = 'VMD_API'.
  lv_vtxtnr = '043'.


* enter your requirements here for which message should be deleted
* in my case it's BP-Type "Person"

  DATA: lv_akt            TYPE tbz0k-aktyp,
        lt_but000         TYPE TABLE OF but000,
        ls_but000         TYPE but000,
        lr_xo_bdt_adapter TYPE REF TO xo_bdt_adapter.

  lr_xo_bdt_adapter ?= xo_bdt_adapter=>get_instance( 'BUPA' ).

  lv_akt = lr_xo_bdt_adapter->get_activity( ).
  CHECK lv_akt <> '03'.

  fsbp_bdt_adapter=>get_current_bp_data(
    EXPORTING
      i_table_name = 'BUT000'
    IMPORTING
      e_data_table = lt_but000 ).

  READ TABLE lt_but000 INTO ls_but000 INDEX 1.

  CHECK ls_but000-type = '1'.

* delete message for customer
  CALL FUNCTION 'BUS_MESSAGE_STORE'
    EXPORTING
      arbgb  = lv_carbgb
      msgty  = lv_msgty
      txtnr  = lv_ctxtnr
      cancel = lv_cancel.

* delete message for supplier
  CALL FUNCTION 'BUS_MESSAGE_STORE'
    EXPORTING
      arbgb  = lv_varbgb
      msgty  = lv_msgty
      txtnr  = lv_vtxtnr
      cancel = lv_cancel.

ENDFUNCTION.

 

 

Assign Function Module to BDT event DCHCK

Open BDT menu from SAP Easy Access screen (initial screen you can see directly after logon) by calling transaction BUPT. Alternatively you can run transaction BUS7.

 03-BUS7.png

To navigate into function module list of BDT event DCHCK, mark event DCHCK and double-click at "Event->Function Module" from navigation tree at the left.

You will see a list of all defined and assigned check function modules for event DCHCK.

Standard check logic is implemented with function module XO_GENERIC_EVENT_DCHCK (Item 3600000) which writes message CMD_API007 (for customer roles) or VMD_API043 (for supplier roles) message into message memory.

Our own function module will delete this message(s) from memory if Business Partner is type Person.

For this purpose we add a new item directly after item 3600000 to delete the message(s).

Create a new item 3600001 and assign your function module.

05-new item.png

Save your changes and test.

 

Testing

Create an Organization first without saving to test message

06-Test Organization.png

 

Create a Person without saving to test

07-Test Person.png

As you can see, there is no message displayed any more for persons.

2 Comments