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: 

how to paas internal table value

Former Member
0 Kudos

how to pass internal table first value to a variable plz help me

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Use read statement or Loop At statement, and in that loop use the key word EXIT.

Reward points.

Regards,

Vamsi.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Use read statement or Loop At statement, and in that loop use the key word EXIT.

Reward points.

Regards,

Vamsi.

Former Member
0 Kudos

Hi dulla anjan prasad

You can use the LOOP statement to process special loops for any internal table.

LOOP AT itab result condition.

statement block

ENDLOOP.

This reads the lines of the table one by one as specified in the result part of the LOOP statement. You can then process them in the statements within the LOOP - ENDLOOP control structure. You can either run the loop for all entries in the internal table, or restrict the number of lines read by specifying a condition. Control level processing is allowed within the loop.

The sequence in which the lines are processed depends on the table type:

· Standard tables and sorted tables

The lines are processed according to the linear index. Within the processing block, the system field sy-tabix contains the index of the current line.

· Hashed tables

As long as the table has not been sorted, the lines are processed in the order in which you added them to the table. Within the processing block, the system field sy-tabix is always 0.

You can nest LOOP blocks. When you leave the loop, sy-tabix has the same value as when you entered it. After the ENDLOOP statement, sy-subrc is zero if at least one table entry was processed. Otherwise, it is 4.

The loop may not contain any operations on entire internal tables that change the table. However, you should remember that even saving a global internal table with the LOCAL statement in a procedure is a change operation on the entire table, since it exchanges the table contents. When you call procedures within loops, you should therefore check that it does not change the entire internal table. If you change the table, the loop can no longer work properly.

If you insert or delete a table entry within a loop pass, it is taken into account in subsequent loop passes as follows:

· If you insert a line after the current line, it will be processed in a subsequent loop pass.

· If you delete a line after the current line, it will not be processed in a subsequent loop pass.

· If you insert a line before or at the current line, the internal loop counter will be increased accordingly.

· If you delete a line before or at the current line, the internal loop counter will be decreased accordingly.

If this information is usefull plz do reward points....

Message was edited by:

ARUN

Former Member
0 Kudos

hi,

do you want to move the first record from the internal table to a variable??

for this just

READ itab into work_area index 1.

this will read the first record in the work area then simply move it into the variable accordingly.

if this is not the case then please elaborate your requirement.

thanks,

award and close the thread if answered.

taher

former_member386202
Active Contributor
0 Kudos

Hi,

Loop at that internal table

pass first record to one variable and use exit to exit the loop.

Regards,

Prashant

0 Kudos

Hi,

Check this..

READ TABLE itab INDEX 1.

then move to variable.

Reward me if it helps.

Thanks ,

Sachin