Sunday, 8 October 2017

SAP BW 7.3 Configuration after installation of BW - Part 1

Introduction


This document contains the Configuration steps which are to be performed after installing SAP BW system.

Step 1: Maintain the logical Systems

After installation, login to the 000 client and add the logical system entry.

Transaction BD54: Add all Logical systems which are in use

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 2: Defining Client in transaction code SCC4 or use below path to configure client

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

It will take you to below screen

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Create new entries

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

◉ Enter client number, name, logical system name, std currency, client role.
           For development system selects customizing

Changes and transports for client-specific objects

           For development system: “select Automatic recording of changes”

           For Quality/Production system: “No changes allowed”

Cross-client Object changes

           For development system: Changes to repository and cross-client Customizing allowed.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

After creating the standard client, add the parameter login/no_automatic_user_sapstar in the instance profile and restart the system for the parameter to take effect. After the restart, you will be able to login to the standard client using the sap* user id   with the standard password.

Perform a client copy from 000 client to the standard client which you have created

T-code SCCL.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Schedule a background job to by giving the above input values.

Once the client copy is completed, perform a kernel upgrade to the latest level and then support pack upgrade.

Step 3: RSADMINC (Customizing Table General BW) table configuration

Update the Table with below values:

INFOIDOCFRQ update with the value 10

IDOCPACKSIZE update with the value 30000

PSAPARTSIZE update with the value 1000000      

File name: BW_OLAP_CACHE

File name span: BW_OLAP_CACHE_SPAN

UOM_BUFF_SIZE: 500

SPLT_QRY_TAB_THR: 50

SPLT_DM_TAB_THR: 20

ORA_PARALLEL_DEG: 4

TMPLID_ANALYZER: ANALYSIS_PATTERN_SPECIAL

RSER_TMPL_ID: 0REPORT_DEFAULT_SPECIAL

This table should have updated with User in source system for ALE communication – ALEREMOTE

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 4: ALEREMOTE settings for Background users

Set ALEREMOTE as the default setting for background users (table entry RSADMINA)

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 5: Activating the Software Component SAP_BW in the CVERS_ACT Table

You can use Function module “RS_SET_ACTIVE_COMPONENT_FLAG” in SE37 to set flag I_ACTIVE_FLAG = ‘X’

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 6: Preparing the BW System

Go to transaction code RSA1:

Start the Data Warehousing Workbench (transaction RSA1). When starting for the first time, the ‘myself source system’ is created automatically and table RSLOGSYSDEST is modified.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 7: Activate Technical Content

When starting the Data Warehousing Workbench (transaction RSA1) for the first time, the content is activated automatically.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 8: Set the BW Transport System as Default

Field TADIRPOPUP in table RSADMINS (System Settings) is set to “x”. With this entry, you define that the BW transport system is activated in the default system

In case of blank value the dialog prompting the user to enter a transport request does not appear when editing the objects.

Development system: As we need to record changes and collect into transport request, Field TADIRPOPUP in table RSADMINS should not
be blank.

This setting will work on top of SCC4 transport settings.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 9: Defining the Recording Time for Transports

Go to->transaction code RSA1, click on transport connection.

Then Edit -> Transport -> Switch-on Standard.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 10: Create job and schedules weekly once

Job name: ZBW_OLAP_CACHE_CLEAR

Program name: RSR_CACHE_RSRV_CHECK

Step 11: Schedule report to clear the DTP buffer

Job: ZBW_DTP_CACHE_CLEAR

Program: RSBKCHECKBUFFER

Step 12: Deleting Messages and Parameters of the BW Background

Job: BI_DELETE_OLD_MSG_PARM_DTPTEMP on daily basis

Program: RSBATCH_DEL_MSG_PARM_DTPTEMP.

Step 13: Metadata repository configuration

Prerequisite: The HTTP or HTTP(s) port needs to be open based on the usage. By default, metadata repository will open using HTTP protocol. In case if you want to launch metadata repository using HTTPS protocol, you can add the below ICM parameter in the instance profile using RZ10 T-code and restart the ICM in SMICM transaction.

Icm/HTTP/redirect_0 = PREFIX=/, FROM=*, FROMPROT=http,
PROT=https, HOST=logicalsystem.FQDN, PORT=XXXX (HTTPS PORT NO)

Transaction code: STRUST

Activate SSL server Standard

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

SPRO -> Maintain web protocol HTTP/HTTPS.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Transaction code SICF: Activate service “rso_metadata_repository”

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Metadata repository then launches fine in RSA1transaction.

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Step 14: Activate personalization content:

Create Development package with project specific naming convention using T-code SE21 or SE80.

Then activate the personalization content using SPRO transaction

SAP Business Warehouse, SAP BW, SAP Learning, SAP Guides, SAP Certification, SAP Live Access, SAP Configuration

Saturday, 7 October 2017

How to create customize inspection type

When an inspection lot is created, the system uses the inspection lot origin to determine how the inspection lot will be processed.

Suppose as per the business requirement inspection type will be use for the material for which result recording is not required and it will have the Post to inspection stock and Auto UD indicator active. I am creating customize Inspection Type Z01 which is a copy of 01.

1. SPRO > Quality Management > Quality Inspection > Inspection Lot Creation > Maintain Inspection Type.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Select the Inspection type 01 and Click on Copy.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Maintain the Inspection Type Z01 and Description.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

2. SPRO > Quality Management > Quality Inspection > Inspection Lot Creation > Maintain Inspection Lot Origin and Assign Inspection Type.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Select the Lot Origin 01 and Click on Inspection type for the Origin.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Click on New Entries

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Maintain Inspection Type Z01.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

3. SPRO > Quality Management > Quality Inspection > Inspection Lot Creation > Define Default Values for Inspection Type.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Select the Inspection type 01 and click on copy.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Maintain the Inspection Type Z01 and field maintain here will have default value for the inspection type.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

4. Assign Inspection Type to the Material.

Customize Inspection type will work only when Preferred Ins Type Indicator is activated.

Detailed information on inspection type Z01 will have default value as maintain in Define Default Values for Inspection Type.

SAP Guides, SAP Learning, SAP Tutorial and Material, SAP Certifications, SAP All Modules List

Friday, 6 October 2017

AppsFreedom: SAP - Security Configuration

Overview


The appsFreedom Platform generates full-featured, enterprise level mobile & web apps, called Freedom Apps for all major mobile operating systems and form factors. AppsFreedom is a platform that allows for complete app development and management. AppsFreedom can be used to develop SAP mobile applications. This document explains configuration of authentication and authorization within the application. For users to perform their task in mobile applications that integrate with SAP they need to have their back-end security in SAP.

Purpose


AppsFreedom app connects to AppsFreedom Manager suite on the cloud server to retrieve data and finally transmits the data to SAP for further processing. A series of apps are designed on Freedom Manager suite that are then displayed on the user’s handheld device to perform actions based on the authorizations.

The below picture explains connection between AppsFreedom and SAP.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

User interface


The user interface for Security administrators will be via a weblink that connects to AppsFreedom Manager suite deployed on AppsFreedom private cloud infrastructure. The following is the webscreen and the WebURL to launch into AppsFreedom.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

In the above screen, the following information needs to be entered into the Tenant ID Field: XXXXXX

In the next sections, I will be explaining about the mode of authentication used and the respective suite to grant authorizations to the users.

Authentication


Users sign in to the Web link using their LDAP credentials as the AppsFreedom is authenticated via LDAP. For LDAP to work, users need to be manually created in the application as the nightly file feed feature is not available for AppsFreedom application. Initial mass user creation is done by AppsFreedom, and moving forward every new individual needs to be manually created in AppsFreedom for LDAP. SSO is also possible with Appsfreedom. This approach shall be in place, until AppsFreedom comes out with the new release supporting the acceptance of nightly file feed job that updates new users from LDAP to the AppsFreedom without any manual intervention.

Authorization


Users in AppsFreedom are provided access via Role Based Access Controls approach. The Access can be divided into two modules:

◉ Platform Users
◉ Apps Users


Platform Users


Platform Users in AppsFreedom comprise of technical users that consist of basis, security and developers in the pool. Platform users gain access to develop apps, control and administer Freedom Manager from deployment standpoint, administer security controls on User creation, Role management, creation of business users and groups for certain apps etc. The following screens depict the settings that Security adminstrators would be able to perform from administrator standpoint.


Create User


Once logged into the AppsFreedom, user needs to click on the ‘Platform Configurator’ to launch the module.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

On the screen, click on ‘Platform User’ to view the list of Platform Users. Click on ‘Create User’ to input the details for new user on the platform configurator.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Once all the fields are completed, click on ‘Create’ to create a new user in the Platform Configurator. Please remember that only Technical users need to be created in the Platform Configurator and not Business users.

