5740 Readings
BI
SAP for 12 years
Posted by Yann MORINEAU
6 years ago
Modified 6 years ago


Licence Creative Commons Attribution - Pas d'Utilisation Commerciale - Pas de Modification 4.0 International.

Partager — copier, distribuer et communiquer le matériel par tous moyens et sous tous formats

Transform the data of DataSource

Since ECC6 version, it is recommended to use the implementation of the BAdI RSU5_SAPI_BADI instead of the traditional USER EXIT (EXIT_SAPLRSAP_001 to 004).

In this tutorial we will focus on changing transactional data.
 

1.Implementing the BAdI ZC_RSU5_SAPI_BADI 

img

Click on btn

Enter the BAdI's name.

img

Enter the BAdI's description.

description

Save save btn

Now, click on the 'Interface' and double-click the name of the class.

interface

For now, the BAdI is created but is not active.

 

2.The class ZCL_IM_C_RSU5_SAPI_BADI

img

We will look at the first method and writing the dynamic call.

img

 

2.1.The method of instantiation IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM

This method of instanciation allows to build the dynamic call of the private methods.

Variable declaration to recovery the Datasrouce's name

DATA : l_method TYPE seocmpname.

The method's name always must begin by a letter, here we had the prefix 'M'

CONCATENATE 'M_' i_datasource INTO l_method.

We verify that the global table contains data.

CHECK c_t_data[] IS NOT INITIAL.

We verify that the called method exists for the class ' ZCL_IM_C_RSU5_SAPI_BADI '.

SELECT SINGLE cmpname
  FROM seocompo
  INTO l_method
  WHERE clsname =  'ZCL_IM_C_RSU5_SAPI_BADI'
    AND cmpname = l_method.

If the method exists

CHECK sy-subrc EQ 0.

We call the method with the standard parameters.

CALL METHOD (l_method)
  EXPORTING
    I_UPDMODE    = i_updmode
    I_T_SELECT   = i_t_select
    I_T_FIELDS   = i_t_fields
  CHANGING
    C_T_DATA     = c_t_data
    C_T_MESSAGES = c_t_messages.

Now we add our method, the one who will modify the data of our DataSource.

img

 

2.2.The private method M_DATASOURCE_NAME

Double-click on the name of the method to focus on the detail.

detail

 

2.2.1.The private domain

Start to modify the 'Private Domain' to inform the parameters of the method.

private domain

class-methods M_DATASOURCE_NAME
  importing
    value(I_UPDMODE) type SBIWA_S_INTERFACE-UPDMODE
    value(I_T_SELECT) type SBIWA_T_SELECT
    value(I_T_FIELDS) type SBIWA_T_FIELDS
  changing
    !C_T_DATA type ANY TABLE
    !C_T_MESSAGES type RSU5_T_MESSAGES optional.

 

2.2.2.The code of the method

For the example, ' datasource_structure ' is the name of the structure generated during the creation of DataSource.

Variable declaration.

FIELD-SYMBOLS: <L_S_DATA> TYPE datasource_structure.

We copy the global table to our internal table.

L_T_DATA[] = C_T_DATA[].

(...) "Your specific selections

Then we curl on the internal table to update the data.

LOOP AT L_T_DATA ASSIGNING <L_S_DATA>.
...
ENDLOOP.

Finally we transfer the data in the global table.

C_T_DATA[] = L_T_DATA[].

Do not forget to CLEAR your tables and variables.

 

3.BAdI activation

Launch the SE19 transaction.

img

Click on modify btn

Click on the activation button activation btn

Your BAdI is active.

img

 

Advantages

  • No need to block the include ZXRSAU01 to add a treatment,
  • Add new implementations without impacting on the others,
  • Facilitate group work.

Info

  • To test the data, use the RSA3 transaction.
  • To deactivate your BAdI, click on  img 

Pub

Sign in or Sign up to ask questions.

Latest tutorials from the same author

imgBPC

Déboguer un package

Astuce pour déboguer un package ...

Posted 6 years ago
Modified 6 years ago
6157
imgBPC

BPC BI and Source system

BPC Overview ...

Posted 6 years ago
Modified 6 years ago
6923
imgBPC

Vider le cache BPC

Vider le cache BPC avec UJA_REFRESH_DIM_CACHE ...

Posted 6 years ago
Modified 6 years ago
5277
imgBPC

BPC, BI et Système source

Vue d'ensemble de BPC ...

Posted 6 years ago
Modified 6 years ago
5966