Application Development and Automation 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: 
Read only

how to set a Java-like static attribute for a class

tongping
Explorer
0 Likes
825

Hi all,

I'd like to define a static attribute for a class; while it seems that: for ABAP, static attribute of a class only valid for a http connection and after this connection it will be reset. I'm sad about this.

Do anybody know how I can define a Java/C++-like static attribute? I would to keep the content of this attribute for long time.

b.t.w. it seems SET PARAMETER ID and GET PARAMETER ID only works for flat field? What I want to keep is an internal table.

Many thanks and best regards,

Said

Edited by: Sayid Tong on Jun 23, 2008 10:21 AM

1 ACCEPTED SOLUTION
Read only

tongping
Explorer
0 Likes
797

Hi Matthew,

While the persistence way is what I intend to avoid in this case. It's possible to use a database table (it's actually more than one for sake of deep structure) to store these data.

Regards,

Ping

7 REPLIES 7
Read only

matt
Active Contributor
0 Likes
797

You need to look at the persistency framework. Thomas Jung did a blog about it, and there's plenty of documentation. Search on "persistence abap objects" to find it all.

matt

Read only

tongping
Explorer
0 Likes
798

Hi Matthew,

While the persistence way is what I intend to avoid in this case. It's possible to use a database table (it's actually more than one for sake of deep structure) to store these data.

Regards,

Ping

Read only

matt
Active Contributor
0 Likes
797

Have you considered using EXPORT and IMPORT to a cluster table?

regards

matt

Read only

0 Likes
797

Hi Ping,

you can use the server-side cookie facilities that are generally used with the BSP programming model. There is no reason you can't use this facility in any ABAP program.

This allows you to persist ABAP data structures and then "pop" them back out on demand.

Look at the cl_bsp_server_side_cookie class.

Cheers

Graham Robbo

Read only

0 Likes
797

Hi Matthew,

yes, i'm trying export and import. While an question: what's the area for a database table?

In ABAP keyword documentation, there is an example:

... DATABASE dbtab(ar) [FROM wa] [CLIENT cl] ID id

EXPORT tab = itab

TO DATABASE indx(XY)

FROM wa_indx

CLIENT cl

ID 'TABLE'.

While I didn't find explanation for database area and where to check it, in keyword docs and SAP help. Could you help explain it?

Thanks and regards,

Said

Read only

matt
Active Contributor
0 Likes
797

Area is whatever the programmer defines it to be. If you've defined the cluster table yourself, you can choose the area. It's just part of the key.

matt

Read only

tongping
Explorer
0 Likes
797

Hi Matthew, hi Graham,

thanks for your help. the data cluster helps. i'll try cl_bsp_server_side_cookie class later also.

regards,

Said