cancel
Showing results for 
Search instead for 
Did you mean: 

where to use local variable and where to use global variable in SAP BODS

Former Member
0 Kudos

Hi ,

    I am confusing to use in which case i have to use local and in which case i have to use global variables and also what is the use of parameters in

workflow and dataflow,can any body give a scenario please.

Regards,

prudhvi

Accepted Solutions (1)

Accepted Solutions (1)

Rishabh_Awasthi
Active Participant
0 Kudos

Hi Prudhvi,

First of all need to understand the scope for use of the local and global variables...

its similar to what we know in C language:

Global Variables can be acesssed anywhere but local variables have a defined scope in the function or entity where you declare it.

If there is a conflict with same name of global and local variable the it depends upon the the level..if a local variable is declared at that level it will override the value of global variable and its value will be accessed and outside the value of global variable will be accessed.

In BODS scope of these variables are as in table-

Object

Variable / Parameter, which can be created for the Object

Scope of use

Job

Local variables

Global variables

A script or conditional in the job

Any object in the job

Work flow

Local variables

Parameters

This work flow or passed down to other work flows or data flows using a  parameter. Parent objects to pass local

  1. Work flows may also return variables or parameters to parent objects.

Data Flow

Parameters

A WHERE clause, column mapping, or a function in the data flow. Data flows cannot return output values.

As for parameters if you want to return any values form a function in script then you can use output parameters and input parameters are used to pass values into the function.

Its better to define variables according to scope and use.

see the below link why global variables should not be used everywhere.

http://www.gulland.com/wp/?p=727

Regards,

Rishabh

Former Member
0 Kudos

Hi Rishadh,

            Thank you

Regards,

Raj

Former Member
0 Kudos

Are local variables accessible under the "Worksheet" while defining the excel object.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Prudhvi,

if you want to use same value of the variable in every component of job then you can use global .

If different values are to be used in different components like in workflows then you can use local variable.

Regards,

Ankit

Former Member
0 Kudos

SAP DS reference guide gives detailed information on local and global variables.

Check this for some info - http://www.dwbiconcepts.com/business-intelligence-forum/how-to-define-local-global-variables-at-job-...

Arun