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

Passing data between programs using OOA

Former Member
0 Likes
3,223

Hello Experts,

I have program1 with selection screen and using class methods to fetch data. Now i have the data stored in both

1) Instance variable and

2) Static variable

Now i need to pass this data to program 2 and i am using Submit and return.

In Program 2 when i try to read the Static method to get the data, there is no data returned. its all empty. any thoughts?

*** Code snippet as below *** PRG 1 **********

  o_sel->v_arbgb = p_arbgb.
  o_sel->t_msgnr_range = s_msgno[].

CALL METHOD o_data->get_data "Uses the selection screen values and fetches the DB values.
  EXPORTING
    o_sel  = o_sel.

**CALL METHOD yggtest1_data1=>get_stored_data
**  IMPORTING
**   it_data = lt_t100.  "Returns data of 10 records

SUBMIT yggtest2 and RETURN.

*** Code snippet as below *** PRG 2 **********

CALL METHOD yggtest1_data1=>get_stored_data
  IMPORTING     it_data = lt_t100

lt_t100 returns no data -even though there is 10 records before the submit statement.

any thoughts do please share?  All i would like is to use OOA to pass data between different reports, instead of Export/Import memory

6 REPLIES 6
Read only

Former Member
0 Likes
1,446

Hi

uh... as i know, there is no concept is you could transport objects by OO in ABAP.

Anyway you need export to memory, export a OO instance to memory or a itab.

Need gurus to confirm this,

And this is class named as 'cl_salv_bs_runtime_info' could get last data from last program you submitted.

regards,

Archer

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,446

Hi,

The static methods/attributes call is invalid across different contexts( valid only in the same program where its used ).

For you scenario, you can have a look into http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/307d791b-3343-2e10-f78a-e1d50c7cf...

Kesav

Read only

Former Member
0 Likes
1,446

Hi,

Please try to use IMPORT and EXPORT parameters. This makes your program easy and problem will be solved.

Regards,

Sneha.

Read only

indra_dewaji
Explorer
0 Likes
1,446

Hi AB GK,

Try to use a singleton class which has an access to a public attributes. You can access the same instance during runtime and sharing the data between two program. It's the other way of using import and export.

Read only

0 Likes
1,446

A singleton class can achieve this?

Say,

A singleton class with global public attribute in program A.

And in program B, submit A, then B can access the attribute of singleton class???

regards,

Archer

Read only

Tomas_Buryanek
Product and Topic Expert
Product and Topic Expert
0 Likes
1,446

SUBMIT replaces internal session, or with AND RETURN creates new one. So previous singleton instance will not be visible in SUBMITed program.

-- Tomas --