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: 

Internal table in badi

Former Member
0 Kudos
610

Hello friends,

I am working with Badi's and my requirement is i need to fetch the data from database in badi method and have to use that data in my abap program.

So, is there any way i can declare internal table as export parameter of badi method or else if I declare internal table in my abap program and export that while calling badi method then how to declare internal table as import parameter in badi method.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
187

Some things are not clear here..

1 - You have a ABAP Program that trigger's a process that calls a BADI and then return to your ABAP Program

OR

2 - You have implemented a BADI in a process that runs separately from the ABAP Program, and you need to grab data from the BADI into your Program?

I`d suggest:

1 - Try to use a static method or a static class with a method that would "hold the data" from the badi into you memory. You could use methods like SET_INT_TABLE in BADI and then GET_INT_TABLE in your ABAP Prog.

2 - Not sure why you want to do this, but use a Z table.

Regards

Edited by: Mauricio Roberto Cruz on Feb 11, 2011 2:26 PM

5 REPLIES 5

eduardo_hinojosa
Active Contributor
0 Kudos
187

Hi,

You can call a function module (Z_*) from the BADI and set in the interface the parameters that you need. In the function module you can work with internal tables.

I hope this helps you

Regards

Eduardo

Former Member
0 Kudos
188

Some things are not clear here..

1 - You have a ABAP Program that trigger's a process that calls a BADI and then return to your ABAP Program

OR

2 - You have implemented a BADI in a process that runs separately from the ABAP Program, and you need to grab data from the BADI into your Program?

I`d suggest:

1 - Try to use a static method or a static class with a method that would "hold the data" from the badi into you memory. You could use methods like SET_INT_TABLE in BADI and then GET_INT_TABLE in your ABAP Prog.

2 - Not sure why you want to do this, but use a Z table.

Regards

Edited by: Mauricio Roberto Cruz on Feb 11, 2011 2:26 PM

0 Kudos
187

The methods which you had suggested 'set_int_table' and 'get_int_table' are SAP defined or I have to code them in my Badi and ABAP program.

0 Kudos
187

You would have to create a new class in SE24, with 2 static methods that would maintain a attribute named INT_TABLE (where data you wanna hold will be stored).

Then you use SET_INT_TABLE inside the BADI, and you can grab data into your program using GET_INT_TABLE.

I already used something similar, and I found more useful and structured than just exporting things to memory (which i hate btw).

Former Member
0 Kudos
187

Solved the problem.

Thanks for replying.