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

Returning table without defining structure

Former Member
0 Likes
687

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.

3 REPLIES 3
Read only

Former Member
0 Likes
583

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.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
583

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

Read only

Former Member
0 Likes
583

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