cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

STATICS data declaration

Former Member
0 Likes
1,743

Hi all,

When we declare the data declaration using STATICS and DATA.

What are the advantages using STATICS. why we use when we are creating generic extractors using FM.

Please let me.

Thanks and Regards

Satish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Hi Satish,

from SAP-Docu:

Example

The subroutine add_1 gets the same result for the variable local for each call as this is instanced again each time. The static variable static is already available and its value increased by one during each call.

DO 10 TIMES.

PERFORM add_one.

ENDDO.

FORM add_one.

DATA local TYPE i VALUE 10.

STATICS static TYPE i VALUE 10.

local = local + 1.

static = static + 1.

WRITE: / local, static.

ENDFORM.

/manfred

Answers (1)

Answers (1)

Former Member
0 Likes

Hi Satish,

you need static variables in generic extractors using FM because the function module is not called once but several times from BW (Once for initialization, then depending on size of data packages). Your extraction programm needs to keep some data from the initial call to be able to extract corectly in the next call. If you use standard (DATA) variables, they will be cleared again and again.

Hope that helps

Stephan