sas supplier relationship management adapter for sap r/3

57
SAS ® Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Upload: others

Post on 09-Feb-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAS Supplier Relationship Management Adapter for SAP R/3
Page 2: SAS Supplier Relationship Management Adapter for SAP R/3
Page 3: SAS Supplier Relationship Management Adapter for SAP R/3
Page 4: SAS Supplier Relationship Management Adapter for SAP R/3

Transformed Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19Summary Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19

APPENDIX A: SAS FORMATS AND INFORMATS THAT ARE CREATED FROM SAP REFERENCE TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21

APPENDIX B: SUMMARY OF JOB DESCRIPTIONS AND DEPENDENCIES . . . . . . . . . . . . . . . . . . . . . . . .23

APPENDIX C: DEFINED LIBRARIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

APPENDIX D: SAS/WAREHOUSE ADMINISTRATOR JOBS - REVERSE IMPACT ANALYSIS DIAGRAM . . .27

APPENDIX E: LIST OF EXTRACTED COLUMNS BY SAP TABLE NAME . . . . . . . . . . . . . . . . . . . . . . . . . . .29BKPF - Accounting Document Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29BSAK - Accounting: Secondary Index for Vendors (Cleared Items) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .29BSEG - Accounting Document Segment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30BSIK - Accounting: Secondary Index for Vendors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31CEPC - Profit Center Master Data Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31CEPCT - Profit Center Master Data Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31CSKS - Cost Center Master Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .31CSKT - Cost Center Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32CSKU - Cost Element Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32EKKN - Account Assignment in Purchasing Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32EKKO - Purchasing Document Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32EKPO - Purchasing Document Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33LFA1 - Vendor Master (General Section) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33MAKT - Material Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34MARA - General Material Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34SKA1 - G/L Account Master (Chart of Accounts) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34SKAT - G/L Account Master Record (Chart of Accounts: Description) . . . . . . . . . . . . . . . . . . . . . . . . . . . .34T001 - Company Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34T001L - Storage Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .34T001W - Plants/Branches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T005T - Taxes: Region Key: Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T005U - Taxes: Region Key: Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T023T - Material Group Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T024 - Purchasing Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T024E - Purchasing Organizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .35T134T - Material Type Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36TGSBT - Business Area Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36TKA01 - Controlling Areas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36TSPAT - Organizational Unit: Sales Divisions: Texts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36pWBHI - Trading Contract: Item Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36WBHK- Trading Contract: Header Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36

iv Contents

Page 5: SAS Supplier Relationship Management Adapter for SAP R/3

APPENDIX F: LOADING THE BKPF AND BSEG TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37Initial Load IS Required or Initial Load NOT Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37Initial Load IS Required Jobs in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37

BKPF (Initial Load) and BSEG (Initial Load) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37Accounting Document (Initial Load) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38

Initial Load NOT Required Jobs in Detail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38BKPF/BSEG Accounting Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38Accounting Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .41

APPENDIX G: RECOMMENDED READING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .43

Contents v

Page 6: SAS Supplier Relationship Management Adapter for SAP R/3

vi

Page 7: SAS Supplier Relationship Management Adapter for SAP R/3

Preface This document provides an overview of the workings of the SAS Supplier Relationship Management Adapter for SAP R/3 software, including information about the following:

• SAP tables that are accessed • SAS/Warehouse Administrator jobs that are executed • job dependencies • user-written mappings • requirements for site-dependent changes.

Page 8: SAS Supplier Relationship Management Adapter for SAP R/3

viii

Page 9: SAS Supplier Relationship Management Adapter for SAP R/3

Data Extraction

SAP Table Data For convenience, the extraction of SAP table data is split into several different job steps. As a result, if only a partial extraction is required, then data extraction for a particular table or set of tables can be run in isolation, thus saving extraction time. Also, to save space and extraction time, the number of columns that are extracted from SAP for each table is limited to only those columns that are deemed to be relevant to SAS Supplier Relationship Management. For a complete list of extracted columns by SAP table name, see Appendix E.

Job Dependencies To ensure accurate results from running the SAS/Warehouse Administrator suite of jobs, the jobs should be run in the correct sequence. A list of all the jobs and their dependencies is available in Chapter 3, “Job Details,” on page 10 or in summary form in Appendix B.

Libraries Several libraries are defined when the adapter is started, for use within the SAS/Warehouse Administrator environment. Each main library and its purpose are detailed in Appendix C.

C H A P T E R

1

Page 10: SAS Supplier Relationship Management Adapter for SAP R/3

2

Page 11: SAS Supplier Relationship Management Adapter for SAP R/3

Formats and Informats

The SAP R/3 system stores reference information (such as texts, descriptions, and names) in separate SAP tables. The SAS Supplier Relationship Management Adapter for SAP R/3 uses the Format Generation Control add-in to create SAS formats and informats from the extracted data. See Appendix A for details about extracted tables and created formats. Date formats are also set up for data that is not stored in SAP R/3. These formats convert dates into month and quarter text, depending on the language setting that is used. • $QTRTXT. converts specified quarter number to quarter text. • $MTHQTR. converts specified month number to quarter text. • $MTHTXT. converts specified month number to month text.

Format Creation The Format Generation utility stores metadata that describes which formats need to be created. The formats are all based on tables, most of which are extracted from SAP, although some are also provided with the adapter. The formats can be modified to add local language descriptions. The metadata for all formats is kept in a single table called PUBSPEC.FMTCNTL.

Format Code Generated If you have not already done so, generate the format code by using the Format Generation add-in utility to SAS/ACCESS Interface to R/3. Although the adapter ships with pre-generated code, the format metadata might need to be modified. Possible reasons for modifying the format metadata include the following: • The solution has expanded. • The strategy of removing duplicates of a particular format has changed. This strategy

is performed if an error message about a repeated range appears when generating the formats.

C H A P T E R

2

Page 12: SAS Supplier Relationship Management Adapter for SAP R/3

4 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

The formats can be printed by using the following code:

The following is an example of the format definitions for Cost Center. Note that for Cost Center, format and informat areas are created, where

format type C = character format format type J = character informat.

The input table is R3DATA.CSKT, which is an extracted copy of the R/3 table CSKT. The format is defined as mapping the concatenation KOKRS || KOSTL onto the concatenation KOKRS || KOSTL || KTEXT, using a hyphen ( - ) as a label separator.

