2007 Oct 30 8:23 PM
I am trying to create methods and to keep things as modularized as possible. I want to call a method from my program to read line items from my calling program's internal table called itab_BSEG. I can use a binary search and field symbols in the method for efficiency.
However, in order to do this I would need to pass the large itab_BSEG to the method, so the method would return a small table of line items, itab_line_items, for my Order Number.
Is there a way to efficiently pass the large internal table of itab_BSEG to the method for processing? Or, in this case am I better off just processing the data from where itab_BSEG lives in the calling program?
I've heard of shared memory, are there any other ways to do this with pointers and addresses so the large internal table can be passed efficiently with little crunch on the system?
Thank-You
2007 Oct 30 9:06 PM
Maybe, try this trick:
Define your internal table as a global data in your calling program.
Then, in your method, do the following:
DATA: l_itab_name(30) VALUE '(ZPROGRAMNAME)-ITABNAME[]'.
FIELD-SYMBOLS: <itab> TYPE TABLE. (or TYPE BSEG_TABLETYPE).
ASSIGN l_itab_name TO <itab>.
Now, you can do:
LOOP AT <itab> INTO workarea. (or ASSIGNING <workare>).
ENDLOOP.
I am trying to create methods and to keep things as modularized as possible. I want to call a method from my program to read line items from my calling program's internal table called itab_BSEG. I can use a binary search and field symbols in the method for efficiency.
However, in order to do this I would need to pass the large itab_BSEG to the method, so the method would return a small table of line items, itab_line_items, for my Order Number.
Is there a way to efficiently pass the large internal table of itab_BSEG to the method for processing? Or, in this case am I better off just processing the data from where itab_BSEG lives in the calling program?
I've heard of shared memory, are there any other ways to do this with pointers and addresses so the large internal table can be passed efficiently with little crunch on the system?
Thank-You
2007 Oct 30 9:06 PM
Maybe, try this trick:
Define your internal table as a global data in your calling program.
Then, in your method, do the following:
DATA: l_itab_name(30) VALUE '(ZPROGRAMNAME)-ITABNAME[]'.
FIELD-SYMBOLS: <itab> TYPE TABLE. (or TYPE BSEG_TABLETYPE).
ASSIGN l_itab_name TO <itab>.
Now, you can do:
LOOP AT <itab> INTO workarea. (or ASSIGNING <workare>).
ENDLOOP.
2007 Nov 04 5:08 PM
When you have defined the method, it has a parameter to pass the itab_BSEG. Right...
By default pass by reference is used in methods which of course uses memory sharing. In case you want to explicitly pass the value, you have to use the <b>(VALUE)</b> addition. The syntax for reference/value
METHODS meth IMPORTING REFERENCE(parameter) ....
METHODS meth RETURNING VALUE(parameter) ....
The other way can be putting the itab_BSEG as an attribute in a separate class which (works as a model) can be accessed from other objects as desired.
2007 Nov 05 3:11 AM
Hi,
You can devide this large internal table into few smaller internal tables and keep an index of the same. Next time you can just go to the internal table required and fetch the data.
I have devided like this if data exceeds more than 2GB. Please go through the following link.
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/how%2bto%2bselect%2bdata%2bfrom%2blarge%2btables">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/how%2bto%2bselect%2bdata%2bfrom%2blarge%2btables</a>
This just gives an idea. If you like this idea and want any more information please get bk.
Reward points if useful,
Aleem.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |