Saturday, September 24, 2022

DELETE_FACTS t-code to delete from BW InfoProvider

Normally in case a deletion of data is to be performed it is possibel to be done via RSA1 t-code or in case of BW/4 in its web environment (SAP BW∕4HANA Cockpit). If this task is supposed to be automated, it is possible to leverage deletion process in process chains. However, there is also a dedicated t-code for deleting of data from the fact table of BW’s InfoProviders. It is called DELETE_FACTS t-code. It is associated with ABAP program RSDRD_DELETE_FACTS. The program/t-code is also available in BW/4 based BW systems.

On its input screen, there is one mandatory parameter – Data Target that the BW InfoProvider on top the deletion is performed. Following that input field there are three radio buttons. Each of them controls mode of the program.

In case it is set to “Direct Deletion” the program asks for deletion criteria and deletion itself is performed as a next. The deletion criteria is just a filter that is setup by a user and is used for deletion. Only data that are returned by the filter criteria are deleted.

Next radio button is called “Generate Selection Program”. It generates either GP program for the InfoProv deletion. The generated program contains selection screen that serves as deletion criteria. User can input the filter in here. Once the deletion criteria are provided the deletion can be performed.

Finally, there is third radio button called “Generate Deletion Program”. The report is generated on the fly and the deletion criteria are static only available when the GP is generated. Thus no usage of ABAP program variants in this case.

Instead the GP program a real program name can be given in another option field of the selection screen – called “Name of report”.

The deletion itself is performed in a very interesting way. BW system copies the data are not supposed to be deleted (selection criteria reversed) to temporary DB table. The temp table is a copy of real InoProvider DB table. Next is that the system deletes the original (infoprov) table completely. Not just the data in the table but whole table is dropped. Finally, as a last step the system renames the temp table to original table. Reason why it is doing like that is a performance. You can read more details about this approach in a SAP Note listed below.

More information:

2918552 - [BW Central KBA] Selective Deletion

Friday, September 23, 2022

Switching output from plain list to ALV and vice versa

Many SAP’s NetWeaver based systems t-codes or programs are giving its output in form of a list. The list can be either in form of paint text formatted into columns and row or ALV list. An ALV is abbreviation of aAp List Viewer and it is popular from of outputting a results. Among many ALV advantages is easy column manipulation, data filtering, sub/total calculation, drilldowns etc.

However it may happen that the report that you are used to use is not coming as an ALV layout. Instead, the plain list is showed. Most likely this is caused that a user parameter called SALV_SWITCH_TO_LIST (Switch Grid -> List) is set to value X via t-code SU3 (Maintain User Profile).

In case of t-code SM66 if the param is set the output look like:

In other case if the param is not set the result of the same t-clod looks like: 


More information:



Thursday, September 22, 2022

Setup of t-code RSMNG

T-code RSMNG is useful replacement of former administration part of RSA1. It comes handy also in case you do not prefer web environment (SAP BW∕4HANA Cockpit) based administration of BW/4 bases systems. However, after some time of using it I realized it has its drawbacks. Most annoying thing for me is its performance. This comes to picture in cases when I do administration of an aDSO object that has large (tens of thousands) number of data load requests.

In such case, it takes time (several minutes) to get into the administration screen. The RSMNG t-code has following two filter options that have an influence on how many request are displayed on the admin screen.

Filter by Time – options like Today, Yesterday and Today, In the Past Week, This Month and Last Month, This Year and Last Year, Free Data and No Time Restriction are available here to choose from. This screen is more less the same as on Process Chain’s log selection screen.

Filter by Status – OK, Error, Running and Deleted are data load request status to choose from.

In case you used filter by time and set it to No Time Restriction position of a radio button on object that has very few data load request - all is fine. However if you meanwhile jump into another aDSO that has a lot of the data load requests you will be waiting till all of them are read and the screen is finally displayed. Therefore, this is the bummer.

There is a database table that stores the setup of the RSMNG t-code. The table name is RSDSO_MNG_DYNSET (ADSO manage: dynamic user settings). The table is managed by Function Module RSDSO_MNG_SET_PARAM. The FM itself is called from RSMNG framework build in ABAP class CL_RSAWBN_AWB. I find myself in a position to change the table entries in case I realize my settings are set e.g. to No Time Restriction and I run to the very large aDSO.

The settings of the table are stored per a user. Means each user (column UNAME) running the RSMNG t-code has its own settings. This is actually causing this issue that if I set time filter to No Time Restriction value it is valid for all the aDSOs I used in the t-code. To avoid situations like this it would be better if table could store the RSMNG settings on particular aDSO (or IO objects as that can be managed here too) level. However, at this time BW/4 2.0 SP06 it is not supported.

There are different tables that stores the RSMNG setup data per infoprovider:

RSDSO_MNG_DYNSET – for aDSOs

RSDMD_MNG_DYNSET – for InfoObjects

RSBOH_MNG_DYNSET – for Open Hubs


In a below pictures you can see how is the table columns mapping done against the particular filter settings of the RSMNG.




Friday, September 16, 2022

Listcube does not show any data

While using a t-code LISTCUBE sometime following odd situation can occur. The t-code does not show any data at all despite the data is present in a BW objects that the LISTCUBE runs on top of. That can be very strange and confusing situation. Instead of any data only below message is present:

No messages exist Message no. R7896



Explanation is very simple. As an ALV technology is used to present the data there needs to be a list of columns that are supposed to be displayed in an output screen passed to the function module (e.g. REUSE_ALV_GRID_DISPLAY) call - that does the display operation itself. This list of columns is called a field catalog (e.g. param IT_FIELDCAT in the FM call). The Field catalog contains all the fields to be displayed with their descriptions. Similarly, there is another structure that needs to be passed to the FM during its call - IS_LAYOUT. That one has the list layout specifications. If some of these information (field catalog or the layout) is missing the ALV does not know what columns (fields) are supposed to be displayed. Thus, no information is displayed after all.

What caused it? As the ALV supports saving the output layout (field catalog) for later use it could happen that, someone stored his/her layout while worked with BW info provider ABC and market it as global and default while working in the LISTCUBE. Once another user use the LISTCUBE against info provider XYZ that has a different structure (different IOs) the global default layout was sent to ALV. As none of the fields that were retrieved from info provider XYZ are matching the field catalog prepared based on the info provider ABC nothing can be displayed. 


How can this be fixed? While in the LISTCUBE output screen there in its menu the layout management screen is available. It can be found in menu Settings -> Layout -> Layout Management:


Here just default layout needs to be deleted: 



More information:

Usage of t-code LISTCUBE

DTP reads different data than LISTCUBE


Tuesday, September 13, 2022

SAPSprint - print service

SAPSprint or so called a print service is a program for printing. It replaces older program SAPlpd as in print server on WINDOWS operating system. It is a part of SAP GUI for Windows installation. Usually it is available in folder "x:\Program Files\SAP\SAPSPrint\sapsprint.exe" - SAPSprint itself and "c:\Program Files\SAP\SAPSPrint\SAPSprintOptEdit.exe" – Print Option Editor.

What it does is to a transfer data for remote print output using WINDOWS operating system as host spool system so called spooler. SAP application server (with a spool work process) acts as a spool system. As the spooler and the spool system are running on different computers there is a need to have an external application (SAPSprint) to transfers the output requests from the SAP spool server to the Microsoft Windows spooler.

The SAPSprint can be a subject to security vulnerabilities. This it is advisable to monitor SAP Notes related to this software on component on regular basis and apply fixes if they are available.

 

More information:

Online docu

Support site component: BC-CCM-PRN (Print and Output Management)

1704243 - Frontend Print Options Editor

Monday, September 5, 2022

Remodeling tools RSMONITOR and RSMRT

RSMONITOR (ABAP prg RSCNV_MONITOR) - Generic Monitor

RSMRT (ABAP prg RSCNV_DESIGN) - Metadata Remodeling Toolbox

These two t-codes mentioned above are part of a BW remodeling framework. The remodeling is an operation during which an object (InfoObject) in BW InfoProvider (that contains data) structure are being changed. Imagine in BW Modeling Tools of SAP HANA Studio a change can be either some InfoObject is added or removed from the InfoProvider. After the change like this is performed the BW system checks whether the provider can be activated immediately or it has to be remodeled first. If the provider can’t be activated (most likely as there is a data in there) the remodeling request is created. There can be a several operations of adding/removing IOs upon the InfoProvider added into the request. By the InfoProvider here what is meant is aDSO object as that is main data storage object in BW/4HANA based BW systems.

Then the remodeling request can be triggered in t-code RSMONITOR. There is a possibility to restart, reset, monitor the request, to review its log etc.



If case the aDSO object is already moved in other subsequent systems (e.g. test, production) to the development system then a transport of the remodeled aDSO is needed. BW checks whether remodeling is needed in those systems and the required remodeling request is created in the target system. Needless to say that since BW/4HANA whole remodeling stuff is to be done in BW/4HANA Cockpit.

Similarly, to aDSO objects there are old good InfoObjects present in BW/4HANA systems. Sometimes there is a need to remodel those too. E.g. to add/remove its attributes, changing data types etc. However, the remodeling tool here is different. The IOs are remodeled in t-code RSMRT.



The two t-codes I briefly mentioned in this blog post are starting to appear in BW since version BW 7.4 and above.

More information:

Remodeling a Data Store Object

Remodeling InfoObjects and Fields

Friday, August 19, 2022

SAP Data Warehouse Cloud (DWC), SAP BW Bridge (BWB)

A next generation of data warehousing solution of SAP so called SAP Data Warehouse Cloud (DWC) is around for a sometime. Yes, the cloud is most important thing in its name. As transactional systems are being moved to the cloud, the analytics/data warehousing do so. Problem here is again (similar to ECC -> S/4 Cloud move) how to migrate SAP data warehouse solution to the cloud with a less pain. SAP comes to address this via SAP Data Warehouse Cloud, SAP BW Bridge (aka DWC Bridge). Solution was announced during TechEd 2021.

What it does in nutshell is that it enables functions of SAP BW but in the (public) cloud.

By the BW functions is meant, a classic BW functionalities as we know them from either classic BW on any DB, or BW4/HANA one. The functions or functionalities basically cover what SAP BW Data Manager is doing, e.g. data loads, data transformations, SQL interface, database utilities, etc. The Bridge enables data modes of classic on premise BW system to be imported into DWC. On premise SAP BW’s InfoProviders objects like (a)DSO, Composite Providers can be imported into the Bridge’s space in DWC. These spaces can be shared with other spaces. A new data models can be built on top of these objects while combining them with other data sources or e.g. master data views.

Technically the SAP DWC Bridge is based on an ABAP Platform. It is a full-blown SAP BW4/HANA system just its analytics functions are not present. This is why the reporting part stays with DWC itself. Therefore, the Bridge has two key components: data modeling and data acquisition.

Data modeling part is managed in two separate modeling environments:

1. SAP BW bridge objects are developed by Eclipse based BW Modeling Tools for SAP BW Bridge objects. The modeling tools are to be installed in SAP HANA Studio.

2. Data Builder (in DWC) – consists of a tools to support data acquiring and replicating from a different sources and as well to combine and prepare these objects for consumption. The Bridge objects are present in DWC as remote tables.

Second - the data acquisition part takes place in so called SAP BW Bridge Cockpit. The cockpit serves as a central point of administration of processes. Data loading processes are managed here, managing aDSOs, InfoObjects, etc. Similar to what BW/4HANA Cockpit does.

To simply put it; the Bridge is the migration tool. The DWC works differently comparing to traditional BW. Difference is that while the classic BW gathers all data and models into a single place, DWC does not only store data. The DWC acts as a consistent layer that virtualizes data and models stored at many organization’s systems thus it supports accessing and managing data for analytics. Man in middle between the DWC and classic BWs is the Bridge that facilitates the move to the cloud.

A minimum version of BW that you can “bridge” with the DWC with the BWB is SAP BW 7.30.


More information:

Online docu

Online docu BWB in DWC

Info page

3117800 - Information/Restrictions Note for SAP Data Warehouse Cloud, SAP BW Bridge

3141688 - Conversion from SAP BW or SAP BW/4HANA to SAP Data Warehouse Cloud, SAP BW Bridge

Interdobs blog

SAP Support site software component: DWC-BWB

Thursday, August 4, 2022

Job BI_WRITE_PROT_TO_APPLLOG not running?

There is an important job in all BW systems that must always run. It is called a BI_WRITE_PROT_TO_APPLLOG or known as Background Job Log Writer. It serves to write temporarily saved logs (batch and enqueue runtime data) of lock manager for any batch processes that are running in BW system.

The job runs an ABAP program RSBATCH_WRITE_PROT_TO_APPLLOG. Logs are written into table RSBATCHDATA by the job. Periodicity of the job should be at least 1 hours if not more frequent. In case of most of the BW systems I worked with the periodicity is 10 minutes. If the BW system is being scheduled for a downtime, the job can be descheduled.

The job is very important to let the BW system functioning properly. BW developers may come across a below pop-up message RSM2 no 081, any time when t-code RSA1 is started:

Report RSBATCH_WRITE_PROT_TO_APPLLOG not planned. See long text.

This is valid for all BW 7.x systems including BW/4 systems. Whoever enters the RSA1 in case the jobs is not scheduled then the system schedules it by that user who entered the RSA1. That's why you can see your user that runs this job in t-codes like SM37.


The message informs that the job does not run means it is not scheduled. The ABAP program RSSM_PLAN_PROTWRITE_TO_APPLLOG can be used to set it up. The program runs FM of the same name (RSSM_PLAN_PROTWRITE_TO_APPLLOG) to do that. The BW system uses other FM RSBATCH_CHECK_START_LOGWRITER to check if the job is scheduled and that one can schedule it too.

In case the job is scheduled multiple times the BW system detects that too. This situation happens when a message RSM2 no 082 is displayed:

Report RSBATCH_WRITE_PROT_TO_APPLLOG planned &1 times. See long text.


More information:

wiki

1135045 - P18:Job BI_WRITE_PROT_TO_APPLLOG is scheduled several times

2495693 - POP-UP Information: Report RSBATCH_WRITE_PROT_TO_APPLLOG x is scheduled


Friday, July 29, 2022

Replacing LOOP statement with ABAP Filter Operator

I tried to compare how ABAP filter operator compete with LOOP statement.

 

1. Classic LOOP statement

On top of itab t_data that is being looped over into a structure a new itab t_data1 is generated from the structure. A condition for the LOOP specified as hardcoded into WHERE part of the LOOP statement.

LOOP AT t_data INTO s_data WHERE ( col_1 = 'AAA' ).

  INSERT s_data INTO TABLE t_data1.

ENDLOOP.

 

2. Filter Operator

A Filter Operator is used to build the itab t_data2 based on th_data itab. Condition is specified as hardcoded one in the filter.

DATA(t_data2) = FILTER #( th_data WHERE col_1 = 'AAA' ).

 

Next, let assume that we have a multiple conditions for the LOOP so they are stored in a special itabs.

3. Classic LOOP statement with WHERE condition as a range

In a case of the class LOOP statement I leveraged range type of itab. The range (t_filter itab) is prepared prior the LOOP. Afterwards the range in used in the WHERE part of the LOOP by IN statement.

t_filter = VALUE #( BASE t_filter ( opt = 'EQ' sign = 'I' low = 'AAA' ) ).
 
LOOP AT th_data INTO s_data WHERE col_1 IN t_filter.
  INSERT s_data INTO TABLE t_data3.
ENDLOOP.

 

4. FILTER Operator with filter as itab

A hash itab (th_filter) is prepared with the condition prior the FILTER operator statement. A new itab (t_data4) is prepared by Filter operator. The Filter operator uses IN statement to specified the itab with the filter.

th_filter = VALUE #( BASE th_filter ( col_1 = 'AAA' ) ).
 
DATA(t_data4) = FILTER #( th_data IN th_filter WHERE col_1 = col_1 ).

 

Conclusion

In my system based on component SAP_ABA 75, SP04 I achieved the fastest the run no 2. Means Filter operator where the condition was hardcoded.



Few more remarks:

To count the no of the itab entries I used REDUCE (Reduction Operator – part of Iteration expression). The statement basically goes over all the entries of the itab and adding 1 into n variable as specified in NEXT statement.

v_count = REDUCE i( INIT n = 0 FOR x_data IN t_data4 NEXT n = n + 1 ).

 

Yes, I’m aware that I could do this by lines (a row function) as seen below. However, I wanted to try more the reduce operator instead.

DATA(v_cnt) = lines( t_data1 )

 

To calculate total of figure that is stored in column col_f in all the itabs I used again Reduction Operator. Just in this case the value of the column col_f is being added up into n variable.

