Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Static table in normal abap function module

Former Member
0 Kudos

Hi All,

I have written a code which calls multiple function module multiple times with parameters. However in code review I got comments: 'Please declare a static table to maintain the values of x/y/z.... this can be used when the FM is called evry time for the same values.'

I have never implemented this functionality. I guess in class and object programming we have functionality to put parameters as static. Can anybody put more light on this? An example would help a lot.

Thanks in advance.

Regards,

Jignesh

4 REPLIES 4

Former Member
0 Kudos

WHEN EVER YOU ARE CALLING ANY SUBROUTINE AND FM THE DATA YOU ARE DECLARING THERE ARE LOCAL TO THAT PERTICULAR FM OR SUB ROUTINE... SO WHEN EXITING FROM THOSE THE VALUES ARE GETTING INITIAL VALUES.. SO IF YOU ARE CALLING THE FM OR SUBROUTINE AGAIN YOU WILL GET THE VALUE AS INITIAL VALUE..FOR THAT WE ARE DECLARING THE VARIABLE STATIC IN FM OR IN SUBROUTINE FOR CONTAINING ITS VALUE AFTER EXITING FROM THOSE AND WHEN WE WILL CALL THAT THE VALUE REMAIN SAME AT IT WAS AFTER LAST CALL.

REGARDS

SHIBA DUTTA

0 Kudos

I know the functionality of static variables but I never heard a static table for them. Do you know how can we define a static table?

Former Member
0 Kudos

Structured Static Data Object Definitions

- STATICS: BEGIN OF struc,

...

END OF struc.

Structured Static Internal Table Definition

- STATICS itab TYPE tabtype [WITH HEADER LINE].

- STATICS itab TYPE tabkind OF linetype

[WITH [UNIQUE|NON-UNIQUE] keydef]

[INITIAL SIZE n] [WITH HEADER LINE].

- STATICS itab LIKE tabkind OF lineobj

[WITH [UNIQUE|NON-UNIQUE] keydef]

[INITIAL SIZE n] [WITH HEADER LINE].

- STATICS itab TYPE linetype OCCURS n [WITH HEADER LINE].

- STATICS itab LIKE lineobj OCCURS n [WITH HEADER LINE].

- STATICS: BEGIN OF itab OCCURS n,

...

END OF itab [VALID BETWEEN f1 AND f2].

STATICS itab TYPE RANGE OF type.

STATICS itab LIKE RANGE OF f

REGARDS

SHIBA DUTTA

0 Kudos

Thanks. I will try this in my program.