SAP BLOG Add Master Data in BW Info Object via AFO interface

SAP Blog

Kayıtlı Üye
Katılım
22 Ara 2017
Mesajlar
1,925
Tepki puanı
7
Puanları
6
Business Scenario:

Creation of new Master Data for Simulation of planning is very common requirement. It is require to create Master Data from planning interface and update the same Master Data Globally.

Issue:

>> It is not allowed to provide access to business user to maintain master data from planning side unless and until users has sufficient authorization and rights to create it.

>> How can we achieve the functionality from Analysis Office?

In this document, I will describe step by step procedure to achieve the same functionality in BW/4 HANA & BPC 11. The 1st issue can be solved by stakeholders.



Requirement:

In our example, I want to use Z_PLANT (Plant) as my Master Data.

1-61.png


City (Z_CITY), Postal Code (0POSTAL_CD), Country (0COUNTRY), Region (Z_REGIO) and State (Z_STATE) is maintained as attributes for this master data.

2-27.png


Need an Analysis Office interface where user can provide his input to maintain the master data.

3-24.png


The above mentioned display is Analysis Office interface where Input field will generate new master data. If the user press Simulate Master Data it will create a master data for Plant. If user is happy will simulation then he can go for permanent creation of master data in Z_PLANT via upload the Master Data button.

4-22.png


The report shows direct from Z_PANT query.

Technical Solution:

  • Need to create dummy info objects for all the attributes. When we create the dummy info object, we need to use actual info objects as template.
  • Need to create aDSO with planning enable mode with the dummy info objects.
  • Create composite provider with union mode.
  • Create aggregation level on the top of Composite provider.
  • Create FOX – planning function to update aDSO.
  • Create FOX – planning function update master data.



Step 1:

Below info objects are created in system which are the attributes of Z_PALNT. This dummy info objects are used to create aDSO. Created a key fig ZDM_KF for aDSO.

5-24.png


6-18.png


We have not maintained any master data for dummy info objects. Only the data type and length are identical like original master data. During dummy info object creation, we used as template.

Original Info object Attributes Dummy Info Object
Z_PLANT Z_STATE ZDM_STATE
Z_REGIO ZDM_REGIO
0COUNTRY ZDM_COUNT
Z_CITY ZDM_CITY
0POSTAL_CD ZDM_POSCO
ZDM_PLANT



Step 2:

Planning aDSO created.

8-15.png


9-15.png


Step 3:

Created composite provider combining info object Z_PLANT & ADSO.

10-14.png


11-13.png


12-10.png


13-3.png


Step 4:

Create aggregation level, filter, planning function and planning sequence.

14-9.png


Filter: (Set Based on data present in adso)

15-6.png


Planning Function: (All character To be changed)

16-4.png


17-4.png


Write below FOX code.

DATA DM_PLANT TYPE ZDM_PLANT.
DATA DM_CITY TYPE ZDM_CITY.
DATA DM_COUNT TYPE ZDM_COUNT.
DATA DM_POSCO TYPE ZDM_POSCO.
DATA DM_REGIO TYPE ZDM_REGIO.
DATA DM_STATE TYPE ZDM_STATE.

DM_PLANT = VARV(ZDM_PLANT).
DM_CITY = VARV(ZDM_CITY).
DM_COUNT = VARV(ZDM_COUNT).
DM_POSCO = VARV(ZDM_POSTCO).
DM_REGIO = VARV(ZDM_REGIO).
DM_STATE = VARV(ZDM_STATE).