v_count = REDUCE i( INIT n = 0 FOR x_data IN t_data4 NEXT n = n + x_data-col_f ).

Source code available in my Gitgub gist zmm_loop_replacement

Monday, July 25, 2022

How to determine query tech name for BEx variable processing (in user exit/BADI)

While implementing a logic in user exit based BEx/BW variables a requirement of query technical name determination may appear. Thus, I tried to research on this topic a little bit. Fortunately, there is a structure called I_S_RKB1D, which has a description Query Reporting Attribute. The structure has a lot of useful information. Among others (see below) there is an also COMPID information that has the query technical name. The structure is available since a call of standard FM RRS_REPORT_INIT_START.

The structure is still available in memory at the point where the custom logic serving for purposes of specific variable is called.


Columns available in the structure:

COMPUID UUID in compressed form

INFOCUBE InfoCube

GENUNIID Internal display of the report identifier

COMPTYPE Type of a reporting component

COMPID Name (ID) of a reporting component

RFCSUPPORT Report supports access using OLAP API

OBJSTAT Object Status

SMODE Special reports

READMODE Read Mode

NOAGGRFL Flag: Do not use aggregates for this query

IDVERS Dictionary version (internal vers.) of report in RSIX

DVERS Dictionary version (current Release) of report in RSIX

RNAME ABAP Program Name

AUTHOR Name of author

GENTIME Query Generation Time (Cache Invalidation)

LASTUSER Last Changed By

MODTIME Last Change to Definition

REPTIME Last Change of Query Runtime Object

GEN1TIME Query Gen Time (no cache invalidation needed)

PACKFL Process Key Figure with High Precision

PACKFL_DEF Boolean

NOSPBUF SP Cannot be Permanently Buffered

CACHEMODE Query Cache Mode

CACHEUSAGEMODE Cache Usage Mode

KIDSEL Use Selection of Structure Elements

FAGGR_LATE Calculation of Commutative Formulas After Aggregation

OPT_OCCURS Boolean

OPT_OCCURS_TIME UTC Time Stamp in Short Form (YYYYMMDDhhmmss)

OPT_OCCURS_MODE Optimization Mode

OPT_OCCURS_PER Optimization Periods

SUPPRMESS Suppress Messages

CACHEUSEREXIT Indicator: Cache Use Despite Virtual Characteristics/KF

NOPARALLEL No Parallel Processing

GENPROT Generation Protocol

INPUTABLE Make All Basic Indicators Ready for Input

PARTITIONMODE Type of SP Grouping for Delta Caching

DELTACACHE Update Cache Objects in Delta Process

ACTUALDATA Data Integrity

OLAPSTAT OLAP Statistic Properties of the Query

OLAPSTATDETLEV OLAP Statistics Detail Level

ADDNLS Should the Cold Store storage be read too?

NOHPA Obsolete Field (Do Not Use BWA Index)

READMODE_DEFT Boolean

ACTUALDATA_DEF Boolean

CACHEMODE_DEF Boolean

DELTACACHE_DEF Boolean

PARTITION_DEF Boolean

DIS_MODE Disaggregation on Totals

INFOPROV_SUPPORT Query is used as InfoProvider

NOPARALLEL_DEF Boolean

KIDSEL_DEF Boolean

ADDNLS_DEF Boolean

NOHPA_DEF Boolean

CHUSEREXIT_DEF Boolean

TREXOPS Operations in SAP HANA

TREXOPS_DEF Boolean

MATERIALIZEQUERYLAYER Materialize Intermediate Query Result

MATERIALIZEQUERYLAYER_DEF Boolean

IS_PLANQUERY Boolean

DATA_INTEGRITY_SCENARIO Data Integrity Profile

DI_SCENARIO_DEF Boolean

READ_CHILD_KIDS Also Read the Child Members with Hierarchy Structure Node

READ_CHILD_KIDS_DEF Boolean

OLAPEFFORT OLAP Effort for Query

QMODI Q Mode Implementation (relational browse)

DOCUMENT_SUPPORT Document Support

DEFAULT_DOC_APPL_ID Default Document Application ID

PROPVERS Version of Properties concerning Support Package

MOSTRECENT Read according to newest, possibly not active structure

VARIANT ABAP: Name of variant (without program name)

PMODE Mode in which a query is executed (online, batch)

TMSTMP_ROLLUP UTC Time Stamp in Short Form (YYYYMMDDhhmmss)

TMSTMP_ROLLUP UTC Time Stamp in Short Form (YYYYMMDDhhmmss)

TMSTMP_START TS for Start of RRI_REPORT_IMPORT_AND_CHECK

ODBO Using ODBO to Execute Query

EXPLAIN_QUERY This Is A Explain Query

NO_RTPERSISTENCE Does the query have a runtime persistency

USE_NLS Boolean

ONLY_SIMPLE_CU Boolean

MANDT_DEP Object is client-specific

Tuesday, July 19, 2022

BW transport error: CL_RSTRAN_STEP_ROUT

 Recently my BW transport has crashed while being imported to target system. Error message in the transport log looked like below:


An exception of type CX_SY_OPEN_SQL_DB was raised and terminated the program, Message no. PU108

Program CL_RSTRAN_STEP_ROUT===========CP, include CL_RSTRAN_STEP_ROUT===========CM003, line 24

Errors occurred during post-handling RS_AFTER_IMPORT for * L, Message no. PU133

RS_AFTER_IMPORT belongs to package RSO_TLOGO

The errors affect the following components: Message no. PU136

   BW4-ME (Metadata (Design time)), Message no. PU137



My transport contained few
BW transformations but from the error log, it wasn’t obvious which TRFN the error is related to. From a keyword “CL_RSTRAN_STEP_ROUT” that popped up in the error log, I concluded that it had something to do with a routine in the TRFN. That just did not help as most of my TRFN in the transport had routines. I tried to google the keyword as well. I just ran into an old question on SAP Community network forum. It happened that I replied on that question back in 2011 – more than eleven years ago – “huh” :) In my reply to that forum question, I suggested to “try to delete whole field routine, activate transformation and create routine again”. Therefore, I did this – right, there was nothing to lose. Just this time I focused only on TRFN which had field routines not a start/end/expert ones. I just recreated a field routines by simply deleting and recreating them.

Moreover, it worked like a charm, on next import to target system I just got a warnings not an errors.

Monday, July 18, 2022

How often a Process Chains are being killed in your BW?

In BW systems if a particular process in a Process Chain (PC) runs into a problem in most cases a whole chain is stopped. Such process chain gets a red status that means that it did not finished properly. A corrective action is needed to be done by BW administrator. An issue that caused the process to be terminated must be removed and process can be restarted afterwards.

However sometime a situation can be different. The chain's run need to be stopped for some reason. There are few options of how to abort currently running process chain.

One can go to respective basis job of the current process that is executed by the PC. Once the job is found from SAP Basis t-code like SM37 the job can be canceled. This can be achieved by displaying a pop-up window of the PC's process within PC related t-codes like RSPC1, etc. There under Bckg tab it is possible to jump to the SM37 via Batch Monitor button.

Once you arrive, there just use Stop icon (Stop active job) available on a toolbar. Afterwards the job status turn to a red, (Canceled) you can return back to level of the chain and particular process will be set to Aborted. This is indicated in table RSPCPROCESSLOG - column STATE = X = Aborted or R = Error.

Other option can be found directly with a monitor part of PC related t-codes like RSPC1. There is a button called "Stop current run as soon as possible" on the toolbar. 


If during the PC run a button "Stop current run as soon as possible" is pressed a flag TO_BE_KILLED is set in table RSPCKILL. The PC is terminated at the step during which execution a button was pressed. The respective step has followign monitor entry in its pop window:

The table RSPCKILL stores such a “killed” runs of the PC. It has a very simple layout there are only following columns in the table:

 

LOG_ID - Log-ID of a Process Chain Run

TSTPNM - Last Changed By

TSTPDAT - Changed On

TSTPTIM - Changed at

TO_BE_KILLED – Boolean, X if the PC was killed like described above

 

Based on number of the entries in this table one can get a rough idea how many time a process chain was stopped/killed during its run in the BW system. Technically the entry in the table is created by a call of a method REMOVE_FROM_BATCH of ABAL class CL_RSPC_FRONTEND. Respective entry in table RSPCPROCESSLOG - column STATE = F = Done.