2008 Aug 13 12:28 PM
Hi friends
in my ITAB1 Iam having follwing records
lgnum matnr werks lgpla
ABC 4545 1000 021234
ABC 4545 1000 031234
ABC 4545 1000 041234
ABC 4545 1000 051234
ABC 4545 1000 061234
ABC 4545 1000 071234
ABC 4545 1000 081234
ABC 4545 1000 091234
now my requiremnet is i have to move only all the values of LGPLA to another internal table ITAB2.
how can i do that.
can any one tell me how to do that.
Regards,
priyanka.
2008 Aug 13 12:35 PM
Hi Priyanka,
Try the following:
If you have only one field(lpgla) in itab2.
Loop at itab1.
itab2-lpgla = itab1-lpgla.
append itab2.
clear itab2.
Endloop.
Regards,
Chandra Sekhar
2008 Aug 13 12:30 PM
2008 Aug 13 12:32 PM
Hi Priyanka,
Refer the following codes,that will solve ur probelm..
loop at itab1.
move : itab1-LGPLA to itab2-LGPLA.
append itab2.
endloop.
Hope this helps,
Regards,
T.D.M.
2008 Aug 13 12:33 PM
hi,
If Your second Internal table have only one Filed ie LGPLA then use MOVE CORRESPONDING.
Otherwise loop at itab1 and place all the LGPLA into itab2 one by one.
Regards
Sumit Agarwal
2008 Aug 13 12:35 PM
Hi Priyanka,
Try the following:
If you have only one field(lpgla) in itab2.
Loop at itab1.
itab2-lpgla = itab1-lpgla.
append itab2.
clear itab2.
Endloop.
Regards,
Chandra Sekhar
2008 Aug 13 12:40 PM
Hi
Check this snippet
DATA :
BEGIN OF fs_itab1,
a TYPE i,
b TYPE f,
END OF fs_itab1.
DATA :
BEGIN OF fs_itab2,
a TYPE i,
d TYPE c,
END OF fs_itab2.
DATA :
t_itab1 LIKE
STANDARD TABLE
OF fs_itab1.
DATA :
t_itab2 LIKE
STANDARD TABLE
OF fs_itab2.
DO 5 TIMES.
CLEAR fs_itab1.
fs_itab1-a = sy-index.
fs_itab1-b = sy-index.
APPEND fs_itab1 TO t_itab1.
ENDDO.
LOOP AT t_itab1 INTO fs_itab1.
MOVE-CORRESPONDING fs_itab1 TO fs_itab2.
APPEND fs_itab2 TO t_itab2.
ENDLOOP.
LOOP AT t_itab2 INTO fs_itab2.
WRITE :
/ fs_itab2-a,
fs_itab2-d.
ENDLOOP.
Regards
Pavan
2008 Aug 13 12:42 PM
A very raw example of how to do it.
Notice that I only filled the table to a given row.
From here you can do your own amendments and make it work for you.
TYPES: BEGIN OF tt,
lgnum(10) TYPE c,
matnr(10) TYPE c,
werks(10) TYPE c,
lgpla(10) TYPE c,
END OF tt.
DATA: itab1 TYPE STANDARD TABLE OF tt,
itab2 TYPE STANDARD TABLE OF tt,
wa1 TYPE tt,
wa2 TYPE tt,
l TYPE i.
wa1-lgnum = 'ABC'.
wa1-matnr = '4545'.
wa1-werks = '1000'.
wa1-lgpla = '021234'.
APPEND wa1 TO itab1.
wa1-lgnum = 'ABC'.
wa1-matnr = '4545'.
wa1-werks = '1000'.
wa1-lgpla = '031234'.
APPEND wa1 TO itab1.
wa1-lgnum = 'ABC'.
wa1-matnr = '4545'.
wa1-werks = '1000'.
wa1-lgpla = '041234'.
APPEND wa1 TO itab1.
wa1-lgnum = 'ABC'.
wa1-matnr = '4545'.
wa1-werks = '1000'.
wa1-lgpla = '051234'.
APPEND wa1 TO itab1.
DESCRIBE TABLE itab1 LINES l. " gives you how many lines itab1 has
DO l TIMES.
READ TABLE itab1 INTO wa1 INDEX sy-index.
wa2-lgpla = wa1-lgpla.
APPEND wa2 TO itab2.
ENDDO.
LOOP AT itab2 INTO wa2.
WRITE: /, wa2-lgpla.
ENDLOOP.
Avraham
2008 Aug 13 12:49 PM
Hey Avraham
can u provide me ur help on one of my issue.
if so, i can tell u my requirment.
Regards,
priyanka.
2008 Aug 13 12:47 PM
Hi,
You can do in the following way....
types: begin of t_itab2,
lgpla(10) type c,
end of t_itab2.
data:itab2 type table of t_itab2.
data:wa_itab2 type t_itab2.
loop at itab .
wa_itab2-lgpla = itab-lgpla.
append wa_itab2 into itab2.
endloop.
u do some changes according to ur requirement i hope this will help u....
Thanks & Regards
Ashu Singh.