SlideShare ist ein Scribd-Unternehmen logo
1 von 93
Downloaden Sie, um offline zu lesen
Luc Vanrobays
SAP Brasil Ltda
InfoDay São Paulo, Maio 2010
luc.vanrobays@sap.com
ABAP OO for BW
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Agenda
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Agenda
What Are Objects
 SAP AG 1999
What Are Objects?
Tree
House
Crane
 Objects are an abstraction of the real world
 Objects are units made up of data and of the
functions belonging to that data
Real world
Model
Data
Method
Method
Method
Data
Method
Method
Method
Data
Method
Method
Method
Boat
Data
Method
Method
Method
Classes
Classes are the central element of object-orientation.
A Class is an abstract description of an object.
Classes are templates for objects.
The attributes of objects are defined by the components of the class, which describe
the state and behavior of objects.
You define global classes and interfaces in the Class Builder (Transaction SE24) in
the ABAP Workbench.
They are stored centrally in class pools in the class library in the R/3 Repository.
All of the ABAP programs in an R/3 System can access the global classes.
An ABAP OO Class – Transaction SE24
ABAP Objects - Class Components
Visibility Sections:
 Public
 Protected
Private
Attributes
Methods
Types
Events
Interfaces
Friends
Class Visibility Sections
These sections define the external visibility of the class components and therefore the interfaces of the class
for their users. Each component of a class must be explicitly assigned to one of the visibility sections.
Public visibility section
All components declared in the public visibility section defined with PUBLIC SECTION are accessible to all
users as well as in the methods of all heirs and the class itself. The public components are the interface of
the class to each user.
Protected visibility section
All components declared in the protected visibility section defined with
PROTECTED SECTION are accessible in the methods of all heirs and in the class itself. The protected
components form a specific interface between the class and its subclasses.
Private visibility section
All components declared in the private visibility section defined with
PRIVATE SECTION are only accessible in the class itself, and are also not visible to the heirs. The private
components therefore do not form an interface to the users of the class.
Class Visibility Sections
Visibility
Sections
Class Attributes
Attributes
Attributes are internal data objects of any ABAP data type within a class. The content of the attributes
specifies the status of the object. You can also define reference variables, which you can then use to create
and address objects. This allows objects to be accessed within classes.
Attributes are defined in the declaration part of a class. Public attributes are completely visible from outside
the class and as such are part of the interface between objects and their user. To encapsulate the status of
the object, you need to use protected or private attributes. You can also limit the changeability of attributes
using the READ-ONLY addition during the declaration.
Instance Attributes
The content of instance attributes forms the instance-specific status of the object. Instance attributes are
declared using the DATA statement.
Static Attributes
The content of static attributes forms the instance-independent status of the object, which is valid for all
instances of the class. Static attributes are available once for each class. They are declared using the
CLASS-DATA statement and are retained throughout the entire runtime. All the objects within a class can
access its static attributes. Changes to a static attribute in an object are visible to all other objects within that
class.
Class Attributes - Types
The Attribute “Type” definition can be maintained in the
“Types” section of the Class – More on Types follows.
Class Methods
Methods
Methods are internal procedures of a class that determine the behavior of an object.
They can access all the attributes of their class and can thus change the object
status. Methods have a parameter interface, through which the system passes values
to them when they are called, and through which they can return values to the caller.
The private attributes of a class can only be changed using methods, of the class
owning the method.
You can declare local data types and data objects in methods, just as in all
procedures. Methods are called using the CALL METHOD statement or one of its
abbreviated forms. You can also call the method dynamically (dynamic invoke).
Methods
Instance methods:
Instance methods are declared using the METHODS statement. They can access all
the attributes of a class and can trigger all its events.
Require Instantiation of the Class – CREATE OBJECT
Static methods:
Static methods are declared using the CLASS-METHODS statement. They can
access static attributes of a class and are allowed only to trigger static events.
Do not require instantiation
Can be used / Called w/o instantiation or reference to an instance
Do not rely on the state of an instance
Class Methods
Method
Parameters:
Importing
Exporting
Changing
Constructor Methods
Constructors are special methods that produce a defined initial state for objects and classes. The state of an
object is determined by its instance attributes and static attributes. You can assign contents to attributes
using the VALUE addition in the DATA statement. Constructors are necessary when you want to set the initial
state of an object dynamically.
Like normal methods, there are two types of constructor - instance constructors and static constructors.
Instance Constructors
Each class has one instance constructor. It is a predefined instance method of the constructor class. If you
want to use the instance constructor, the constructor method must be declared in the declaration part of the
class using the METHODS statement. Unless it is explicitly declared, the instance constructor is an implicit
method, which inherits and accesses the interface from the instance constructor in the upper class.
Static Constructors
Each class has a single static constructor. This is a predefined, public, static method of the class named
constructor. If you want to use the static constructor, you must declare the static method class_constructor in
the public section of the declaration part of the class using the CLASS-METHODS statement, and implement
it in the implementation part. The static constructor has no interface parameters and cannot trigger
exceptions. Unless you implement it explicitly it is merely an empty method. The static constructor is
executed once in each program. It is called automatically for the class before the class is accessed for the
first time
Constructor Methods
method CONSTRUCTOR.
select * from /BIC/PZCITY into CORRESPONDING FIELDS OF TABLE IT_CITY_SIZ
where objvers = 'A'.
SORT IT_CITY_SIZ by /BIC/ZCITY.
endmethod. method CONSTRUCTOR.
select * from /BIC/PZCITY into CORRESPONDING FIELDS OF TABLE IT_CITY_SIZ
where objvers = 'A'.
SORT IT_CITY_SIZ by /BIC/ZCITY.
endmethod.
Data Types and Constants
Data types
Independent types
The TYPES statement can be used to define any number of your own ABAP data types within a class. Types are not
instance-specific and are only available once for all the objects in the class.
As of release 6.40, it is possible to define data types in the public visibility section.
Bound data types
Bound data types that occur as properties of instance or static attributes also belong to the static attributes of a class.
After a LIKE addition, the class name can be used to access the properties of instance attributes (exceptions to this
rule are the statements ASSIGN ... CASTING and SELECT-OPTIONS ... FOR). In addition, a reference variable can be
used with an object component selector without the object having previously been generated.
Constants
Constants are special static attributes, whose values are specified when they are declared and which cannot be
changed later. Use the CONSTANTS statement to declare constants. Constants are not instance-specific - they only
once for all the objects in the class.
As of release 6.40, it is possible to define constants in the public visibility section of global classes.
Data Types and Constants – Support All ABAP
Types
Events
In ABAP Objects, events are declared as components of classes. SAP makes a
distinction between instance events and static events. Triggers and handlers can be
objects and classes, depending on whether they are instance events, static events, or
event handler methods.
Instance events
Instance events are declared using the EVENTS statement. They can only be
triggered in instance methods.
Static events
Static events are declared using the CLASS-EVENTS statement. All methods
(instance or static) can trigger them, but only static events can be triggered by static
methods.
Interfaces
The components of a class are divided into visibility sections, and this forms the
external point of contact between the class and its users. For example, the
components of the public section form the public interface of the class, since all
attributes and method parameters can be accessed by any user.
The protected components form an interface between the class and those classes
that inherit from it (subclasses).
Interfaces are independent structures that allow you to enhance the class-specific
public points of contact by implementing them in classes. Different classes that
implement the same interface can all be addressed in the same way. Interfaces are
the basis for polymorpism in classes because they allow a single interface method to
behave differently in different classes. Interface reference variables Interface
references allow users to address different classes in the same manner. Interfaces
can also be nested.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
The Motivation
For BW Consultants I see three motivating factors:
Reusability
Organization / Consistency especially in
transformations
Modern Approach to ABAP
Note: Regarding the Location of the Scenario
Samples
The samples of the scenarios that follow can be found in the
BW7 Sandbox, with the exception of the Scenario BADI for BW
Loading which is located in the corresponding ECC source
system E60 client 001.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Calling Class Methods in BW Routines
Once a class / class method has been created & activated, the easiest way to call the
class method is through the ABAP editor “Patterns” pushbutton.
Enter or F4
for a list of
the class
methods
Scenario – Class Methods in Transformations
We will be working with the transformation from Infocube 0D_SD_C03 (source) to
InfoCube Z0DSD_C03 (target).
In the target InfoCube we have added the City Size (ZCITSIZ), which is determined
using the city of the sold to and looking up the city size which is an attribute of the
InfoObject ZCITY.
We have defined a class named ZCL_BW_TRAN_FKOM09, which contains the
Methods:
FILL_IT_CIT_SIZ - Fills the internal table IT_CITY_SIZ of the class
GET_CITY_SIZ_VIA_SOLDTO – Using sold to, determines sold to city, then looks
up city size in the internal table IT_CITY_SIZ .
Lets review the class & methods.
Scenario – Class Methods in Transformations
In the Start Routine of the transformation from Infocube 0D_SD_C03 to InfoCube
Z0DSD_C03, we will call the method FILL_IT_CIT_SIZ .
Scenario – Class Methods in Transformations
In the transformation rule for the characteristic ZCITSIZ
we will use
The source field 0D_ SOLD_TO and rule type routine
where we will call the GET_CITY_SIZ_VIA_SOLDTO.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Scenario – The Class Constructor
The purpose of this scenario is to demonstrate how the class constructor behaves in
terms of producing a defined initial state for class objects, once the class is
instantiated.
We will use the ABAP program ZSHOW_CONSTRUCTOR, which instantiates the
ZCL_BW_TRAN_FKOM09 class, and then calls the GET_CITY_SIZ_VIA_SOLDTO
method.
In our prior example we filled the internal table IT_CITY_SIZ by calling the method
FILL_IT_CIT_SIZ in our start routine. In this example the internal table is filled
through the CONSTUCTOR method once the class is instantiated.
Let’s take a look at this through the ABAP Editor & then use the debugger to show
how the constructor fills the internal table.
Scenario – The Class Constructor
REPORT ZSHOW_CONSTRUCTOR.
data: Xobject type ref to ZCL_BW_TRAN_FKOM09.
data: zout type c length 1.
************************************************************************
*  S E L E C T I O N  S C R E E N
************************************************************************
parameters: p_soldto TYPE /BI0/OID_SOLD_TO obligatory.
************************************************************************
*  Process by Instantiating a class implementation which has the effect
*  of setting the initial state of class objects such as class attributes
*  by executing the CLASS CONSTRUCTOR.
*  In this example the class attribute 'IT_CITY_SIZ' an internal table
*  is filled by the CLASS CONSTRUCTOR, then the method
*  'GET_CITY_SIZ_VIA_SOLDTO' is executed.
************************************************************************
create object xobject.
CALL METHOD ZCL_BW_TRAN_FKOM09=>GET_CITY_SIZ_VIA_SOLDTO
EXPORTING
IN_SOLD_TO = p_soldto
IMPORTING
OUT_CIT_SIZ = zout.
write: /01 text-001, sy-repid,
40 text-002 INTENSIFIED ON,
100 text-003, sy-datum, space.
write: /01 text-004, sy-uname,
40 text-005,
60 text-006, sy-uzeit, space.
write: /.
write: /01 text-007, p_soldto,
40 text-008, zout.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Scenario – Class Methods in the Userexit for
Variables
In this scenario we will use the class ZCL_BW_TRAN_FKOM09 method
ZVAR_GET12MOS_FRM_LASTCL in the SAP provided userexit for variables
EXIT_SAPLRRS0_001.
We need a Bex Variable that will determine an interval for the time characteristic
0CALMONTH ending with the last closed month as determined in TVARVC and
beginning with the month 11 months before the last closed month.
The TVARV variable Z_LAST_CLOSED_MONTH will hold the last closed month
(transaction STVARV).
Let’s take a look at the method & run it through in the test mode.
We can also use Query ZJPL_ABAPOO_METH_VAR_USEREXIT to verify our
results, then re-run the query after changing the value of the TVARVC variable
Z_LAST_CLOSED_MONTH via STVARV.
Scenario – Class Methods in the Userexit for
Variables
CASE I_VNAM.
WHEN 'ZVAR_CALMON_INTVL_TVARVC_LST12'.
IF i_step EQ 2.
CALL METHOD ZCL_BW_TRAN_FKOM09=>ZVAR_GET12MOS_FRM_LASTCL
IMPORTING
L_S_RANGE = L_S_RANGE.
endif.
APPEND L_S_RANGE TO E_T_RANGE.
ENDCASE.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Scenario - Custom Functions in the Formula
Builder
BAdI: Customer-defined Functions in Formula Builder
Use
This Business Add-In (BAdI) is used in the formula builder
transformation library. You use this BAdI to integrate user-defined
functions into the transformation library of the formula builder. In
this way, you can make special functions that are not contained in
the standard delivery available for Transfer Rules, Update Rules,
Transformations, Process Chain Process Types, APD’s etc.
Requirements
The technical name of a user-defined function
Must be specified
Must be unique
Must begin with 'C_'
Can contain only alphanumeric characters
( ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_) (lower-
case letters, empty spaces and special characters are not allowed)
Can be a maximum of 61 characters long.
Standard settings
The BAdI can be used repeatedly. Is it not filter-dependent.
Activities
After you have called up the IMG activity, a dialog box appears in
which you enter a name for implementation.
If implementations have already been created for this BAdI, a dialog
box appears in which the existing implementations are displayed. In
this dialog box, choose Create and proceed as follows:
Continued on next Slide
Custom Functions in the Formula Builder
Steps Continued from prior Slide:
1. In the Implementation field, enter a name for the implementation of the BAdIs and choose Create.
2. The initial screen for creating BAdI implementations appears.
3. In the initial screen, in the Short Text for Implementation field, enter a short text for the
implementation.
4. Choose the Interface tab index.
5. On the tab page, the field Name of Implemented Class is filled automatically, since the system
assigns a class name based on the name of your implementation.
6. Save your entries and assign the implementation to a development class.
7. Position the cursor on the method and double-click on it to reach the method editing screen.
8. Between the statements method <Interface Name>~<Name of Method>. and endmethod. the
coding for your implementation.
9. Save and activate your coding and return to the Change Implementation screen.
10. Save your entries on the Change Implementation screen.
Note: You can create an implementation for a BAdI and activate it later. If this is the case, close the
editing screen now.
11. Choose Activate.
When you execute the application program, the coding you defined in the method is executed
Custom Formula (Fox) in Alternate Decision Process
Type (0) Scenario I – when to condense ?
In order to decide when is the rigth time to operate some Process Type
(Condense InfoProvider, Delete Change Log, Delete PSA etc..) that might have a negative
impact on Perfromance at the wrong moment:
We set up the Alternate Decision Step in our Process Chain along with a Z Custom Fox Formula
with Multiple Alternatives (IF-ELSEIF-ELSEIF-ENDIF) and a Z custom decision table that have
criterias such as InfoProvider, Process Type and Rule Type (Odd-Even Days, Daily, Weekly,
Monthly, Other)
 D Daily between 0600 PM and 0900 AM.
 M > will happen only the last day of the month (18:00 till 12:00 next day)
 M Mês = 7 and Valor Livre = 23 wil happen only on 23 July YYYY (Any Year)
 A and Valor Livre = 1 > Process Type will happen on
Even Days: Tuesday(2)-Thursday(4)-Saturday(6)
 A and Valor Livre = ‘’ > Process Type will happen on
Odd Days : Monday(1)-Wened(3)-Friday(5)-Sunday(7)
 M and Valor Livre = ‘20090725’ – Selected day – anytime.
 S and WeekDay1 = 5 > Will Process Weekly On Friday
Custom Formula (Fox) in Alternate Decision (5) –
When to Condense ? - ZTABLE
Custom Formula (Fox) in Alternate Decision Process
Type (1) Scenario I – when to condense ?
Custom Formula (Fox) in Alternate Decision Process
Type (2) Scenario I – when to condense ?
Custom Formula (Fox) in Alternate Decision Process
Type (3) Scenario I – when to condense ?
To merge this result with the decision process step development we will go through
the steps quickly here:
Activate the BADI RSAR_CONNECTOR
Integration of self-defined functions in the transformation library of the formula
builder(See document: Enhancements in SAP BW by Gary Nolan Know - How
Network Call March 31, 2004) In SE18 create new implementation: And here are
the two screens after clicking Display/Change: And the Interface tab:
Create new class ZCL_IM_CL_BW_FORM_BUILDER.
For this class implement interface: IF_EX_RSAR_CONNECTOR. For this interface
implement one method: IF_EX_RSAR_CONNECTOR~GET. Here is the code
under the method IF_EX_RSAR_CONNECTOR~GET.
Read the comments in the code. These are largely transparent and useful. Most of
this code is provided by SAP.
Custom Formula (Fox) in Alternate Decision
Process Type (3)
Custom = User-Defined Functions
We created a boolean custom formula function C_COMP_CUBO
with two parameters : InfoProvider and Process Type
Custom Formula (Fox) in Alternate Decision
Process Type (4)
Custom = User-Defined Functions
We have created a boolean custom formula function C_COMP_CUBO
with two parameters : InfoProvider and Process Type
We created a Z decision Table to define the specific processing
Custom Formula (Fox) in Alternate Decision (5) –
When to Condense or Delete Chge Log ?
METHOD check_compression_rule.
* Methodo precisa de um parametro a providenciar na FOX Formula
*  Infoprovider
* Methodo precisa de um parametro a providenciar na FOX Formula
*  Infoprovider
* Retorna um Booleano 'X' se for o momento de processar
*Compressão - Deleção Chge Log - Deleção PSA Etc
*ABAP  Programa ABAP
*AGGRFILL  Preenchimento inicial de novos agregados
*ARCHIVE  Arquivar dados de um InfoProvider
*ATTRIBCHAN  Execução de modificação de atributo
*BIAINDEX  Ativação inicial e preenchimento de índices BI accelerator
*CHAIN  Cadeia de processos local
*CHGLOGDEL  Eliminação de requisições do log de modificação
*CLEARTODS  Elimina conteúdo total do ODS transacional acoplado
*COMMAND  Comando do sistema operacional
*COMPRESS  Comprimir InfoCubo
*CPS_EVENT  Evento em CPS SAP (Redwood)
*CPS_JOB  Job em CPS SAP (Redwood)
*DATACHANGE  Acionar evento modificação de dados (p/BEx Broadcaster)
*DBSTAT  Estruturar estatística do banco de dados
*DROPCUBE  Eliminação completa do conteúdo do destino de dados
Custom Formula with Alternate Decision – Scenario
II (1) – Set the Semaphore
Use Decision Process Type and a Custom Formula to Control Process Chain Flow
Scenario:
This is a simple test scenario designed to illustrate the technique.
You have a task to execute different branches of a Process Chain depending on
conditions in the System.
These conditions can be determined via ABAP code.
The conditions could be :
state of data, date, time, factory calendar or
other settings changed by the user, etc.,
This Scenario can also set a semaphore (in TVARVC) as STOP or CONTINUE if
some conditions are or are not met.
Custom Formula with Alternate Decision – Scenario
II (2) – Set the Semaphore
Here is the final chain you have to deliver:
The Start step of the chain is triggered by an event.
The second step, the decision process type, directs the flow and either:
1) runs the ABAP process step - wait one minute - and subsequently the ABAP
process step - continue(trigger event), or
2) runs the ABAP process step - wait two minute- and terminates, or
3) errors out, in case the state could not be defined, and terminates.
4) In addition, in our example, the event triggered is the same event which starts the
chain.
Custom Formula with Alternate Decision – Scenario
II (3) – Set the Semaphore
Consequently, in case 1) the chain will restart and continue executing (will loop) until
conditions change and the decision process type directs it to 2) or 3).
For the purpose of our example we created a record in TVARV table with key:
NAME = ZDW_CONTROL.
We control the flow by changing the value of field LOW.
Possible values are ‘STOP’ or 'CONTINUE'.
Any other value will cause Decision to error out.
Here is how this entry looks: Or: Creating the elements: To achieve the above result,
the most complicated part is creating a custom formula. This is very well
documented by SAP (see references at the end).
Custom Formula with Alternate Decision – Scenario II
(4) - IF_EX_RSAR_CONNECTOR~GET Code
All this method does is to append a formula to the list of available formulas
METHOD if_ex_rsar_connector~get.
DATA: l_function TYPE sfbeoprnd.
* Structure with the description of the function
CASE i_key.
*      importing parameter: key with the function category
WHEN 'CUSTOM'.
* The BAdI implementation is always accessed with the ‘CUSTOM’ key.
CLEAR l_function.
l_function-tech_name = 'C_COMP_CUBO'.
* Aparece mais tarde no nome tecnico da coluna e preciso ser unico
l_function-descriptn = 'Determina Se For Hora de Comprimir'.
* Aparece mais tarde na coluna Dexcrição.
l_function-class = 'Z_CL_FORMULAS'.
* Nome da Classe que implementa o methodo que implementa a formula
l_function-method = 'CHECK_COMPRESSION_RULE'.
* Nome do Methodo que implementa a formula
APPEND l_function TO c_operands.
* Changing parameter: Table with descriptions of the function
l_function-tech_name = 'C_CHECK_LOAD'.
l_function-descriptn = 'Check Load'.
l_function-class = 'Z_CL_FORMULAS'.
l_function-method = 'CHECK_LOAD'.
APPEND l_function TO c_operands.
ENDCASE.
ENDMETHOD. "IF_EX_RSAR_CONNECTOR~GET
As a result you should see two formulas
C_COMP_CUBO, C_ZDW_CHECK_LOAD in the formula screen:
Custom Formula with Alternate Decision – Custom
Formulas Availables (6)
Custom Formula with Alternate Decision – Scenario
II (6) - new method CHECK_LOAD
In the newly created new class Z_CL_FORMULAS Implement another method:
CHECK_LOAD
Create this method with two parameters: CONTROL and RETURN
Custom Formula with Alternate Decision – Scenario
II (7) - new method CHECK_LOAD
method CHECK_LOAD.
* The control parameter allows multiple checks to be implemented:
* We may have if,...elseif,...elseif,...else,...endif. statement
* We created a record in table TVARV with name Z_PC_CONTROL
* We can control the flow by changing
*  the value of field LOW in the record:
*  NAME = 'Z_PC_CONTROL' of table TVARV
* ************************************************************************
data f_low like control.
select single LOW into f_low
from TVARV where NAME = 'Z_PC_CONTROL'
and TYPE = 'P' and NUMB = '0000'.
if f_low = control.
return = 'X'.
else.
return = ''.
endif.
endmethod.
Custom Formula with Alternate Decision – Scenario
II (8) - new method CHECK_LOAD
FUNCTION ZWRITE_TVARVC.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  TABLES
*"      T_VALUES STRUCTURE  TVARVC
*"  EXCEPTIONS
*"      UPDATE_FAILED
*"      OTHERS
*"----------------------------------------------------------------------
TYPES: l_values type tvarvc.
DATA: s_values TYPE l_values.
MOVE t_values to s_values.
MODIFY tvarvc FROM s_values.
IF SY-SUBRC = 0.
COMMIT WORK.
ELSE.
RAISE UPDATE_FAILED.
ENDIF.
ENDFUNCTION.
Custom Formula with Alternate Decision – Scenario
II (9) – Decision Step
Create the Decision step as follows:
Customize the formulas:
C_CHECK_LOAD( 'CONTINUE' ) And:
C_CHECK_LOAD( 'STOP' )
ABAP code:
In this example ABAP process steps
wait one minute
wait two minutes
and after error just exit
-
Use the following report Z_CIGE_TIME_WAIT with different parameter
settings:
Custom Formula with Alternate Decision – Scenario
II (8) - Z_CIGE_TIME_WAIT
REPORT Z_CIGE_TIME_WAIT.
PARAMETER: P_WAIT TYPE I,
*           p_server LIKE MSXXLIST-NAME,
P_event TYPE btceventid.
START-OF-SELECTION.
WAIT UP TO P_WAIT SECONDS.
* The ABAP process step continue(trigger event)
* uses metodo cl_batch_event=>raise to trigger event.
CALL METHOD cl_batch_event=>raise
EXPORTING
i_eventid = p_event
EXCEPTIONS
excpt_raise_failed = 1
excpt_raise_forbidden = 3
excpt_unknown_event = 4
excpt_no_authority = 5
OTHERS = 6.
CASE sy-subrc.
WHEN 0.
EXIT.
WHEN 1 OR 3.
RAISE raise_failed.
WHEN 4.
RAISE eventid_does_not_exist.
WHEN OTHERS.
RAISE raise_failed.
ENDCASE.
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Scenario: - BADI for BW Loading - RSU5_SAPI_BADI
Scenario: Need to Enhance 2LIS_03_BF with MBEW-VPRSV Price Control (MAC or Standard). Since this
can change month to month customer wants the value of VPRSV at the time of Material Doc Creation.
Note:Normally this should be handled via SMOD MCB10001 in a CMOD implementation, but due to
constraints on suitable datasources of the sandbox application tables with data in the I chose 2LIS_03_ITM to
demonstrate the load BADI.
Steps Taken in
month to month customer wants the value of VPRSV at the time of Material Doc Creation.
VIA SE11 added the field VPRSV to structure MCMSEGUSR.
VIA LBWE Maintained the 2LIS_03_BF STRUCTURE - Transferred VPRSV from right to left
VIA LBWE Un Hide VPRSV and generated the 2LIS_03_BF DataSource, and activated the update.
IN BW7 Replicated 2LIS_03_BF
Created a classic Implementation of the RSU5_SAPI_BADI named Z_FKOM_2009_LOADDATA
Using the DATA_TRANSFORM method of the RSU5_SAPI_BADI implemented the code to acquire the
VPRSV value of each MATERIAL movement doc line item that contains a valid material.
BADI for BW Loading - RSU5_SAPI_BADI
Use SE19
This Business Add-In (BAdI) is used in the SAP Business Information Warehouse Extractors (BC-
BW) component. Using this BAdI you are able to either fill fields with data, or change the content
of the DataSource fields that you added to the extract structure of a DataSource as an append
structure.
Requirements
If you want to fill the fields of an append structure, create an append structure for the
DataSource.
You can find more information on append structures in the Web Application Server
documentation in the SAP Library at ABAP Workbench -> ABAP Dictionary, in the section Tables.
Standard settings
Business Add-In is active in the standard system.
Business Add-In can be used more than once. All active implementations are called up and
executed.
Business Add-In is not dependent on a filter.
BADI for BW Loading - RSU5_SAPI_BADI
Activities: Via Transaction SE19 if creating a new BADI implementation, Enter the BADI
name RSU5_SAPI_BADI in the Classic BADI, BADI name input field of the Create
Implementation section, then select Create.
Or, If you are editing an existing implementation of the BADI, enter the implementation
name in the classic BADI implementation name field of the Edit Implementation section.
BADI for BW Loading - RSU5_SAPI_BADI
You then reach the initial screen for creating BAdI implementations. In the field
implementation Short text , enter a short text for the implementation.
- BADI for BW Loading - RSU5_SAPI_BADI
Select the Interface tab. The Name of implementing class field on the interface tab
page is filled automatically. The system allocates a class name based on the name of
your implementation.Here:ZCL_IM_ZRSU5_SAPI_BADI and has two methods.
Save your
entries and
assign a
package for
transport.
Add four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (1).
 Besides methods inherited from the BADi
IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM
IF_EX_RSU5_SAPI_BADI~HIER_TRANSFORM
 We create now 4 new methods (in case they do not already exist)
_CALL_DATASOURCE
_CHECK_BW_SYSTEM
_TEMPLATE_DATASOURCE
_CHECK_METHOD_EXISTS
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (1).
_CHECK_METHOD_EXISTS
Description “Check if the implementation of datasource is done”
Level Static
Visibility Public
Parameters
IV_CMPNAME Importing Type SEOCMPNAME “Component name”
RV_EXISTSReturning (Value Transfer) Type CHAR01 “Method Exists”
Exceptions None
With the following code:
METHOD _check_method_exists.
DATA: lv_clsname TYPE seoclskey.
*  FIELD-SYMBOLS: "<ls_method>      TYPE seoo_method_r,
*                 <ls_method_ex>   TYPE seoo_method_r.
CLEAR rv_exists.
IF ct_methods IS INITIAL.
lv_clsname-clsname = 'ZCL_IM_RSU5_SAPI_BADI'.
CALL FUNCTION 'SEO_METHOD_READ_ALL'
EXPORTING
cifkey = lv_clsname
version = seoc_version_active
IMPORTING
methods = ct_methods
EXCEPTIONS
clif_not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0. ENDIF.
DELETE ct_methods WHERE cmpname(1) = '_'.
ENDIF.
* check existence
READ TABLE ct_methods TRANSPORTING NO FIELDS
WITH KEY cmpname = iv_cmpname.
IF sy-subrc EQ 0. rv_exists = 'X'.
ENDIF.
ENDMETHOD.
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (2).
_CHECK_BW_SYSTEM
Description “Checks what system is doing the request”(could be BOBJ not BW)
Level Static
Visibility Public
Parameters
RV_IS_EDWH Returning (Value Transfer) Type CHAR01 “Request is a EDWH Request”
Exceptions None
With the following code:
METHOD _check_bw_system.
rv_is_edwh = 'X'.
* FIELD-SYMBOLS: <ls_request> TYPE rosrequest.
* CLEAR rv_is_edwh.
** in online mode (extraction checker) just do it
* IF sy-batch IS INITIAL.
* rv_is_edwh = 'X'.
* EXIT.
* ENDIF.
*
* IF cv_bwsystem IS INITIAL.
** get request parameters
* ASSIGN ('(SBIE0001)REQUEST') TO <ls_request>.
** finally
* cv_bwsystem = <ls_request>-rcvprn.
* ENDIF.
*
** check
* IF cv_bwsystem(3) = 'DED'
* OR cv_bwsystem(3) = 'QED'
* OR cv_bwsystem(3) = 'PED'.
* rv_is_edwh = 'X'.
* ENDIF.
ENDMETHOD.
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (3.1).
_CALL_DATASOURCE
Description “Call Individual Method for Each DataSource”
Level Static
Visibility Public
Parameters
I_DATASOURCE Importing (Value Transfer) Type RSAOT_OLTPSOURCE
I_UPDMODE Importing (Value Transfer) Type SBIWA_S_INTERFACE-UPDMODE
I_T_SELECT Importing (Value Transfer) Type SBIWA_T_SELECT
I_T_FIELDS Importing (Value Transfer) Type SBIWA_T_FIELDS
C_T_DATA Changing Type ANY TABLE
C_T_MESSAGES Changing Type RSU5_T_MESSAGES
Exceptions None
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (3.2).
With the following code:
METHOD _call_datasource.
DATA: ls_oltpsource TYPE rsaot_s_osource,
lv_data TYPE REF TO data,
lv_method TYPE seocmpname.
FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE.
* check if any data is extracted
CHECK c_t_data IS NOT INITIAL.
CALL FUNCTION 'RSA1_SINGLE_OLTPSOURCE_GET'
EXPORTING
i_oltpsource = i_datasource
i_objvers = 'A'
IMPORTING
e_s_oltpsource = ls_oltpsource
EXCEPTIONS
no_authority = 1
not_exist = 2
inconsistent = 3
OTHERS = 4.
IF sy-subrc <> 0.
EXIT.
ENDIF.
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (3.3) c’td.
Continuing with the following code:
* create data for Extract Structure
CREATE DATA lv_data TYPE TABLE OF (ls_oltpsource-exstruct).
ASSIGN lv_data->* TO <lt_data>.
ASSIGN c_t_data TO <lt_data>.
* get method name for datasource
lv_method = i_datasource.
IF lv_method(1) = '0' or
lv_method(1) = '2'. "for instance 2LIS_11*
* shift by one character as methods can't start with a number
SHIFT lv_method.
ENDIF.
* check method is implemented
CHECK _check_method_exists( lv_method ) = 'X'.
CALL METHOD (lv_method)
EXPORTING
i_updmode = i_updmode
i_t_select = i_t_select
i_t_fields = i_t_fields
CHANGING
c_t_data = <lt_data>
c_t_messages = c_t_messages.
ENDMETHOD.
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (4.1).
_TEMPLATE_DATASOURCE
Description “Template You Can Use To Copying Enhancement Method of your DataSource”
Level Static
Visibility Public
Parameters
I_DATASOURCE Importing (Value Transfer) Type RSAOT_OLTPSOURCE
I_UPDMODE Importing (Value Transfer) Type SBIWA_S_INTERFACE-UPDMODE
I_T_SELECT Importing (Value Transfer) Type SBIWA_T_SELECT
I_T_FIELDS Importing (Value Transfer) Type SBIWA_T_FIELDS
C_T_DATA Changing Type ANY TABLE
C_T_MESSAGES Changing Type RSU5_T_MESSAGES
Exceptions None
Adding four new Methods in your implementation
ZCL_IM_ZRSU5_SAPI_BADI (4.2).
Append the following code to Your Method _template_datasource:
METHOD _template_datasource.
* Data Definition
* DATA: lth_vbak type hashed table of vbak with unique key vbeln,
* ls_vbak type vbak .
* FIELD-SYMBOLS: <L_S_DATA> TYPE <Extract structure name>.
* Init
* Perform always a mass select into an internal table
* SELECT * FROM VBAK INTO TABLE lth_vbak
* FOR ALL ENTRIES IN C_T_DATA
* WHERE VBELN = C_T_DATA_VBELN.
* map the data
* LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.
* READ TABLE lth_vbak into ls_vbak
* with table key vbeln = <L_S_DATA>-vbeln.
* if sy-subrc eq 0.
* <L_S_DATA>-VKORG = ls_vbak-vkorg.
* !!! No MODIFY necessary as the field is changed immediatly in the
* internal table by using Field Symbols
* endif.
* ENDLOOP.
ENDMETHOD.
Modify now the Method DATA_TRANSFORM in your
implementation of IF_EX_RSU5_SAPI_BADI
Do not forget to modify the original method DATA_TRANSFORM with
the following code !!
METHOD if_ex_rsu5_sapi_badi~data_transform.
CALL METHOD zcl_im_rsu5_sapi_badi=>_call_datasource
EXPORTING
i_datasource = i_datasource
i_updmode = i_updmode
i_t_select = i_t_select
i_t_fields = i_t_fields
CHANGING
c_t_data = c_t_data
c_t_messages = c_t_messages.
ENDMETHOD.
Summary
In the methods tab of the class ZCL_IM_ZRSU5_SAPI_BADI, ( inheriting from the Interface IF_EX_RSU5_SAPI_BADI) we have created 4 new
methods.
Enriching a datasource, will consist of extending its structure (SE11 and RSA6) and then creating your own method using
_TEMPLATE_DATASOURCE as a model and rename it to the almost exact name of your datasource:
In case you enhance a Business Content datasource skip the 0 or the 2 at the beginning (e.g. Datasource 0UC_MTR_DOC -> Method
UC_MTR_DOC or 2LIS_03_BF -> Method LIS_03_BF), the Z datasource Z_DS_G_TR_ZV_EGER giving its exact name to the enrichment method.
The method is then called by the Exit Framework
Creating an enhancement of a DataSource(1)
I will assume that you have enhanced the structure of the data source, and need to
code to populate the enhanced fields of the structure.
Copy the method _TEMPLATE_DATASOURCE and rename it, with the same name
of the datasource you want to enhance. In case of standard datasource, omit the first
character of the name (‘0’ or ‘2’).
ie. DataSource 2LIS_18_IOTASK  Method name: LIS_18_IOTASK
Creating an enhancement of a DataSource(2)
Declare on the code the structure to populate.
On the code, you have to declare the structure <L_S_DATA> of the type of the enhancement
sctructure of your data source, ie: Tcode RSA6
As you see in the picture, the Extract Structure of the data source 2LIS_18_I0TASK is
MC18I00TSK.
Creating an enhancement of a DataSource(3)
Declare:
FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK .
During the execution of the extraction process, when this method is called, the structure
C_T_DATA will be populated with packages of 100 records each time. So a loop must be
declared to process these data packages, as you see on the code examples bellow.
Here is a simple way to populate the fields of the structure straight from the select:
LOOP AT C_T_DATA ASSIGNING <L_S_DATA>.
SELECT SINGLE BETRH BETRW INTO (<L_S_DATA>-BETRH, <L_S_DATA>-BETRW)
FROM DFKKOP WHERE OPBEL = <L_S_DATA>-OPBEL AND
OPUPW = <L_S_DATA>-OPUPW AND
OPUPK = <L_S_DATA>-OPUPK AND
OPUPZ = <L_S_DATA>-OPUPZ.
ENDLOOP.
Go testing your DataSource in Tx RSA3.
- BADI for BW Loading - RSU5_SAPI_BADI
Alternate Non-Modular Way (Not Recommended)
Double click on the appropriate method,
DATA_TRANSFORM, for Transaction, Master Data, and Texts
datasources, or HIER_TRANSFORM for hierarchy
datasource.
Between the instructions Method <Interface
Name>~<Method name>. and endmethod., enter the code
that you require for the implementation.
Save and activate your code and navigate back to the
Change implementation screen, then be sure to activate the
BADI implementation. method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM.
CASE I_DATASOURCE.
WHEN '2LIS_03_BF'.
data: wa_vprsv TYPE mbew-vprsv.
FIELD-SYMBOLS:
<c_t_data> TYPE TY_MC03BF0.
loop at c_t_data ASSIGNING <c_t_data>.
if not <c_t_data>-matnr is INITIAL.
select vprsv from mbew
into wa_vprsv
where
matnr = <c_t_data>-matnr and
BWKEY = <c_t_data>-werks.
ENDSELECT.
if sy-subrc = 0.
<c_t_data>-vprsv = wa_vprsv.
endif.
endif.
endloop.
ENDCASE.
endmethod.
Note the use of
FIELD-SYMBOLS
Launch Internet Explorer Browser.lnk
References
Note 691154 - SAPI with BADI: User exits in SAPI with BADI-interfaces
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Other Areas Where ABAP OO Classes Are Used
Other areas where Classes / Methods Can be used.
XI Integration to BI using ABAP Proxy Services
BADI for :
Virtual Characteristics & Key Figures
Own Report Type as Jump Target Recipient
InfoSpoke with Transformation (BW 3.5 only)
>> Custom Process Type
 Formula in Alternate Decision Process Type
Custom Process Type using Pass-Through
technique (1)
- Creation of Class ZCL_ABAP_PT_RESULT with no methods, types, attributes etc.
- Go To > Public Section and Paste the following Lines
- interfaces if_rspc_call_monitor .
interfaces if_rspc_check .
interfaces if_rspc_execute .
interfaces if_rspc_get_status .
interfaces if_rspc_get_variant .
interfaces if_rspc_maintain .
interfaces if_rspc_transport .
interfaces if_rspv_transport .
constants failed type rspc_state value 'R'. "#EC NOTEXT
constants status_mem_id type char20 value 'PC_ABAP_STATUS'. "#EC NOTEXT
constants success type rspc_state value 'G'. "#EC NOTEXT
Custom Process Type using Pass-Through
technique (2)
- The protected and public section contain nothing.
- Now we need to implement the methods of the interface.
- They all must be implemented - though most are empty.
- Those that are not empty are:
-
if_rspv_transport~get_additional_objects.
- if_rspc_transport~get_tlogo.
- if_rspc_maintain~maintain.
- if_rspc_maintain~get_header.
- if_rspc_get_variant~get_variant.
- if_rspc_get_variant~wildcard_enabled.
- if_rspc_get_variant~exists.
- if_rspc_get_status~get_status.
- if_rspc_execute~give_chain.
- if_rspc_check~check.
- if_rspc_check~give_all
- if_rspc_call_monitor~call_monitor.
- if_rspc_execute~execute.
Custom Process Type using Pass-Through
technique (3)
 You'll notice, that with the exception of the last method, all I've done is pass and retrieve
identical parameters to CL_RSPC_ABAP static methods.
 This is known as passing through, because we execute the methods of Class
CL_RSPC_ABAP
In the last method (if_rspc_execute~execute), I also do this, but I have an additional
statement.
“IMPORT e_state TO e_state FROM MEMORY ID zcl_abap_pt_result=>status_mem_id. “
This method executes the ABAP program in the Process Type variant, and then sets
the state of the Process Type according to that stored in the memory id.
Custom Process Type using Pass-Through
technique (4) – Abap Program
 The ABAP program that the process type will actually call, needs to set its status - whether it
succeeded or failed - and report that to the process type handling class. This I've done simply
using memory ids. You could follow the example in Jürgen Noe's blog, where he addresses
the same issue, and use a table to store the result of the called program.
 * Set the flag for the process chain to read
if ... " The ABAP program failed
l_flag = zcl_abap_pt_decision =>failed.
else. " The ABAP program was successful
l_flag = zcl_abap_pt_decision =>success.
endif.
 export e_state from l_flag to memory id zcl_abap_pt_decision=>status_mem_id.
Custom Process Type using Pass-Through
technique (4) – Abap Program
 The ABAP program that the process type will actually call, needs to set its status - whether it
succeeded or failed - and report that to the process type handling class. This I've done simply
using memory ids. You could follow the example in Jürgen Noe's blog, where he addresses
the same issue, and use a table to store the result of the called program.
 * Set the flag for the process chain to read
if ... " The ABAP program failed
l_flag = zcl_abap_pt_decision =>failed.
else. " The ABAP program was successful
l_flag = zcl_abap_pt_decision =>success.
endif.
 export e_state from l_flag to memory id zcl_abap_pt_decision=>status_mem_id.
Custom Process Type using Pass-Through
technique (5) – Create New Process Type
 The final bit of work is setting up the process type for use within a process chain.
 From transaction RSPC, go to Settings->Maintain Process types. ( You might have to select a
process chain first to activate this menu option ). Create a new process type: Z_ABAP_RES
Custom Process Type using Pass-Through
technique (6) – Sample Program

REPORT Z_TEST_GREEN_OR_RED.
DATA:
e_state type RSPC_STATE,
zcl_abap_pt_result TYPE REF TO zcl_abap_pt_result,
l_flag TYPE rspc_state.
SELECTION-SCREEN BEGIN OF BLOCK eins WITH FRAME.
PARAMETERS:
red RADIOBUTTON GROUP radi,
green RADIOBUTTON GROUP radi.
SELECTION-SCREEN END OF BLOCK eins.
START-OF-SELECTION.
CREATE OBJECT zcl_abap_pt_result.
IF NOT green IS INITIAL.
l_flag = zcl_abap_pt_result=>success.
ELSE.
l_flag = zcl_abap_pt_result=>failed.
ENDIF.
EXPORT e_state FROM l_flag TO MEMORY ID zcl_abap_pt_result=>status_mem_id.
Custom Process Type using Pass-Through
technique (7) – Methods Copied from Class
Passing Through
CL_RSPC_ABAP static meth
Overview – ABAP OO Classes & Methods
Motivation For Using ABAP OO In BW
Scenario: Using Classes & Methods in Transformations
Scenario: The Class Constructor
Scenario: Class Methods in the Userexit for Variables
Scenario: Custom Functions for The Formula Builder
Scenario: BADI for BW Loading
Other Areas in BW using ABAP OO Classes & Methods
Custom Class To Use in Transformation : generic
programming (1)
Will fill internal tables in the START ROUTINE to derive from in the END ROUTINE
Object Types : InfoObjects, ODSO .
The method allows up to 5 filters with a FOR ALL ENTRIES type of conditions
Custom Class To Use in Transformation
: generic programming (2)
Handle several logical partitions based on Naming Conventions and Source System
The Object can be local or global.
Up to 5 Filters as Distinct Values working as FOR ALL ENTRIES
Time Dependency for InfoObjects
Custom Class To Use in Transformation
: generic programming (3)
Custom Class To Use in Transformation
: generic programming (4) – START Routine
Appendix 1 – Passing Through CL_RSPC_ABAP
static methods.
method IF_RSPV_TRANSPORT~AFTER_IMPORT.
endmethod.
method IF_RSPV_TRANSPORT~GET_ADDITIONAL_OBJECTS.
cl_rspc_abap=>if_rspv_transport~get_additional_objects(
EXPORTING i_variant = i_variant
i_cto_mode = i_cto_mode
i_is_content_system = i_is_content_system
IMPORTING e_t_cto_object = e_t_cto_object
e_t_cto_key = e_t_cto_key ).
endmethod.
method IF_RSPC_TRANSPORT~GET_TLOGO.
cl_rspc_abap=>if_rspc_transport~get_tlogo( EXPORTING i_variant = i_variant
i_objvers = i_objvers
IMPORTING e_tlogo = e_tlogo
e_objnm = e_objnm ).
endmethod.
method IF_RSPC_TRANSPORT~KEY_CHANGE.
endmethod.
method IF_RSPC_MAINTAIN~MAINTAIN.
cl_rspc_abap=>if_rspc_maintain~maintain( EXPORTING i_variant = i_variant
i_t_chain = i_t_chain
IMPORTING e_variant = e_variant
e_variant_text = e_variant_text ).
endmethod.
method IF_RSPC_MAINTAIN~GET_HEADER.
cl_rspc_abap=>if_rspc_maintain~get_header( EXPORTING i_variant = i_variant
i_objvers = i_objvers
IMPORTING e_variant_text = e_variant_text
e_s_changed = e_s_changed
e_contrel = e_contrel
e_conttimestmp = e_conttimestmp ).
endmethod.
METHOD if_rspc_get_variant~get_variant.
cl_rspc_abap=>if_rspc_get_variant~get_variant( EXPORTING i_variant = i_variant
i_t_chain = i_t_chain
i_t_select = i_t_select
i_objvers = i_objvers
IMPORTING e_variant = e_variant
e_variant_text = e_variant_text
EXCEPTIONS nothing_selected = 1 ).
IF sy-subrc EQ 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING nothing_selected.
ENDIF.
ENDMETHOD.
method IF_RSPC_GET_VARIANT~WILDCARD_ENABLED.
result = cl_rspc_abap=>if_rspc_get_variant~wildcard_enabled( ).
endmethod.
method IF_RSPC_GET_VARIANT~EXISTS.
r_exists = cl_rspc_abap=>if_rspc_get_variant~exists( i_variant = i_variant
i_objvers = i_objvers ).
endmethod.
method IF_RSPC_GET_STATUS~GET_STATUS.
cl_rspc_abap=>if_rspc_get_status~get_status( EXPORTING i_variant = i_variant
i_instance = i_instance
i_dont_update = i_dont_update
IMPORTING e_status = e_status ).
endmethod.
method IF_RSPC_EXECUTE~GIVE_CHAIN.
return = cl_rspc_abap=>if_rspc_execute~give_chain( i_variant ).
endmethod.
method IF_RSPC_CHECK~CHECK.
cl_rspc_abap=>if_rspc_check~check(
EXPORTING
i_s_process = i_s_process
i_t_chain = i_t_chain
i_t_chains = i_t_chains
IMPORTING
e_t_conflicts = e_t_conflicts
).
endmethod.
method IF_RSPC_CALL_MONITOR~CALL_MONITOR.
cl_rspc_abap=>if_rspc_call_monitor~call_monitor(
i_variant = i_variant
i_instance = i_instance ).
endmethod.
method IF_RSPC_CHECK~GIVE_ALL.
return = cl_rspc_abap=>if_rspc_check~give_all( i_variant ).
endmethod.
METHOD if_rspc_execute~execute.
cl_rspc_abap=>if_rspc_execute~execute(
EXPORTING
i_variant = i_variant
i_event_start = i_event_start
i_eventp_start = i_eventp_start
i_t_processlist = i_t_processlist
i_logid = i_logid
i_t_variables = i_t_variables
i_synchronous = i_synchronous
i_simulate = i_simulate
i_repair = i_repair
IMPORTING
e_instance = e_instance
e_state = e_state
e_eventno = e_eventno
e_hold = e_hold
).
IMPORT e_state TO e_state FROM MEMORY ID zcl_abap_pt_result=>status_mem_id.
ENDMETHOD.
Appendix 2 – ZCL_ISU_GET_MASTER_DATA
METHOD zcl_isu_get_data. DATA: struct_type TYPE REF TO cl_abap_structdescr, tab_type TYPE REF TO cl_abap_tabledescr, comp_tab TYPE cl_abap_structdescr=>component_table, comp LIKE LINE OF comp_tab. DATA: t_data TYPE REF TO data. DATA: BEGIN OF ls_rsdchabas, chabasnm TYPE rschabasnm, chatp TYPE rschatp, attribfl TYPE rsattribfl, timdepfl TYPE rstimdepfl, END OF ls_rsdchabas. TYPES: BEGIN OF ly_dd03l, tabname TYPE tabname, fieldname TYPE fieldname, domname TYPE domname, position TYPE tabfdpos, datatype TYPE datatype_d, leng TYPE ddleng, END OF ly_dd03l. TYPES: BEGIN OF ly_where, line(100) TYPE c, END OF ly_where. DATA: lt_where TYPE STANDARD TABLE OF ly_where, ls_where TYPE ly_where.* DATA: lt_dd03l TYPE STANDARD TABLE OF ly_dd03l,* ls_dd03l TYPE ly_dd03l. DATA: lv_object_ddic TYPE string, lv_soursystem(3). DATA: dref TYPE REF TO data. FIELD-SYMBOLS: <f_s_table> TYPE ANY, <f_t_table> TYPE ANY TABLE. FIELD-SYMBOLS: <f_v_field> TYPE ANY. FIELD-
SYMBOLS: <f_t_filter1> TYPE STANDARD TABLE, <f_t_filter2> TYPE STANDARD TABLE, <f_t_filter3> TYPE STANDARD TABLE, <f_t_filter4> TYPE STANDARD TABLE. FIELD-
SYMBOLS: <f_s_filter1> TYPE ANY, <f_s_filter2> TYPE ANY, <f_s_filter3> TYPE ANY, <f_s_filter4> TYPE ANY. DATA: lt_is_u_infobjects TYPE RANGE OF rsattrinm. DATA: ls_is_u_infobjects LIKE LINE OF lt_is_u_infobjects. DATA: lt_columns TYPE zcl_isu_t_filter, ls_columns LIKE LINE OF lt_columns. DATA: lv_field_filter TYPE string. DATA: lv_dynamic_data_table TYPE string. DATA: lv_dynamic_range_table TYPE string. DATA: lv_e_tablnm TYPE tabname. DATA: lv_number(1). DATA: lt_fields_range TYPE TABLE OF lvc_s_fcat, ls_fields_range LIKE LINE OF lt_fields_range. DATA: ls_data_filter TYPE LINE OF zcl_isu_t_filter. DATA: lv_e_chktab TYPE rsdchkview, lv_e_chntab TYPE rschntab. DATA: lv_chabasnm TYPE rschabasnm. DATA: lv_soursystem_view TYPE string.* begin of insertion by SAP - 25.11.2008 DATA: new_table TYPE REF TO data, new_line TYPE REF TO data. DATA: descr_ref TYPE REF TO cl_abap_structdescr, lt_details TYPE abap_compdescr_tab, ls_details TYPE abap_compdescr.* end of insertion by SAP - 25.11.2008 IF ( i_soursystem NE 'RS' ) AND ( i_soursystem NE 'BS' ) AND ( i_soursystem NE 'PS' ). RAISE sour
ce_system_no_good. ENDIF.* begin of modification by SAP - 26.11.2008* source system CONCATENATE 'ZC' i_soursystem INTO lv_soursystem. CASE i_object_type.* infoobjetc WHEN 'IOBJ'.* verifica se o infoobjeto existe SELECT SINGLE chabasnm chatp attribfl timdepfl INTO ls_rsdchabas FROM rsdchabas WHERE chabasnm = i_object_name AND objvers = cv_objvers. IF sy-subrc NE 0. RAISE master_data_doesn_exist. ENDIF.* DSO WHEN 'ODSO'. lv_chabasnm = i_object_name.* BEGIN OF INSERTION BY SAP - 03.12.2008 IF i_global_dso IS INITIAL. REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm. ENDIF.* END OF INSERTION BY SAP - 03.12.2008 clear lv_e_tablnm. CALL METHOD cl_rsd_odso=>get_tablnm EXPORTING i_odsobject = lv_chabasnm* i_tabt = IMPORTING e_tablnm = lv_e_tablnm* e_ttypename =* e_viewnm =* e_chnglognm =* e_infosource =* e_datasource = EXCEPTIONS name_error = 1 input_invalid = 2 OTHERS = 3 . IF sy-
subrc <> 0. RAISE dso_doesn_exist. ENDIF.* begin of insertion by SAP - 24.11.2008* VIEW WHEN 'VIEW'. CONCATENATE '_' i_soursystem(1) '_' INTO lv_soursystem_view. lv_dynamic_data_table = i_object_name. REPLACE '_G_' WITH lv_soursystem_view INTO lv_dynamic_data_table.* to be continued (insert double check over table DDTYPES to insure* that the view really exists* end of insertion by SAP - 24.11.2008 WHEN OTHERS. RAISE object_type_no_good. ENDCASE.* begin of insertion by SAP - 25.11.2008* table CREATE DATA new_table LIKE e_t_table. ASSIGN new_table->* TO <f_t_table>.* structure CREATE DATA new_line LIKE LINE OF <f_t_table>. ASSIGN new_line->* TO <f_s_table>. descr_ref ?= cl_abap_typedescr=>describe_by_data( <f_s_table> ). lt_details[] = descr_ref->components[].* end of insertion by SAP - 25.11.2008* trata atributos controlados por empresa* atributos controlados por empresa** Somente quando for diferente de objeto VIEW IF i_object_type = 'IOBJ'. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'.* 1) Dados Técnicos* Instalação ls_is_u_infobjects-
low = '/BIC/ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Local de Consumo ls_is_u_infobjects-low = '/BIC/ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Objeto de Ligação ls_is_u_infobjects-low = '/BIC/ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Device ls_is_u_infobjects-low = '/BIC/ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* 2) Dados Comerciais* Parceiro de Negócio ls_is_u_infobjects-low = '/BIC/ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Contrato ls_is_u_infobjects-low = '/BIC/ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-
low = 'ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Conta-Contrato ls_is_u_infobjects-low = '/BIC/ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Conta-Contrato Parceiro ls_is_u_infobjects-low = '/BIC/ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* begin of insertion by SAP - 10.01.2009** Conta Contrato Coletiva ls_is_u_infobjects-low = '/BIC/ZCGABWVK'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGABWVK'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.** Pagador alternativo - ref. PN ls_is_u_infobjects-low = '/BIC/ZCG_ABWRE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCG_ABWRE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.** Empregado responsável - ref. PN ZCRBPEMPL ls_is_u_infobjects-low = '/BIC/ZCGBPEMPL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-
low = 'ZCGBPEMPL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.*** início alteração SAP040877 - Diogo em 11/08/09*** chamado 8000019681 ls_is_u_infobjects-low = '/BIC/ZCGUNLEIT'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGUNLEIT'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.*** fim alteração SAP040877 - Diogo em 11/08/09**** alteração 21/08/09 - cadeia batch - carga FAT - EBF*** chamado 8000020612 - Diogo Almeida ls_is_u_infobjects-low = '/BIC/ZCGPORTIO'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGPORTIO'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.**** fim alteração 21/08/09 - cadeia batch - carga FAT - chamado *** chamado 8000020612* end of insertion by SAP - 10.01.2009 ELSE. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'.* Registro dummy ls_is_u_infobjects-low = 'DUMMY'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ENDIF.* begin of insertion by SAP - 25.11.2008 LOOP AT lt_details INTO ls_details. ls_columns = ls_details-
name. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF. APPEND ls_columns TO lt_columns. ENDLOOP.* end of insertion by SAP - 25.11.2008 IF i_object_type NE 'VIEW'. IF i_ignore_source_system IS INITIAL.* SOURCE SYSTEM CONCATENATE 'SOURSYSTEM = ''' i_soursystem '''' INTO ls_where-line. APPEND ls_where TO lt_where. ENDIF.* infoobject IF i_object_type = 'IOBJ'. IF i_ignore_source_system IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF.* monta select dinamico CONCATENATE 'OBJVERS = ''' cv_objvers '''' INTO ls_where-
line. APPEND ls_where TO lt_where. lv_chabasnm = i_object_name. IF lv_chabasnm IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm. ENDIF.* retornar configuração de dicionário para infoobjet CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS' EXPORTING i_chabasnm = lv_chabasnm* I_NSPACEGEN =* I_S_VIOBJ =* I_T_ATR = IMPORTING e_chktab = lv_e_chktab e_chntab = lv_e_chntab* E_CHTTAB =* E_TXTTAB =* E_SIDTAB =* E_SIDVIEW =* E_ASITAB =* E_ASISTR =* E_ASTTAB =* E_CHKNEW = EXCEPTIONS name_error = 1 OTHERS = 2 . IF sy-subrc <> 0. RAISE erro_dynamic_table. ENDIF.* determina tabela para select* de acordo com infoobjet IF i_time_dependent = 'X' AND ls_rsdchabas-timdepfl EQ 'X'.* time-dependent table lv_dynamic_data_table = lv_e_chktab. ELSE.* regular table lv_dynamic_data_table = lv_e_chntab. ENDIF.* DSO ELSE. lv_dynamic_data_table = lv_e_tablnm. ENDIF. ENDIF.* time-
dependente information IF ( i_object_type = 'IOBJ' AND i_time_dependent = 'X' AND ls_rsdchabas-timdepfl EQ 'X' ) OR ( i_object_type = 'ODSO' AND i_time_dependent = 'X' ). IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF.* SOURCE SYSTEM CONCATENATE 'DATETO = ''' cv_datato '''' INTO ls_where-line. APPEND ls_where TO lt_where. ENDIF.* begin of insertion by SAP - 26.11.2008* cria filtros para select* Até 4 filtros de select IF NOT i_filter IS INITIAL. DO 4 TIMES. MOVE sy-index TO lv_number. CONCATENATE 'I_FILTER-ZCL_FILTER' lv_number INTO lv_field_filter. ASSIGN (lv_field_filter) TO <f_v_field>. IF sy-subrc EQ 0. IF NOT <f_v_field> IS INITIAL. READ TABLE lt_details WITH KEY name = <f_v_field> INTO ls_details. IF sy-subrc EQ 0.* FIRST FIELTER - FOR ALL ENTRIES IF lv_number = 1. REFRESH lt_fields_range. CLEAR ls_fields_range.* TABELA interna para ser utilizada como for all entries ls_columns = ls_details-
name. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF. ls_fields_range-fieldname = ls_columns. ls_fields_range-ref_table = lv_dynamic_data_table.* ls_fields_range-ref_field = <f_v_field>. ls_fields_range-ref_field = ls_columns. APPEND ls_fields_range TO lt_fields_range.*** Alteração Bobis data: op_len TYPE i, op_out type OUTPUTLEN, op_dec TYPE OUTPUTLEN, w_iobj type RSD_IOBJNM, w_iobj1 type RSD_IOBJNM. LOOPAT lt_fields_range INTO ls_fields_range. if ls_fields_range-FIELDNAME(4) eq '/BIC'. w_iobj = ls_fields_range-FIELDNAME+5(10). else. concatenate '0' ls_fields_range-FIELDNAME into w_iobj. endif. clear op_len. select single CHABASNM from RSDCHA into w_iobj1 where CHANM = w_iobj and objvers = 'A'. select single OUTPUTLEN from RSDCHABAS into op_out where CHABASNM = w_iobj1 and objvers = 'A'. if sy-
subrc eq 0. move op_out to op_len. endif. comp-name = ls_fields_range-FIELDNAME.* CASE op_type.* WHEN 'DEC'.* CALL METHOD cl_abap_elemdescr=>get_p* EXPORTING* p_length = op_len* p_decimals = op_dec* RECEIVING* p_result = comp-type.* WHEN OTHERS. comp-type = cl_abap_elemdescr=>get_c( op_len ).* ENDCASE. APPEND comp TO comp_tab. CLEAR: comp. ENDLOOP. CLEAR struct_type . CALL METHOD cl_abap_structdescr=>create EXPORTING p_components = comp_tab p_strict = cl_abap_structdescr=>false RECEIVING p_result = struct_type. CLEAR tab_type . CALL METHOD cl_abap_tabledescr=>create EXPORTING p_line_type = struct_type p_table_kind = cl_abap_tabledescr=>tablekind_std RECEIVING p_result = tab_type. CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref-
>* TO <f_t_filter1>. CREATE DATA dref LIKE LINE OF <f_t_filter1>. ASSIGN dref->* TO <f_s_filter1>.** CREATE DATA t_data LIKE LINE OF <f_t_filter1>.** ASSIGN t_data->* TO <f_s_filter1>.**** Alteração Bobis* CALL METHOD cl_alv_table_create=>create_dynamic_table* EXPORTING* it_fieldcatalog = lt_fields_range* IMPORTING* ep_table = dref* EXCEPTIONS* generate_subpool_dir_full = 1* OTHERS = 2.** IF sy-subrc NE 0.* RAISE erro_dynamic_table.* ENDIF.** ASSIGN dref->* TO <f_t_filter1>.* CREATE DATA dref LIKE LINE OF <f_t_filter1>.* ASSIGN dref->* TO <f_s_filter1>.**** Alteração Bobis LOOPAT i_filter-
zcl_data_filter1 INTO ls_data_filter. CONCATENATE '<f_s_filter1>' ls_columns INTO lv_field_filter SEPARATED BY '-'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter1> TO <f_t_filter1>. ENDLOOP. ELSE. break sap857850. REFRESH lt_fields_range. CLEAR ls_fields_range.* cria field range para receber valores do filtro ls_fields_range-fieldname = 'SIGN'. ls_fields_range-datatype = 'CHAR'. ls_fields_range-outputlen = 1. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'OPTION'. ls_fields_range-datatype = 'CHAR'. ls_fields_range-outputlen = 2. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'LOW'. ls_fields_r
I_SOURSYSTEM Importing Type RSSOURSYSID Source System
I_OBJECT_NAME Importing Type RSIOBJNM InfoObjeto
I_TIME_DEPENDENT Importing Type CHAR1 'X' or ''
I_OBJECT_TYPE Importing Type RSTLOGO 'IOBJ' (InfoObjeto), 'ODSO' (Objeto DataStore), or 'VIEW'
I_IGNORE_SOURCE_SYSTEM Importing Type CHAR1 'X' or '' (default tem sourcesystem)
E_T_MESSAGES Exporting Type RSU5_T_MESSAGES Log de aplicação: interface para Business Add Ins
E_OBJECT_NAME Exporting Type STRING Object Name
METHOD zcl_isu_get_object_name.
DATA: BEGIN OF ls_rsdchabas,
chabasnm TYPE rschabasnm,
chatp TYPE rschatp,
attribfl TYPE rsattribfl,
timdepfl TYPE rstimdepfl,
END OF ls_rsdchabas.
DATA: lv_soursystem(3).
DATA: lt_is_u_infobjects TYPE RANGE OF rsattrinm.
DATA: ls_is_u_infobjects LIKE LINE OF lt_is_u_infobjects.
DATA: lv_e_tablnm TYPE tabname.
DATA: lv_e_chktab TYPE rsdchkview,
lv_e_chntab TYPE rschntab.
DATA: lv_chabasnm TYPE rschabasnm.
DATA: lv_soursystem_view TYPE string.
IF ( i_soursystem NE 'RS' ) AND
( i_soursystem NE 'BS' ) AND
( i_soursystem NE 'PS' ).
RAISE source_system_no_good.
ENDIF.
* source system
CONCATENATE 'ZC' i_soursystem INTO
lv_soursystem.
*
CASE i_object_type.
* infoobjetc
WHEN 'IOBJ'.
* verifica se o infoobjeto existe
SELECT SINGLE chabasnm chatp attribfl
timdepfl
INTO ls_rsdchabas
FROM rsdchabas
WHERE chabasnm = i_object_name
AND objvers = cv_objvers.
IF sy-subrc NE 0.
RAISE master_data_doesn_exist.
ENDIF.
* DSO
WHEN 'ODSO'.
lv_chabasnm = i_object_name.
REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm.
CALL METHOD cl_rsd_odso=>get_tablnm
EXPORTING
i_odsobject = lv_chabasnm
*    i_tabt        =
IMPORTING
e_tablnm = lv_e_tablnm
*    e_ttypename   =
*    e_viewnm      =
*    e_chnglognm   =
*    e_infosource  =
*    e_datasource  =
EXCEPTIONS
name_error = 1
input_invalid = 2
OTHERS = 3
.
IF sy-subrc <> 0.
RAISE dso_doesn_exist.
ENDIF.
* begin of insertion by SAP - 24.11.2008
* VIEW
WHEN 'VIEW'.
CONCATENATE '_' i_soursystem(1) '_' INTO lv_soursystem_view.
e_object_name = i_object_name.
REPLACE '_G_' WITH lv_soursystem_view INTO e_object_name.
* to be continued  (insert double check over table DDTYPES to insure
* that the view really exists
* end of insertion by SAP - 24.11.2008
WHEN OTHERS.
RAISE object_type_no_good.
ENDCASE.
* begin of insertion by SAP - 25.11.2008
IF i_object_type = 'IOBJ'.
ls_is_u_infobjects-sign = 'I'.
ls_is_u_infobjects-option = 'EQ'.
* 1) Dados Técnicos
* Instalação
ls_is_u_infobjects-low = '/BIC/ZCGINSTAL'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGINSTAL'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Local de Consumo
ls_is_u_infobjects-low = '/BIC/ZCGPREMIS'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGPREMIS'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Objeto de Ligação
ls_is_u_infobjects-low = '/BIC/ZCGCONOBJ'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGCONOBJ'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Device
ls_is_u_infobjects-low = '/BIC/ZCGDEVICE'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGDEVICE'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* 2) Dados Comerciais
* Parceiro de Negócio
ls_is_u_infobjects-low = '/BIC/ZCGBPARTN'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGBPARTN'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Contrato
ls_is_u_infobjects-low = '/BIC/ZCGCONTRA'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGCONTRA'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Conta-Contrato
ls_is_u_infobjects-low = '/BIC/ZCGACCOUN'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGACCOUN'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
* Conta-Contrato Parceiro
ls_is_u_infobjects-low = '/BIC/ZCGACNTBP'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ls_is_u_infobjects-low = 'ZCGACNTBP'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ELSE.
ls_is_u_infobjects-sign = 'I'.
ls_is_u_infobjects-option = 'EQ'.
* Registro dummy
ls_is_u_infobjects-low = 'DUMMY'.
APPEND ls_is_u_infobjects TO lt_is_u_infobjects.
ENDIF.
* begin of insertion by SAP - 02.12.2008
e_object_name = i_object_name.
IF e_object_name IN lt_is_u_infobjects.
REPLACE 'ZCG' WITH lv_soursystem INTO e_object_name.
ENDIF.
* end of insertion by SAP - 02.12.2008
IF i_object_type = 'IOBJ'.
lv_chabasnm = e_object_name.
* retornar configuração de dicionário para infoobjet
CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS'
EXPORTING
i_chabasnm = lv_chabasnm
*   I_NSPACEGEN       =
*   I_S_VIOBJ         =
*   I_T_ATR           =
IMPORTING
e_chktab = lv_e_chktab
e_chntab = lv_e_chntab
*   E_CHTTAB          =
*   E_TXTTAB          =
*   E_SIDTAB          =
*   E_SIDVIEW         =
*   E_ASITAB          =
*   E_ASISTR          =
*   E_ASTTAB          =
*   E_CHKNEW          =
EXCEPTIONS
name_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
RAISE erro_dynamic_table.
ENDIF.
* determina tabela para select
* de acordo com infoobjet
IF i_time_dependent = 'X' AND
ls_rsdchabas-timdepfl EQ 'X'.
* time-dependent table
e_object_name = lv_e_chktab.
ELSE.
* regular table
e_object_name = lv_e_chntab.
ENDIF.
* DSO
ELSE.
e_object_name = lv_e_tablnm.
ENDIF.
ENDMETHOD.
nge-ref_table = lv_dynamic_data_table. ls_fields_range-ref_field = <f_v_field>. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'HIGH'. ls_fields_range-ref_table = lv_dynamic_data_table. ls_fields_range-ref_field = <f_v_field>. APPEND ls_fields_range TO lt_fields_range.*** Alteração Bobis refresh comp_tab. clear comp_tab. LOOP AT lt_fields_range INTO ls_fields_range. clear op_len. if ls_fields_range-REF_FIELD(4) eq '/BIC'. w_iobj = ls_fields_range-REF_FIELD+5(10). else. concatenate '0' ls_fields_range-REF_FIELD into w_iobj. endif. select single CHABASNM from RSDCHA into w_iobj1 where CHANM = w_iobj and objvers = 'A'. if sy-subrc eq 0. select single OUTPUTLEN from RSDCHABAS into op_out where CHABASNM = w_iobj1 and objvers = 'A'. if sy-subrc eq 0. if sy-subrc eq 0. move op_out to ls_fields_range-outputlen. endif. endif. endif.
op_len = ls_fields_range-outputlen. comp-name = ls_fields_range-FIELDNAME. comp-type = cl_abap_elemdescr=>get_c( op_len ). APPEND comp TO comp_tab. CLEAR: comp. endloop. CALL METHOD cl_abap_structdescr=>create EXPORTING p_components = comp_tab p_strict = cl_abap_structdescr=>false RECEIVING p_result = struct_type. CLEAR tab_type . CALL METHOD cl_abap_tabledescr=>create EXPORTING p_line_type = struct_type p_table_kind = cl_abap_tabledescr=>tablekind_std RECEIVING p_result = tab_type.* CLEAR: dref.* CREATE DATA dref TYPE HANDLE tab_type.* ASSIGN dref->* TO <f_t_filter1>.* CREATE DATA t_data LIKE LINE OF <f_t_filter1>.* ASSIGN t_data->* TO <f_s_filter1>.* CALL METHOD cl_alv_table_create=>create_dynamic_table* EXPORTING* it_fieldcatalog = lt_fields_range* IMPORTING* ep_table = dref
* EXCEPTIONS* generate_subpool_dir_full = 1* OTHERS = 2.** IF sy-subrc NE 0.* RAISE erro_dynamic_table.* ENDIF.*** Alteração Bobis CASE lv_number.********************************************************************************************* Filtro 2**************************************************************************************** WHEN 2.*** Alteração Bobis CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter2>. CREATE DATA t_data LIKE LINE OF <f_t_filter2>. ASSIGN t_data->* TO <f_s_filter2>.* ASSIGN dref->* TO <f_t_filter2>.* CREATE DATA dref LIKE LINE OF <f_t_filter2>.* ASSIGN dref->* TO <f_s_filter2>.*** Alteração Bobis lv_field_filter = '<f_s_filter2>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter2>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. LOOP AT i_filter-zcl_data_filter2 INTO ls_data_filter. lv_field_filter = '<f_s_filter2>-low'.
ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter2> TO <f_t_filter2>. ENDLOOP.********************************************************************************************* Filtro 3**************************************************************************************** WHEN 3.*** Alteração Bobis CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter3>. CREATE DATA t_data LIKE LINE OF <f_t_filter3>. ASSIGN t_data->* TO <f_s_filter3>.* ASSIGN dref->* TO <f_t_filter3>.* CREATE DATA dref LIKE LINE OF <f_t_filter3>.* ASSIGN dref->* TO <f_s_filter3>.*** Alteração Bobis lv_field_filter = '<f_s_filter3>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter3>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. refresh <f_t_filter3>. LOOP AT i_filter-zcl_data_filter3 INTO ls_data_filter. lv_field_filter = '<f_s_filter3>-low'. ASSIGN (lv_field_filter) TO <f_v_field>.
<f_v_field> = ls_data_filter. APPEND <f_s_filter3> TO <f_t_filter3>. ENDLOOP.********************************************************************************************* Filtro 3**************************************************************************************** WHEN 4. CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter4>. CREATE DATA t_data LIKE LINE OF <f_t_filter4>. ASSIGN t_data->* TO <f_s_filter4>.* ASSIGN dref->* TO <f_t_filter4>.* CREATE DATA dref LIKE LINE OF <f_t_filter4>.* ASSIGN dref->* TO <f_s_filter4>.*** Alteração Bobis lv_field_filter = '<f_s_filter4>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter4>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. refresh <f_t_filter4>. LOOP AT i_filter-zcl_data_filter4 INTO ls_data_filter. lv_field_filter = '<f_s_filter4>-low'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter.
APPEND <f_s_filter4> TO <f_t_filter4>. ENDLOOP. ENDCASE. ENDIF. ENDIF. ELSE. EXIT. ENDIF. ENDIF. ENDDO. ENDIF.* end of insertion by SAP - 26.11.2008* filtro 1 IF <f_t_filter1> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter1. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where* condição where CONCATENATE ls_columns ' EQ <f_t_filter1>-' ls_columns INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 2 IF <f_t_filter2> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter2. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter2>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 3 IF <f_t_filter3> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where.
ENDIF. ls_columns = i_filter-zcl_filter3. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter3>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 4 IF <f_t_filter4> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter4. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter4>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* faz select infoobject IF <f_t_filter1> IS ASSIGNED. SELECT (lt_columns) FROM (lv_dynamic_data_table) INTO TABLE e_t_table FOR ALL ENTRIES IN <f_t_filter1> WHERE (lt_where). ELSE. SELECT (lt_columns) FROM (lv_dynamic_data_table) INTO TABLE e_t_table WHERE (lt_where). ENDIF.ENDMETHOD.

Weitere ähnliche Inhalte

Was ist angesagt?

Technical Overview of CDS View – SAP HANA Part I
Technical Overview of CDS View – SAP HANA Part ITechnical Overview of CDS View – SAP HANA Part I
Technical Overview of CDS View – SAP HANA Part IAshish Saxena
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infosapdocs. info
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantAnkit Sharma
 
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...Luc Vanrobays
 
How to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwHow to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwLuc Vanrobays
 
Technical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IITechnical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IIAshish Saxena
 
How to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selectionHow to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selectionValko Arbalov
 
Customer exit variables in sap
Customer exit variables in sapCustomer exit variables in sap
Customer exit variables in sapSidharth Sriram
 
Introduction to SAP Gateway and OData
Introduction to SAP Gateway and ODataIntroduction to SAP Gateway and OData
Introduction to SAP Gateway and ODataChris Whealy
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systemsKranthi Kumar
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialscesarmendez78
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfKoushikGuna
 
Call transaction method
Call transaction methodCall transaction method
Call transaction methodKranthi Kumar
 
Creating new unit of measure in sap bw
Creating new unit of measure in sap bwCreating new unit of measure in sap bw
Creating new unit of measure in sap bwRajat Agrawal
 
User exits
User exitsUser exits
User exitsanilkv29
 
SAP Variant configuration
SAP Variant configurationSAP Variant configuration
SAP Variant configurationKumbum Ramesh
 

Was ist angesagt? (20)

Technical Overview of CDS View – SAP HANA Part I
Technical Overview of CDS View – SAP HANA Part ITechnical Overview of CDS View – SAP HANA Part I
Technical Overview of CDS View – SAP HANA Part I
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.info
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional Consultant
 
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...
Dmm300 – mixed scenarios for sap hana data warehousing and BW: overview and e...
 
CDS Views.pptx
CDS Views.pptxCDS Views.pptx
CDS Views.pptx
 
How to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bwHow to use abap cds for data provisioning in bw
How to use abap cds for data provisioning in bw
 
Technical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part IITechnical Overview of CDS View - SAP HANA Part II
Technical Overview of CDS View - SAP HANA Part II
 
How to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selectionHow to write a routine for 0 calday in infopackage selection
How to write a routine for 0 calday in infopackage selection
 
Customer exit variables in sap
Customer exit variables in sapCustomer exit variables in sap
Customer exit variables in sap
 
Introduction to SAP Gateway and OData
Introduction to SAP Gateway and ODataIntroduction to SAP Gateway and OData
Introduction to SAP Gateway and OData
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systems
 
SAP-ABAP/4@e_max
SAP-ABAP/4@e_maxSAP-ABAP/4@e_max
SAP-ABAP/4@e_max
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdf
 
Call transaction method
Call transaction methodCall transaction method
Call transaction method
 
Creating new unit of measure in sap bw
Creating new unit of measure in sap bwCreating new unit of measure in sap bw
Creating new unit of measure in sap bw
 
User exits
User exitsUser exits
User exits
 
SAP Variant configuration
SAP Variant configurationSAP Variant configuration
SAP Variant configuration
 

Ähnlich wie Abap Objects for BW

Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1bharath yelugula
 
Abap Inicio
Abap InicioAbap Inicio
Abap Iniciounifor
 
ABAP Object oriented concepts
ABAP Object oriented conceptsABAP Object oriented concepts
ABAP Object oriented conceptsDharmeshKumar49
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4dplunkett
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad NicheTech Com. Solutions Pvt. Ltd.
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptmanomkpsg
 
Learn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceLearn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceEng Teong Cheah
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)Khaled Anaqwa
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable typevinay arora
 
Class objects oopm
Class objects oopmClass objects oopm
Class objects oopmShweta Shah
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 eehomeworkping9
 
Java Basics Presentation
Java Basics PresentationJava Basics Presentation
Java Basics PresentationOmid Sohrabi
 

Ähnlich wie Abap Objects for BW (20)

Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1Objectorientedprogrammingmodel1
Objectorientedprogrammingmodel1
 
Abap Inicio
Abap InicioAbap Inicio
Abap Inicio
 
ABAP Object oriented concepts
ABAP Object oriented conceptsABAP Object oriented concepts
ABAP Object oriented concepts
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4
 
Classes2
Classes2Classes2
Classes2
 
Java defining classes
Java defining classes Java defining classes
Java defining classes
 
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
Cocoa and MVC in ios, iOS Training Ahmedbad , iOS classes Ahmedabad
 
Java basics
Java basicsJava basics
Java basics
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.ppt
 
Learn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & InheritanceLearn C# Programming - Classes & Inheritance
Learn C# Programming - Classes & Inheritance
 
BIT211_3.pdf
BIT211_3.pdfBIT211_3.pdf
BIT211_3.pdf
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 
3 java - variable type
3  java - variable type3  java - variable type
3 java - variable type
 
VB.net
VB.netVB.net
VB.net
 
Ppt chapter05
Ppt chapter05Ppt chapter05
Ppt chapter05
 
Class objects oopm
Class objects oopmClass objects oopm
Class objects oopm
 
Java Basics
Java BasicsJava Basics
Java Basics
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
 
Java Basics Presentation
Java Basics PresentationJava Basics Presentation
Java Basics Presentation
 
Oops
OopsOops
Oops
 

Mehr von Luc Vanrobays

Introduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds viewsIntroduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds viewsLuc Vanrobays
 
Sap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypesSap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypesLuc Vanrobays
 
BW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loadsBW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loadsLuc Vanrobays
 
Build and run an sql data warehouse on sap hana
Build and run an sql data warehouse on sap hanaBuild and run an sql data warehouse on sap hana
Build and run an sql data warehouse on sap hanaLuc Vanrobays
 
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2Luc Vanrobays
 
Dmm203 – new approaches for data modelingwith sap hana
Dmm203 – new approaches for data modelingwith sap hanaDmm203 – new approaches for data modelingwith sap hana
Dmm203 – new approaches for data modelingwith sap hanaLuc Vanrobays
 
Text analysis matrix event 2015
Text analysis matrix event 2015Text analysis matrix event 2015
Text analysis matrix event 2015Luc Vanrobays
 
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA Luc Vanrobays
 
DMM270 – Spatial Analytics with Sap Hana
DMM270 – Spatial Analytics with Sap HanaDMM270 – Spatial Analytics with Sap Hana
DMM270 – Spatial Analytics with Sap HanaLuc Vanrobays
 
Dmm212 – Sap Hana Graph Processing
Dmm212 – Sap Hana  Graph ProcessingDmm212 – Sap Hana  Graph Processing
Dmm212 – Sap Hana Graph ProcessingLuc Vanrobays
 
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and Predictive
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and PredictiveDmm117 – SAP HANA Processing Services Text Spatial Graph Series and Predictive
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and PredictiveLuc Vanrobays
 
What is mmd - Multi Markdown ?
What is mmd - Multi Markdown ?What is mmd - Multi Markdown ?
What is mmd - Multi Markdown ?Luc Vanrobays
 
Dmm300 - Mixed Scenarios/Architecture HANA Models / BW
Dmm300 - Mixed Scenarios/Architecture HANA Models / BWDmm300 - Mixed Scenarios/Architecture HANA Models / BW
Dmm300 - Mixed Scenarios/Architecture HANA Models / BWLuc Vanrobays
 
DMM161_2015_Exercises
DMM161_2015_ExercisesDMM161_2015_Exercises
DMM161_2015_ExercisesLuc Vanrobays
 
DMM161 HANA_MODELING_2015
DMM161 HANA_MODELING_2015DMM161 HANA_MODELING_2015
DMM161 HANA_MODELING_2015Luc Vanrobays
 
EA261_2015_Exercises
EA261_2015_ExercisesEA261_2015_Exercises
EA261_2015_ExercisesLuc Vanrobays
 
Tech ed 2012 eim260 modeling in sap hana-exercise
Tech ed 2012 eim260   modeling in sap hana-exerciseTech ed 2012 eim260   modeling in sap hana-exercise
Tech ed 2012 eim260 modeling in sap hana-exerciseLuc Vanrobays
 
Sap esp integration options
Sap esp integration optionsSap esp integration options
Sap esp integration optionsLuc Vanrobays
 

Mehr von Luc Vanrobays (20)

Introduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds viewsIntroduction to extracting data from sap s 4 hana with abap cds views
Introduction to extracting data from sap s 4 hana with abap cds views
 
Sap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypesSap bw4 hana architecture archetypes
Sap bw4 hana architecture archetypes
 
BW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loadsBW Adjusting settings and monitoring data loads
BW Adjusting settings and monitoring data loads
 
Build and run an sql data warehouse on sap hana
Build and run an sql data warehouse on sap hanaBuild and run an sql data warehouse on sap hana
Build and run an sql data warehouse on sap hana
 
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2
Bi05 fontes de_dados_hana_para_relatorios_presentação_conceitual_2
 
Dmm203 – new approaches for data modelingwith sap hana
Dmm203 – new approaches for data modelingwith sap hanaDmm203 – new approaches for data modelingwith sap hana
Dmm203 – new approaches for data modelingwith sap hana
 
Text analysis matrix event 2015
Text analysis matrix event 2015Text analysis matrix event 2015
Text analysis matrix event 2015
 
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
Dmm302 - Sap Hana Data Warehousing: Models for Sap Bw and SQL DW on SAP HANA
 
DMM270 – Spatial Analytics with Sap Hana
DMM270 – Spatial Analytics with Sap HanaDMM270 – Spatial Analytics with Sap Hana
DMM270 – Spatial Analytics with Sap Hana
 
Dmm212 – Sap Hana Graph Processing
Dmm212 – Sap Hana  Graph ProcessingDmm212 – Sap Hana  Graph Processing
Dmm212 – Sap Hana Graph Processing
 
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and Predictive
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and PredictiveDmm117 – SAP HANA Processing Services Text Spatial Graph Series and Predictive
Dmm117 – SAP HANA Processing Services Text Spatial Graph Series and Predictive
 
What is mmd - Multi Markdown ?
What is mmd - Multi Markdown ?What is mmd - Multi Markdown ?
What is mmd - Multi Markdown ?
 
Dmm300 - Mixed Scenarios/Architecture HANA Models / BW
Dmm300 - Mixed Scenarios/Architecture HANA Models / BWDmm300 - Mixed Scenarios/Architecture HANA Models / BW
Dmm300 - Mixed Scenarios/Architecture HANA Models / BW
 
Dev104
Dev104Dev104
Dev104
 
DMM161_2015_Exercises
DMM161_2015_ExercisesDMM161_2015_Exercises
DMM161_2015_Exercises
 
DMM161 HANA_MODELING_2015
DMM161 HANA_MODELING_2015DMM161 HANA_MODELING_2015
DMM161 HANA_MODELING_2015
 
EA261_2015_Exercises
EA261_2015_ExercisesEA261_2015_Exercises
EA261_2015_Exercises
 
EA261_2015
EA261_2015EA261_2015
EA261_2015
 
Tech ed 2012 eim260 modeling in sap hana-exercise
Tech ed 2012 eim260   modeling in sap hana-exerciseTech ed 2012 eim260   modeling in sap hana-exercise
Tech ed 2012 eim260 modeling in sap hana-exercise
 
Sap esp integration options
Sap esp integration optionsSap esp integration options
Sap esp integration options
 

Kürzlich hochgeladen

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Kürzlich hochgeladen (20)

The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

Abap Objects for BW

  • 1. Luc Vanrobays SAP Brasil Ltda InfoDay São Paulo, Maio 2010 luc.vanrobays@sap.com ABAP OO for BW
  • 2. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods Agenda
  • 3. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods Agenda
  • 4. What Are Objects  SAP AG 1999 What Are Objects? Tree House Crane  Objects are an abstraction of the real world  Objects are units made up of data and of the functions belonging to that data Real world Model Data Method Method Method Data Method Method Method Data Method Method Method Boat Data Method Method Method
  • 5. Classes Classes are the central element of object-orientation. A Class is an abstract description of an object. Classes are templates for objects. The attributes of objects are defined by the components of the class, which describe the state and behavior of objects. You define global classes and interfaces in the Class Builder (Transaction SE24) in the ABAP Workbench. They are stored centrally in class pools in the class library in the R/3 Repository. All of the ABAP programs in an R/3 System can access the global classes.
  • 6. An ABAP OO Class – Transaction SE24
  • 7. ABAP Objects - Class Components Visibility Sections:  Public  Protected Private Attributes Methods Types Events Interfaces Friends
  • 8. Class Visibility Sections These sections define the external visibility of the class components and therefore the interfaces of the class for their users. Each component of a class must be explicitly assigned to one of the visibility sections. Public visibility section All components declared in the public visibility section defined with PUBLIC SECTION are accessible to all users as well as in the methods of all heirs and the class itself. The public components are the interface of the class to each user. Protected visibility section All components declared in the protected visibility section defined with PROTECTED SECTION are accessible in the methods of all heirs and in the class itself. The protected components form a specific interface between the class and its subclasses. Private visibility section All components declared in the private visibility section defined with PRIVATE SECTION are only accessible in the class itself, and are also not visible to the heirs. The private components therefore do not form an interface to the users of the class.
  • 10. Class Attributes Attributes Attributes are internal data objects of any ABAP data type within a class. The content of the attributes specifies the status of the object. You can also define reference variables, which you can then use to create and address objects. This allows objects to be accessed within classes. Attributes are defined in the declaration part of a class. Public attributes are completely visible from outside the class and as such are part of the interface between objects and their user. To encapsulate the status of the object, you need to use protected or private attributes. You can also limit the changeability of attributes using the READ-ONLY addition during the declaration. Instance Attributes The content of instance attributes forms the instance-specific status of the object. Instance attributes are declared using the DATA statement. Static Attributes The content of static attributes forms the instance-independent status of the object, which is valid for all instances of the class. Static attributes are available once for each class. They are declared using the CLASS-DATA statement and are retained throughout the entire runtime. All the objects within a class can access its static attributes. Changes to a static attribute in an object are visible to all other objects within that class.
  • 11. Class Attributes - Types The Attribute “Type” definition can be maintained in the “Types” section of the Class – More on Types follows.
  • 12. Class Methods Methods Methods are internal procedures of a class that determine the behavior of an object. They can access all the attributes of their class and can thus change the object status. Methods have a parameter interface, through which the system passes values to them when they are called, and through which they can return values to the caller. The private attributes of a class can only be changed using methods, of the class owning the method. You can declare local data types and data objects in methods, just as in all procedures. Methods are called using the CALL METHOD statement or one of its abbreviated forms. You can also call the method dynamically (dynamic invoke).
  • 13. Methods Instance methods: Instance methods are declared using the METHODS statement. They can access all the attributes of a class and can trigger all its events. Require Instantiation of the Class – CREATE OBJECT Static methods: Static methods are declared using the CLASS-METHODS statement. They can access static attributes of a class and are allowed only to trigger static events. Do not require instantiation Can be used / Called w/o instantiation or reference to an instance Do not rely on the state of an instance
  • 15. Constructor Methods Constructors are special methods that produce a defined initial state for objects and classes. The state of an object is determined by its instance attributes and static attributes. You can assign contents to attributes using the VALUE addition in the DATA statement. Constructors are necessary when you want to set the initial state of an object dynamically. Like normal methods, there are two types of constructor - instance constructors and static constructors. Instance Constructors Each class has one instance constructor. It is a predefined instance method of the constructor class. If you want to use the instance constructor, the constructor method must be declared in the declaration part of the class using the METHODS statement. Unless it is explicitly declared, the instance constructor is an implicit method, which inherits and accesses the interface from the instance constructor in the upper class. Static Constructors Each class has a single static constructor. This is a predefined, public, static method of the class named constructor. If you want to use the static constructor, you must declare the static method class_constructor in the public section of the declaration part of the class using the CLASS-METHODS statement, and implement it in the implementation part. The static constructor has no interface parameters and cannot trigger exceptions. Unless you implement it explicitly it is merely an empty method. The static constructor is executed once in each program. It is called automatically for the class before the class is accessed for the first time
  • 16. Constructor Methods method CONSTRUCTOR. select * from /BIC/PZCITY into CORRESPONDING FIELDS OF TABLE IT_CITY_SIZ where objvers = 'A'. SORT IT_CITY_SIZ by /BIC/ZCITY. endmethod. method CONSTRUCTOR. select * from /BIC/PZCITY into CORRESPONDING FIELDS OF TABLE IT_CITY_SIZ where objvers = 'A'. SORT IT_CITY_SIZ by /BIC/ZCITY. endmethod.
  • 17. Data Types and Constants Data types Independent types The TYPES statement can be used to define any number of your own ABAP data types within a class. Types are not instance-specific and are only available once for all the objects in the class. As of release 6.40, it is possible to define data types in the public visibility section. Bound data types Bound data types that occur as properties of instance or static attributes also belong to the static attributes of a class. After a LIKE addition, the class name can be used to access the properties of instance attributes (exceptions to this rule are the statements ASSIGN ... CASTING and SELECT-OPTIONS ... FOR). In addition, a reference variable can be used with an object component selector without the object having previously been generated. Constants Constants are special static attributes, whose values are specified when they are declared and which cannot be changed later. Use the CONSTANTS statement to declare constants. Constants are not instance-specific - they only once for all the objects in the class. As of release 6.40, it is possible to define constants in the public visibility section of global classes.
  • 18. Data Types and Constants – Support All ABAP Types
  • 19. Events In ABAP Objects, events are declared as components of classes. SAP makes a distinction between instance events and static events. Triggers and handlers can be objects and classes, depending on whether they are instance events, static events, or event handler methods. Instance events Instance events are declared using the EVENTS statement. They can only be triggered in instance methods. Static events Static events are declared using the CLASS-EVENTS statement. All methods (instance or static) can trigger them, but only static events can be triggered by static methods.
  • 20. Interfaces The components of a class are divided into visibility sections, and this forms the external point of contact between the class and its users. For example, the components of the public section form the public interface of the class, since all attributes and method parameters can be accessed by any user. The protected components form an interface between the class and those classes that inherit from it (subclasses). Interfaces are independent structures that allow you to enhance the class-specific public points of contact by implementing them in classes. Different classes that implement the same interface can all be addressed in the same way. Interfaces are the basis for polymorpism in classes because they allow a single interface method to behave differently in different classes. Interface reference variables Interface references allow users to address different classes in the same manner. Interfaces can also be nested.
  • 21. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 22. The Motivation For BW Consultants I see three motivating factors: Reusability Organization / Consistency especially in transformations Modern Approach to ABAP
  • 23. Note: Regarding the Location of the Scenario Samples The samples of the scenarios that follow can be found in the BW7 Sandbox, with the exception of the Scenario BADI for BW Loading which is located in the corresponding ECC source system E60 client 001.
  • 24. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 25. Calling Class Methods in BW Routines Once a class / class method has been created & activated, the easiest way to call the class method is through the ABAP editor “Patterns” pushbutton. Enter or F4 for a list of the class methods
  • 26. Scenario – Class Methods in Transformations We will be working with the transformation from Infocube 0D_SD_C03 (source) to InfoCube Z0DSD_C03 (target). In the target InfoCube we have added the City Size (ZCITSIZ), which is determined using the city of the sold to and looking up the city size which is an attribute of the InfoObject ZCITY. We have defined a class named ZCL_BW_TRAN_FKOM09, which contains the Methods: FILL_IT_CIT_SIZ - Fills the internal table IT_CITY_SIZ of the class GET_CITY_SIZ_VIA_SOLDTO – Using sold to, determines sold to city, then looks up city size in the internal table IT_CITY_SIZ . Lets review the class & methods.
  • 27. Scenario – Class Methods in Transformations In the Start Routine of the transformation from Infocube 0D_SD_C03 to InfoCube Z0DSD_C03, we will call the method FILL_IT_CIT_SIZ .
  • 28. Scenario – Class Methods in Transformations In the transformation rule for the characteristic ZCITSIZ we will use The source field 0D_ SOLD_TO and rule type routine where we will call the GET_CITY_SIZ_VIA_SOLDTO.
  • 29. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 30. Scenario – The Class Constructor The purpose of this scenario is to demonstrate how the class constructor behaves in terms of producing a defined initial state for class objects, once the class is instantiated. We will use the ABAP program ZSHOW_CONSTRUCTOR, which instantiates the ZCL_BW_TRAN_FKOM09 class, and then calls the GET_CITY_SIZ_VIA_SOLDTO method. In our prior example we filled the internal table IT_CITY_SIZ by calling the method FILL_IT_CIT_SIZ in our start routine. In this example the internal table is filled through the CONSTUCTOR method once the class is instantiated. Let’s take a look at this through the ABAP Editor & then use the debugger to show how the constructor fills the internal table.
  • 31. Scenario – The Class Constructor REPORT ZSHOW_CONSTRUCTOR. data: Xobject type ref to ZCL_BW_TRAN_FKOM09. data: zout type c length 1. ************************************************************************ *  S E L E C T I O N  S C R E E N ************************************************************************ parameters: p_soldto TYPE /BI0/OID_SOLD_TO obligatory. ************************************************************************ *  Process by Instantiating a class implementation which has the effect *  of setting the initial state of class objects such as class attributes *  by executing the CLASS CONSTRUCTOR. *  In this example the class attribute 'IT_CITY_SIZ' an internal table *  is filled by the CLASS CONSTRUCTOR, then the method *  'GET_CITY_SIZ_VIA_SOLDTO' is executed. ************************************************************************ create object xobject. CALL METHOD ZCL_BW_TRAN_FKOM09=>GET_CITY_SIZ_VIA_SOLDTO EXPORTING IN_SOLD_TO = p_soldto IMPORTING OUT_CIT_SIZ = zout. write: /01 text-001, sy-repid, 40 text-002 INTENSIFIED ON, 100 text-003, sy-datum, space. write: /01 text-004, sy-uname, 40 text-005, 60 text-006, sy-uzeit, space. write: /. write: /01 text-007, p_soldto, 40 text-008, zout.
  • 32. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 33. Scenario – Class Methods in the Userexit for Variables In this scenario we will use the class ZCL_BW_TRAN_FKOM09 method ZVAR_GET12MOS_FRM_LASTCL in the SAP provided userexit for variables EXIT_SAPLRRS0_001. We need a Bex Variable that will determine an interval for the time characteristic 0CALMONTH ending with the last closed month as determined in TVARVC and beginning with the month 11 months before the last closed month. The TVARV variable Z_LAST_CLOSED_MONTH will hold the last closed month (transaction STVARV). Let’s take a look at the method & run it through in the test mode. We can also use Query ZJPL_ABAPOO_METH_VAR_USEREXIT to verify our results, then re-run the query after changing the value of the TVARVC variable Z_LAST_CLOSED_MONTH via STVARV.
  • 34. Scenario – Class Methods in the Userexit for Variables CASE I_VNAM. WHEN 'ZVAR_CALMON_INTVL_TVARVC_LST12'. IF i_step EQ 2. CALL METHOD ZCL_BW_TRAN_FKOM09=>ZVAR_GET12MOS_FRM_LASTCL IMPORTING L_S_RANGE = L_S_RANGE. endif. APPEND L_S_RANGE TO E_T_RANGE. ENDCASE.
  • 35. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 36. Scenario - Custom Functions in the Formula Builder BAdI: Customer-defined Functions in Formula Builder Use This Business Add-In (BAdI) is used in the formula builder transformation library. You use this BAdI to integrate user-defined functions into the transformation library of the formula builder. In this way, you can make special functions that are not contained in the standard delivery available for Transfer Rules, Update Rules, Transformations, Process Chain Process Types, APD’s etc. Requirements The technical name of a user-defined function Must be specified Must be unique Must begin with 'C_' Can contain only alphanumeric characters ( ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_) (lower- case letters, empty spaces and special characters are not allowed) Can be a maximum of 61 characters long. Standard settings The BAdI can be used repeatedly. Is it not filter-dependent. Activities After you have called up the IMG activity, a dialog box appears in which you enter a name for implementation. If implementations have already been created for this BAdI, a dialog box appears in which the existing implementations are displayed. In this dialog box, choose Create and proceed as follows: Continued on next Slide
  • 37. Custom Functions in the Formula Builder Steps Continued from prior Slide: 1. In the Implementation field, enter a name for the implementation of the BAdIs and choose Create. 2. The initial screen for creating BAdI implementations appears. 3. In the initial screen, in the Short Text for Implementation field, enter a short text for the implementation. 4. Choose the Interface tab index. 5. On the tab page, the field Name of Implemented Class is filled automatically, since the system assigns a class name based on the name of your implementation. 6. Save your entries and assign the implementation to a development class. 7. Position the cursor on the method and double-click on it to reach the method editing screen. 8. Between the statements method <Interface Name>~<Name of Method>. and endmethod. the coding for your implementation. 9. Save and activate your coding and return to the Change Implementation screen. 10. Save your entries on the Change Implementation screen. Note: You can create an implementation for a BAdI and activate it later. If this is the case, close the editing screen now. 11. Choose Activate. When you execute the application program, the coding you defined in the method is executed
  • 38. Custom Formula (Fox) in Alternate Decision Process Type (0) Scenario I – when to condense ? In order to decide when is the rigth time to operate some Process Type (Condense InfoProvider, Delete Change Log, Delete PSA etc..) that might have a negative impact on Perfromance at the wrong moment: We set up the Alternate Decision Step in our Process Chain along with a Z Custom Fox Formula with Multiple Alternatives (IF-ELSEIF-ELSEIF-ENDIF) and a Z custom decision table that have criterias such as InfoProvider, Process Type and Rule Type (Odd-Even Days, Daily, Weekly, Monthly, Other)  D Daily between 0600 PM and 0900 AM.  M > will happen only the last day of the month (18:00 till 12:00 next day)  M Mês = 7 and Valor Livre = 23 wil happen only on 23 July YYYY (Any Year)  A and Valor Livre = 1 > Process Type will happen on Even Days: Tuesday(2)-Thursday(4)-Saturday(6)  A and Valor Livre = ‘’ > Process Type will happen on Odd Days : Monday(1)-Wened(3)-Friday(5)-Sunday(7)  M and Valor Livre = ‘20090725’ – Selected day – anytime.  S and WeekDay1 = 5 > Will Process Weekly On Friday
  • 39. Custom Formula (Fox) in Alternate Decision (5) – When to Condense ? - ZTABLE
  • 40. Custom Formula (Fox) in Alternate Decision Process Type (1) Scenario I – when to condense ?
  • 41. Custom Formula (Fox) in Alternate Decision Process Type (2) Scenario I – when to condense ?
  • 42. Custom Formula (Fox) in Alternate Decision Process Type (3) Scenario I – when to condense ? To merge this result with the decision process step development we will go through the steps quickly here: Activate the BADI RSAR_CONNECTOR Integration of self-defined functions in the transformation library of the formula builder(See document: Enhancements in SAP BW by Gary Nolan Know - How Network Call March 31, 2004) In SE18 create new implementation: And here are the two screens after clicking Display/Change: And the Interface tab: Create new class ZCL_IM_CL_BW_FORM_BUILDER. For this class implement interface: IF_EX_RSAR_CONNECTOR. For this interface implement one method: IF_EX_RSAR_CONNECTOR~GET. Here is the code under the method IF_EX_RSAR_CONNECTOR~GET. Read the comments in the code. These are largely transparent and useful. Most of this code is provided by SAP.
  • 43. Custom Formula (Fox) in Alternate Decision Process Type (3) Custom = User-Defined Functions We created a boolean custom formula function C_COMP_CUBO with two parameters : InfoProvider and Process Type
  • 44. Custom Formula (Fox) in Alternate Decision Process Type (4) Custom = User-Defined Functions We have created a boolean custom formula function C_COMP_CUBO with two parameters : InfoProvider and Process Type We created a Z decision Table to define the specific processing
  • 45. Custom Formula (Fox) in Alternate Decision (5) – When to Condense or Delete Chge Log ? METHOD check_compression_rule. * Methodo precisa de um parametro a providenciar na FOX Formula *  Infoprovider * Methodo precisa de um parametro a providenciar na FOX Formula *  Infoprovider * Retorna um Booleano 'X' se for o momento de processar *Compressão - Deleção Chge Log - Deleção PSA Etc *ABAP  Programa ABAP *AGGRFILL  Preenchimento inicial de novos agregados *ARCHIVE  Arquivar dados de um InfoProvider *ATTRIBCHAN  Execução de modificação de atributo *BIAINDEX  Ativação inicial e preenchimento de índices BI accelerator *CHAIN  Cadeia de processos local *CHGLOGDEL  Eliminação de requisições do log de modificação *CLEARTODS  Elimina conteúdo total do ODS transacional acoplado *COMMAND  Comando do sistema operacional *COMPRESS  Comprimir InfoCubo *CPS_EVENT  Evento em CPS SAP (Redwood) *CPS_JOB  Job em CPS SAP (Redwood) *DATACHANGE  Acionar evento modificação de dados (p/BEx Broadcaster) *DBSTAT  Estruturar estatística do banco de dados *DROPCUBE  Eliminação completa do conteúdo do destino de dados
  • 46. Custom Formula with Alternate Decision – Scenario II (1) – Set the Semaphore Use Decision Process Type and a Custom Formula to Control Process Chain Flow Scenario: This is a simple test scenario designed to illustrate the technique. You have a task to execute different branches of a Process Chain depending on conditions in the System. These conditions can be determined via ABAP code. The conditions could be : state of data, date, time, factory calendar or other settings changed by the user, etc., This Scenario can also set a semaphore (in TVARVC) as STOP or CONTINUE if some conditions are or are not met.
  • 47. Custom Formula with Alternate Decision – Scenario II (2) – Set the Semaphore Here is the final chain you have to deliver: The Start step of the chain is triggered by an event. The second step, the decision process type, directs the flow and either: 1) runs the ABAP process step - wait one minute - and subsequently the ABAP process step - continue(trigger event), or 2) runs the ABAP process step - wait two minute- and terminates, or 3) errors out, in case the state could not be defined, and terminates. 4) In addition, in our example, the event triggered is the same event which starts the chain.
  • 48. Custom Formula with Alternate Decision – Scenario II (3) – Set the Semaphore Consequently, in case 1) the chain will restart and continue executing (will loop) until conditions change and the decision process type directs it to 2) or 3). For the purpose of our example we created a record in TVARV table with key: NAME = ZDW_CONTROL. We control the flow by changing the value of field LOW. Possible values are ‘STOP’ or 'CONTINUE'. Any other value will cause Decision to error out. Here is how this entry looks: Or: Creating the elements: To achieve the above result, the most complicated part is creating a custom formula. This is very well documented by SAP (see references at the end).
  • 49. Custom Formula with Alternate Decision – Scenario II (4) - IF_EX_RSAR_CONNECTOR~GET Code All this method does is to append a formula to the list of available formulas METHOD if_ex_rsar_connector~get. DATA: l_function TYPE sfbeoprnd. * Structure with the description of the function CASE i_key. *      importing parameter: key with the function category WHEN 'CUSTOM'. * The BAdI implementation is always accessed with the ‘CUSTOM’ key. CLEAR l_function. l_function-tech_name = 'C_COMP_CUBO'. * Aparece mais tarde no nome tecnico da coluna e preciso ser unico l_function-descriptn = 'Determina Se For Hora de Comprimir'. * Aparece mais tarde na coluna Dexcrição. l_function-class = 'Z_CL_FORMULAS'. * Nome da Classe que implementa o methodo que implementa a formula l_function-method = 'CHECK_COMPRESSION_RULE'. * Nome do Methodo que implementa a formula APPEND l_function TO c_operands. * Changing parameter: Table with descriptions of the function l_function-tech_name = 'C_CHECK_LOAD'. l_function-descriptn = 'Check Load'. l_function-class = 'Z_CL_FORMULAS'. l_function-method = 'CHECK_LOAD'. APPEND l_function TO c_operands. ENDCASE. ENDMETHOD. "IF_EX_RSAR_CONNECTOR~GET As a result you should see two formulas C_COMP_CUBO, C_ZDW_CHECK_LOAD in the formula screen:
  • 50. Custom Formula with Alternate Decision – Custom Formulas Availables (6)
  • 51. Custom Formula with Alternate Decision – Scenario II (6) - new method CHECK_LOAD In the newly created new class Z_CL_FORMULAS Implement another method: CHECK_LOAD Create this method with two parameters: CONTROL and RETURN
  • 52. Custom Formula with Alternate Decision – Scenario II (7) - new method CHECK_LOAD method CHECK_LOAD. * The control parameter allows multiple checks to be implemented: * We may have if,...elseif,...elseif,...else,...endif. statement * We created a record in table TVARV with name Z_PC_CONTROL * We can control the flow by changing *  the value of field LOW in the record: *  NAME = 'Z_PC_CONTROL' of table TVARV * ************************************************************************ data f_low like control. select single LOW into f_low from TVARV where NAME = 'Z_PC_CONTROL' and TYPE = 'P' and NUMB = '0000'. if f_low = control. return = 'X'. else. return = ''. endif. endmethod.
  • 53. Custom Formula with Alternate Decision – Scenario II (8) - new method CHECK_LOAD FUNCTION ZWRITE_TVARVC. *"---------------------------------------------------------------------- *"*"Interface local: *"  TABLES *"      T_VALUES STRUCTURE  TVARVC *"  EXCEPTIONS *"      UPDATE_FAILED *"      OTHERS *"---------------------------------------------------------------------- TYPES: l_values type tvarvc. DATA: s_values TYPE l_values. MOVE t_values to s_values. MODIFY tvarvc FROM s_values. IF SY-SUBRC = 0. COMMIT WORK. ELSE. RAISE UPDATE_FAILED. ENDIF. ENDFUNCTION.
  • 54. Custom Formula with Alternate Decision – Scenario II (9) – Decision Step Create the Decision step as follows: Customize the formulas: C_CHECK_LOAD( 'CONTINUE' ) And: C_CHECK_LOAD( 'STOP' ) ABAP code: In this example ABAP process steps wait one minute wait two minutes and after error just exit - Use the following report Z_CIGE_TIME_WAIT with different parameter settings:
  • 55. Custom Formula with Alternate Decision – Scenario II (8) - Z_CIGE_TIME_WAIT REPORT Z_CIGE_TIME_WAIT. PARAMETER: P_WAIT TYPE I, *           p_server LIKE MSXXLIST-NAME, P_event TYPE btceventid. START-OF-SELECTION. WAIT UP TO P_WAIT SECONDS. * The ABAP process step continue(trigger event) * uses metodo cl_batch_event=>raise to trigger event. CALL METHOD cl_batch_event=>raise EXPORTING i_eventid = p_event EXCEPTIONS excpt_raise_failed = 1 excpt_raise_forbidden = 3 excpt_unknown_event = 4 excpt_no_authority = 5 OTHERS = 6. CASE sy-subrc. WHEN 0. EXIT. WHEN 1 OR 3. RAISE raise_failed. WHEN 4. RAISE eventid_does_not_exist. WHEN OTHERS. RAISE raise_failed. ENDCASE.
  • 56. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 57. Scenario: - BADI for BW Loading - RSU5_SAPI_BADI Scenario: Need to Enhance 2LIS_03_BF with MBEW-VPRSV Price Control (MAC or Standard). Since this can change month to month customer wants the value of VPRSV at the time of Material Doc Creation. Note:Normally this should be handled via SMOD MCB10001 in a CMOD implementation, but due to constraints on suitable datasources of the sandbox application tables with data in the I chose 2LIS_03_ITM to demonstrate the load BADI. Steps Taken in month to month customer wants the value of VPRSV at the time of Material Doc Creation. VIA SE11 added the field VPRSV to structure MCMSEGUSR. VIA LBWE Maintained the 2LIS_03_BF STRUCTURE - Transferred VPRSV from right to left VIA LBWE Un Hide VPRSV and generated the 2LIS_03_BF DataSource, and activated the update. IN BW7 Replicated 2LIS_03_BF Created a classic Implementation of the RSU5_SAPI_BADI named Z_FKOM_2009_LOADDATA Using the DATA_TRANSFORM method of the RSU5_SAPI_BADI implemented the code to acquire the VPRSV value of each MATERIAL movement doc line item that contains a valid material.
  • 58. BADI for BW Loading - RSU5_SAPI_BADI Use SE19 This Business Add-In (BAdI) is used in the SAP Business Information Warehouse Extractors (BC- BW) component. Using this BAdI you are able to either fill fields with data, or change the content of the DataSource fields that you added to the extract structure of a DataSource as an append structure. Requirements If you want to fill the fields of an append structure, create an append structure for the DataSource. You can find more information on append structures in the Web Application Server documentation in the SAP Library at ABAP Workbench -> ABAP Dictionary, in the section Tables. Standard settings Business Add-In is active in the standard system. Business Add-In can be used more than once. All active implementations are called up and executed. Business Add-In is not dependent on a filter.
  • 59. BADI for BW Loading - RSU5_SAPI_BADI Activities: Via Transaction SE19 if creating a new BADI implementation, Enter the BADI name RSU5_SAPI_BADI in the Classic BADI, BADI name input field of the Create Implementation section, then select Create. Or, If you are editing an existing implementation of the BADI, enter the implementation name in the classic BADI implementation name field of the Edit Implementation section.
  • 60. BADI for BW Loading - RSU5_SAPI_BADI You then reach the initial screen for creating BAdI implementations. In the field implementation Short text , enter a short text for the implementation.
  • 61. - BADI for BW Loading - RSU5_SAPI_BADI Select the Interface tab. The Name of implementing class field on the interface tab page is filled automatically. The system allocates a class name based on the name of your implementation.Here:ZCL_IM_ZRSU5_SAPI_BADI and has two methods. Save your entries and assign a package for transport.
  • 62. Add four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (1).  Besides methods inherited from the BADi IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM IF_EX_RSU5_SAPI_BADI~HIER_TRANSFORM  We create now 4 new methods (in case they do not already exist) _CALL_DATASOURCE _CHECK_BW_SYSTEM _TEMPLATE_DATASOURCE _CHECK_METHOD_EXISTS
  • 63. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (1). _CHECK_METHOD_EXISTS Description “Check if the implementation of datasource is done” Level Static Visibility Public Parameters IV_CMPNAME Importing Type SEOCMPNAME “Component name” RV_EXISTSReturning (Value Transfer) Type CHAR01 “Method Exists” Exceptions None With the following code: METHOD _check_method_exists. DATA: lv_clsname TYPE seoclskey. *  FIELD-SYMBOLS: "<ls_method>      TYPE seoo_method_r, *                 <ls_method_ex>   TYPE seoo_method_r. CLEAR rv_exists. IF ct_methods IS INITIAL. lv_clsname-clsname = 'ZCL_IM_RSU5_SAPI_BADI'. CALL FUNCTION 'SEO_METHOD_READ_ALL' EXPORTING cifkey = lv_clsname version = seoc_version_active IMPORTING methods = ct_methods EXCEPTIONS clif_not_existing = 1 OTHERS = 2. IF sy-subrc <> 0. ENDIF. DELETE ct_methods WHERE cmpname(1) = '_'. ENDIF. * check existence READ TABLE ct_methods TRANSPORTING NO FIELDS WITH KEY cmpname = iv_cmpname. IF sy-subrc EQ 0. rv_exists = 'X'. ENDIF. ENDMETHOD.
  • 64. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (2). _CHECK_BW_SYSTEM Description “Checks what system is doing the request”(could be BOBJ not BW) Level Static Visibility Public Parameters RV_IS_EDWH Returning (Value Transfer) Type CHAR01 “Request is a EDWH Request” Exceptions None With the following code: METHOD _check_bw_system. rv_is_edwh = 'X'. * FIELD-SYMBOLS: <ls_request> TYPE rosrequest. * CLEAR rv_is_edwh. ** in online mode (extraction checker) just do it * IF sy-batch IS INITIAL. * rv_is_edwh = 'X'. * EXIT. * ENDIF. * * IF cv_bwsystem IS INITIAL. ** get request parameters * ASSIGN ('(SBIE0001)REQUEST') TO <ls_request>. ** finally * cv_bwsystem = <ls_request>-rcvprn. * ENDIF. * ** check * IF cv_bwsystem(3) = 'DED' * OR cv_bwsystem(3) = 'QED' * OR cv_bwsystem(3) = 'PED'. * rv_is_edwh = 'X'. * ENDIF. ENDMETHOD.
  • 65. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (3.1). _CALL_DATASOURCE Description “Call Individual Method for Each DataSource” Level Static Visibility Public Parameters I_DATASOURCE Importing (Value Transfer) Type RSAOT_OLTPSOURCE I_UPDMODE Importing (Value Transfer) Type SBIWA_S_INTERFACE-UPDMODE I_T_SELECT Importing (Value Transfer) Type SBIWA_T_SELECT I_T_FIELDS Importing (Value Transfer) Type SBIWA_T_FIELDS C_T_DATA Changing Type ANY TABLE C_T_MESSAGES Changing Type RSU5_T_MESSAGES Exceptions None
  • 66. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (3.2). With the following code: METHOD _call_datasource. DATA: ls_oltpsource TYPE rsaot_s_osource, lv_data TYPE REF TO data, lv_method TYPE seocmpname. FIELD-SYMBOLS: <lt_data> TYPE STANDARD TABLE. * check if any data is extracted CHECK c_t_data IS NOT INITIAL. CALL FUNCTION 'RSA1_SINGLE_OLTPSOURCE_GET' EXPORTING i_oltpsource = i_datasource i_objvers = 'A' IMPORTING e_s_oltpsource = ls_oltpsource EXCEPTIONS no_authority = 1 not_exist = 2 inconsistent = 3 OTHERS = 4. IF sy-subrc <> 0. EXIT. ENDIF.
  • 67. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (3.3) c’td. Continuing with the following code: * create data for Extract Structure CREATE DATA lv_data TYPE TABLE OF (ls_oltpsource-exstruct). ASSIGN lv_data->* TO <lt_data>. ASSIGN c_t_data TO <lt_data>. * get method name for datasource lv_method = i_datasource. IF lv_method(1) = '0' or lv_method(1) = '2'. "for instance 2LIS_11* * shift by one character as methods can't start with a number SHIFT lv_method. ENDIF. * check method is implemented CHECK _check_method_exists( lv_method ) = 'X'. CALL METHOD (lv_method) EXPORTING i_updmode = i_updmode i_t_select = i_t_select i_t_fields = i_t_fields CHANGING c_t_data = <lt_data> c_t_messages = c_t_messages. ENDMETHOD.
  • 68. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (4.1). _TEMPLATE_DATASOURCE Description “Template You Can Use To Copying Enhancement Method of your DataSource” Level Static Visibility Public Parameters I_DATASOURCE Importing (Value Transfer) Type RSAOT_OLTPSOURCE I_UPDMODE Importing (Value Transfer) Type SBIWA_S_INTERFACE-UPDMODE I_T_SELECT Importing (Value Transfer) Type SBIWA_T_SELECT I_T_FIELDS Importing (Value Transfer) Type SBIWA_T_FIELDS C_T_DATA Changing Type ANY TABLE C_T_MESSAGES Changing Type RSU5_T_MESSAGES Exceptions None
  • 69. Adding four new Methods in your implementation ZCL_IM_ZRSU5_SAPI_BADI (4.2). Append the following code to Your Method _template_datasource: METHOD _template_datasource. * Data Definition * DATA: lth_vbak type hashed table of vbak with unique key vbeln, * ls_vbak type vbak . * FIELD-SYMBOLS: <L_S_DATA> TYPE <Extract structure name>. * Init * Perform always a mass select into an internal table * SELECT * FROM VBAK INTO TABLE lth_vbak * FOR ALL ENTRIES IN C_T_DATA * WHERE VBELN = C_T_DATA_VBELN. * map the data * LOOP AT C_T_DATA ASSIGNING <L_S_DATA>. * READ TABLE lth_vbak into ls_vbak * with table key vbeln = <L_S_DATA>-vbeln. * if sy-subrc eq 0. * <L_S_DATA>-VKORG = ls_vbak-vkorg. * !!! No MODIFY necessary as the field is changed immediatly in the * internal table by using Field Symbols * endif. * ENDLOOP. ENDMETHOD.
  • 70. Modify now the Method DATA_TRANSFORM in your implementation of IF_EX_RSU5_SAPI_BADI Do not forget to modify the original method DATA_TRANSFORM with the following code !! METHOD if_ex_rsu5_sapi_badi~data_transform. CALL METHOD zcl_im_rsu5_sapi_badi=>_call_datasource EXPORTING i_datasource = i_datasource i_updmode = i_updmode i_t_select = i_t_select i_t_fields = i_t_fields CHANGING c_t_data = c_t_data c_t_messages = c_t_messages. ENDMETHOD.
  • 71. Summary In the methods tab of the class ZCL_IM_ZRSU5_SAPI_BADI, ( inheriting from the Interface IF_EX_RSU5_SAPI_BADI) we have created 4 new methods. Enriching a datasource, will consist of extending its structure (SE11 and RSA6) and then creating your own method using _TEMPLATE_DATASOURCE as a model and rename it to the almost exact name of your datasource: In case you enhance a Business Content datasource skip the 0 or the 2 at the beginning (e.g. Datasource 0UC_MTR_DOC -> Method UC_MTR_DOC or 2LIS_03_BF -> Method LIS_03_BF), the Z datasource Z_DS_G_TR_ZV_EGER giving its exact name to the enrichment method. The method is then called by the Exit Framework
  • 72. Creating an enhancement of a DataSource(1) I will assume that you have enhanced the structure of the data source, and need to code to populate the enhanced fields of the structure. Copy the method _TEMPLATE_DATASOURCE and rename it, with the same name of the datasource you want to enhance. In case of standard datasource, omit the first character of the name (‘0’ or ‘2’). ie. DataSource 2LIS_18_IOTASK  Method name: LIS_18_IOTASK
  • 73. Creating an enhancement of a DataSource(2) Declare on the code the structure to populate. On the code, you have to declare the structure <L_S_DATA> of the type of the enhancement sctructure of your data source, ie: Tcode RSA6 As you see in the picture, the Extract Structure of the data source 2LIS_18_I0TASK is MC18I00TSK.
  • 74. Creating an enhancement of a DataSource(3) Declare: FIELD-SYMBOLS: <l_s_data> TYPE MC18I00TSK . During the execution of the extraction process, when this method is called, the structure C_T_DATA will be populated with packages of 100 records each time. So a loop must be declared to process these data packages, as you see on the code examples bellow. Here is a simple way to populate the fields of the structure straight from the select: LOOP AT C_T_DATA ASSIGNING <L_S_DATA>. SELECT SINGLE BETRH BETRW INTO (<L_S_DATA>-BETRH, <L_S_DATA>-BETRW) FROM DFKKOP WHERE OPBEL = <L_S_DATA>-OPBEL AND OPUPW = <L_S_DATA>-OPUPW AND OPUPK = <L_S_DATA>-OPUPK AND OPUPZ = <L_S_DATA>-OPUPZ. ENDLOOP. Go testing your DataSource in Tx RSA3.
  • 75. - BADI for BW Loading - RSU5_SAPI_BADI Alternate Non-Modular Way (Not Recommended) Double click on the appropriate method, DATA_TRANSFORM, for Transaction, Master Data, and Texts datasources, or HIER_TRANSFORM for hierarchy datasource. Between the instructions Method <Interface Name>~<Method name>. and endmethod., enter the code that you require for the implementation. Save and activate your code and navigate back to the Change implementation screen, then be sure to activate the BADI implementation. method IF_EX_RSU5_SAPI_BADI~DATA_TRANSFORM. CASE I_DATASOURCE. WHEN '2LIS_03_BF'. data: wa_vprsv TYPE mbew-vprsv. FIELD-SYMBOLS: <c_t_data> TYPE TY_MC03BF0. loop at c_t_data ASSIGNING <c_t_data>. if not <c_t_data>-matnr is INITIAL. select vprsv from mbew into wa_vprsv where matnr = <c_t_data>-matnr and BWKEY = <c_t_data>-werks. ENDSELECT. if sy-subrc = 0. <c_t_data>-vprsv = wa_vprsv. endif. endif. endloop. ENDCASE. endmethod. Note the use of FIELD-SYMBOLS Launch Internet Explorer Browser.lnk
  • 76. References Note 691154 - SAPI with BADI: User exits in SAPI with BADI-interfaces
  • 77. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 78. Other Areas Where ABAP OO Classes Are Used Other areas where Classes / Methods Can be used. XI Integration to BI using ABAP Proxy Services BADI for : Virtual Characteristics & Key Figures Own Report Type as Jump Target Recipient InfoSpoke with Transformation (BW 3.5 only) >> Custom Process Type  Formula in Alternate Decision Process Type
  • 79. Custom Process Type using Pass-Through technique (1) - Creation of Class ZCL_ABAP_PT_RESULT with no methods, types, attributes etc. - Go To > Public Section and Paste the following Lines - interfaces if_rspc_call_monitor . interfaces if_rspc_check . interfaces if_rspc_execute . interfaces if_rspc_get_status . interfaces if_rspc_get_variant . interfaces if_rspc_maintain . interfaces if_rspc_transport . interfaces if_rspv_transport . constants failed type rspc_state value 'R'. "#EC NOTEXT constants status_mem_id type char20 value 'PC_ABAP_STATUS'. "#EC NOTEXT constants success type rspc_state value 'G'. "#EC NOTEXT
  • 80. Custom Process Type using Pass-Through technique (2) - The protected and public section contain nothing. - Now we need to implement the methods of the interface. - They all must be implemented - though most are empty. - Those that are not empty are: - if_rspv_transport~get_additional_objects. - if_rspc_transport~get_tlogo. - if_rspc_maintain~maintain. - if_rspc_maintain~get_header. - if_rspc_get_variant~get_variant. - if_rspc_get_variant~wildcard_enabled. - if_rspc_get_variant~exists. - if_rspc_get_status~get_status. - if_rspc_execute~give_chain. - if_rspc_check~check. - if_rspc_check~give_all - if_rspc_call_monitor~call_monitor. - if_rspc_execute~execute.
  • 81. Custom Process Type using Pass-Through technique (3)  You'll notice, that with the exception of the last method, all I've done is pass and retrieve identical parameters to CL_RSPC_ABAP static methods.  This is known as passing through, because we execute the methods of Class CL_RSPC_ABAP In the last method (if_rspc_execute~execute), I also do this, but I have an additional statement. “IMPORT e_state TO e_state FROM MEMORY ID zcl_abap_pt_result=>status_mem_id. “ This method executes the ABAP program in the Process Type variant, and then sets the state of the Process Type according to that stored in the memory id.
  • 82. Custom Process Type using Pass-Through technique (4) – Abap Program  The ABAP program that the process type will actually call, needs to set its status - whether it succeeded or failed - and report that to the process type handling class. This I've done simply using memory ids. You could follow the example in Jürgen Noe's blog, where he addresses the same issue, and use a table to store the result of the called program.  * Set the flag for the process chain to read if ... " The ABAP program failed l_flag = zcl_abap_pt_decision =>failed. else. " The ABAP program was successful l_flag = zcl_abap_pt_decision =>success. endif.  export e_state from l_flag to memory id zcl_abap_pt_decision=>status_mem_id.
  • 83. Custom Process Type using Pass-Through technique (4) – Abap Program  The ABAP program that the process type will actually call, needs to set its status - whether it succeeded or failed - and report that to the process type handling class. This I've done simply using memory ids. You could follow the example in Jürgen Noe's blog, where he addresses the same issue, and use a table to store the result of the called program.  * Set the flag for the process chain to read if ... " The ABAP program failed l_flag = zcl_abap_pt_decision =>failed. else. " The ABAP program was successful l_flag = zcl_abap_pt_decision =>success. endif.  export e_state from l_flag to memory id zcl_abap_pt_decision=>status_mem_id.
  • 84. Custom Process Type using Pass-Through technique (5) – Create New Process Type  The final bit of work is setting up the process type for use within a process chain.  From transaction RSPC, go to Settings->Maintain Process types. ( You might have to select a process chain first to activate this menu option ). Create a new process type: Z_ABAP_RES
  • 85. Custom Process Type using Pass-Through technique (6) – Sample Program  REPORT Z_TEST_GREEN_OR_RED. DATA: e_state type RSPC_STATE, zcl_abap_pt_result TYPE REF TO zcl_abap_pt_result, l_flag TYPE rspc_state. SELECTION-SCREEN BEGIN OF BLOCK eins WITH FRAME. PARAMETERS: red RADIOBUTTON GROUP radi, green RADIOBUTTON GROUP radi. SELECTION-SCREEN END OF BLOCK eins. START-OF-SELECTION. CREATE OBJECT zcl_abap_pt_result. IF NOT green IS INITIAL. l_flag = zcl_abap_pt_result=>success. ELSE. l_flag = zcl_abap_pt_result=>failed. ENDIF. EXPORT e_state FROM l_flag TO MEMORY ID zcl_abap_pt_result=>status_mem_id.
  • 86. Custom Process Type using Pass-Through technique (7) – Methods Copied from Class Passing Through CL_RSPC_ABAP static meth
  • 87. Overview – ABAP OO Classes & Methods Motivation For Using ABAP OO In BW Scenario: Using Classes & Methods in Transformations Scenario: The Class Constructor Scenario: Class Methods in the Userexit for Variables Scenario: Custom Functions for The Formula Builder Scenario: BADI for BW Loading Other Areas in BW using ABAP OO Classes & Methods
  • 88. Custom Class To Use in Transformation : generic programming (1) Will fill internal tables in the START ROUTINE to derive from in the END ROUTINE Object Types : InfoObjects, ODSO . The method allows up to 5 filters with a FOR ALL ENTRIES type of conditions
  • 89. Custom Class To Use in Transformation : generic programming (2) Handle several logical partitions based on Naming Conventions and Source System The Object can be local or global. Up to 5 Filters as Distinct Values working as FOR ALL ENTRIES Time Dependency for InfoObjects
  • 90. Custom Class To Use in Transformation : generic programming (3)
  • 91. Custom Class To Use in Transformation : generic programming (4) – START Routine
  • 92. Appendix 1 – Passing Through CL_RSPC_ABAP static methods. method IF_RSPV_TRANSPORT~AFTER_IMPORT. endmethod. method IF_RSPV_TRANSPORT~GET_ADDITIONAL_OBJECTS. cl_rspc_abap=>if_rspv_transport~get_additional_objects( EXPORTING i_variant = i_variant i_cto_mode = i_cto_mode i_is_content_system = i_is_content_system IMPORTING e_t_cto_object = e_t_cto_object e_t_cto_key = e_t_cto_key ). endmethod. method IF_RSPC_TRANSPORT~GET_TLOGO. cl_rspc_abap=>if_rspc_transport~get_tlogo( EXPORTING i_variant = i_variant i_objvers = i_objvers IMPORTING e_tlogo = e_tlogo e_objnm = e_objnm ). endmethod. method IF_RSPC_TRANSPORT~KEY_CHANGE. endmethod. method IF_RSPC_MAINTAIN~MAINTAIN. cl_rspc_abap=>if_rspc_maintain~maintain( EXPORTING i_variant = i_variant i_t_chain = i_t_chain IMPORTING e_variant = e_variant e_variant_text = e_variant_text ). endmethod. method IF_RSPC_MAINTAIN~GET_HEADER. cl_rspc_abap=>if_rspc_maintain~get_header( EXPORTING i_variant = i_variant i_objvers = i_objvers IMPORTING e_variant_text = e_variant_text e_s_changed = e_s_changed e_contrel = e_contrel e_conttimestmp = e_conttimestmp ). endmethod. METHOD if_rspc_get_variant~get_variant. cl_rspc_abap=>if_rspc_get_variant~get_variant( EXPORTING i_variant = i_variant i_t_chain = i_t_chain i_t_select = i_t_select i_objvers = i_objvers IMPORTING e_variant = e_variant e_variant_text = e_variant_text EXCEPTIONS nothing_selected = 1 ). IF sy-subrc EQ 1. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING nothing_selected. ENDIF. ENDMETHOD. method IF_RSPC_GET_VARIANT~WILDCARD_ENABLED. result = cl_rspc_abap=>if_rspc_get_variant~wildcard_enabled( ). endmethod. method IF_RSPC_GET_VARIANT~EXISTS. r_exists = cl_rspc_abap=>if_rspc_get_variant~exists( i_variant = i_variant i_objvers = i_objvers ). endmethod. method IF_RSPC_GET_STATUS~GET_STATUS. cl_rspc_abap=>if_rspc_get_status~get_status( EXPORTING i_variant = i_variant i_instance = i_instance i_dont_update = i_dont_update IMPORTING e_status = e_status ). endmethod. method IF_RSPC_EXECUTE~GIVE_CHAIN. return = cl_rspc_abap=>if_rspc_execute~give_chain( i_variant ). endmethod. method IF_RSPC_CHECK~CHECK. cl_rspc_abap=>if_rspc_check~check( EXPORTING i_s_process = i_s_process i_t_chain = i_t_chain i_t_chains = i_t_chains IMPORTING e_t_conflicts = e_t_conflicts ). endmethod. method IF_RSPC_CALL_MONITOR~CALL_MONITOR. cl_rspc_abap=>if_rspc_call_monitor~call_monitor( i_variant = i_variant i_instance = i_instance ). endmethod. method IF_RSPC_CHECK~GIVE_ALL. return = cl_rspc_abap=>if_rspc_check~give_all( i_variant ). endmethod. METHOD if_rspc_execute~execute. cl_rspc_abap=>if_rspc_execute~execute( EXPORTING i_variant = i_variant i_event_start = i_event_start i_eventp_start = i_eventp_start i_t_processlist = i_t_processlist i_logid = i_logid i_t_variables = i_t_variables i_synchronous = i_synchronous i_simulate = i_simulate i_repair = i_repair IMPORTING e_instance = e_instance e_state = e_state e_eventno = e_eventno e_hold = e_hold ). IMPORT e_state TO e_state FROM MEMORY ID zcl_abap_pt_result=>status_mem_id. ENDMETHOD.
  • 93. Appendix 2 – ZCL_ISU_GET_MASTER_DATA METHOD zcl_isu_get_data. DATA: struct_type TYPE REF TO cl_abap_structdescr, tab_type TYPE REF TO cl_abap_tabledescr, comp_tab TYPE cl_abap_structdescr=>component_table, comp LIKE LINE OF comp_tab. DATA: t_data TYPE REF TO data. DATA: BEGIN OF ls_rsdchabas, chabasnm TYPE rschabasnm, chatp TYPE rschatp, attribfl TYPE rsattribfl, timdepfl TYPE rstimdepfl, END OF ls_rsdchabas. TYPES: BEGIN OF ly_dd03l, tabname TYPE tabname, fieldname TYPE fieldname, domname TYPE domname, position TYPE tabfdpos, datatype TYPE datatype_d, leng TYPE ddleng, END OF ly_dd03l. TYPES: BEGIN OF ly_where, line(100) TYPE c, END OF ly_where. DATA: lt_where TYPE STANDARD TABLE OF ly_where, ls_where TYPE ly_where.* DATA: lt_dd03l TYPE STANDARD TABLE OF ly_dd03l,* ls_dd03l TYPE ly_dd03l. DATA: lv_object_ddic TYPE string, lv_soursystem(3). DATA: dref TYPE REF TO data. FIELD-SYMBOLS: <f_s_table> TYPE ANY, <f_t_table> TYPE ANY TABLE. FIELD-SYMBOLS: <f_v_field> TYPE ANY. FIELD- SYMBOLS: <f_t_filter1> TYPE STANDARD TABLE, <f_t_filter2> TYPE STANDARD TABLE, <f_t_filter3> TYPE STANDARD TABLE, <f_t_filter4> TYPE STANDARD TABLE. FIELD- SYMBOLS: <f_s_filter1> TYPE ANY, <f_s_filter2> TYPE ANY, <f_s_filter3> TYPE ANY, <f_s_filter4> TYPE ANY. DATA: lt_is_u_infobjects TYPE RANGE OF rsattrinm. DATA: ls_is_u_infobjects LIKE LINE OF lt_is_u_infobjects. DATA: lt_columns TYPE zcl_isu_t_filter, ls_columns LIKE LINE OF lt_columns. DATA: lv_field_filter TYPE string. DATA: lv_dynamic_data_table TYPE string. DATA: lv_dynamic_range_table TYPE string. DATA: lv_e_tablnm TYPE tabname. DATA: lv_number(1). DATA: lt_fields_range TYPE TABLE OF lvc_s_fcat, ls_fields_range LIKE LINE OF lt_fields_range. DATA: ls_data_filter TYPE LINE OF zcl_isu_t_filter. DATA: lv_e_chktab TYPE rsdchkview, lv_e_chntab TYPE rschntab. DATA: lv_chabasnm TYPE rschabasnm. DATA: lv_soursystem_view TYPE string.* begin of insertion by SAP - 25.11.2008 DATA: new_table TYPE REF TO data, new_line TYPE REF TO data. DATA: descr_ref TYPE REF TO cl_abap_structdescr, lt_details TYPE abap_compdescr_tab, ls_details TYPE abap_compdescr.* end of insertion by SAP - 25.11.2008 IF ( i_soursystem NE 'RS' ) AND ( i_soursystem NE 'BS' ) AND ( i_soursystem NE 'PS' ). RAISE sour ce_system_no_good. ENDIF.* begin of modification by SAP - 26.11.2008* source system CONCATENATE 'ZC' i_soursystem INTO lv_soursystem. CASE i_object_type.* infoobjetc WHEN 'IOBJ'.* verifica se o infoobjeto existe SELECT SINGLE chabasnm chatp attribfl timdepfl INTO ls_rsdchabas FROM rsdchabas WHERE chabasnm = i_object_name AND objvers = cv_objvers. IF sy-subrc NE 0. RAISE master_data_doesn_exist. ENDIF.* DSO WHEN 'ODSO'. lv_chabasnm = i_object_name.* BEGIN OF INSERTION BY SAP - 03.12.2008 IF i_global_dso IS INITIAL. REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm. ENDIF.* END OF INSERTION BY SAP - 03.12.2008 clear lv_e_tablnm. CALL METHOD cl_rsd_odso=>get_tablnm EXPORTING i_odsobject = lv_chabasnm* i_tabt = IMPORTING e_tablnm = lv_e_tablnm* e_ttypename =* e_viewnm =* e_chnglognm =* e_infosource =* e_datasource = EXCEPTIONS name_error = 1 input_invalid = 2 OTHERS = 3 . IF sy- subrc <> 0. RAISE dso_doesn_exist. ENDIF.* begin of insertion by SAP - 24.11.2008* VIEW WHEN 'VIEW'. CONCATENATE '_' i_soursystem(1) '_' INTO lv_soursystem_view. lv_dynamic_data_table = i_object_name. REPLACE '_G_' WITH lv_soursystem_view INTO lv_dynamic_data_table.* to be continued (insert double check over table DDTYPES to insure* that the view really exists* end of insertion by SAP - 24.11.2008 WHEN OTHERS. RAISE object_type_no_good. ENDCASE.* begin of insertion by SAP - 25.11.2008* table CREATE DATA new_table LIKE e_t_table. ASSIGN new_table->* TO <f_t_table>.* structure CREATE DATA new_line LIKE LINE OF <f_t_table>. ASSIGN new_line->* TO <f_s_table>. descr_ref ?= cl_abap_typedescr=>describe_by_data( <f_s_table> ). lt_details[] = descr_ref->components[].* end of insertion by SAP - 25.11.2008* trata atributos controlados por empresa* atributos controlados por empresa** Somente quando for diferente de objeto VIEW IF i_object_type = 'IOBJ'. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'.* 1) Dados Técnicos* Instalação ls_is_u_infobjects- low = '/BIC/ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Local de Consumo ls_is_u_infobjects-low = '/BIC/ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Objeto de Ligação ls_is_u_infobjects-low = '/BIC/ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Device ls_is_u_infobjects-low = '/BIC/ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* 2) Dados Comerciais* Parceiro de Negócio ls_is_u_infobjects-low = '/BIC/ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Contrato ls_is_u_infobjects-low = '/BIC/ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects- low = 'ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Conta-Contrato ls_is_u_infobjects-low = '/BIC/ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* Conta-Contrato Parceiro ls_is_u_infobjects-low = '/BIC/ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.* begin of insertion by SAP - 10.01.2009** Conta Contrato Coletiva ls_is_u_infobjects-low = '/BIC/ZCGABWVK'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGABWVK'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.** Pagador alternativo - ref. PN ls_is_u_infobjects-low = '/BIC/ZCG_ABWRE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCG_ABWRE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.** Empregado responsável - ref. PN ZCRBPEMPL ls_is_u_infobjects-low = '/BIC/ZCGBPEMPL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects- low = 'ZCGBPEMPL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.*** início alteração SAP040877 - Diogo em 11/08/09*** chamado 8000019681 ls_is_u_infobjects-low = '/BIC/ZCGUNLEIT'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGUNLEIT'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.*** fim alteração SAP040877 - Diogo em 11/08/09**** alteração 21/08/09 - cadeia batch - carga FAT - EBF*** chamado 8000020612 - Diogo Almeida ls_is_u_infobjects-low = '/BIC/ZCGPORTIO'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGPORTIO'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects.**** fim alteração 21/08/09 - cadeia batch - carga FAT - chamado *** chamado 8000020612* end of insertion by SAP - 10.01.2009 ELSE. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'.* Registro dummy ls_is_u_infobjects-low = 'DUMMY'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ENDIF.* begin of insertion by SAP - 25.11.2008 LOOP AT lt_details INTO ls_details. ls_columns = ls_details- name. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF. APPEND ls_columns TO lt_columns. ENDLOOP.* end of insertion by SAP - 25.11.2008 IF i_object_type NE 'VIEW'. IF i_ignore_source_system IS INITIAL.* SOURCE SYSTEM CONCATENATE 'SOURSYSTEM = ''' i_soursystem '''' INTO ls_where-line. APPEND ls_where TO lt_where. ENDIF.* infoobject IF i_object_type = 'IOBJ'. IF i_ignore_source_system IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF.* monta select dinamico CONCATENATE 'OBJVERS = ''' cv_objvers '''' INTO ls_where- line. APPEND ls_where TO lt_where. lv_chabasnm = i_object_name. IF lv_chabasnm IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm. ENDIF.* retornar configuração de dicionário para infoobjet CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS' EXPORTING i_chabasnm = lv_chabasnm* I_NSPACEGEN =* I_S_VIOBJ =* I_T_ATR = IMPORTING e_chktab = lv_e_chktab e_chntab = lv_e_chntab* E_CHTTAB =* E_TXTTAB =* E_SIDTAB =* E_SIDVIEW =* E_ASITAB =* E_ASISTR =* E_ASTTAB =* E_CHKNEW = EXCEPTIONS name_error = 1 OTHERS = 2 . IF sy-subrc <> 0. RAISE erro_dynamic_table. ENDIF.* determina tabela para select* de acordo com infoobjet IF i_time_dependent = 'X' AND ls_rsdchabas-timdepfl EQ 'X'.* time-dependent table lv_dynamic_data_table = lv_e_chktab. ELSE.* regular table lv_dynamic_data_table = lv_e_chntab. ENDIF.* DSO ELSE. lv_dynamic_data_table = lv_e_tablnm. ENDIF. ENDIF.* time- dependente information IF ( i_object_type = 'IOBJ' AND i_time_dependent = 'X' AND ls_rsdchabas-timdepfl EQ 'X' ) OR ( i_object_type = 'ODSO' AND i_time_dependent = 'X' ). IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF.* SOURCE SYSTEM CONCATENATE 'DATETO = ''' cv_datato '''' INTO ls_where-line. APPEND ls_where TO lt_where. ENDIF.* begin of insertion by SAP - 26.11.2008* cria filtros para select* Até 4 filtros de select IF NOT i_filter IS INITIAL. DO 4 TIMES. MOVE sy-index TO lv_number. CONCATENATE 'I_FILTER-ZCL_FILTER' lv_number INTO lv_field_filter. ASSIGN (lv_field_filter) TO <f_v_field>. IF sy-subrc EQ 0. IF NOT <f_v_field> IS INITIAL. READ TABLE lt_details WITH KEY name = <f_v_field> INTO ls_details. IF sy-subrc EQ 0.* FIRST FIELTER - FOR ALL ENTRIES IF lv_number = 1. REFRESH lt_fields_range. CLEAR ls_fields_range.* TABELA interna para ser utilizada como for all entries ls_columns = ls_details- name. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF. ls_fields_range-fieldname = ls_columns. ls_fields_range-ref_table = lv_dynamic_data_table.* ls_fields_range-ref_field = <f_v_field>. ls_fields_range-ref_field = ls_columns. APPEND ls_fields_range TO lt_fields_range.*** Alteração Bobis data: op_len TYPE i, op_out type OUTPUTLEN, op_dec TYPE OUTPUTLEN, w_iobj type RSD_IOBJNM, w_iobj1 type RSD_IOBJNM. LOOPAT lt_fields_range INTO ls_fields_range. if ls_fields_range-FIELDNAME(4) eq '/BIC'. w_iobj = ls_fields_range-FIELDNAME+5(10). else. concatenate '0' ls_fields_range-FIELDNAME into w_iobj. endif. clear op_len. select single CHABASNM from RSDCHA into w_iobj1 where CHANM = w_iobj and objvers = 'A'. select single OUTPUTLEN from RSDCHABAS into op_out where CHABASNM = w_iobj1 and objvers = 'A'. if sy- subrc eq 0. move op_out to op_len. endif. comp-name = ls_fields_range-FIELDNAME.* CASE op_type.* WHEN 'DEC'.* CALL METHOD cl_abap_elemdescr=>get_p* EXPORTING* p_length = op_len* p_decimals = op_dec* RECEIVING* p_result = comp-type.* WHEN OTHERS. comp-type = cl_abap_elemdescr=>get_c( op_len ).* ENDCASE. APPEND comp TO comp_tab. CLEAR: comp. ENDLOOP. CLEAR struct_type . CALL METHOD cl_abap_structdescr=>create EXPORTING p_components = comp_tab p_strict = cl_abap_structdescr=>false RECEIVING p_result = struct_type. CLEAR tab_type . CALL METHOD cl_abap_tabledescr=>create EXPORTING p_line_type = struct_type p_table_kind = cl_abap_tabledescr=>tablekind_std RECEIVING p_result = tab_type. CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref- >* TO <f_t_filter1>. CREATE DATA dref LIKE LINE OF <f_t_filter1>. ASSIGN dref->* TO <f_s_filter1>.** CREATE DATA t_data LIKE LINE OF <f_t_filter1>.** ASSIGN t_data->* TO <f_s_filter1>.**** Alteração Bobis* CALL METHOD cl_alv_table_create=>create_dynamic_table* EXPORTING* it_fieldcatalog = lt_fields_range* IMPORTING* ep_table = dref* EXCEPTIONS* generate_subpool_dir_full = 1* OTHERS = 2.** IF sy-subrc NE 0.* RAISE erro_dynamic_table.* ENDIF.** ASSIGN dref->* TO <f_t_filter1>.* CREATE DATA dref LIKE LINE OF <f_t_filter1>.* ASSIGN dref->* TO <f_s_filter1>.**** Alteração Bobis LOOPAT i_filter- zcl_data_filter1 INTO ls_data_filter. CONCATENATE '<f_s_filter1>' ls_columns INTO lv_field_filter SEPARATED BY '-'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter1> TO <f_t_filter1>. ENDLOOP. ELSE. break sap857850. REFRESH lt_fields_range. CLEAR ls_fields_range.* cria field range para receber valores do filtro ls_fields_range-fieldname = 'SIGN'. ls_fields_range-datatype = 'CHAR'. ls_fields_range-outputlen = 1. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'OPTION'. ls_fields_range-datatype = 'CHAR'. ls_fields_range-outputlen = 2. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'LOW'. ls_fields_r I_SOURSYSTEM Importing Type RSSOURSYSID Source System I_OBJECT_NAME Importing Type RSIOBJNM InfoObjeto I_TIME_DEPENDENT Importing Type CHAR1 'X' or '' I_OBJECT_TYPE Importing Type RSTLOGO 'IOBJ' (InfoObjeto), 'ODSO' (Objeto DataStore), or 'VIEW' I_IGNORE_SOURCE_SYSTEM Importing Type CHAR1 'X' or '' (default tem sourcesystem) E_T_MESSAGES Exporting Type RSU5_T_MESSAGES Log de aplicação: interface para Business Add Ins E_OBJECT_NAME Exporting Type STRING Object Name METHOD zcl_isu_get_object_name. DATA: BEGIN OF ls_rsdchabas, chabasnm TYPE rschabasnm, chatp TYPE rschatp, attribfl TYPE rsattribfl, timdepfl TYPE rstimdepfl, END OF ls_rsdchabas. DATA: lv_soursystem(3). DATA: lt_is_u_infobjects TYPE RANGE OF rsattrinm. DATA: ls_is_u_infobjects LIKE LINE OF lt_is_u_infobjects. DATA: lv_e_tablnm TYPE tabname. DATA: lv_e_chktab TYPE rsdchkview, lv_e_chntab TYPE rschntab. DATA: lv_chabasnm TYPE rschabasnm. DATA: lv_soursystem_view TYPE string. IF ( i_soursystem NE 'RS' ) AND ( i_soursystem NE 'BS' ) AND ( i_soursystem NE 'PS' ). RAISE source_system_no_good. ENDIF. * source system CONCATENATE 'ZC' i_soursystem INTO lv_soursystem. * CASE i_object_type. * infoobjetc WHEN 'IOBJ'. * verifica se o infoobjeto existe SELECT SINGLE chabasnm chatp attribfl timdepfl INTO ls_rsdchabas FROM rsdchabas WHERE chabasnm = i_object_name AND objvers = cv_objvers. IF sy-subrc NE 0. RAISE master_data_doesn_exist. ENDIF. * DSO WHEN 'ODSO'. lv_chabasnm = i_object_name. REPLACE 'ZCG' WITH lv_soursystem INTO lv_chabasnm. CALL METHOD cl_rsd_odso=>get_tablnm EXPORTING i_odsobject = lv_chabasnm *    i_tabt        = IMPORTING e_tablnm = lv_e_tablnm *    e_ttypename   = *    e_viewnm      = *    e_chnglognm   = *    e_infosource  = *    e_datasource  = EXCEPTIONS name_error = 1 input_invalid = 2 OTHERS = 3 . IF sy-subrc <> 0. RAISE dso_doesn_exist. ENDIF. * begin of insertion by SAP - 24.11.2008 * VIEW WHEN 'VIEW'. CONCATENATE '_' i_soursystem(1) '_' INTO lv_soursystem_view. e_object_name = i_object_name. REPLACE '_G_' WITH lv_soursystem_view INTO e_object_name. * to be continued  (insert double check over table DDTYPES to insure * that the view really exists * end of insertion by SAP - 24.11.2008 WHEN OTHERS. RAISE object_type_no_good. ENDCASE. * begin of insertion by SAP - 25.11.2008 IF i_object_type = 'IOBJ'. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'. * 1) Dados Técnicos * Instalação ls_is_u_infobjects-low = '/BIC/ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGINSTAL'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Local de Consumo ls_is_u_infobjects-low = '/BIC/ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGPREMIS'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Objeto de Ligação ls_is_u_infobjects-low = '/BIC/ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGCONOBJ'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Device ls_is_u_infobjects-low = '/BIC/ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGDEVICE'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * 2) Dados Comerciais * Parceiro de Negócio ls_is_u_infobjects-low = '/BIC/ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGBPARTN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Contrato ls_is_u_infobjects-low = '/BIC/ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGCONTRA'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Conta-Contrato ls_is_u_infobjects-low = '/BIC/ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACCOUN'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. * Conta-Contrato Parceiro ls_is_u_infobjects-low = '/BIC/ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ls_is_u_infobjects-low = 'ZCGACNTBP'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ELSE. ls_is_u_infobjects-sign = 'I'. ls_is_u_infobjects-option = 'EQ'. * Registro dummy ls_is_u_infobjects-low = 'DUMMY'. APPEND ls_is_u_infobjects TO lt_is_u_infobjects. ENDIF. * begin of insertion by SAP - 02.12.2008 e_object_name = i_object_name. IF e_object_name IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO e_object_name. ENDIF. * end of insertion by SAP - 02.12.2008 IF i_object_type = 'IOBJ'. lv_chabasnm = e_object_name. * retornar configuração de dicionário para infoobjet CALL FUNCTION 'RSD_CHKTAB_GET_FOR_CHA_BAS' EXPORTING i_chabasnm = lv_chabasnm *   I_NSPACEGEN       = *   I_S_VIOBJ         = *   I_T_ATR           = IMPORTING e_chktab = lv_e_chktab e_chntab = lv_e_chntab *   E_CHTTAB          = *   E_TXTTAB          = *   E_SIDTAB          = *   E_SIDVIEW         = *   E_ASITAB          = *   E_ASISTR          = *   E_ASTTAB          = *   E_CHKNEW          = EXCEPTIONS name_error = 1 OTHERS = 2 . IF sy-subrc <> 0. RAISE erro_dynamic_table. ENDIF. * determina tabela para select * de acordo com infoobjet IF i_time_dependent = 'X' AND ls_rsdchabas-timdepfl EQ 'X'. * time-dependent table e_object_name = lv_e_chktab. ELSE. * regular table e_object_name = lv_e_chntab. ENDIF. * DSO ELSE. e_object_name = lv_e_tablnm. ENDIF. ENDMETHOD. nge-ref_table = lv_dynamic_data_table. ls_fields_range-ref_field = <f_v_field>. APPEND ls_fields_range TO lt_fields_range. ls_fields_range-fieldname = 'HIGH'. ls_fields_range-ref_table = lv_dynamic_data_table. ls_fields_range-ref_field = <f_v_field>. APPEND ls_fields_range TO lt_fields_range.*** Alteração Bobis refresh comp_tab. clear comp_tab. LOOP AT lt_fields_range INTO ls_fields_range. clear op_len. if ls_fields_range-REF_FIELD(4) eq '/BIC'. w_iobj = ls_fields_range-REF_FIELD+5(10). else. concatenate '0' ls_fields_range-REF_FIELD into w_iobj. endif. select single CHABASNM from RSDCHA into w_iobj1 where CHANM = w_iobj and objvers = 'A'. if sy-subrc eq 0. select single OUTPUTLEN from RSDCHABAS into op_out where CHABASNM = w_iobj1 and objvers = 'A'. if sy-subrc eq 0. if sy-subrc eq 0. move op_out to ls_fields_range-outputlen. endif. endif. endif. op_len = ls_fields_range-outputlen. comp-name = ls_fields_range-FIELDNAME. comp-type = cl_abap_elemdescr=>get_c( op_len ). APPEND comp TO comp_tab. CLEAR: comp. endloop. CALL METHOD cl_abap_structdescr=>create EXPORTING p_components = comp_tab p_strict = cl_abap_structdescr=>false RECEIVING p_result = struct_type. CLEAR tab_type . CALL METHOD cl_abap_tabledescr=>create EXPORTING p_line_type = struct_type p_table_kind = cl_abap_tabledescr=>tablekind_std RECEIVING p_result = tab_type.* CLEAR: dref.* CREATE DATA dref TYPE HANDLE tab_type.* ASSIGN dref->* TO <f_t_filter1>.* CREATE DATA t_data LIKE LINE OF <f_t_filter1>.* ASSIGN t_data->* TO <f_s_filter1>.* CALL METHOD cl_alv_table_create=>create_dynamic_table* EXPORTING* it_fieldcatalog = lt_fields_range* IMPORTING* ep_table = dref * EXCEPTIONS* generate_subpool_dir_full = 1* OTHERS = 2.** IF sy-subrc NE 0.* RAISE erro_dynamic_table.* ENDIF.*** Alteração Bobis CASE lv_number.********************************************************************************************* Filtro 2**************************************************************************************** WHEN 2.*** Alteração Bobis CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter2>. CREATE DATA t_data LIKE LINE OF <f_t_filter2>. ASSIGN t_data->* TO <f_s_filter2>.* ASSIGN dref->* TO <f_t_filter2>.* CREATE DATA dref LIKE LINE OF <f_t_filter2>.* ASSIGN dref->* TO <f_s_filter2>.*** Alteração Bobis lv_field_filter = '<f_s_filter2>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter2>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. LOOP AT i_filter-zcl_data_filter2 INTO ls_data_filter. lv_field_filter = '<f_s_filter2>-low'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter2> TO <f_t_filter2>. ENDLOOP.********************************************************************************************* Filtro 3**************************************************************************************** WHEN 3.*** Alteração Bobis CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter3>. CREATE DATA t_data LIKE LINE OF <f_t_filter3>. ASSIGN t_data->* TO <f_s_filter3>.* ASSIGN dref->* TO <f_t_filter3>.* CREATE DATA dref LIKE LINE OF <f_t_filter3>.* ASSIGN dref->* TO <f_s_filter3>.*** Alteração Bobis lv_field_filter = '<f_s_filter3>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter3>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. refresh <f_t_filter3>. LOOP AT i_filter-zcl_data_filter3 INTO ls_data_filter. lv_field_filter = '<f_s_filter3>-low'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter3> TO <f_t_filter3>. ENDLOOP.********************************************************************************************* Filtro 3**************************************************************************************** WHEN 4. CLEAR: dref. CREATE DATA dref TYPE HANDLE tab_type. ASSIGN dref->* TO <f_t_filter4>. CREATE DATA t_data LIKE LINE OF <f_t_filter4>. ASSIGN t_data->* TO <f_s_filter4>.* ASSIGN dref->* TO <f_t_filter4>.* CREATE DATA dref LIKE LINE OF <f_t_filter4>.* ASSIGN dref->* TO <f_s_filter4>.*** Alteração Bobis lv_field_filter = '<f_s_filter4>-sign'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'I'. lv_field_filter = '<f_s_filter4>-option'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = 'EQ'. refresh <f_t_filter4>. LOOP AT i_filter-zcl_data_filter4 INTO ls_data_filter. lv_field_filter = '<f_s_filter4>-low'. ASSIGN (lv_field_filter) TO <f_v_field>. <f_v_field> = ls_data_filter. APPEND <f_s_filter4> TO <f_t_filter4>. ENDLOOP. ENDCASE. ENDIF. ENDIF. ELSE. EXIT. ENDIF. ENDIF. ENDDO. ENDIF.* end of insertion by SAP - 26.11.2008* filtro 1 IF <f_t_filter1> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter1. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where* condição where CONCATENATE ls_columns ' EQ <f_t_filter1>-' ls_columns INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 2 IF <f_t_filter2> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter2. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter2>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 3 IF <f_t_filter3> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter3. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter3>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* filtro 4 IF <f_t_filter4> IS ASSIGNED. IF NOT lt_where[] IS INITIAL.* and ls_where-line = 'AND'. APPEND ls_where TO lt_where. ENDIF. ls_columns = i_filter-zcl_filter4. IF ls_columns IN lt_is_u_infobjects. REPLACE 'ZCG' WITH lv_soursystem INTO ls_columns. ENDIF.* condição where CONCATENATE ls_columns ' IN <f_t_filter4>' INTO ls_where. APPEND ls_where TO lt_where. ENDIF.* faz select infoobject IF <f_t_filter1> IS ASSIGNED. SELECT (lt_columns) FROM (lv_dynamic_data_table) INTO TABLE e_t_table FOR ALL ENTRIES IN <f_t_filter1> WHERE (lt_where). ELSE. SELECT (lt_columns) FROM (lv_dynamic_data_table) INTO TABLE e_t_table WHERE (lt_where). ENDIF.ENDMETHOD.