In the example CSKT extract (Display 2.1), a format is created called COSTC, which maps 10000000000600 onto 1000-0000000600-Plant/Branc2, etc. and so on.

Display 2.1 Cost Center Texts

options ls=84 ps=54 pageno=1; proc print data =sasuser.fmtcntl label; where inactive=''; title 'Formats defined by SAS HCM Adapter for R/3'; id fmtname; var fmttype fmtdesc inpdsn startv1 startv2 startv3 labelv1 labelv2 labelv3 labelsep fmtlib wherecls dupstrat ndupvars; run; title 'SAS';

LHS LHS LHS Format Format Format start start start RHS RHS RHS name type description Input Table var.1 var.2 var.3 var. 1 var. 2 var. 3 1 COSTC C Cost Centre R3DATA.CSKT KOKRS KOSTL KOKRS KOSTL KTEXT 2 COSTC J Cost Centre R3DATA.CSKT KOKRS KOSTL KTEXT KOKRS KOSTL Sort vars Label Dup removal for Dup Format char. Output format Where clause strategy- removal name separator library for input dsn FIRST/LAST FIRST/LAST 1 COSTC - LIBRARY.fmt&LANG (SPRAS="&LANG") L DATBI

Page 13: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 2: Formats and Informats 5

While using this approach guarantees label uniqueness, readability suffers. A compromise option is to remove the controlling area (KOKRS) from the label or to simply use KTEXT as the label (which can cause multiple cost centers to be mapped onto the same text). In the second part of the format metadata, the output format library is specified in LIBRARY.FMT&lang. For example, for English language formats, the formats are created in LIBRARY.FMTE. This method enables you to create formats for all languages that are maintained in the R/3 system. In addition, the WHERE clause SPRAS="&LANG" is used to extract only English language descriptions. The last two metadata information fields specify a duplicate removal strategy of L, and specify DATBI as the sort variable for duplicate removal. In the CSKT table contents, the value for DATBI is usually the R/3 maximum date, 31DEC9999. Consequently, the descriptions are valid until the year 9999. It is possible that multiple records can indicate multiple descriptions for the same cost center, in which case they would be distinguished by a different DATBI value. In this case, to get the latest description, perform a sort by both START (start label) and DATBI (sort variables for duplicate removal), and then take the LAST.DATBI row as shown in the following code:

The format creation job step must be included early in the job flow, because most if not all of the subsequent processes use formats. Doing so enables new features that use formats to assume correct and available formats. The actual code is created by the Format Generation add-in utility to SAS/ACCESS Interface to R/3.

%put Duplicate removal strategy = L; proc sort data=work._fmt; by start DATBI; run; data work._fmt; set work._fmt; by start DATBI; if LAST.start; run;

Page 14: SAS Supplier Relationship Management Adapter for SAP R/3

6

Page 15: SAS Supplier Relationship Management Adapter for SAP R/3

Executing SAS/Warehouse Administrator Jobs

Choosing How to Execute the SAS/Warehouse Administrator Jobs To populate the data warehouse environment, the full suite of supplied SAS/Warehouse Administrator jobs must be executed. There are two options for submitting these jobs for execution: manually submitting each job in sequence, or submitting all (or many) jobs in one batch. The option that you choose depends on the site installation, time constraints, and other such considerations.

Submit Jobs Manually, One by One This method is useful if you have very little confidence that the job suite will run successfully without manual intervention. For instance, if there is a high degree of customization within the SAP installation, then errors could occur while the adapter code is being run. Submitting the jobs individually gives you the option of customizing the adapter code to match the SAP installation before continuing with the remaining jobs.

Submit All (or Many) Jobs in One Batch If there has been very little customization within the SAP installation, then it is possible that the job suite will run successfully without manual intervention. In this case it is feasible to submit all jobs in one batch. The downside to this method is that if an error occurs early in the process, then it will not be identified until all jobs have run. This could result in time wasted before solving the problem that caused the error.

Opening the SAS/Warehouse Administrator Process Editor Whether you are submitting the adapter jobs manually or in batch, you must open the SAS/Warehouse Administrator Process Editor as follows:

1. From the SAS/Warehouse Administrator Desktop folder that was created during adapter installation, double-click the SAS SRM Solution Adapter for SAP 2.4 icon. The Data Warehouse Environment window opens (Display 3.1).

C H A P T E R

3

Page 16: SAS Supplier Relationship Management Adapter for SAP R/3

8 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Display 3.1 Data Warehouse Environment Window

2. Using the navigation tree, navigate to the desired Operational Data Definition (ODD). Right-click the desired ODD and select Process. The Process Editor window opens.

3. In the Process Editor window, select View → Job Hierarchy to show the job hierarchy in the navigation tree.

To submit jobs manually, see the following section. To submit multiple jobs in a batch, see “Submitting Multiple Jobs” on page 5.

Submitting Jobs Manually The adapter jobs must be executed in a specific order that is determined by the job dependencies. These dependency groupings are listed in Appendix A. Running the jobs in order from the top of the list to the bottom should successfully generate the full SAS/Warehouse Administrator environment. These dependency groupings are also shown graphically in Appendix B. An example of submitting a single SAS/Warehouse Administrator job follows. This process must be repeated for every job in the adapter suite (Appendix A).

Page 17: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 3: Executing SAS/Warehouse Administrator Jobs 9

To run a single selected job in SAS/Warehouse Administrator: 1. In the Job List or Job Hierarchy tree of the Process Editor, right-click the desired job name and select

Run. The Load Generation/Execution Properties dialog box opens (Display 3.2).

Display 3.2 Load Generation/Execution Properties Dialog Box 2. Click Submit to run the selected job immediately. 3. When the job is complete, click Close. 4. Check the SAS log for error messages. If necessary, make corrections and resubmit the job; otherwise,

repeat this process for the next job.

Submitting Multiple Jobs A SAS/Warehouse Administrator add-in enables you to execute more than one job in a single command. The add-in is automatically installed as part of the adapter installation. To run more than one SAS/Warehouse Administrator job: 1. In the Job List or Job Hierarchy tree of the Process Editor, right-click any job name and select Add-Ins.

A list of add-ins appears (Display 3.3).

Page 18: SAS Supplier Relationship Management Adapter for SAP R/3

10 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Display 3.3 List of Add-ins 2. Select Publish Multiple Jobs Source Code from the list and click OK. The Publish Multiple Jobs Source

Code dialog box opens (Display 3.4).

Display 3.4 Publish Multiple Jobs Source Code Dialog Box

Page 19: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 3: Executing SAS/Warehouse Administrator Jobs 11

3. To select individual jobs, select a job group in the Jobgroups list, then select the jobs to execute in the

Jobs list. Click the right arrow button to add these jobs to the Selected Jobs list. Repeat for another job group if desired. To select all jobs, click Select All Jobs.

4. Select the Include Master Job check box and click OK. When the processing has completed, a dialog box opens, indicating the number of jobs that were processed. Also, the output source code that is produced is stored in the catalog that is specified in the Source Catalog field of the Publish Multiple Jobs Source Code dialog box. You should check the SAS log for any errors that occurred during processing. Tip: The output source code can be stored in a permanent SAS catalog or external file by changing the specifications in the Generation Options box of the Publish Multiple Jobs Source Code dialog box. You can then submit, or schedule the submission of, any number of SAS/Warehouse Administrator jobs, without having to initiate SAS/Warehouse Administrator or the adapter. Submit these jobs by using the SAS Explorer to navigate to the appropriate catalog; right-click the _MASTERJOB_.SOURCE entry and select Run.

Page 20: SAS Supplier Relationship Management Adapter for SAP R/3

12

Page 21: SAS Supplier Relationship Management Adapter for SAP R/3

Job Details

The following details are valid for the initially provided software. Any site-specific changes that are made to the adapter will affect the accuracy of this information.

Table Extracts for Formats Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. This job extracts the following SAP R/3 tables:

• CSKT Cost Center Texts • CSKU Cost Element Texts • MAKT Material Descriptions • T001 Company Codes • T001L Storage Locations • T001W Plants/Branches • T005U Taxes: Region Key: Texts • T023T Material Group Descriptions • T024 Purchasing Groups • T024E Purchasing Organizations • T134T Material Type Descriptions • TGSBT Business Area Names • TKA01 Controlling Areas • TSPAT Organizational Unit: Sales Division

These tables are used later in the process to create SAS formats.

Account Assignment in Purchasing Document Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table EKKN Account Assignment in Purchasing

Document.

C H A P T E R

4

Page 22: SAS Supplier Relationship Management Adapter for SAP R/3

14 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

BKPF (Initial Load) Dependencies: Table Extracts for Formats Details: This job executes a user-written load step.

Source member is SRMR3SRC.INITBKPF.SOURCE. Creates a full initial load or full refresh of table BKPF Accounting

Document Header. The &_START macro variable can be set in autoexec.sas to indicate the

desired date from which data should be extracted. To prevent timeout and limit R/3 resources, the data is extracted in smaller

batches. This is achieved by extracting data by company code (BUKRS) and accounting year (GJAHR).

This job also contains a post-processing step. See Appendix F for more details about BKPF extraction.

BSEG (Initial Load) Dependencies: BKPF (Initial Load) Details: This job executes a user-written load step.

Source member is SRMR3SRC.INITBSEG.SOURCE. Creates a full initial load or full refresh of table BSEG Accounting

Document Segment. A control table is set up in BKPF (Initial Load) that indicates the required

records to be extracted from BSEG. To prevent timeout and limit R/3 resources, the data is extracted in smaller

batches. This is achieved by extracting data by company code (BUKRS) and accounting year (GJAHR).

See Appendix F for more details about BSEG extraction.

BKPF/BSEG Accounting Document Dependencies: None Details: This job executes a user written load step.

Source member is SRMR3SRC.CDC.SOURCE. Creates a combined delta load of the tables BKPF Accounting Document

Header and BSEG Accounting Document Segment. A delta control table is set up in indicating the starting date of required

records to be extracted from BKPF/BSEG. This job also contains a post-processing step. See Appendix F for more details about BSEG extraction.

BSAK Accounting: Secondary Index for Ven Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table BSAK Accounting: Secondary Index for

Vendors (Cleared Items).

Page 23: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 4: Job Details 15

BSIK Accounting: Secondary Index for Ven Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table BSIK Accounting: Secondary Index for

Vendors.

Cost Center Master Data Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table CSKS Cost Center Master Data.

G/L Account Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the following SAP R/3 tables:

• SKA1 G/L Account Master (Chart of Accounts) • SKAT G/L Account Master Record (Chart of Accounts:

Description).

Material Data Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table MARA General Material Data.

Profit Center Master Data Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the following SAP R/3 tables:

• CEPC Profit Center Master Data • CEPCT Texts for Profit Center Master Data.

Purchasing Document Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the following SAP R/3 tables:

• EKKO Purchasing Document Header • EKPO Purchasing Document Item.

Page 24: SAS Supplier Relationship Management Adapter for SAP R/3

16 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Trading Contract Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the following SAP R/3 tables:

• WBHI Trading Contract: Item Data • WBHK Trading Contract: Header Data.

Vendor Master Dependencies: None Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Extracts the SAP R/3 table LFA1 Vendor Master.

Format Creation Dependencies: Table Extracts for Formats Details: This job executes a user-written mapping. However, this is a not a mapping

program but source code to create the formats. Source member is FMTCNTL.GENFMT.SOURCE. The data that is extracted from the job Formats is used to create SAS

formats, as detailed in Appendix A. SAS formats are also created for output of month and quarter descriptions.

Account Assignment Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Joins tables SKA1 and SKAT, extracted in the job G/L Account. The variables that are used for the join are MANDT, KTOPL, and SAKNR. The macro variable &SPRAS is used to subset the table SKAT to the correct

language descriptions. Output from this job is Account Assignment

(SRMDATA.ACCOUNT_ASSIGNMENT). Note: The output from the job Account Assignment is currently not used

in the remainder of the adapter process. This data extraction is included for future expansion or for additional reporting requirements. Therefore, if there are no requirements for this information, then this job can be removed from the job suite.

Page 25: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 4: Job Details 17

Cost Centers Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Joins the tables CSKS and CSKT, extracted in the jobs Cost Center Master

Data and Formats, respectively. The variables that are used for the join are MANDT, KOKRS, KOSTL, and

DATBI. The macro variable &SPRAS is used to subset the table CSKT to the

correct language descriptions. Output from this job is Cost Centers (SRMDATA.COST_CENTRES).

