2006 Nov 17 7:44 AM
Hello, I'm back again, finally I can work with general tables without defining structures but now I found a problem, I want introduce the modified fields into a table for returning it, but the question is that this table hasn't the structure definition because is for general purpose so I need return it a then work with it.
I was looking for a solution here and into the sap help but I'm not able to find the solution.
How can I work with the fields (field1-a = xxxxx)?
This one is my code:
DATA: itab_spfli TYPE spfli OCCURS 0 WITH HEADER LINE,
itab1_spfli LIKE itab_spfli OCCURS 0 WITH HEADER LINE,
wa_spfli LIKE spfli.
SELECT * INTO wa_spfli FROM spfli.
APPEND wa_spfli TO itab_spfli.
ENDSELECT.
PERFORM read_table TABLES itab_spfli[] USING 'ITAB_SPFLI[]'.
LOOP AT itab1_spfli INTO wa_spfli.
WRITE: / wa_spfli-carrid.
ENDLOOP.
&----
*& Form read_table
&----
text
----
-->P_TABLA text
----
FORM read_table TABLES pe_itspfli USING ti.
FIELD-SYMBOLS: <f1> TYPE STANDARD TABLE,
<f2> TYPE ANY,
<f3> TYPE ANY.
DATA tabla(20).
tabla = ti.
CONDENSE tabla NO-GAPS.
ASSIGN (tabla) TO <f1>[].
Get data into table
LOOP AT <f1> ASSIGNING <f2>.
WHILE sy-subrc = 0.
ASSIGN COMPONENT sy-index OF STRUCTURE <f2> TO <f3>.
ENDWHILE.
Working with table
APPEND <f2> TO itab1_spfli.
ENDLOOP.
ENDFORM. " read_table
Thank You Very Much In Advance.
You would have to use the ASSIGN COMPONENT statement, you can directly assign the component by field name to the field symbol, then simply move the value to it.
Regards
Rich Heilman
2006 Nov 17 6:26 PM
Hello, anybody answers me and I don't know if I don't explain enough my problem or maybe my problem hasn't solution.
Someone could answer me anything else?
Thanks in advance.
2006 Nov 17 6:35 PM
2006 Nov 17 6:39 PM
Hi Jose
ASSIGN COMPONENT sy-index OF STRUCTURE <f2> TO <f3>.
<f3> = <new value>.
This will change the value in the internal table automatically.
Hope this is what you are asking.
Regards
Kathirvel
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |