1 Scenario
1.1 Simple interaction between two variables.
This example shows how one variable can be filled based on the value of another variable. This can be
used in various circumstances. The implementation details are listed in the chapters 3.2 Basics and 3.3
Simple interaction between variables – implementation.
· Next year: You have a variable A containing the actual year and you would like to fill variable B
for the next year automatically based on A.
· Reference versions: You have a variable A containing your current plan version and you would
like to fill variable B with the corresponding reference version.
· Global variables: From a logical point of view you have the same variables in several planning
areas e.g. the actual year. Now you would like to define one ‘leading’ area containing the variable
that should automatically set/adjust the corresponding variables in the other planning areas.
1.2 Use Variables of type attribute in the WEB or in the
planning folders
Due to technical reasons you can’t use variables of type attributes in the web or in the planning folders. A
workaround is explained in chapter 3.4 Using variables of type attribute.
1.3 Selection of an interval
This example shows how you can fill a variable with an interval by specifying the ‘from’ and the ‘to’
separately, e.g. with two drop down boxes in a WEB Application. This is useful when you need one
variable with an interval (e.g. for data selection in a planning package) as well as the upper and lower
values of the interval (e.g. for the parameters of a planning function). Please see chapter 3.5 Selection of
an interval.
1.4 One variable restricts the selection of another variable.
You work in the WEB and you have a variable A containing the material group. Now variable B should
contain all materials belonging to this group.
1.5 BW Query uses SEM-BPS/BW-BPS variable for default
value
During your planning session you have restricted a variable to a single value. Now you like to execute a
BW query that should use this restriction as default. Please see chapter 3.7 BW Query uses SEM-BPS/BWBPS
variable for default value for more details.
2 Introduction
Before starting there are some things that have to be taken into consideration when working with the
examples.
When the system sets or reads the values of several variables in one step (e.g. when pressing the refresh
button) no particular sequence of processing is guaranteed. This could lead to problems when you work
with ‘dependent’ variables as shown in the following example. You can force the system to set and refresh
a variable value after each change by pressing the refresh button in the planning folder each time or, for
variables in the WIB, by setting the event-attribute to true.
Example: You allow the choice of the material group and the material simultaneously with the
consequence that you can enter an invalid combination. Hence you have to specify a rule that determines
which variable is the dependent and which is the leading one in order to determine the result values.
The variables are often part of the selection. Please consider that for one execution of a planning function
the value is normally requested several times. This implies that it doesn’t make sense to send pop-ups
without additional logic. As a consequence of this you should buffer the selection results in the variable
to avoid a certain overhead.
During processing using the default settings, the WIB buffers the values of a variable internally and will
not change the set of variable values that are displayed after the initial execution of a WEB planning
application. This default can be changed by specifying a variable that should trigger a re-read of a second
variable. (When using SEM3.1-3.5 you need to add a record to table upc_dark2 with param=
WEB_REFRESH_ON_CHANGE and value=X.)
Example: The variable product delivers the values 1000 and 1001 on the execution of the web application.
As this variable is of type exit it’s values can change during runtime to 2000 and 2001 (e.g. as a reaction to
the change of variable for product line). The drop-down box on the WEB page will still show the values
1000 and 1001 unless you have specified that a change of product line should re-read the values of the
drop-down box.
To understand the steps described in the following chapters it is assumed that you are familiar with the
ABAP development transactions (e.g. SE80 or SE37) and that you know how to create and activate new
function modules.
Create the function module
z_variable_get_detail. The complete
Source code is listed in the attachments
of this document.
(See chapter 4.1 Function module
Z_VARIABLE_GET_DETAIL).
FUNCTION z_variable_get_detail.
*”————————————————-
*”*”Local interface:
*” IMPORTING
*” VALUE(I_AREA) TYPE UPC_VAR-AREA
*” VALUE(I_VARIABLE) TYPE UPC_VAR-VAR
*” VALUE(I_BUFFER) TYPE BOOLE-BOOLE OPTIONAL
*” EXPORTING
*” VALUE(E_SUBRC) TYPE SY-SUBRC
*” VALUE(ES_RETURN) TYPE BAPIRET2
*” VALUE(E_TYPE) TYPE UPC_VAR-VARTYPE
*” REFERENCE(ETO_VARSEL_ALL) TYPE UPC_YTO_CHARSEL
*” REFERENCE (ETO_VARSEL) TYPE UPC_YTO_CHARSEL
*” REFERENCE (ETO_CHANM) TYPE UPC_YTO_CHA
*”————————————————-
All the data in this post are from sap . this is not of my own.