Assign Role


Once the Platform User has been created, select on the new user created. A tab opens at the bottom highlighted in RED. Select ‘Assigned Roles’ on the tab and click on ‘Add’ to add the roles to the selected user.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Select a role from the list and click ‘Save’ to finish the activity of assigning the role to the user.

Create Role


The Platform Configurator allows users to Create custom roles and assign specific authorizations to the role based on the technical requirements. Below screen depict the Role creation and assignment of authorizations to the role.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

To create a custom role, click on ‘Create Role’. A window pops-up asking to input a Role name and its description. The below screenshot depicts the fields.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Once the information is entered, click on ‘Save’ to complete the role creation.

Select on the new role on the radio button. A tab opens at the bottom with the following fields highlighted in RED. Select ‘Assigned Access’ and click on ‘Update’ to open up the selection of authorizations needed to assign authorizations to the role.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

The below screen opens once the user clicks on ‘Update’.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Authorizations can be selected at header level (ex: Platform Configurator) and a list of authorizations would drop down allowing user to select activities that a custom role would need to have based on the requirements. Once the selections are complete, user can then hit ‘Save’ to complete the assignment of authorizations to the custom role.

The new role will now be populated under the list, when assigning roles to new / exisiting users.

Apps Users


Apps Users are Business Users accessing the Apps on the handheld / Desktop to run the applications for day to day operations. Business Users need to be created solely under App Library and assigned to Business Groups that contains a list of Apps that the certain Business group would be using them. The below section details the creation of users, creation of business groups and assignment of users to business groups.

Business Users



To create users in the AppsFreedom, please navigate to the App Library and select ‘Business User’ on the top bar to display the business users tab.

Once selected, click on ‘Create Users’ tab to open a pop-window to enter the details.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Click on ‘Create User’ for new user creation. A pop-window opens prompting user to enter the details of the new user.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Once the details are entered, click on ‘Create’ to finish the activity.

Business Group



Business Groups consist of an app (or) a combination of apps based on the requirements. Business Groups are named in accordance with the SAP Security roles description to match the user base to the assignment of Apps required for Business use. Users who have access to a specific security role in SAP would get the business group in AppsFreedom (named like SAP Security role) that contains Apps as per business requirement. Apps are designed by development team on Freedom Manager and are then activated for use in assignment to Business Groups / Users. To maintain consistency, all apps are assigned to Business Groups that are in turn assigned to the Business Users. The below screenprints depict the creation of Business Groups and assignment of Apps to the Business Groups.

Select ‘Business Groups’ on the tab and click on ‘Create group’.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

A pop-up window opens to enter the details of the Business Group.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Once the information is entered in the given fields, click on ‘Create’ to complete the activity.

Select on the newly created Business Group and click on ‘Assigned Roles’ displayed at the bottom of the page highlighted in RED.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

‘Mobile Users’ role need to be assigned to the Business Group inorder to make the Apps for ‘Mobile Use’ only. Only users who have handheld devices can access the apps that are classified as Mobile Users.

On the next tab ‘Assigned Users’, click on Add to assigned Business Users to the selected Group.

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

On the next tab ‘Available Apps’, assigned apps that the business group needs to have access to based on the requirements

SAP Security, SAP Live, SAP Certifications, SAP Guides, SAP Tutorial and Material, SAP Learning, SAP Fiori

Click on ‘Add’ to add the listed Apps to the groups.

Once selected, click on ‘Save’ to complete the activity.

Thursday, 5 October 2017

Central Finance: Challenges in Finance Transformation

There are many business cases for S/4HANA Adoption for existing SAP Customers. However, the journey to S/4HANA Business Suite is fraught with its own challenges which are inevitable – the costs and risks of migrating and upgrading to a new system, especially for those customers, who have built very complex and distributed landscapes spanning across geographies and businesses.

SAP S/4HANA Finance, FIN (Finance), MM (Materials Management), SAP S/4HANA, SAP Fiori for SAP S/4HANA, SAP Live, SAP Guides

One element of S/4HANA, which has caught the imagination of many of the Global Customers is Central Finance, which has been projected as the “Smartest”, “Fastest”, “Simplest” way to latch on to S/4HANA bandwagon with a quick win of simplified and unified financial reporting structure. The approach of Central Finance, instead of forcing customers to migrate their SAP instances to S/4HANA Application, allows financial documents to be replicated into a new Central Finance instance running on S/4HANA Business Suite. This is particularly true for Customers who have multiple old SAP ERP Instances and non SAP Systems as well. This gives an organization wide financial reporting view, with minimal intervention to the Transaction Processing Source SAP and non SAP Systems. It has been claimed to be a quick win solution for all the Enterprise Customers of SAP, with extremely short turnaround time for adaption.

However, there are series of multiple challenges, which need to be considered in implementation of Central Finance. Some of them can dearly cost the S/4HANA Journey and cost thousands of dollars in terms of effort and missed objectives. Some of the business related challenges and technical product related challenges that I have encountered in my journey on Central Finance Project are below:

1. Organizational Structure: One of the biggest use cases for central finance is to look at harmonized reporting for multiple markets. A logical extension of central finance on S/4HANA is to use the same CFIN System as a future Business System with integrated Finance and logistics transaction system. Therefore, it makes the organizational structure design extremely critical. In one of my projects, the customer in the legacy ERP (Source SAP ERP Systems) was using Business Area, Segment, Profit center etc as key considerations for reporting. Additionally, the Logistics Org Structures like Sales Org were not having in synch in various Source ERP System, as well as non SAP Source system did not have the org object which were relevant from SAP standpoint. As an IT Strategy roadmap, the customer wanted all the markets, where it operated to be on S/4HANA Business Suite and CFIN was the starting point. Additionally, many of the org structures were used in Account Based COPA in CFIN. So the Organizational structure design is a very crucial factor for long term journey and it is critical that design of org structure is thought through in CFIN. This should take into consideration the future logistics org structure as well

2. New GL and Document Splitting in S/4HANA Central Finance: Document splitting and parallel ledgers functionality is one of the key asks from Finance Transformation for a large scale Enterprise level customer. Many of the customers might be using a source system without functionalities like new GL or Document splitting, but would want to use the S/4HANA CFIN with these functionalities. However a source system without Document splitting for eg and a target CFIN System with Document splitting is NOT a functionality which is supported out of box. It takes a real challenge to make sure that all the documents replicated from the source SAP ERP and non SAP Systems have the right level of details to support Document splitting. There are options available like BADI_FINS_CFIN_AC_INTERFACE, which can be used to enable the right rules for populating the account assignments for Document splitting. Some of the examples for Document splitting and parallel ledger usage:

◈ The account assignments for Document splitting can be populated only in some of the line items and let standard Splitting set up take care of offsetting line item (eg, Profit Center and segment update in line items and let vendor line item derive the same from offsetting line item in case of Vendor Invoice Posting).

◈ Some of the FI Document line items can derive account assignment objects for document splitting from areas like material master, cost center etc. The customer specific changes, should not be triggered in case, where standard derivation logic can work

◈ Secondary CO Postings from Source systems, where the profit center is not available in one of the line items, the customer specification needs to be updated

◈ Data from Non SAP systems needs to be enriched with account assignment details for postings in the target central finance system

◈ There are transfer postings between subledgers which fail in the target system if it has document splitting active.

3. Master Data Harmonization: Master data replication of objects like Cost Center, Profit center, GL Accounts, customers, Vendors etc is a challenge. Data harmonization is a key challenge in Enterprise customers with multiple SAP Systems. Some of the challenges in master data set up in Central Finance encountered in my experience are:

◈ Customer Vendor Integration - The central finance function was used in S/4HANA 1610 EM instance, where the customers and vendors are created as Business Partners and the number ranges were overlapping in the source system for Customer and vendor account groups. To tide over the issue, the number ranges for Vendors were changed in the target CFIN System

◈ GL Master Data Replication - The SAP ERP System were substantially old systems, where transactional data existed for more than 15 years. As part of CFIN replication, only few years of historical data was being replicated into the target CFIN System. So the GL Master replication was designed based on the no of years in past where transactional data existed for a GL, that only was replicated into the target system

◈ Profit Center and Segments – One of the outcome of org structure redesign in CFIN was the whole profit center and segment usage in Central finance. The profit center in target CFIN system was tagged to Brand for reporting, while a segment was concentrated around line of business. However, the brands in the source system were limited to profit center with Business area being used for line of business reporting. The usage of different objects for reporting in source and target system entailed usage of complex mapping framework for replication of master data

◈ Material master – The material master usage was also a challenge due to disparate systems. A governance structure was required to be put in place to synch up the master data in the source systems and than have the same replicated in the target system.

