Showing posts with label user exist. Show all posts
Showing posts with label user exist. Show all posts

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, January 28, 2014

Switch Framework for BW

You may hear about term Switch Framework. It simplifies ABAP based NetWeaver systems by enabling of switching on/off features of the system. Switching on/off approach means objects change their visibility in repository. The purpose is to adapt/activate the industry settings or solution in particular system. The intention is to provide more functionality by enhancing standard functionality with aim to minimize custom development. The Switch Framework controls which enhancement implementations are to be performed. This is controlling:

- Switch on industry solutions and Enterprise Add-Ons delivered by SAP
- Enhance delivered partner and customer systems delivered by partners

See details here on components and architecture of Switch Framework here:

By which transaction I manage Switch Framework?

SFW1                      Create switches
SFW2                      Create business functions
SFW3                      Create business functions sets
SFW5                      Switch on business functions
SFW2 and SFW5       Maintaining information about business functions
SFW_BROWSER        Display and check the status of business functions

When it comes to BW there are also objects which can be managed by Switch Framework. In this case it is about query components. In particular about Business Content (BCT) delivered queries. The framework is called "Switchable Query Components in the Switch Framework".

All query components that are not reusable (e.g. characteristics, attributes, structure elements, conditions, exceptions and cells) are switchable in the Switch Framework. In case query is missing some functionality you can do the switch in TA RSOSCSW.

For more details refer to documentation. 

- Update on 04/08/2017 –

The BW Switch Framework is being further enhanced in recent versions of BW. As per SAP Note 2094114 with the Switch Framework it is possible to influence the BW system behavior either system-wide or user specific. 

Monday, November 11, 2013

How to read other’s program data

When it comes to enhancing SAP functionality we usually talks about user exists, BAdIs and enhancement points. Their main purpose is to extent SAP standard functionality. As particular customer needs may differ from what is offered by standard enhancements are needed to fulfill that particular need. Therefore SAP ABAP programmers are very well known of them.

What does it take to implement the enhancement? Basically you need to find a point in standard code where you plug-in your part of enhancement code. It is not an easy to do so and it takes a lot of
debugging. What is even tricky you may get into the situation where you exactly know where to put the code but you do not have all the input information in order to produce desired output information. This is often case as input parameters of standard function modules or forms may be very limited. So some information that is needed may not be at the right place. But case can be that data is there sitting in memory just it is not part of interface of that standard functionality. Therefore you need to explore what are global data of that program module which were loaded in memory. This can be done using ABAP field symbols. Field symbol enables you to access the place in memory. It is placeholder or symbolic name for other field. It doesn't physically store the data for the field, it just points to its contents. It can point to any data object. Prerequisite is that the field symbol needs to be declared first before is assigned to the data object.

Field symbol has following declaration syntax:
FIELD-SYMBOLS <fs> [typing].

Here’s syntax for assigning Field symbol to the data object:
ASSIGN dobj TO <fs>.

Once we do not need Field symbol we can cancel assignment by following statement:
UNASSIGN <fs>.

Now let’s go back to original topic of how we can read global data from other programs. In order to read it you need to know what the ABAP program is where data object is used. Also it is necessary to make sure that a data object in that ABAP program has a value. Once we know that we prepare variable in format:

(PRG)DOBJ

Where PRG is the name of an ABAP program and DOBJ is the name of a global data object of this program. Let see in following short ABAP fragment of code:

DATA: lv_data(30) TYPE c.
FIELD-SYMBOLS  <> TYPE ANY.

lv_data 
= '(RSAWBN_START)L_AWB_VIEW_MODE'.
ASSIGN (lv_data) TO <>.

IF <fs> EQ 'M'.
  "RSA1 was started 
ELSEIF <fs> EQ 'A'.
  "RSMON was started 
ELSEIF <fs> EQ ''.  
  "RSAWB was started 
ENDIF.  

Now if the program PROG (in this case = RSAWBN_START) is loaded during execution of the statement ASSIGN in the same internal mode as the current program, the data object (RSAWBN_START)L_AWB_VIEW_MODE is searched for in this program, and the field symbol points to this data object after the object has been successfully assigned.

This example would help us in imaginary extension of TA RSA1 of BW system. With help of this code we could possible enhanced RSA1 depending in which mode it was started. By this we would recognize in which mode RSA1 was started and we would put code into all 3 IF/ELSEIF statement.

Used sources:

Tuesday, October 2, 2012

Something about BEx’s variables

