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

Transporting data from abap to function

h_senden2
Active Contributor
0 Likes
1,582

Hi,

i need to transport data (Set/Get or other technique) from method 1 to method 2.

abap 1 call method1 of badi 1

abap 1 calls function module 1 IN UPDATE TASK

function module 1 calls function module 2 with destination 'NONE'.

function module 2 calls method 2 of badi 2

I've tried the Set/get parameter technique, but it didn't work.

Are there other possibilities ?

regards,

Hans

hans.senden@philips.com

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,523

Hi ,

So you have given 4 scenarios in your first mail.

Please try this

In Method 1

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

WA_INDX TYPE INDX.

  • Before export, fill the data fields

  • before CLUSTR.

WA_INDX-AEDAT = SY-DATUM.

WA_INDX-USERA = SY-UNAME.

  • Export der Daten.

EXPORT IT FROM IT

TO SHARED BUFFER INDX(ST) FROM WA_INDX ID INDXKEY.

In Method 2

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

WA_INDX TYPE INDX.

IMPORT IT TO IT

FROM SHARED BUFFER INDX(ST) ID INDXKEY TO WA_INDX.

Hope thsi works .

Cheers.

14 REPLIES 14
Read only

Former Member
0 Likes
1,523

Hi

You can use ABAP memory with EXPORT / IMPORT parameters .

Cheers.

Read only

Vinod_Chandran
Active Contributor
0 Likes
1,523

Try EXPORT TO MEMORY.

For example

EXPORT <var> TO MEMORY ID 'TEST'.

IMPORT <var> FROM MEMORY ID 'TEST'.

Read only

0 Likes
1,523

I've tried the EXPORT to memory id solution, but the compiler gives an error in the badi-method :

EXPORT var_1 ... var_n TO MEMORY ... is not supported in the OO context.

Hans

Read only

Former Member
0 Likes
1,523

Hi

You will have to define the from parameter also like -

EXPORT W_SEND_MEM FROM W_SEND_MEM TO MEMORY ID 'Z129'.

Cheers

Read only

0 Likes
1,523

I've changed it to this syntax. The compiler says everything is all right. But no data is transferred from method 1 to method 2.

Read only

0 Likes
1,523

Hi ,

To add to Sanjay,

when you are importing it should have the same parameter name, otherwise it will not copy the value.

For example if you are exporting like this:

EXPORT W_SEND_MEM FROM W_SEND_MEM TO MEMORY ID 'Z129'

the corresponding import statement should be

IMPORT W_SEND_MEM FROM MEMORY ID 'Z129'

W_SEND_MEM in export and import statements should match.

Regards,

Surendra

Read only

0 Likes
1,523

> Hi ,

> To add to Sanjay,

> when you are importing it should have the same

> parameter name, otherwise it will not copy the

> value.

>

> Regards,

> Surendra

it is !

Read only

Former Member
0 Likes
1,523

Hi

Can you paste your code of method 1 and method 2.

Cheers.

Read only

0 Likes
1,523

Code method 1 :

data: lx_convert type xfeld.
* depending on some conditions the variable lx_convert
* will be set to 'X' or ' '
lx_convert = 'X'.

EXPORT lx_convert from lx_convert to memory id 'ZZHSTEST_CONVERT'.

Code method 2 :

DATA: lx_convert TYPE xfeld.
IMPORT lx_convert to lx_convert FROM MEMORY ID 'ZZHSTEST_CONVERT'.
* to show the resulting value of lx_convert
* i will use a call of function TH_POPUP with the value 
* as text

Read only

Former Member
0 Likes
1,523

Hi

My question was how you are calling method 2 from methiod 1

Cheers.

Read only

0 Likes
1,523

> Hi

>

> My question was how you are calling method 2 from

> methiod 1

>

> Cheers.

see my initial post

Read only

Former Member
0 Likes
1,524

Hi ,

So you have given 4 scenarios in your first mail.

Please try this

In Method 1

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

WA_INDX TYPE INDX.

  • Before export, fill the data fields

  • before CLUSTR.

WA_INDX-AEDAT = SY-DATUM.

WA_INDX-USERA = SY-UNAME.

  • Export der Daten.

EXPORT IT FROM IT

TO SHARED BUFFER INDX(ST) FROM WA_INDX ID INDXKEY.

In Method 2

DATA: INDXKEY LIKE INDX-SRTFD VALUE 'KEYVALUE',

WA_INDX TYPE INDX.

IMPORT IT TO IT

FROM SHARED BUFFER INDX(ST) ID INDXKEY TO WA_INDX.

Hope thsi works .

Cheers.

Read only

0 Likes
1,523

Sanjay,

the values are transported now. It seems to work all right. It's the end of the day for me now, but i'm going to test it tomorrow morning.

Thanx,

Hans

Read only

0 Likes
1,523

Sanjay,

your solution did solve my problem. Thanx

Hans