Note: The output from the job Cost Centers is currently not used in the remainder of the adapter process. This data extraction is included for future expansion or for additional reporting requirements. Therefore, if there are no requirements for this information, then this job can be removed from the job suite.

Invoice Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Concatenates the tables BSAK and BSIK to create an intermediate table

called Vendors Secondary Index (INTERM.CONCAT). This intermediate table is the joined with the tables BKPF and BSEG. The variables that are used for the join are MANDT, BUKRS, GJAHR, and

BELNR from all three tables, and BUZEI from BSEG/concat. Output from this job is Invoice (SRMDATA.INVOICE). A simple index (SUPPLIER_NUMBER) is created for this data set for use

in later job steps.

Item Master Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Straight assignment from the table Material Data. Output from this job is Item Master (SRMDATA.ITEM_MASTER).

Page 26: SAS Supplier Relationship Management Adapter for SAP R/3

18 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Profit Centers Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Joins the tables CEPC and CEPCT, extracted in the job Profit Center

Master Data. The variables that are used for the join are MANDT, PRCTR, DATBI, and

KOKRS. The macro variable &SPRAS is used to subset the table CEPCT to the

correct language descriptions. Output from this job is Profit Centers (SRMDATA.PROFIT_CENTRES).

Note: The output from the job Profit Centers is currently not used in the remainder of the adapter process. This data extraction is included for future expansion or for additional reporting requirements. Therefore, if there are no requirements for this information, then this job can be removed from the job suite.

Purchase Order Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Joins the tables EKKO, EKKN, and EKPO, extracted in the jobs

Purchasing Document and Account Assignment in Purchasing Docum. The variables that are used for the join are MANDT and EBELN from

EKKO/EKPO and EBELN and EBELP from EKPO/EKKN. Output from this job is Purchase Order

(SRMDATA.PURCHASE_ORDER).

Supplier Master Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Straight assignment from table LFA1 Vendor Master. Output from this job is Supplier Master

(SRMDATA.SUPPLIER_MASTER).

Accounting Document (Initial Load) Dependencies: Format Creation Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Joins data that is extracted in BKPF Initial Load and BSEG Initial Load. The variables that are used for the join are BUKRS, BELNR, and GJAHR. Output from this job is Accounting Document (Initial Load)

(R3DATA.ACCDOC).

Page 27: SAS Supplier Relationship Management Adapter for SAP R/3

Chapter 4: Job Details 19

Accounting Document Dependencies: Format Creation Details: This job executes a user-written mapping.

Source member is SRMR3SRC.ADDDELTA.SOURCE. Updates Accounting Document data with delta extracted data from

BKPF/BSEG Accounting Document. Output from this job is an updated Accounting Document

(R3DATA.ACCDOC).

Transformed Data Dependencies: • Invoice

• Item Master • Purchase Order • Supplier Master

Details: This job executes user-written mappings. Join_POI.SOURCE; left-joins the tables Purchase Order and Item Master to

create an intermediate table called Joined: PO & Item (INTERM.JOIN_POI).

Join_INV_PO_SUPP.SOURCE; left-joins the tables Invoice, intermediate table Joined: PO & Item and Supplier Master.

Output from this job is Transformed Data (SRMDATA.CAPABILITIES_TRANSFORMED).

Summary Tables Dependencies: Transformed Data Details: This job uses only source code that is generated by SAS/Warehouse

Administrator. Creates an OLAP Nway table. Class columns: CUS_SYSTEM1_CODE DB_DUNS DB_HQPAR_DUNS DB_DOM_DUNS DB_GLBL_DUNS DB_UNSPSC2_CODE DB_UNSPSC4_CODE DB_UNSPSC6_CODE DB_UNSPSC8_CODE SAS_YEAR SAS_QUARTER SAS_MONTH SAS_SIC2_CODE SAS_SIC4_CODE SAS_SIC6_CODE SAS_SIC8_CODE VAR_MATRL1_CODE VAR_MATRL2_CODE VAR_ORG1_CODE VAR_ORG2_CODE VAR_GENHIER1_LEV1_CODE VAR_GENHIER1_LEV2_CODE VAR_GENHIER1_LEV3_CODE VAR_GENHIER2_LEV1_CODE VAR_GENHIER3_LEV1_CODE

Statistic columns: CUS_SPEND (Stat=Sum) SAS_TRANSACTIONS (Stat=Sum) CAR_XTRA_NUM (Stat=Sum)

Output from this job is Nway (SRMDATA.NWAY).

Page 28: SAS Supplier Relationship Management Adapter for SAP R/3

20

Page 29: SAS Supplier Relationship Management Adapter for SAP R/3

SAS Formats and Informats Created from SAP Reference Tables

SAP Table SAP Table Name Format Informat

CSKT Cost Center Texts $COSTC. $COSTC. CSKU Cost Element Texts $COSTEL. MAKT Material Description $MAT2F. T001 Company Codes $COMPNY. $COMPNY. T001L Storage Locations $STORAG. $STORAG. T001W Plants/Branches $SITE. $SITE. T005T Country Names $HR1_1F.

$COUNTRY.

T005U Taxes: Region Key: Texts $HR1_2F. $STATE.

$STATE.

T023T Material Group Descriptions $MAT1F. T024 Purchasing Groups $PURGRP. $PURGRP. T024E Purchasing Organizations $PURORG. $PURORG. T134T Material Type Descriptions $MATTYP. TGSBT Business Area Names $BUSARE. $BUSARE. TKA01 Controlling Areas $COAREA. TSPAT Organizational Unit: Sales Divisions:

Texts $DIVISN. $DIVISN.

A P P E N D I X

A

Page 30: SAS Supplier Relationship Management Adapter for SAP R/3

22

Page 31: SAS Supplier Relationship Management Adapter for SAP R/3

Summary of Job Descriptions and Dependencies

Job Name Description Dependency Table Extracts for Formats

Extracts the following SAP tables for subsequent creation of SAS formats: • CSKT Cost Center Texts • CSKU Cost Element Texts • MAKT Material Descriptions • T001 Company Codes • T001L Storage Locations • T001W Plants/Branches • T005T Country Names • T005U Taxes: Region Key: Texts • T023T Material Group Descriptions • T024 Purchasing Groups • T024E Purchasing Organizations • T134T Material Type Descriptions • TGSBT Business Area Names • TKA01 Controlling Areas • TSPAT Organizational Unit: Sales Division

