‎2008 Jul 07 9:47 AM
hi guyz,
for eg if i have an internal table with data
1234 m1
1234 m6
1234 m8
1234 m9
3456 k6
3456 k8
i wanted to make this to
1234 m1
m6
m8
m9
3456 k6
k8
how can i get that...plz advise..
regds
‎2008 Jul 07 9:50 AM
hi,
Use on change of or at new commands
see the below example
data : begin of itab occurs 0,
f1 type i,
f2(2),
end of itab.
itab-f1 = 1234.
itab-f2 = 'M1'.
append itab.
itab-f1 = 1234.
itab-f2 = 'M6'.
append itab.
itab-f1 = 1234.
itab-f2 = 'M9'.
append itab.
itab-f1 = 3456.
itab-f2 = 'K6'.
append itab.
itab-f1 = 3456.
itab-f2 = 'K8'.
append itab.
loop at itab.
on change of itab-f1.
write : / itab-f1, itab-f2.
else.
write :/13 itab-f2.
end
regards
prasanth
‎2008 Jul 07 9:51 AM
Hi Friend,
Try the following code:
Loop at itab.
at new <field1>.
write:/ <field1>.
endat.
write:/ <field2>
endloop.Hope this helps you.
Regards,
Chandra Sekhar
Edited by: Chandrasekhar Gandla on Jul 7, 2008 11:12 AM
‎2008 Jul 07 9:54 AM
Hello,
You can use ON CHANGE OF event for that field in which these 1234 & 3456 values are there for printing.
For EG:
Loop at idata.
on change of 1234
print : 1234.
endon.
endloop.
Regards,
Amit G.
‎2008 Jul 07 9:55 AM
hi
do this
let the fiel name is
F1 F2
1234 m1
1234 m6
1234 m8
1234 m9
3456 k6
3456 k8
loop at <table name>
use At new F2
endloop
also if ur want the total At the next new entry use
loop at <table name>
At end.
endloop.
Cheers
Snehi
Edited by: snehi chouhan on Jul 7, 2008 10:56 AM
‎2008 Jul 07 9:59 AM
hI
check out this code
DATA :
BEGIN OF fs_itab,
sno TYPE i,
field(2) TYPE c,
END OF fs_itab.
DATA :
t_tab LIKE
STANDARD TABLE
OF fs_itab.
CLEAR fs_itab.
fs_itab-sno = 1234.
fs_itab-field = 'M1'.
APPEND fs_itab TO t_tab.
CLEAR fs_itab.
fs_itab-sno = 1234.
fs_itab-field = 'M2'.
APPEND fs_itab TO t_tab.
CLEAR fs_itab.
fs_itab-sno = 1235.
fs_itab-field = 'N1'.
APPEND fs_itab TO t_tab.
CLEAR fs_itab.
fs_itab-sno = 1235.
fs_itab-field = 'N2'.
APPEND fs_itab TO t_tab.
CLEAR fs_itab.
fs_itab-sno = 1235.
fs_itab-field = 'N2'.
APPEND fs_itab TO t_tab.
LOOP AT t_tab INTO fs_itab.
AT NEW sno.
WRITE :
/ fs_itab-sno.
ENDAT.
WRITE :
/10 fs_itab-field.
ENDLOOP.
Regards
Pavan
‎2008 Jul 07 10:03 AM
‎2008 Jul 07 10:03 AM
Hi,
Loop at Itab.
at new f1.
write / itab-f1.
endat.
write / itab-f2.
endloop.
If you want to calculate count of F1 then try this one
Loop at Itab.
at new f1.
add 1 to w_count.
write / itab-f1.
endat.
write : itab-f2.
at last.
write / w_count.
endat.
endloop.Regards,
Rajitha.
‎2008 Jul 07 10:03 AM
Hi,
Check this:
DATA:
BEGIN OF w_test,
field1(5) TYPE c,
field2(2) TYPE c,
END OF w_test,
t_test LIKE TABLE OF w_test.
w_test-field1 = '1234'.
w_test-field2 = 'm1'.
APPEND w_test TO t_test.
w_test-field1 = '1234'.
w_test-field2 = 'm6'.
APPEND w_test TO t_test.
w_test-field1 = '1234'.
w_test-field2 = 'm8'.
APPEND w_test TO t_test.
w_test-field1 = '1234'.
w_test-field2 = 'm9'.
APPEND w_test TO t_test.
w_test-field1 = '3456'.
w_test-field2 = 'k6'.
APPEND w_test TO t_test.
w_test-field1 = '3456'.
w_test-field2 = 'k8'.
APPEND w_test TO t_test.
LOOP AT t_test INTO w_test.
AT NEW field1.
WRITE:/
w_test-field1.
ENDAT.
write:/
w_test-field2.
ENDLOOP.Regards
Adil
‎2008 Jul 07 10:04 AM
Hiii!
Check Out this code.
REPORT z_sdn.
DATA:
BEGIN OF fs_test,
temp(5) TYPE n,
char(4) TYPE c,
END OF fs_test.
DATA:
t_test LIKE
TABLE OF
fs_test.
PERFORM populate_data USING '1234' 'm1'.
PERFORM populate_data USING '1234' 'm6'.
PERFORM populate_data USING '1234' 'm8'.
PERFORM populate_data USING '3456' 'k6'.
PERFORM populate_data USING '3456' 'k8'.
LOOP AT t_test INTO fs_test.
AT NEW temp.
WRITE: / fs_test-temp.
ENDAT.
WRITE: / fs_test-char.
ENDLOOP.
FORM populate_data USING p_temp
p_char.
fs_test-temp = p_temp.
fs_test-char = p_char.
APPEND fs_test TO t_test.
ENDFORM. " populate_data
Regards
Abhijeet Kulshreshtha
‎2008 Jul 07 10:08 AM
Hi,
Try This,
Loop at itab into wa.
At New <field1>.
Write:
/ field1.
Endat.
Write:
/ field2.
Endloop.
Revert Back if any problem.
Regards,
Sujit
‎2008 Jul 07 10:08 AM
Helloo..
You need to use control levels ...
here you have 5 control levels
1. at new
2. on change
3. at last
4. at first
5. at end of
for your requirement you can use at new / on change ....
but this control levels will be used in between LOOP ... ENDLOOP only...
ex :
Loop at itab.
at new field1.
write : field1 , field2.
endat.
write : field3, field4, field5.
endloop.
the values of field1 and field2 will priint only new time and the remaining fields 3,4,5 will be executing every time...
check this process it will work ...
reward points if help fullllllllllll*