◈ Data Services or SLT for Master Data – Harmonization and Business Objectives for Master data usage greatly determined the usage of the technology layer for replication between Source SAP and non SAP Systems to S/4HANA Central Finance Environment. Based on specific requirements like Data Filters for GL Account, Numbering changes etc, it was decided to introduce Data Services as a technology layer between Source and Target system for master data replication in S/4HANA Master Data replication.

1. MDG Layer and Value / Key Mappings: Central Finance offers an integrated MDG layer which can be used to recreate the accounting document in the target system, based on the data replication from the source. Some of the key learnings from my association with the central finance project were:

◈ Mapping Action - The mapping action determines if a transformation is required for any data element. In one of my project, business area was very widely used for financial reporting in the source SAP system. However, the complete reimagining of financial reporting meant that business area was not a key reporting factor in Central Finance. Hence a mapping action was set to clear the business area information from the source data. Essentially, the Mapping action should be designed taking into consideration of what are the key financial reporting parameters and if those parameters will hold true for the business even in case of a completely integrated system of records with finance and logistics transactions happening in the same system some time into future.

◈ Key Mapping - Typically the identifiers for a business object can be different in source and target system, given that Central Finance has the ability to connect to a heterogeneous set of SAP and non SAP systems. Eg, a customer 2212 in a source system may be customer (BP) 500000 in CFIN to harmonize master data. In one of the projectw, the key ask was to manage millions of customer master, vendor, gl etc to name and arrive at a common structure. The current design of central finance does not support automatic mapping of the source and target object number, though there is a standard upload tool to do an excel upload using the transaction code FINS_CFIN_MAP_MANAGE. However, to manage the real time replication of master data in the mapping layer, a custom program was created for each of the object to ensure, that there are no failures in transactions

◈ Value Mapping Structure - The value mapping is used in Central Finance to ensure if any transaction specific value has to be transformed. In some of the projects, the source systems had custom values for objects like Document types, Tax Codes etc. The whole objective of the transformation program was to ensure a standardized approach to finance structure across multiple markets. Eg, the markets used Document type R1 and RX for billing in two different geographies, but the intention in the target central finance system was to ensure that all the geographies, where the business operated should have the same document type for billing transactions. Hence the value mapping functionality was used to ensure that the new system has a standardized approach

2. COPA Transformation from Costing based COPA to Account based COPA: Most of the customers in SAP World use Costing based COPA. However, the preferred approach for reporting in S/4HANA Is Account based COPA. The data replication from the Costing based COPA to Account based COPA is not a standard and out of box functionality in S/4HANA. Some of the challenges encountered have been:

◈ There are scenarios in CB COPA where COPA data and GL postings happen at different time, whereas the expectation on AB COPA is to have the data based in COPA and GL at the same time. This presented it’s own challenges since AB COPA was supposed to be used for all kind of profitability analysis. Some of the design considerations for this transformation included moving key data like Sales Area data, material product hierarchy etc from material master, customer sales area data into central finance. These attributes were used in the derivation rule to ensure that the right attributes are populated. In some of the scenario like post goods issue, the data which is relevant for COPA was pulled through custom enhancements into Central finance.

◈ There are condition types on the billing cycle, which post data into COPA but not into GL. This functionality is not yet supported in AB COPA in S/4HANA. This means that the business had to look at the way, in which some of the discounts and pricing could be extended to Billing cycle

3. Transactional Data Posting: Central finance is supposed to reflect all of transactional financial data into a single place from multiple systems. However, the fine print is not all straight forward. There are not all scenarios which can be replicated into Central Finance. For eg, the transactional postings on Asset Sub ledger and WBS Elements through direct replication is not yet supported in central finance. There are quite a few challenges for customers, who already have SAP Source system which have parallel ledgers implemented. In such cases, the fiscal year differe nce in multiple ledgers presents its own issues. Some of the challenges assigned in Transactional data postings are:

◈ Asset Subledger postings are not supported in S/4HANA Central Finance. The posting on asset sub ledger in the source system have to be replicated on a normal GL Accounts in the target central finance system. We utilized the Key Mapping functionality in MDG Layer in Central Finance to ensure that the postings happened correctly

◈ The Transactional postings on WBS System in the source are not replicated into Central finance. This is mapped as a functionality, which will be addressed in the new releases of Central Finance. A custom enhancement was done in one of our projects to create the postings on other supported cost objects like internal order.

◈ Some of the legal entities had multiple ledgers in the source system with both ledgers having different fiscal year variants (one corresponding to 5-5-4 set up and other being April – March). The specification of the cutover month in source system for balance upload and document replication start due to different fiscal years in leading and non leading ledger meant duplicate data being posted in the non leading ledger, since the balance upload happens based on the fiscal year set up for leading ledger.

◈ A big challenge faced was the replication of the open items on the sub ledger and GL. The original document in source might be open at the time of initial load, but cleared in the period replication started. Such practical issues led to document failures in replication when subsequent actions on open items are not replicated immediately in central finance. These have been resolved through implementation of correction notes and custom code involvement

Wednesday, 4 October 2017

Dynamic Programming in ABAP: Part 3 – An Example – ABAP RTTS

In my last blog I explained about the significance of field symbol and data references in dynamic programming.

https://saponlineguides.blogspot.in/2017/09/dynamic-programming-in-abap-part-1-introduction-to-field-symbols.html

https://saponlineguides.blogspot.in/2017/09/dynamic-programming-in-abap-part-2-introduction-to-data-reference.html

SAP ABAP RTTS, SAP Guides, SAP ABAP Learning, SAP Certifications

Now here we will see one example of dynamic programming approach and also a brief introduction to ABAP RTTS.

ABAP Runtime Type Services (RTTS) consists of two components:

◉ Runtime Type Identification (RTTI) – Provides the methods to get the type definition of data objects at runtime.

◉ Runtime Type Creation (RTTC) – Provides the methods to create the data objects at runtime with any type definition.

Basically, ABAP RTTS provides a set of classes, whose methods can be used for runtime type identification and runtime type creation. To know more about ABAP RTTS you can follow below link:

https://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=42965


An example of dynamic programming:


Requirement: As an ABAP developer, very often we get the situation where we need to write data from an internal table to a file on application server.

Solution: We will build one class having a method which will take any internal table as input and write its content in a file on application server.

Class Definition:

CLASS cl_appserver_writer DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: write IMPORTING
                           iv_filename  TYPE string
                           it_data      TYPE ANY TABLE
                           write_header TYPE abap_bool DEFAULT space
                         EXPORTING
                           ev_message   TYPE string.
ENDCLASS.

Here importing parameter it_data is of TYPE ANY TABLE so that it can receive any internal table.

Class Implementation:

CLASS cl_appserver_writer IMPLEMENTATION.
  METHOD write.
    TYPES: BEGIN OF ty_comp_detail,
             name  TYPE abap_compname,
             descr TYPE scrtext_m,
           END OF ty_comp_detail.
    DATA: lo_type_def    TYPE REF TO cl_abap_typedescr.
    DATA: lo_struct_def  TYPE REF TO cl_abap_structdescr.
    DATA: lo_table_def   TYPE REF TO cl_abap_tabledescr.
    DATA: lo_data_def    TYPE REF TO cl_abap_datadescr.
    DATA: lo_element_def TYPE REF TO cl_abap_elemdescr.
    DATA: lt_components  TYPE abap_compdescr_tab.
    DATA: wa_components  LIKE LINE OF lt_components.
    DATA: lv_str         TYPE string.
    DATA: lv_filerow     TYPE string.
    DATA: lv_counter     TYPE i VALUE 0.
    DATA: lw_field_info  TYPE dfies.
    DATA: ls_comp_detail TYPE ty_comp_detail.
    DATA: lt_comp_detail TYPE TABLE OF ty_comp_detail.

    FIELD-SYMBOLS: <row> TYPE any.
    FIELD-SYMBOLS: <field_value> TYPE any.

* Using RTTS to get the runtime type information of the internal table
    lo_type_def  = cl_abap_tabledescr=>describe_by_data( it_data ).
    lo_table_def ?= lo_type_def.
    lo_data_def = lo_table_def->get_table_line_type( ).
    lo_struct_def ?= lo_data_def.

* Get the components of the structure
    lt_components = lo_struct_def->components.

    CLEAR: lo_data_def.

* If the WRITE_HEADER is ABAP_TRUE then fetch the label
* of data element associated to each component of the
* line type structure of internal table, if no data element
* is associated then use component name as the header text
    IF write_header EQ abap_true.
      LOOP AT lt_components INTO wa_components.
        lo_data_def = lo_struct_def->get_component_type( wa_components-name ).
        lo_element_def ?= lo_data_def.
        lw_field_info = lo_element_def->get_ddic_field( ).
        ls_comp_detail-name = lw_field_info-rollname.  "Get the data element name

* Calling FM to get data element text
        CALL FUNCTION 'WCGW_DATA_ELEMENT_TEXT_GET'
          EXPORTING
            i_data_element = lw_field_info-rollname
            i_language     = sy-langu
          IMPORTING
            e_scrtext_m    = ls_comp_detail-descr
          EXCEPTIONS
            error          = 1.
        IF ls_comp_detail-descr IS INITIAL.
          ls_comp_detail-descr = wa_components-name.
        ENDIF.
        APPEND ls_comp_detail TO lt_comp_detail.
        CLEAR: ls_comp_detail.
      ENDLOOP.
    ENDIF.

    OPEN DATASET iv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc EQ 0.
* Writing header text for each column separated by comma
      IF write_header EQ abap_true.
        LOOP AT lt_comp_detail INTO ls_comp_detail.
          lv_counter = lv_counter + 1.
          IF lv_counter EQ 1.
            lv_filerow = ls_comp_detail-descr.
          ELSE.
            CONCATENATE lv_filerow ',' ls_comp_detail-descr INTO lv_filerow.
          ENDIF.
        ENDLOOP.
        TRANSFER lv_filerow TO iv_filename.
        CLEAR: lv_filerow, lv_counter.
      ENDIF.

* Writing internal table content separated by comma
      LOOP AT it_data ASSIGNING <row>.
        LOOP AT lt_components INTO wa_components.
          lv_counter = lv_counter + 1.
          ASSIGN COMPONENT wa_components-name OF STRUCTURE <row> TO <field_value>.
          IF <field_value> IS ASSIGNED.
            lv_str = <field_value>.
            IF lv_counter EQ 1.
              lv_filerow = lv_str.
            ELSE.
              CONCATENATE lv_filerow ',' lv_str INTO lv_filerow.
            ENDIF.
            UNASSIGN <field_value>.
          ENDIF.
        ENDLOOP.
        TRANSFER lv_filerow TO iv_filename.
        CLEAR: lv_filerow, lv_counter.
      ENDLOOP.
      CLOSE DATASET iv_filename.
      ev_message = 'Success'.
    ELSE.
      ev_message = 'Failure'.
    ENDIF.
  ENDMETHOD.
ENDCLASS.

Here the classes CL_ABAP_*DESCR are provided by the ABAP RTTS and used to get the type definition of data objects at runtime. Also we have extracted the data element name of each component of line type structure of internal table it_data using RTTS classes. Then we fetched the data element label using the FM WCGW_DATA_ELEMENT_TEXT_GET. This label is used to write the header for each column of internal table it_data if WRITE_HEADER parameter of class is provided with ABAP_TRUE.

Using the Class – The above designed class can be used as:

DATA: lt_data  TYPE STANDARD TABLE OF mara.
  DATA: lv_filename TYPE string.
  DATA: lv_message  TYPE string.

  SELECT * FROM mara INTO TABLE lt_data UP TO 5 ROWS.

  cl_appserver_writer=>write(
    EXPORTING
      iv_filename  = 'D:\usr\sap\testdata.csv'
      it_data      = lt_data
      write_header = abap_true
    IMPORTING
      ev_message   = lv_message
  ).

  WRITE: / lv_message.

Here we are passing one internal table of structure MARA to the class, and subsequently its content will be written on application server as comma separated values. However, we can pass internal table of any structure. This file can also be downloaded from application server to an excel spreadsheet.

So this is how field symbol, data reference, generic data type, RTTS helps in dynamic programming approach.

The complete code:


App Server Writer.txt

REPORT zwrite_appserver.

CLASS cl_appserver_writer DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: write IMPORTING
                           iv_filename  TYPE string
                           it_data      TYPE ANY TABLE
                           write_header TYPE abap_bool DEFAULT space
                         EXPORTING
                           ev_message   TYPE string.
ENDCLASS.

