Application Development 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: 

array concept in abap

Former Member
0 Kudos

I want to know concept of table(array). i want to take name of 5 student from user and display on screen.how can i increment variable.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi

you use internal table to fetch the data from database and use it for further processing. this will help you decrease hitting the Database frequently and hence improve your performance.

in ur case:

REPORT ZM1 .

DATA: BEGIN OF ITAB OCCURS 0, " Internal table

NAME(30), " Char type

END OF ITAB.

SELECTION-SCREEN BEGIN OF BLOCK B1.

PARAMETER: P_NAME LIKE ITAB-NAME.

SELECTION-SCREEN END OF BLOCK B1.

START-OF-SELECTION.

SELECT <field>

FROM <table>

INTO TABLE ITAB

WHERE <condition>.

IF SY-SUBRC = 0.

LOOP AT ITAB.

WRITE:/ ITAB-NAME.

ENDLOOP.

ENDIF.

**reward if helpful

regards,

madhu

4 REPLIES 4

Former Member
0 Kudos

hi

you use internal table to fetch the data from database and use it for further processing. this will help you decrease hitting the Database frequently and hence improve your performance.

in ur case:

REPORT ZM1 .

DATA: BEGIN OF ITAB OCCURS 0, " Internal table

NAME(30), " Char type

END OF ITAB.

SELECTION-SCREEN BEGIN OF BLOCK B1.

PARAMETER: P_NAME LIKE ITAB-NAME.

SELECTION-SCREEN END OF BLOCK B1.

START-OF-SELECTION.

SELECT <field>

FROM <table>

INTO TABLE ITAB

WHERE <condition>.

IF SY-SUBRC = 0.

LOOP AT ITAB.

WRITE:/ ITAB-NAME.

ENDLOOP.

ENDIF.

**reward if helpful

regards,

madhu

0 Kudos

no , i do not want to fetch data from database. i just want to save date in a internal table temporarly and want to display it on screen using write statement.

0 Kudos

Hi Mohit,

you can create an internal table and append data to that table. using the write statement you can display data what you have appended.

DATA: BEGIN OF ITAB OCCURS 5, " Internal table

NAME(20) type 20,

END OF ITAB.

itab-name = 'mohit'.

append itab.

itab-name = 'abc'.

append itab.

. .. . .

. . . .

. . . .

IF SY-SUBRC = 0.

LOOP AT ITAB.

WRITE:/ ITAB-NAME.

ENDLOOP.

ENDIF.

this code will display the data inserted by you.

reward all the helpful answers.

regards

vivek

0 Kudos

thanks to solve my problem. hope we keep on going in future also