Skip to Content
author's profile photo
Former Member

AT END OF F1/F2 on same itab; LOOP AT <itab1/itab2> INTO wa

Hi All,

1)

I need to get the itab dynamically.

LOOP AT itab_dyn INTO wa.

ENDLOOP.

Here, itab_dyn can be itab1 or itab2 (based on a condition) and both of which have same fields only change in order of table fields. ex: table1 - F1, F2 ; table2- F2, F1

Can we have field symbols for that? Please tell any other possible solutions.

2)

But my basic requirement is to use AT END OF F1/F2 inside a single LOOP.

But even if we give SORT itab BY F1 F2 and F2 F1 based on condition, AT END OF won't work in both cases (ex: struct-F1 F2, SORT F2 F1. it will consider change of F1, when you write AT END OF F2) because I think the field should be first one while defining structure

Thanks in advance,

Nunu Vengal.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 11:11 AM

    1) Define a field symbol as TYPE TABLE and assign the internal table itab1 or itab2 to that field symbol using the ASSIGN TABLE statement.

    ASSIGN TABLE itab1 TO <fs>.

    2) Sort the field symbol (internal table) by the desired field (F1/F2) and use ON CHANGE OF <Field> instead of AT END OF...

    Please mark points and close the thread if the solution was useful.

    Regards,

    Manoj

    Add comment
    10|10000 characters needed characters exceeded