{ ZDM_KF, #, ‘ZDMDSO_PL’, #, DM_CITY, DM_COUNT, DM_PLANT, DM_POSCO, DM_REGIO, DM_STATE, #, #, #, # } = 1.

Planning Sequence. (for simulation means dummy adso update)

18-5.png


Planning Function to update Z_PLANT.

19-4.png


20-5.png


Below FOX code change the master data.

DATA PLANT TYPE Z_PLANT.
DATA DM_PLANT TYPE ZDM_PLANT.
DATA DM_CITY TYPE ZDM_CITY.
DATA DM_COUNT TYPE ZDM_COUNT.
DATA DM_POSCO TYPE ZDM_POSCO.
DATA DM_REGIO TYPE ZDM_REGIO.
DATA DM_STATE TYPE ZDM_STATE.

DM_PLANT = VARV(ZDM_PLANT).
DM_CITY = VARV(ZDM_CITY).
DM_COUNT = VARV(ZDM_COUNT).
DM_POSCO = VARV(ZDM_POSTCO).
DM_REGIO = VARV(ZDM_REGIO).
DM_STATE = VARV(ZDM_STATE).

PLANT = DM_PLANT.

{ ZDM_KF, #, ‘ZDMDSO_PL’, #, DM_CITY, DM_COUNT, DM_PLANT, DM_POSCO, DM_REGIO, DM_STATE, #, #, #, # } = 1.

CALL FUNCTION ‘ZACTIVATE_MASTERDATA’
EXPORTING
I_PLANT = PLANT .
Planning sequence

21-6.png


Function Model

22-5.png


24-5.png


25-6.png


Source Code
FUNCTION zactivate_masterdata.
*”———————————————————————-
*”*”Local Interface:
*” IMPORTING
*” REFERENCE(I_PLANT) TYPE /BIC/OIZDM_PLANT
*” REFERENCE(I_CITY) TYPE /BIC/OIZDM_CITY OPTIONAL
*” REFERENCE(I_COUNTRY) TYPE /BIC/OIZDM_COUNT OPTIONAL
*” REFERENCE(I_POSTCODE) TYPE /BIC/OIZDM_POSCO OPTIONAL
*” REFERENCE(I_REGION) TYPE /BIC/OIZDM_REGIO OPTIONAL
*” REFERENCE(I_STATE) TYPE /BIC/OIZDM_STATE OPTIONAL
*”———————————————————————-

DATA: e_subrc TYPE sysubrc,
e_t_messages TYPE rsndi_t_message,
l_t_data TYPE TABLE OF rsndi_s_chavl_max,
wa_t_data TYPE rsndi_s_chavl_max,
l_t_attributes TYPE TABLE OF rsd_s_iobjnm,
wa_t_attributes TYPE rsd_s_iobjnm,
it_tab TYPE TABLE OF /bic/azdmdso_pl1,
wa_tab TYPE /bic/azdmdso_pl1.

SELECT SINGLE * FROM /bic/azdmdso_pl1
INTO wa_tab
WHERE /bic/zdm_plant = i_plant.
CHECK sy-subrc = 0.

*wa_tab-/BIC/ZDM_CITY
*wa_tab-/BIC/ZDM_COUNT
*wa_tab-/BIC/ZDM_PLANT
*wa_tab-/BIC/ZDM_POSCO
*wa_tab-/BIC/ZDM_REGIO
*wa_tab-/BIC/ZDM_STATE

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘Z_PLANT’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘0POSTAL_CD’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘Z_STATE’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘0COUNTRY’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘Z_CITY’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_attributes.
wa_t_attributes-iobjnm = ‘Z_REGIO’.
APPEND wa_t_attributes TO l_t_attributes.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘Z_PLANT’.
wa_t_data-value = i_plant.
APPEND wa_t_data TO l_t_data.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘0POSTAL_CD’.
wa_t_data-value = wa_tab-/bic/zdm_posco. ” i_postcode. ”
APPEND wa_t_data TO l_t_data.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘Z_STATE’.
wa_t_data-value = wa_tab-/bic/zdm_state. “i_state. ”
APPEND wa_t_data TO l_t_data.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘0COUNTRY’.
wa_t_data-value = wa_tab-/bic/zdm_count. “i_country. ”
APPEND wa_t_data TO l_t_data.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘Z_CITY’.
wa_t_data-value = wa_tab-/bic/zdm_city. “i_city. ”
APPEND wa_t_data TO l_t_data.

CLEAR wa_t_data.
wa_t_data-record_no = ‘1’.
wa_t_data-iobjnm = ‘Z_REGIO’.
wa_t_data-value = wa_tab-/bic/zdm_regio. “i_region. ”
APPEND wa_t_data TO l_t_data.

CALL FUNCTION ‘RSDMD_API_ATTRIBUTES_UPDATE’
EXPORTING
i_iobjnm = ‘Z_PLANT’
i_t_data = l_t_data
* I_UPDATE_ALL_ATTRIBUTES =
i_t_attributes = l_t_attributes
* I_CLEAR_UNMAPPED_ATTRIBUTES = RS_C_FALSE
i_chavl_enqueue = rs_c_true
* I_PROTOCOL = RS_C_FALSE
* I_NO_APPL_LOGGING = RS_C_FALSE
IMPORTING
e_subrc = e_subrc
e_t_messages = e_t_messages.

ENDFUNCTION.

Step 5:

Analysis office Operation.

26-6.png


27-4.png


Okumaya devam et...
 
Üst