Someone may say that everything was already said about BEx’s variables. In my opinion; truth is that there is always something new on this topic. Recently I came across useful SAP Notes discussing this topic. And guess what? I learned a lot from those notes. Therefore I’m sharing it here.

121291 - Tips and tricks for the use of variables; Discuss hints related to “shifted variables (offset based)”. Useful for year to year data, comparison of cumulative values (e.g. CO-PA data). Efficient Business Content variables: 0CYEAR - refers automatically to the current year; 0CYTCM - Current year to current month;

199014 - Tips & tricks with variables II; Describes behavior of following Business Content variables: 0FYTCFP - Current year to current fiscal month; 0FYTLFP - Current year to previous fiscal month

339476 - Tips & tricks for variables part III; Depicts a function to override input of variables (given on variable screen). This can be achieved by activating setting 'Can be changed in query navigation' in variable maintenance for characteristic variables.

381709 - Tips and tricks for variables part iV; Describes cases when variable values cannot be changed even it is dynamically changeable variable based on a compounded characteristic.

629697 - Variable exit: Fields SIGN and OPT; Discuss combinations of SIGN and OPT as components of internal table E_T_RANGE that are allowed for the different variable types.

492504 - Dependent customer exit-type variables; Discuss various values of I_STEP parameter which controls when BW: Enhancements for global variables in reporting (RSR00001) is called:

1 - Call directly before the variable is entered
2 - Call directly after the variable is entered. Only if same variable could not be filled for I_STEP = 1 and it is not ready for input.
3 - To check values of variables.
0 - Enhancement is not called from variable screen. Call can come from the authorization check or from the monitor.

PS: If you want to make sure that your variable is executed in particular I_STEP, put code similar to following:

IF I_STEP = 1.
        RAISE no_processing.
ENDIF.

Other posts on BE’x variable topic:

Monday, August 9, 2010

Where to see code for Business Content SAP exit variable?

SAP exit variable are type of BEx variables processed during BEx Query runtime by replacement path predefined in SAP exit. SAP exit is like customer exit it is just delivered by standard SAP BW Business Content. Comparison to customer exit is right since there is also ABAP code which is in particular performing the replacement of variable value.



This might seems to be tricky for first look: Where to see ABAP code for BEx variables a type of SAP exit? Actually again comparing to user exits variable it is stored in ABAP repository but in include just in function modules:







In our case for variable 0P_SYSID there is the function module called RSVAREXIT_0P_SYSID where all the variable logic is coded:



update - 27-09-2012-
Older business content variables (e.g. 0CWD) are coded in FM RREX_VARIABLE_EXIT. 

Monday, September 7, 2009

Business Add-In (BAdI) used in BI

Following BAdI are present in BW system:
BAdI: Customer-defined Functions in Formula Builde
BAdI: Documents
BAdI: InfoSpoke with Transformation
BAdI: Maintenance of Text Documents in the Web
BAdI: Virtual Characteristics and Key Figures in Reporting
BAdI: Web Item "Individual Document"
BAdI: Web Item "List of Documents"
BAdIs for Document Management
You can access them via customizing TA SPRO:













- update as of 23/03/2013 –
With the newer versions of BW e.g. 7.3 SP08 there are more BADIs available:

BAdI: Virtual Characteristics and Key Figures in Reporting
BAdI: Own Report Type as Recipient (Jump Target)
BAdI: dynamic determination of jump targets at runtime
BAdI: Customer-defined Functions in Formula Builder
BAdI: Virtual Authorizations
BAdI: Enhancement for InfoObjects
BAdIs for Document Management
BAdIs for Document Management
BAdI: Web Item "Individual Document"
BAdI: Web Item "List of Documents"
BAdI: Maintenance of Text Documents in the Web
BAdI: BW Transport
BAdI: Restricting the Value Help in the Variables Screen
BAdI: Partitioning of a semantically partitioned object
 


















- Update as of 24/03/2013 –
BAdi used in ECC source system to enhance extraction for BW’s data sources is following:

RSU5_SAPI_BADI - BW Service APIs with Business Add-Ins

It has following two methods to include business logic for extraction enhancing:

DATA_TRANSFORM   Business Add-Ins Method for General Data Transfer
HIER_TRANSFORM    Business Add-Ins Method for Hierarchy Data Transfer


SCN guides to implement the BAdi:
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10c79642-fdc3-2e10-b0a1-de305db42233?overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/10c79642-fdc3-2e10-b0a1-de305db42233?overridelayout=true