2007 Aug 16 6:05 AM
Hi Experts,
My requirements is like . In a SAP trasaction i have made some changes with some fields for ex. I made changes for a fields XXX for 3 times and made another for field ZZZ changes for 2 times .And i want my output like
fieldname No. of. changes.
XXX 3
ZZZ 2.
I ve done some coding for that . But i getting the output like below
Fieldname No. of Changes
XXX 1
XXX 2
XXX 3
ZZZ 4
ZZZ 5.
I ve one internal table T_OUTPUT_DATA where all the 5 records is stored .
Just help me out .Its Very urgent.
Message was edited by:
Satyanarayan Pujahari
2007 Aug 16 7:20 AM
Hi,
Sorry I am sleepy mood
data : v_flg type c.
data : v_no type 1.
refresh : t_output_data1. "<< Modified
sort t_output_data by fieldname. "<< check your fieldname for sort
loop at t_output_data.
at end of fieldname.
move 'Y' to v_flg.
endat.
v_no = v_no + 1. "<<<<< changed
if v_flg = 'Y'.
move t_output_data-fieldname to t_output_data1-fieldname.
move v_no to t_output_data1-noofchanges. " Check this variable
append t_output_data1.
clear: v_no, v_flg.
endif.
endloop.
I have changed v_no = v_no + 1. line before if condition
aRs
Hi Experts,
My requirements is like . In a SAP trasaction i have made some changes with some fields for ex. I made changes for a fields XXX for 3 times and made another for field ZZZ changes for 2 times .And i want my output like
fieldname No. of. changes.
XXX 3
ZZZ 2.
I ve done some coding for that . But i getting the output like below
Fieldname No. of Changes
XXX 1
XXX 2
XXX 3
ZZZ 4
ZZZ 5.
I ve one internal table T_OUTPUT_DATA where all the 5 records is stored .
Just help me out .Its Very urgent.
Message was edited by:
Satyanarayan Pujahari
2007 Aug 16 6:12 AM
Hi,
create another internal table as same structure of t_output_data as t_output_data1
data : v_flg type c.
data : v_no type 1.
sort t_output_data by fieldname.
loop at t_output_data.
at end of fieldname.
move 'Y' to v_flg.
endat.
if v_flg = 'Y'.
move t_output_data-fieldname to t_output_data1-fieldname.
move v_no to t_output_data1-noofchanges.
append t_output_data1.
clear: v_no, v_flg.
endif.
v_no = v_no + 1.
endloop.
After this loop your t_output_data1 table contains records
XXX 3
ZZZ 2
2007 Aug 16 6:39 AM
Thanks for the quick response,
But in my t_output_data table i ve 7 fields. I tried with ur code but it'll add that field along with the five records and its showing only one records.
Please help .
Regards,
Satya
2007 Aug 16 6:43 AM
2007 Aug 16 6:52 AM
Hi,
As i told u i ve 5 records in my T_OUTPUT_DATA table . And i added ur code then it shows 6 records like ...
FNAME No of changes
XXX 3
XXX 1
XXX 2
XXX 3
ZZZ 4
ZZZ 5.
Regards,
Satya
2007 Aug 16 6:55 AM
Hi,
Got it , i just refresh the table and it'll show one records but i want both records.
my output is like this
XXX 3
2007 Aug 16 6:59 AM
Hi,
data : v_flg type c.
data : v_no type 1.
refresh : t_output_data1. "<< Modified
sort t_output_data by fieldname. "<< check your fieldname for sort
loop at t_output_data.
at end of fieldname.
move 'Y' to v_flg.
endat.
if v_flg = 'Y'.
move t_output_data-fieldname to t_output_data1-fieldname.
move v_no to t_output_data1-noofchanges. " Check this variable
append t_output_data1.
clear: v_no, v_flg.
endif.
v_no = v_no + 1.
endloop.
Please look into table T_OUTPUT_DATA1 table after the loop. results will be
XXX 3
ZZZ 2.
aRs
2007 Aug 16 7:00 AM
2007 Aug 16 7:17 AM
Hi,
I checked the table T_OUTPUT_DATA1 after loop but its having the 2 records but
like
ZZZ 1 (This should be two)
XXX 3
And in my output its showing only one records
i.e.XXX 3
I am giving my code...
DATA: t_output_data1 LIKE T_OUTPUT_DATA OCCURS 0 WITH HEADER LINE.
data : v_flg type c.
data : v_no type i.
refresh : t_output_data1.
sort t_output_data by fname.
loop at t_output_data.
at end of fname.
move 'Y' to v_flg.
endat.
if v_flg = 'Y'.
move t_output_data-FIELD_DESC to t_output_data1-FIELD_DESC.
move v_no to t_output_data1-noc.
append t_output_data1.
clear: v_no, v_flg.
endif.
v_no = v_no + 1.
endloop.
refresh : t_output_data.
append t_output_data1 to t_output_data[].
Help me,
Regards,
Satya
Message was edited by:
Satyanarayan Pujahari
2007 Aug 16 7:25 AM
2007 Aug 16 6:15 AM
Hi
first move the first field into one internal table say itab1.
loop at itab.
itab1 -fld1 = itab-fld1.
append itab1.
clear itab,itab1.
endloop.
now sort itab1.
delete adjacent duplicates from itab1.
sort itab by fld1.
itab2[] = itab[].
loop at itab1.
loop at itab2.
if itab1 - fld1 = itab2 - fld1.
count = count + 1.
endif.
endloop.
itab3- fld1 = itab1 -fld1.
itab3-count = count.
append itab3.
clear itab1,itab2,count.
endloop.
reward points to all helpful answers
kiran.M
2007 Aug 16 7:20 AM
Hi,
Sorry I am sleepy mood
data : v_flg type c.
data : v_no type 1.
refresh : t_output_data1. "<< Modified
sort t_output_data by fieldname. "<< check your fieldname for sort
loop at t_output_data.
at end of fieldname.
move 'Y' to v_flg.
endat.
v_no = v_no + 1. "<<<<< changed
if v_flg = 'Y'.
move t_output_data-fieldname to t_output_data1-fieldname.
move v_no to t_output_data1-noofchanges. " Check this variable
append t_output_data1.
clear: v_no, v_flg.
endif.
endloop.
I have changed v_no = v_no + 1. line before if condition
aRs
2007 Aug 16 7:28 AM
Hi,
Yes its working and now the correct records are coming in that table but why its not showing in the output.
Definitely i'll give the reward point.
Regards,
Satya
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |