‎2009 Oct 05 4:10 AM
hello experts...
my question is...
for example my WA_TAB contains this data:
Pernr lgart begda
0001 0101 2009.06.01
0001 0101 2009.06.02
0001 0101 2009.06.03
0001 0101 2009.06.04
0001 0101 2009.06.05
0002 0101 2009.06.01
0002 0101 2009.06.02
0002 0101 2009.06.03
0002 0101 2009.06.04
0002 0101 2009.06.05
But i want to add another field for the sequence number in field CNT.
Pernr lgart begda cnt
0001 0101 2009.06.01 1
0001 0101 2009.06.02 2
0001 0101 2009.06.03 3
0001 0101 2009.06.04 4
0001 0101 2009.06.05 5
0002 0101 2009.06.01 1
0002 0101 2009.06.02 2
0002 0101 2009.06.03 3
0002 0101 2009.06.04 4
0002 0101 2009.06.05 5
how to achieve this?
please help...
thank you
Edited by: Bernadette6184 on Oct 5, 2009 5:11 AM
‎2009 Oct 05 4:18 AM
Hi,
Try this way.
Thanks
Venkat.O
LOOP AT it_tab INTO wa_tab.
wa_tab-cnt = sy-tabix.
MODIFY it_tab FROM wa_tab INDEX sy-tabix TRANSPORTING cnt
ENDLOOP.
‎2009 Oct 05 4:18 AM
Hi,
Try this way.
Thanks
Venkat.O
LOOP AT it_tab INTO wa_tab.
wa_tab-cnt = sy-tabix.
MODIFY it_tab FROM wa_tab INDEX sy-tabix TRANSPORTING cnt
ENDLOOP.
‎2009 Oct 05 4:51 AM
hello...
this code will help me count the total number of itab entry but my problem is
example employee 0001 and 0002 both have 5 entries in wa_tab table total of 10 entries
so if i add field CNT in wa_tab it will create 1~5 sequence number for employee 0001 and 0002
not 1~10 sequence number.
wa_tab should look like this:
PERNR LGART BEGDA CNT
0001 0101 2009.06.01 1
0001 0101 2009.06.02 2
0001 0101 2009.06.03 3
0001 0101 2009.06.04 4
0001 0101 2009.06.05 5
0002 0101 2009.06.01 1
0002 0101 2009.06.02 2
0002 0101 2009.06.03 3
0002 0101 2009.06.04 4
0002 0101 2009.06.05 5
‎2009 Oct 05 4:59 AM
Hi,
I could not observe last time.
Check this
Thanks
Venkat.O
DATA:count TYPE i. "Define one variable for count
SORT it_tab BY pernr. "sort table by pernr
LOOP AT it_tab INTO wa_tab.
count = 1.
wa_tab-cnt = count.
MODIFY it_tab FROM wa_tab INDEX sy-tabix TRANSPORTING cnt.
AT END OF pernr.
CLEAR count. "Clear when it reaches last record for pernr
ENDAT.
ENDLOOP.
‎2009 Oct 05 6:42 AM
Well I guess, what Venkat actually means that you should add 1 to count in every loop pass
So NOT count = 1, but count = COUNT + 1.
Right Venkat? Probably a typo.
Allthough I don't know why you would want to have another variable COUNT when wa_tab-CNT is already available.
‎2009 Oct 05 6:46 AM
Yes Micky. You are right. I think that Bernadette6184 might have corrected. That is why he is keep quite. Thanks Venkat.O
‎2009 Oct 05 7:07 AM
‎2009 Oct 05 7:09 AM
‎2009 Oct 05 7:22 AM
and give Venkat O. the credit he deserves (meaning a w a r d... some p o i n t s).