2013 Jun 13 2:19 AM
Hi Experts,
I can't figure out how to do the following:
Pass an internal table to a ABAP Method by reference
In the Method, use the internal table data to do a SELECT FROM INTO TABLE FOR ALL ENTRIES WHERE.
The internal table I'm passing can have different structure but will always have the fields used in the WHERE clause.
I've tried typing it "Table" in the method parameters but then I can't use the field name in the WHERE clause since it's not explicitly defined. I could loop thru the table using field symbols and recreate the table but that defeats the purpose. I might as well do the SELECT outside of the method and pass the end result to the Class.
Any help would be much appreciated.
Thank you,
Dae
2013 Jun 13 3:13 AM
2013 Jun 13 3:13 AM
2013 Jun 13 3:18 AM
Hi,
Have you done something like shown in the screenshot for using as reference Check the entry ET_KEYVALUE that should pass an internal table to a ABAP Method by reference, I got confused on the below statement
I've tried typing it "Table" in the method parameters but then I can't use the field name in the WHERE clause since it's not explicitly defined.
Can you clarify a bit more.
Cheers,
Arindam
2013 Jun 13 8:14 AM
You could define a local structured internal table in the method with only the field(s) required for the SELECT statement. At start of method use a LOOP ASSIGNING a ANY TYPE field-symbols then assign the component required to another FIELD-SYMBOLS of the required type and append it to the local internal table. Use this local internal table in the FOR ALL ENTRIES clause.
Regards,
Raymond
2013 Jun 13 8:40 AM
FIELD-SYMBOLS: <l_i_ref> TYPE STANDARD TABLE.
DATA: i_tab TYPE t_tab,
ASSIGN i_temp TO <l_i_ref>.
SELECT matnr
maktx
FROM z_table
INTO TABLE i_tab
FOR ALL ENTRIES IN <l_i_ref>
WHERE (matnr EQ <l_i_ref>-matnr ).
2013 Jun 13 8:54 AM
Exactly as in the links posted by Uma Arjunan.
Thread locked. Please search before posting questions.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |