‎2010 May 31 11:40 AM
Hi ,
i have a internal table:
A B C 1 2 4
A B C 3 5 6
D S R 3 $ %
D S R 3 5 1
i want it to be displayed as
A B C 1 2 4
3 5 6
D S R 3 $ %
3 $ %
Please let me know how can i handle this
thanks,
Poonam
‎2010 May 31 11:47 AM
Hi,
try control statement AT new in the loop on the first field ABC & b4 this loop sort the internal table on the first field
‎2010 May 31 11:43 AM
‎2010 May 31 11:47 AM
Hi,
try control statement AT new in the loop on the first field ABC & b4 this loop sort the internal table on the first field
‎2010 May 31 12:15 PM
CAn u please give me an example?
when i use AT new
i get this error.:
The specified type has no structure and therefore no component called
"ZCONTITM" . . . ..
its also possible for the below criteria :
A B C 1 3 4
A B D 14 5
A B C 3 4 6
it shud diaplay as
A B C 1 3 4
3 4 6
A B D 1 4 5
this means also on 3rd field change it shid display
how to handle
Edited by: Poonam Naik on May 31, 2010 1:24 PM
‎2010 May 31 12:26 PM
Tell me one thing tat the internal table structure is it like this
this is the value of field1 -->(A B C)
& this is the value of field2 ---> 1 3 4
then
data : wa like it ,
flag.
sort it by field1
loop at it.
clear flag.
wa = it
at new field1.
write : wa-field1 wa-field2.
flag = 'X'.
endat.
if flag ne 'X'.
write : wa-field2.
endif.
endloop.
‎2010 May 31 12:44 PM
i m writing it in a form - subroutine... im getting the error whihc i mentioned in my previous thread..
Please anyone suggest me..
‎2010 May 31 12:58 PM
‎2010 May 31 1:08 PM
yes,
FORM fill_table .
DATA : w_result TYPE ty_temp_all,
t_reuslt TYPE STANDARD TABLE OF ty_temp_all,
w_both TYPE ty_both.
LOOP AT t_both INTO w_both.
AT NEW w_both-zccode.
MOVE w_both-zccode TO w_result-zccode.
MOVE w_both-zcontnum TO w_result-zcontnum.
MOVE w_both-zcontitm TO w_result-zcontitm.
ENDAT.
IF w_both-flag = c_r.
MOVE w_both-flag TO w_result-flag.
MOVE w_both-zdocnum TO w_result-zdocnum.
MOVE w_both-cbelnr TO w_result-cbelnr.
MOVE w_both-zicobill TO w_result-zicobill.
MOVE w_both-zpostdt TO w_result-zpostdt.
ELSEIF w_both-flag = c_b.
MOVE w_both-flag TO w_result-flag.
MOVE w_both-zdocnum TO w_result-zdocnum.
MOVE w_both-cbelnr TO w_result-cbelnr.
MOVE w_both-zicobill TO w_result-zicobill.
MOVE w_both-zpostdt TO w_result-zpostdt.
ENDIF.
APPEND w_result TO t_result.
ENDLOOP.
‎2010 May 31 1:11 PM
at new NEW zccode. only give the field name here
and add a sort on the internal table on the zcode field
and after the loop statement
LOOP AT t_both INTO w_both.
wa_both = w_both.--- assgin this b4 at new statement
and print this wa_both varable
hope this may solve ur problem
Edited by: Madhukar Shetty on May 31, 2010 2:12 PM
‎2010 May 31 1:44 PM
Hi Poonam,
Declare an internal table same as w_result eg. w_result1.
then,
LOOP AT t_both INTO w_both.
READ TABLE t_result1 WITH KEY zzcode = w_both-zzcode .
(initially the table t_result1 is empty, so returns sy-subrc 4 and appends the record,
second time reads the table t_result1, if sy-subrc eq 0 it will clear the fieldsand appends it...and so on..........)*********
IF sy-subrc EQ 0.
CLEAR: field1,field2, field3.
APPEND w_both TO t_result1.
ELSE.
APPEND w_both TO t_result1.
ENDIF.
ENDLOOP.
I have tested it and its working fine.
Regards,
Md Ziauddin.
‎2010 May 31 11:59 AM
Hi Poonam,
Assume this is itab:
A B C 1 2 4
A B C 3 5 6
D S R 3 $ %
D S R 3 5 1
And Assume that itab_final is the final internal table which you want to display on the screen and now it is initial.
Loop at itab.
read table itab_final with key field1 = 'Cond'.
if sy-subrc ne 0.
clear: field1,field2, field3.
append itab_final.
else.
append itab_final.
endif.
endloop.
Therefore with this code you can get the desired output.
Regards,
Md Ziauddin.
‎2010 May 31 1:38 PM
Hi Poolnam,
use ALV/SALV technology, SORT.
Regards,
Clemens
Note: Using standard lists (filled with WRITE statements) is listed by SAP in the [Obsolete Techniques|http://help.sap.com/saphelp_nw70ehp2/helpdata/en/42/e5e554ee893ee7e10000000a1553f7/frameset.htm] section of ABAP programming.
Edited by: Clemens Li on May 31, 2010 2:39 PM