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

Internal Table

Former Member
0 Likes
477

Hi Experts,

I have internal table like this

Doc_no Doc_name Doc_ver

K01 swuu 01

M01 mmuq 01

S01 ssqq 01

S01 ssqq 02

S01 ssqq 03

While displaying all the data’s are coming.But I wants to display

Document with the current version.

In this case S01 ssqq 03 this is the document with the current verison.

kindly put some light on this, Thanks in advance.

Cheers...

Santosh

1 ACCEPTED SOLUTION
Read only

alex_m
Active Contributor
0 Likes
456

Sort ur internal table by Doc_no Doc_name Doc_ver

loop at internal table and

at end of Doc_ver,

write the output.

Endloop.

5 REPLIES 5
Read only

alex_m
Active Contributor
0 Likes
457

Sort ur internal table by Doc_no Doc_name Doc_ver

loop at internal table and

at end of Doc_ver,

write the output.

Endloop.

Read only

Former Member
0 Likes
456

sort the table and then use at control

at end of Doc_name

format color COL_HEADING on,

write Doc_no Doc_name Doc_ver

format color off.

endat.

Read only

Former Member
0 Likes
456

HI..

<b>loop at itab where Doc_ver = '03'.

write: / itab-Doc_no ,

itab-Doc_name,

itab-Doc_ver.

endloop.</b>

Read only

Former Member
0 Likes
456

Hi there. Another option is to sort descending and then use the first record. This should be a little faster. Example:

SORT itab by Doc_no DESCENDING Doc_name Doc_ver DESCENDING.

LOOP AT itab.

write: / "Current version: ", itab-Doc_no, ' ', itab-Doc_name, ' ', itab-Doc_ver.

EXIT.

ENDLOOP.

- April King

Read only

Former Member
0 Likes
456

Hi..,

data wa_current_version like line of itab.

data w_version like itab-doc_ver vallue '00'.

loop at itab .

if itab-doc_ver gt w_version .

w_version = itab-doc_ver.

wa_current_version = itab.

endif.

endloop.

here wa_current_version contains the record with version '03'.

reward if it helps u..

sai ramesh