N/A

BKPF (Initial Load) Extracts SAP table BKPF Accounting Document Header

Table Extracts for Formats. Run only for Initial Load or full refresh.

BSEG (Initial Load) Extracts SAP table BSEG Accounting Document Segment.

BKPF (Initial Load). Run only for Initial Load or full refresh.

BKPF/BSEG Accounting Document

Extracts SAP tables: BKPF Accounting Document Header BSEG Accounting Document Segment

Run only if not an Initial Load or full refresh.

Account Assignment in Purchasing Document

Extracts SAP table EKKN Account Assignment in Purchasing Document

N/A

BSAK Accounting: Secondary Index for Ven

Extracts SAP table BSAK Accounting: Secondary Index for Vendors (Cleared Items)

N/A

BSIK Accounting: Extracts SAP table BSIK Accounting: Secondary N/A

A P P E N D I X

B

Page 32: SAS Supplier Relationship Management Adapter for SAP R/3

24 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Job Name Description Dependency Secondary Index for Ven

Index for Vendors

Cost Center Master Data

Extracts SAP table CSKS Cost Center Master Data N/A

G/L Account Extracts SAP tables: SKA1 G/L Account Master (Chart of Accounts) SKAT G/L Account Master Record (Chart of Accounts: Description)

N/A

Material Data Extracts SAP table MARA General Material Data N/A Profit Center Master Data

Extracts SAP tables: CEPC Profit Center Master Data CEPCT Texts for Profit Center Master Data

N/A

Purchasing Document

Extracts SAP tables: EKKO Purchasing Document Header EKPO Purchasing Document Item

N/A

Trading Contract Extracts SAP tables: WBHI Trading Contract: Item Data WBHK Trading Contract: Header Data

N/A

Vendor Master Extracts SAP table LFA1 Vendor Master N/A Format Creation Creates SAS formats using SAP tables as input Table Extracts for

Formats Accounting Document (Initial Load)

Joins data extracted in: BKPF (Initial Load) BSEG (Initial Load)

Format Creation. Run only for Initial Load or full refresh.

Accounting Document

Processes data extracted in BKPF/BSEG Accounting Document

Format Creation. Only run if not an Initial Load or full refresh.

Account Assignment Creates Account_Assignment table by joining SKA1 and SKAT

Format Creation

Cost Centers Creates Cost_Centers table by joining CSKS and CSKT

Format Creation

Invoice Creates Invoice table by joining BSAK, BSIK, BKPF, and BSEG

Accounting Document (Initial Load) or Accounting Document

Item Master Creates Item Master table from MARA Format Creation Profit Centers Creates Profit_Centers table by joining CEPC and

CEPCT Format Creation

Purchase Order Creates Purchase_Order table by joining EKKO, EKKP, and EKKN

Format Creation

Supplier Master Creates Supplier_Master table from LFA1 Format Creation Transformed Data Join Invoice, Item Master, Purchase Order, Supplier

Master tables, and Enrichment data Invoice Item Master Purchase Order Supplier Master

Nway Tables Summarize Transformed_Data table as required Transformed Data

Page 33: SAS Supplier Relationship Management Adapter for SAP R/3

Defined Libraries

ENRICH !r3droot\Enrichment

Library intended to contain any user- or externally provided enrichment data, such as Dun & Bradstreet data

INTERM !r3droot\Intermediate Stores intermediate working data sets that are used for temporary table joins

LIBRARY !root\formats SAS format library

NONR3D !r3droot\nonr3data Data sets that contain data that has not been sourced from SAP

R3DATA !r3droot\r3data Data sets that contain data that has been extracted from SAP

R3LIB !root\srm\dd\r3lib Data dictionary metadata on SAP tables

R3VIEW !root\srm\dd\r3view Catalog for all R/3 descriptors

SASERP !r3droot\r3addins\programs Source library for R3 add-ins

SRMDATA !r3droot\SRMdata Detail tables that are produced as output from the adapter process. Includes the final summary Nway table.

SRMR3SRC !r3droot\r3source Source catalogs for all user-written source code and format control source code

A P P E N D I X

C

Page 34: SAS Supplier Relationship Management Adapter for SAP R/3

26

Page 35: SAS Supplier Relationship Management Adapter for SAP R/3

SAS/Warehouse Administrator Jobs — Reverse Impact Analysis Diagram

About the Reverse Impact Analysis Diagram The reverse impact analysis diagram on the next page (Figure D.1) shows the default job sequence and dependencies for the adapter. You might need to customize the job sequence to meet the requirements of your site. Customizations can include adding, removing, or updating jobs

A P P E N D I X

D

Page 36: SAS Supplier Relationship Management Adapter for SAP R/3

Figure D.1 Reverse Impact Analysis Diagram

Page 37: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix D: SAS/Warehouse Administrator Jobs — Reverse Impact Analysis Diagram 29

Producing the Reverse Impact Analysis Diagram Follow these steps to produce a reverse impact analysis diagram. 1. From the Job Hierarchy view in SAS/Warehouse Administrator, right-click the Complete

Solution Loaded event, then select Add-Ins (Display D.1).

Display D.1 Select Add-Ins of Complete Solution Loaded

2. From the selection list of SAS/Warehouse Administrator add-ins, select Reverse Impact

Analysis and click OK (Display D.2).

Page 38: SAS Supplier Relationship Management Adapter for SAP R/3

30 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

Display D.2 Selection List of Warehouse Administrator Add-Ins

Page 39: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix D: SAS/Warehouse Administrator Jobs — Reverse Impact Analysis Diagram 31

3. In the Reverse Impact Analysis dialog box (Display D.3), select Detailed (Tables and processes) and click OK. A new reverse impact analysis diagram is displayed (Display D.4). You can view, save or print this diagram.

Display D.3 Reverse Impact Analysis Dialog Box

Display D.4 New Reverse Impact Analysis Diagram

Page 40: SAS Supplier Relationship Management Adapter for SAP R/3

32

Page 41: SAS Supplier Relationship Management Adapter for SAP R/3

List of Extracted Columns by SAP Table Name

Shaded text indicates a primary key.

BKPF - Accounting Document Header MANDT Client BUKRS Company code BELNR Accounting document number GJAHR Fiscal year BUDAT Posting date in the document

