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

retrieve the data in internal table

Former Member
0 Likes
1,368

Hi all

I gt this internal table. Wad is the syntax to display all the data in the internal table. Below is my code for the internal table. I know i need to use a loop, however i do not know the loop statement. any help?

DATA: line(256) TYPE c,

text_tab LIKE STANDARD TABLE OF line,

field LIKE line.

START-OF-SELECTION.

line = 'Hello'.

APPEND line TO text_tab.

line = 'World'

APPEND line TO text_tab.

11 REPLIES 11
Read only

Former Member
0 Likes
1,248

Hi,

LOOP AT text_tab INTO line.

Write:/ line.

ENDLOOP.

Regards,

Atish

Read only

Former Member
0 Likes
1,248

check link how to write report

Reports

http://www.sapgenie.com/abap/reports.htm

http://www.allsaplinks.com/material.html

http://www.sapdevelopment.co.uk/reporting/reportinghome.htm

http://www.sapfans.com/forums/viewtopic.php?t=58286

http://www.sapfans.com/forums/viewtopic.php?t=76490

http://www.sapfans.com/forums/viewtopic.php?t=20591

http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.

DATA: line(256) TYPE c,

text_tab LIKE STANDARD TABLE OF line,

field LIKE line.

START-OF-SELECTION.

loop at text_tab.

line = 'Hello'.

APPEND line TO text_tab.

line = 'World'

APPEND line TO text_tab.

endloop.

here Hello and World will be get stored one below the others so you will get total records double than internal table size.

Minal Nampalliwar

null

Read only

Former Member
0 Likes
1,248

You can use this syntax.

SORT TEXT_TAB.

LOOP AT TEXT_tAB.

WRITE:/ TEXT_TAB-LINE.

ENDLOOP.

For more details for WRITE and LOOP command check this link -

http://www.geocities.com/rmtiwari/Resources/Utilities/ABAPReference/ABAPReference.html

ashish

Read only

harimanjesh_an
Active Participant
0 Likes
1,248

hi gary,

DATA: line(256) TYPE c,

text_tab LIKE STANDARD TABLE OF line,

field LIKE line.

START-OF-SELECTION.

line = 'Hello'.

APPEND line TO text_tab.

line = 'World'.

APPEND line TO text_tab.

<b>LOOP AT text_tab INTO field.

write : / field.

ENDLOOP.</b>

Reward me if useful,

Harimanjesh AN

Read only

0 Likes
1,248

Thank!

Instead of having a write statement, i want the record go into my database table. how can i achieve it. I need a insert statement. What is the syntax for this insert?

Read only

0 Likes
1,248

Hi,

This depend on the structure of your DB table.

Regards,

Atish

Read only

0 Likes
1,248

See my link which i mentioned earlier -

http://www.geocities.com/rmtiwari/Resources/Utilities/ABAPReference/ABAPReference.html

It contains syntax for all basic ABAP commands with example.

ashish

Read only

0 Likes
1,248

Hi gary,

Instead of write line:

============================

LOOP AT text_tab.

WRITE 😕 text_tab-line.

ENDLOOP.

==============================

You can append to another itab if your itab have similar datatype. you can do a loop to append to the itab like this:

=================================

LOOP AT text_tab.

APPEND text_tab-line TO itab.

ENDLOOP.

=========================

Regards,

Rayden

Read only

0 Likes
1,248

Hi

You can use modify or insert statement.For getting all syntax just type insert or modify in abap editor and place the cursor on that and press f1 you will get all the documentation for that.

Reward if useful.

Regards

Shibin

Read only

gopi_narendra
Active Contributor
0 Likes
1,248

Check this sample code

DATA : BEGIN OF text_tab OCCURS 0,
         line(50) TYPE c,
       END OF text_tab.

START-OF-SELECTION.

  text_tab-line = 'Hello'.
  APPEND text_tab.
  text_tab-line = 'World'.
  APPEND text_tab.

  LOOP AT text_tab.
    WRITE :/ text_tab-line.
  ENDLOOP.

Regards

Gopi

Read only

Former Member
0 Likes
1,248

Hi,

LOOP AT text_tab INTO field.

Write:/ field-line.

ENDLOOP.

<b>reward points if helpful.</b>

regards,

Vinod Samuel.