Documente Academic
Documente Profesional
Documente Cultură
1 Business Scenario
Data from legacy systems do not distinguish between transactional data and master data very often. For example you can find the customer number, customer name, period and revenue in one single record.
2 The Result
The SAP Business Information Warehouse stores master data and transactional data in different tables and therefore the data has to be split in the appropriate master data tables and in the fact table from the InfoCube. Example: The file with the transactional data contains the name of the customer: 20010315;1000;10;1;CN00S1;6000;Smith&Co.;10000;USD 20010315;1000;12;2;CN00S2;6001;Bush Transport;5000;USD Customer number 6000: Smith&Co. Customer number 6001: Bush Transport. During the upload of the transaction data, the master data is updated as well.
3. Add in the global part a definition for the type-pool RSSM and a definition for an internal table. The internal table will collect all customer numbers and names. The complete coding can be found in the appendix. 4. In the routine the internal table is filled with the customer number and name. The internal table DATA_PACKAGE contains all records from one package of the upload.
5. After the collection of all customer numbers and names the internal table custtxt is handed over to the function module RSDMD_WRITE_ATTRIBUTES_TE XTS. Tip: With this function module its also possible to update attributes. An example is shown in the appendix.
data: begin of custattr occurs 5000. include structure /BI0/MD_SOLD_TO. data: end of custattr. "M-view
start-of-selection.
*fill internal table all values in internal format (e.g. leading zeros) custattr-D_SOLD_TO custattr-D_COUNTRY = '0000006000'. = 'US'.
custattr-D_SOLD_TO custattr-D_COUNTRY
= '0000006001'. = 'CA'.
call function 'RSDMD_WRITE_ATTRIBUTES_TEXTS' exporting i_iobjnm i_tabclass tables i_t_table exceptions attribute_name_error iobj_not_found = 1 = 2 = custattr = '0D_SOLD_TO' = 'M'
generate_program_error = 3 others = 4.
5 Appendix
PROGRAM UPDATE_ROUTINE. *$*$ begin of global - insert your declaration only below this line * TABLES: ... type-pools: rssm. data: begin of custtxt occurs 5000. include structure /BI0/TD_SOLD_TO. data: end of custtxt. * DATA: ... *-* "TEXTTABLE *-*
*$*$ end of global - insert your declaration only before this line
FORM startup TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring DATA_PACKAGE STRUCTURE /BIC/CS0000000092 USING RECORD_ALL LIKE SY-TABIX SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS CHANGING ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update * *$*$ begin of routine - insert your code only below this line * fill the internal table "MONITOR", to make monitor entries *-*
field-symbols: <l_requnr> type rssm_s_minfo-requnr. data: l_requnr type fieldname. data: l_s_minfo type rssm_s_minfo.
* fill internal table with customernumber and customertext loop at DATA_PACKAGE. custtxt-d_sold_to = DATA_PACKAGE-d_sold_to. custtxt-txtsh collect custtxt. endloop. = DATA_PACKAGE-txtsh.
generate_program_error = 3 others = 4.
* if abort is not equal zero, the update process will be canceled ABORT = 0.
*$*$ end of routine - insert your code only before this line * ENDFORM.
*-*