BSAK - Accounting: Secondary Index for Vendors (Cleared Items) MANDT Client BUKRS Company code LIFNR Account number of vendor or creditor GJAHR Fiscal year BELNR Accounting document number BUZEI Number of line item within accounting document BUDAT Posting date in the document WAERS Currency key SHKZG Debit/credit indicator GSBER Business area DMBTR Amount in local currency WRBTR Amount in document currency AUFNR Order number EBELN Purchasing document number EBELP Item number of purchasing document SAKNR G/L account number REBZG Number of the invoice the transaction belongs to REBZJ Fiscal year of the relevant invoice (for credit memo) REBZZ Line item in the relevant invoice KOSTL Cost center PRCTR Profit center PYAMT Amount in payment currency VERTN Contract number

A P P E N D I X

E

Page 42: SAS Supplier Relationship Management Adapter for SAP R/3

34 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

BSEG - Accounting Document Segment MANDT Client BUKRS Company code BELNR Accounting document number GJAHR Fiscal year BUZEI Number of line item within accounting document KOART Account type SHKZG Debit/credit indicator GSBER Business area DMBTR Amount in local currency WRBTR Amount in document currency BEWAR Transaction type KOSTL Cost center AUFNR Order number VBELN Billing document SAKNR G/L account number LIFNR Account number of vendor or creditor NEBTR Net payment amount REBZG Number of the invoice the transaction belongs to REBZJ Fiscal year of the relevant invoice (for credit memo) REBZZ Line item in the relevant invoice MATNR Material number WERKS Plant MENGE Quantity MEINS Base unit of measure ERFMG Quantity in unit of entry ERFME Unit of entry BPMNG Quantity in purchase order price unit BPRME Order price unit ELIKZ "Delivery completed" indicator PRCTR Profit center XHKOM Indicator: G/L account assigned manually? VERTN Contract number

Page 43: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix E: List of Extracted Columns by SAP Table Name 35

BSIK - Accounting: Secondary Index for Vendors MANDT Client BUKRS Company code LIFNR Account number of vendor or creditor GJAHR Fiscal year BELNR Accounting document number BUZEI Number of line item within accounting document BUDAT Posting date in the document WAERS Currency key SHKZG Debit/credit indicator GSBER Business area DMBTR Amount in local currency WRBTR Amount in document currency AUFNR Order number EBELN Purchasing document number EBELP Item number of purchasing document SAKNR G/L account number REBZG Number of the invoice the transaction belongs to REBZJ Fiscal year of the relevant invoice (for credit memo) REBZZ Line item in the relevant invoice KOSTL Cost center PRCTR Profit center PYAMT Amount in payment currency VERTN Contract number

CEPC - Profit Center Master Data Table MANDT Client PRCTR Profit center DATBI Valid to date KOKRS Controlling area KHINR Profit center area

CEPCT – Profit Center Master Data Table MANDT Client SPRAS Language key PRCTR Profit center DATBI Valid to date KOKRS Controlling area KTEXT General name LTEXT Long text MCTXT Search term for matchcode search

CSKS – Cost Center Master Data MANDT Client KOKRS Controlling area KOSTL Cost center DATBI Valid to date SPRAS Language key KHINR Standard hierarchy area

Page 44: SAS Supplier Relationship Management Adapter for SAP R/3

36 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

CSKT – Cost Center Texts MANDT Client SPRAS Language key KOKRS Controlling area KOSTL Cost center DATBI Valid to date KTEXT General name LTEXT Description MCTXT Search term for matchcode use

CSKU – Cost Element Texts MANDT Client SPRAS Language key KTOPL Chart of accounts KSTAR Cost element KTEXT General name LTEXT Description MCTXT Search term for matchcode use

EKKN – Account Assignment in Purchasing Document MANDT Client EBELN Purchasing document number EBELP Item number of purchasing document ZEKKN Sequential number of account assignment SAKTO G/L account number KOSTL Cost center AUFNR Order number PRCTR Profit center

EKKO – Purchasing Document Header MANDT Client EBELN Purchasing document number BUKRS Company code BSTYP Purchasing document category BSART Purchasing document type LOEKZ Deletion indicator in purchasing document STATU Status of purchasing document AEDAT Date on which the record was created LIFNR Vendor's account number SPRAS Language key EKORG Purchasing organization EKGRP Purchasing group WAERS Currency key WKURS Exchange rate BEDAT Purchasing document date

Page 45: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix E: List of Extracted Columns by SAP Table Name 37

EKPO – Purchasing Document Item MANDT Client EBELN Purchasing document number EBELP Item number of purchasing document LOEKZ Deletion indicator in purchasing document STATU Status of purchasing document AEDAT Date on which the record was created MATNR Material number BUKRS Company code MATKL Material group MENGE Purchase order quantity MEINS Order unit UMREZ Numerator for conversion of order unit to base unit UMREN Denominator for conversion of order unit to base unit NETPR Net price in purchasing document (in document currency) PEINH Price unit NETWR Net order value in PO currency BRTWR Gross order value in PO currency ELIKZ "Delivery completed" indicator EREKZ Final invoice indicator KNTTP Account assignment category WEUNB Goods receipt, non-valuated REPOS Invoice receipt indicator LMEIN Base unit of measure BSTYP Purchasing document category

LFA1 – Vendor Master (General Section) MANDT Client LIFNR Account number of vendor or creditor LAND1 Country key NAME1 Name 1 NAME2 Name 2 NAME3 Name 3 NAME4 Name 4 ORT01 City ORT02 District PFACH P.O. Box PSTL2 P.O. Box postal code PSTLZ Postal code REGIO Region (state, province, county) STRAS House number and street ADRNR Address BRSCH Industry key ERDAT Date on which the record was created LOEVM Central deletion flag for master record SPRAS Language key STCD1 Tax number 1 STCD2 Tax number 2 TELF1 First telephone number TELF2 Second telephone number TELFX Fax number KRAUS Credit information number

Page 46: SAS Supplier Relationship Management Adapter for SAP R/3

38 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

MAKT – Material Descriptions MANDT Client MATNR Material number SPRAS Language key MAKTX Material description

MARA – General Material Data MANDT Client MATNR Material number ERSDA Creation date MTART Material type MATKL Material group MEINS Base unit of measure ATTYP Material category

SKA1 – G/L Account Master (Chart of Accounts) MANDT Client KTOPL Chart of accounts SAKNR G/L account number