CLASS cl_appserver_writer IMPLEMENTATION.
  METHOD write.
    TYPES: BEGIN OF ty_comp_detail,
             name  TYPE abap_compname,
             descr TYPE scrtext_m,
           END OF ty_comp_detail.
    DATA: lo_type_def    TYPE REF TO cl_abap_typedescr.
    DATA: lo_struct_def  TYPE REF TO cl_abap_structdescr.
    DATA: lo_table_def   TYPE REF TO cl_abap_tabledescr.
    DATA: lo_data_def    TYPE REF TO cl_abap_datadescr.
    DATA: lo_element_def TYPE REF TO cl_abap_elemdescr.
    DATA: lt_components  TYPE abap_compdescr_tab.
    DATA: wa_components  LIKE LINE OF lt_components.
    DATA: lv_str         TYPE string.
    DATA: lv_filerow     TYPE string.
    DATA: lv_counter     TYPE i VALUE 0.
    DATA: lw_field_info  TYPE dfies.
    DATA: ls_comp_detail TYPE ty_comp_detail.
    DATA: lt_comp_detail TYPE TABLE OF ty_comp_detail.

    FIELD-SYMBOLS: <row> TYPE any.
    FIELD-SYMBOLS: <field_value> TYPE any.

* Using RTTS to get the runtime type information of the internal table
    lo_type_def  = cl_abap_tabledescr=>describe_by_data( it_data ).
    lo_table_def ?= lo_type_def.
    lo_data_def = lo_table_def->get_table_line_type( ).
    lo_struct_def ?= lo_data_def.
    lt_components = lo_struct_def->components.

    CLEAR: lo_data_def.

* If the WRITE_HEADER is ABAP_TRUE then fetch the label
* of data element associated to each component of the
* line type structure of internal table, if no data element
* is associated then use component name as the header text
    IF write_header EQ abap_true.
      LOOP AT lt_components INTO wa_components.
        lo_data_def = lo_struct_def->get_component_type( wa_components-name ).
        lo_element_def ?= lo_data_def.
        lw_field_info = lo_element_def->get_ddic_field( ).
        ls_comp_detail-name = lw_field_info-rollname.

* Calling FM to get data element text
        CALL FUNCTION 'WCGW_DATA_ELEMENT_TEXT_GET'
          EXPORTING
            i_data_element = lw_field_info-rollname
            i_language     = sy-langu
          IMPORTING
            e_scrtext_m    = ls_comp_detail-descr
          EXCEPTIONS
            error          = 1.
        IF ls_comp_detail-descr IS INITIAL.
          ls_comp_detail-descr = wa_components-name.
        ENDIF.
        APPEND ls_comp_detail TO lt_comp_detail.
        CLEAR: ls_comp_detail.
      ENDLOOP.
    ENDIF.


    OPEN DATASET iv_filename FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    IF sy-subrc EQ 0.
* Writing header text for each column separated by comma
      IF write_header EQ abap_true.
        LOOP AT lt_comp_detail INTO ls_comp_detail.
          lv_counter = lv_counter + 1.
          IF lv_counter EQ 1.
            lv_filerow = ls_comp_detail-descr.
          ELSE.
            CONCATENATE lv_filerow ',' ls_comp_detail-descr INTO lv_filerow.
          ENDIF.
        ENDLOOP.
        TRANSFER lv_filerow TO iv_filename.
        CLEAR: lv_filerow, lv_counter.
      ENDIF.

* Writing internal table content separated by comma
      LOOP AT it_data ASSIGNING <row>.
        LOOP AT lt_components INTO wa_components.
          lv_counter = lv_counter + 1.
          ASSIGN COMPONENT wa_components-name OF STRUCTURE <row> TO <field_value>.
          IF <field_value> IS ASSIGNED.
            lv_str = <field_value>.
            IF lv_counter EQ 1.
              lv_filerow = lv_str.
            ELSE.
              CONCATENATE lv_filerow ',' lv_str INTO lv_filerow.
            ENDIF.
            UNASSIGN <field_value>.
          ENDIF.
        ENDLOOP.
        TRANSFER lv_filerow TO iv_filename.
        CLEAR: lv_filerow, lv_counter.
      ENDLOOP.
      CLOSE DATASET iv_filename.
      ev_message = 'Success'.
    ELSE.
      ev_message = 'Failure'.
    ENDIF.
  ENDMETHOD.
ENDCLASS.


START-OF-SELECTION.
  DATA: lt_data  TYPE STANDARD TABLE OF mara.
  DATA: lv_filename TYPE string.
  DATA: lv_message  TYPE string.

  SELECT * FROM mara INTO TABLE lt_data UP TO 5 ROWS.

  cl_appserver_writer=>write(
    EXPORTING
      iv_filename  = 'D:\usr\sap\testdata.csv'
      it_data      = lt_data
      write_header = abap_true
    IMPORTING
      ev_message   = lv_message
  ).

  WRITE: / lv_message.