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

inetrnal table

Former Member
0 Likes
849

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

K01 swuu 01

M01 mmuq 01

S01 ssqq 03

these are the document with the current verison.

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

K01 swuu 01

M01 mmuq 01

S01 ssqq 03

these are the document with the current verison.

7 REPLIES 7
Read only

alex_m
Active Contributor
0 Likes
829

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.

Message was edited by:

Alexander

Read only

Former Member
0 Likes
829

HI

sort the itab with Doc_ver.

use "at end of doc_ver" event to print the req output.

regards,

madhu

Read only

former_member632991
Active Contributor
0 Likes
829

Hi,

Sort ur internal table by Doc_no Doc_name Doc_ver

and

loop at internal table and

at end of Doc_ver,

write the output.

Regards,

Sonika

Read only

Former Member
0 Likes
829

sort the internal table and then use AT control

at end of Doc_no

write: / Doc_no Doc_name Doc_ver.

enat.

Message was edited by:

liang ren

Read only

Former Member
0 Likes
829

Hi,

u need to have a common code for versions i.e

01-latest

02-not latest

03-oldest

then u could say.

Loop at itab where doc_ver = '01'.

write:/....

Endloop.

r else you need to handle all the cases seperately.

Loop at itab where doc_ver = '01'.

perform sub_check print using itab-doc_ver

changing p_flag.

if p_flag = 'X'.

write.

endif.

Endloop.

update the flag when its a new version write ur code in the perform

santhosh

Read only

Former Member
0 Likes
829

Hi,

data ITAB1 like ITAB occurs 0 with header line.

Sort ITAB by DOc_no DOC-Name version.

loop at ITAB.

at end of version.

read table itab index sy-tabix.

move-corresponding iTAB to ITAB1.

appen itab1.

clear itab1.

endat.

endloop

reward if useful

regards,

ANJI

Read only

Former Member
0 Likes
829

Hi Vani,

Use SORT statement on internal table to sort the content of internal tables on fields.

If your DOC_VER is a character field then use

SORT ITAB BY DOC_NO DOC_VER.

If your DOC_VER is a numeric field then use

SORT ITAB BY DOC_NO DOC_VER DESCENDING.

LOOP AT ITAB.
AT NEW DOC_NO.
READ ITAB INDEX SY-TABIX INTO WA_ITAB.
WRITE:/ WA_ITAB-DOC_NO, WA_ITAB-DOC_NAME, WA_ITAB-DOC_VER.
ENDAT.
ENDLOOP.

Thanks,

Vinay