SKAT – G/L Account Master Record (Chart of Accounts: Description) MANDT Client SPRAS Language key KTOPL Chart of accounts SAKNR G/L account number TXT20 G/L account short text TXT50 G/L account long text MCOD1 Search term for using matchcode

T001 – Company Codes MANDT Client BUKRS Company code BUTXT Name of the company code or company ORT01 City LAND1 Country key WAERS Currency key SPRAS Language key KTOPL Chart of accounts WAABW Maximum exchange rate deviation in percent PERIV Fiscal year variant

T001L – Storage Locations MANDT Client WERKS Plant LGORT Storage location LGOBE Description of storage location

Page 47: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix E: List of Extracted Columns by SAP Table Name 39

T001W – Plants/Branches MANDT Client WERKS Plant NAME1 Name BWKEY Valuation area KUNNR Customer number of plant LIFNR Vendor number of plant FABKL Factory calendar key NAME2 Name 2 STRAS House number and street PFACH P.O. Box PSTLZ Postal code ORT01 City LAND1 Country key REGIO Region (state, province, county) SPRAS Language key

T005T – Taxes: Region Key: Texts MANDT Client SPRAS Language key LAND1 Country key LANDX Country name NATIO Nationality

T005U – Taxes: Region Key: Texts MANDT Client SPRAS Language key LAND1 Country key BLAND Region (state, province, county) BEZEI Description

T023T – Material Group Descriptions MANDT Client SPRAS Language key MATKL Material group WGBEZ Description of material group WGBEZ60 Long text describing the material group

T024 – Purchasing Groups MANDT Client EKGRP Purchasing group EKNAM Description of purchasing group EKTEL Telephone number of purchasing group (buyer group) LDEST Spool: Output device TELFX Fax number of purchasing (buyer) group

T024E – Purchasing Organizations MANDT Client EKORG Purchasing organization EKOTX Description of purchasing organization BUKRS Company code

Page 48: SAS Supplier Relationship Management Adapter for SAP R/3

40 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

T134T – Material Type Descriptions MANDT Client SPRAS Language key MTART Material type MTBEZ Description of material type

TGSBT – Business Area Names MANDT Client SPRAS Language key GSBER Business area GTEXT Business area description

TKA01 – Controlling Areas MANDT Client KOKRS Controlling area BEZEI Name of the controlling area WAERS Currency key KTOPL Chart of accounts KHINR Standard hierarchy for cost centers PHINR Profit center area

TSPAT – Organizational Unit: Sales Divisions: Texts MANDT Client SPRAS Language key SPART Division VTEXT Name

WBHI – Trading Contract: Item Data MANDT Client TPOSN Trading contract: Item number MENGE Quantity ordered against this purchase requisition

WBHK– Trading Contract: Header Data MANDT Client TKONN Trading contract: Trading contract number TKWAERS Trading contract: Currency of trading contract

Page 49: SAS Supplier Relationship Management Adapter for SAP R/3

Loading the BKPF and BSEG Tables

Initial Load IS Required or Initial Load NOT Required The Initial Load IS Required set of jobs should be run once during the first complete run of the SAS/Warehouse Administrator job suite. However, there might be a requirement to completely refresh data at some later stage if incomplete data is suspected. In all other cases the Initial Load NOT Required set of jobs should be run. The reason for this is that the initial load will do a complete extraction of the data from the BKPF and BSEG tables (depending on the date setting in the autoexec.sas file), whereas the subsequent loads will extract only delta changes that have been made to those tables, resulting in significant savings in extraction time. The Initial Load IS Required set of jobs are as follows: • BKPF (Initial Load) • BSEG (Initial Load) • Accounting Document (Initial Load). The Initial Load NOT Required set of jobs are as follows: • BKPF/BSEG Accounting Document • Accounting Document.

Initial Load IS Required Jobs in Detail

BKPF (Initial Load) and BSEG (Initial Load) The tables BKPF and BSEG are the main tables that are used for storing financial transactions in SAP R/3. BKPF is the heading table and BSEG contains line item detail. BSEG is often one of the largest individual tables in an SAP R/3 system. Because of the way BSEG is indexed in SAP, there is a different process to do this initial load compared to subsequent updates. This job must be run by using the Batch RFC Server, which is the default server for the adapter extractions. Execution times in excess of 12 hours can be expected.

A P P E N D I X

F

Page 50: SAS Supplier Relationship Management Adapter for SAP R/3

42 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

The extraction is split into logical sections, by looking up all the relevant company codes and then splitting the data into financial years. The process uses the macro variable &_START, which must be set in the autoexec.sas file. All data that has a date greater than or equal to &_START will be extracted. The macro %GET_TABLE_BY_BUKRS_GJAHR is executed. This macro essentially calls BATR3CV by building WHERE clauses on BUKRS (company code) and GJAHR (financial year). When this extraction process is complete, the table NONR3D.DELTACTL is updated to reflect the date of the latest extraction. This date is then used in subsequent extractions to determine where extraction should begin. The macro variable &OVERLAP_DAYS, which is set in autoexec.sas, is used to subtract a number of days from the date that is stored in NONR3D.DELTACTL. This prevents the loss of data that was not in the system when the previous extraction was done.

Accounting Document (Initial Load) This job creates the physical table R3DATA.ACCDOC by performing a relatively simple join of the transaction tables BKPF and BSEG that are created in jobs BKPF (Initial Load) and BSEG (Initial Load).

Initial Load NOT Required Jobs in Detail

BKPF/BSEG Accounting Document One of the most technically demanding tasks for the adapter is to extract changes to the BKPF and BSEG tables in an efficient manner. Since a full extraction takes many hours and uses a significant amount of SAP R/3 and network resources, it is not desirable to do a full extraction frequently. Unfortunately, there is no perfect solution to this problem, because SAP does not time-stamp the tables in a perfect way. There are columns in BKPF that can be used to recognize changes. These are as follows: • CPUDT (Accounting document entry date) • AEDAT (Date of last document change by transaction) • UPDDT (Date of the last document update). BSEG has no date or time stamps that can be used, so the adapter must identify the new and changed records in the heading table BKPF and extract the matching items from BSEG. The extraction of the changed records in BKPF is therefore quite simple, but the extraction of BSEG is not. Extraction of BSEG is done by using a server-side join. The SAP server selects all relevant BKPF records and then does a “nested select” to get the matching BSEG records.

Page 51: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix F: Loading the BKPF and BSEG Tables 43

The Advanced Business Application Program (ABAP) function Z_SAS_READ_TABLE _JOIN is called as follows: %callrfc(

Z_SAS_READ_TABLE_JOIN EXPORTING data_file = &data_fileref metadata_file = &field_fileref destination = &sasrfcex_destination IMPORTING return = rc INTABLES parameter = work.table_parameter TABLES s = work.program

);

However, the ABAP function is called by the SAS/ACCESS Interface to R/3 software Business Application Programming Interface (BAPI) connector (%CALLRFC macro), a component of SAS/ACCESS Interface to R/3 software. This connector submits code as an interactive process on the SAP R/3 server. For this reason, it is possible to experience the time-out problems that are associated with interactive processes. The ABAP code takes as parameters an initial table name, columns in that table, and an associated WHERE clause. Additional lines in the parameters specify an additional table that is joined by a nested select (SAP R/3 does not allow standard SQL join syntax to extract from the BSEG cluster table). To prevent potential memory problems in SAP R/3, the extraction is split logically into financial years. No splitting is done on the BUKRS company code column, but it might make sense to add logic to split the extraction into date ranges (instead of simply getting all data with dates greater than the previous extraction). However, if extractions are done frequently enough, then this should not be a problem. In addition, ensure that the RFC destination that calls the program SASRFCEX is on the same server that is running the extraction. The SAP gateway must be set correctly in the destination if the server load balancing is done on the SAP system. The following description is adapted from the comment at the head of the macro %BKPF_BSEG_JOIN_PARAMETERS, which is used to define the input table (server-side query definition) of the ABAP function Z_SAS_READ_TABLE_JOIN:

The input table has only one column called LINE. The length of the column should not exceed 72 characters. The function Z_SAS_READ_TABLE_JOIN expects the parameter in a certain format. Each table is identified by the keyword TABLE, followed by the table name. The next line contains the keyword FIELD, followed by the first field to extract. The next lines contain the keyword FIELD, followed by a field name, or only the field name without the keyword. Each field must be identified in a separate line. The keyword AS can be used to rename a field—for example, FIELD OBJECTID AS OBJECTID1. A list of field names is required. An asterisk (*) is not accepted. All fields that are used in one of the WHERE conditions must be listed in the field list.

Page 52: SAS Supplier Relationship Management Adapter for SAP R/3

44 SAS Supplier Relationship Management Adapter for SAP R/3: User’s Guide

The next line contains the keyword WHERE, followed by the WHERE condition for the table. The WHERE condition can be continued on the next line (as long as it does not start with one of the keywords). If, while generating input tables, the possibility exists that the next line will start with one of the keywords, then insert the keyword WHERE at the beginning of the line. The example below joins the tables CDHDR and CDPOS. A nested SELECT statement will be generated to join the two tables. Simplified, the generated ABAP statement will look like the following:

SELECT MANDANT OBJECTID CHANGENR FROM CDHDR WHERE UDATE > '20001020'. SELECT OBJECTID TABNAME FNAME VALUE_NEW VALUE_OLD FROM CDPOS WHERE OBJECTID = CDHDR-OBJECTID AND CHANGENR = CDHDR-CHANGENR. move fields to table space and send data records to the client ENDSELECT. ENDSELECT.

The following shows an example definition of the server side join:

data work.table_parameter; length line $ 72; line = 'TABLE BKPF'; output; line = 'FIELD MANDT'; output; line = ' BUKRS as BKPF_BUKRS'; output; line = ' BELNR as BKPF_BELNR'; output; line = ' CPUDT'; output; line = ' AEDAT'; output; line = ' BUDAT'; output; line = ' MONAT'; output; line = ' WAERS'; output; line = ' UPDDT'; output; line = "WHERE GJAHR = &gjahr"; output; line = " AND ( CPUDT GE &cutdateq"; output; line = " OR AEDAT GE &cutdateq"; output; line = " OR UPDDT GE &cutdateq ) "; output; line = 'TABLE BSEG'; output; line = 'FIELD BUKRS'; output; line = ' BELNR'; output; line = ' GJAHR'; output; line = ' BUZEI'; output; line = ' BSCHL'; output; line = ' KOART'; output; line = ' GSBER'; output; line = ' DMBTR'; output; line = ' WRBTR'; output; line = ' PSWBT'; output; line = ' PSWSL'; output;

Page 53: SAS Supplier Relationship Management Adapter for SAP R/3

Appendix F: Loading the BKPF and BSEG Tables 45

line = ' MATNR'; output; line = ' WERKS'; output; line = ' PRCTR'; output; line = ' HKONT'; output; line = 'WHERE BUKRS = BKPF-BKPF_BUKRS'; output; line = ' AND BELNR = BKPF-BKPF_BELNR'; output; line = ' AND GJAHR = '!!compress("'"!!&gjahr!!"'"); output; stop; run;

The statements in bold are used for subsetting. If you must modify the logic—for example, to extract changes for a single date only—then the expression could be changed to use the EQ operator instead of GE. (Note that as the query is being executed on SAP, valid ABAP expression syntax must be used.) It is possible to add columns. Valid names can be found via the SAS/ACCESS to R/3 List of Tables program. The job calls the macros %START_LISTENER and %KILL_LISTENER to start and stop communication with SAP through an SAP destination. The %START_LISTENER macro in turn calls a CMD script (for Windows) or a shell script (for UNIX) that starts the listening program. The CMD script SAS_RFCEXEC.CMD (or shell script sas_rfcexec) must be modified to fit your local SAP system. The script must also use a destination that refers back to the machine on which SAS is running. When the server-side join of BKPF and BSEG is complete, the result is joined to R3DATA.T001 in order to include the local currency columns.

Accounting Document This job takes the output from the job BKPF/BSEG Accounting Document and updates the previously extracted R3DATA.ACCDOC with the delta-change information. This new data is not appended because the changed data must be updated.

Page 54: SAS Supplier Relationship Management Adapter for SAP R/3
Page 55: SAS Supplier Relationship Management Adapter for SAP R/3
Page 56: SAS Supplier Relationship Management Adapter for SAP R/3
Page 57: SAS Supplier Relationship Management Adapter for SAP R/3