Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

read... the rules about meaningfull subject titles please

Hi Guyz,

LOOP AT gt_data INTO gs_data FROM 2.

REFRESH:gt_columns.

  • gs_data = gt_data-line.

SPLIT gs_data AT '|' INTO TABLE gt_columns.

READ TABLE gt_columns INDEX 1 ASSIGNING <fs_data>.

gt_tab-client = <fs_data>.

im reading the data using above read statement , iam doing it 11 times coz i know there is 11 entries (sy-tabix = 11)..but i dont wanna hardcode that bit after index..how can i do it?..plz advise

thanks

Edited by: Julius Bussche on Oct 7, 2008 6:00 PM

Tags:
Former Member
replied

I see, but the problem is not LOOP vs. READ TABLE here...

The question is now, if in the target table the fields are in the same order, then in the source. If gt_tab is built up in the same sequence, like the source (that means client is the fierst field, asd is the second....wsd is the last), if yes than you can code like:

FIELD-SYMBOLS : <fs_target> TYPE ANY.

DO 11 TIMES.
READ TABLE gt_columns INDEX sy-index ASSIGNING <fs_data>.
ASSIGN COMPONENT sy-index OF structure gt_tab TO <fs_target>.
<fs_target> = <fs_data>.
ENDDO.

(sorry Rob, it still READ TABLE

One more thing: Can't you replace the whole thing with only:

SPLIT gs_data AT '|' INTO gt_tab-client, gt_tab-asd, ... , gt_tab-wsd.

???

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question