2007 Jul 18 12:51 PM
Hi friends,
i have one internal table.. that structure with two fields...its like this..
DATA:BEGIN OF ITAB1 OCCURS 0,
MATERIAL LIKE MARA-MATNR,
MTATERIAL LIKE MARA-MTART,
END OF ITAB1.
after that i select the data from data base table.. and i did some modifications on the data which is in ITAB1..
SELECT MATNR MTART FROM MARA INTO TABLE ITAB1 WHERE MTART = 'BABU'.
itab1-MATERIAL = 'M09'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000058'.
itab1-MATERIAL = 'M10'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000059'.
ITAB1-MTATERIAL = 'vijayawada'.
modify itab1 TRANSPORTING MTATERIAL WHERE MTATERIAL = 'BABU'.
now i want to insert those modified data.. for this what is the statement... can i write.. ..
thanks
Bbau
2007 Jul 18 12:54 PM
hi..
Use <b>APPEND</b> statement..
Eg: <b>append itab1</b>..
I u wanna insert into database table use <b>insert</b> statement..
Eg: <b>insert ztable</b>
<b>U cant insert into standard table.. u can insert only to thecustom table..</b>
<b>Reward points if useful</b>
Regards
Ashu
2007 Jul 18 12:52 PM
2007 Jul 18 12:54 PM
Thanks
but I'm not an abaper.. so, can u plz give me the exact statement what i have to write for inserting those modified data into MARA table..
thanks
babu
2007 Jul 18 12:57 PM
Hi,
using modify itab command u r already modifying entries in itab.
but if u want those entries to update into data base then use :
modify dbtab from table itab.
or if u want to insert those entires:
insert dbtab from table itab.
Jogdand M B
2007 Jul 18 12:54 PM
hi..
Use <b>APPEND</b> statement..
Eg: <b>append itab1</b>..
I u wanna insert into database table use <b>insert</b> statement..
Eg: <b>insert ztable</b>
<b>U cant insert into standard table.. u can insert only to thecustom table..</b>
<b>Reward points if useful</b>
Regards
Ashu
2007 Jul 18 12:55 PM
Hi,
APPEND ITAB. - adds it into the internal table.
INSERT <DBTABLE> FROM TABLE ITAB.
DBTABLE - Ztable created by u not SAP standard table like MARA.
<b>Remember u can insert only into Ztables not into standard SAP tables.</b>
Regards,
Priyanka.
2007 Jul 18 12:55 PM
Hi BAbu,
loop at itab1.
itab1-MATERIAL = 'M09'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000058'.
itab1-MATERIAL = 'M10'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000059'.
ITAB1-MTATERIAL = 'vijayawada'.
modify itab1 TRANSPORTING MTATERIAL WHERE MTATERIAL = 'BABU'.
Append itab1.
Endloop.
Thanks.
Reward If Helpful.
2007 Jul 18 12:55 PM
Hi
First change the field name in Internal Table change the seond one to MTART
and then do the correct coding
It is confusing since you are using both internal table fields with same name as MATERIAL
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 18 12:56 PM
(use a append statement) check the following code.
DATA:BEGIN OF ITAB1 OCCURS 0,
MATERIAL LIKE MARA-MATNR,
MTATERIAL LIKE MARA-MTART,
END OF ITAB1.
after that i select the data from data base table.. and i did some modifications on the data which is in ITAB1..
SELECT MATNR MTART FROM MARA INTO TABLE ITAB1 WHERE MTART = 'BABU'.
itab1-MATERIAL = 'M09'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000058'.
itab1-MATERIAL = 'M10'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000059'.
ITAB1-MTATERIAL = 'vijayawada'.
modify itab1 TRANSPORTING MTATERIAL WHERE MTATERIAL = 'BABU'.
append ITAB1.
regards,
srinivas
<b>
*reward for useful answers*</b>
2007 Jul 18 12:58 PM
Hi,
If u want to modify all the record with the possibility of different valus,
then you can simply use loop endloop.
Loop at itab1.
if itab1-matnr = '000000000000000058'.
itab1-MATERIAL = 'M09'.
elseif itab1-MATERIAL = '000000000000000059'.
itab1-MATERIAL = 'M10'.
endif.
modify itab1.
Endloop.
2007 Jul 18 1:11 PM
hi babu
its very simple..jus try this...
DATA:BEGIN OF ITAB1 OCCURS 0,
MATERIAL LIKE MARA-MATNR,
MTATERIAL LIKE MARA-MTART,
END OF ITAB1.
after that i select the data from data base table.. and i did some modifications on the data which is in ITAB1..
SELECT MATNR MTART FROM MARA INTO TABLE ITAB1 WHERE MTART = 'BABU'.
itab1-MATERIAL = 'M09'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000058'.
itab1-MATERIAL = 'M10'.
modify itab1 TRANSPORTING MATERIAL WHERE MATERIAL = '000000000000000059'.
ITAB1-MTATERIAL = 'vijayawada'.
modify itab1 TRANSPORTING MTATERIAL WHERE MTATERIAL = 'BABU'.
<b>append itab1.
loop at itab1.
write 😕 itab1.
endloop.</b>
reward if useful.....!!!
2007 Jul 18 1:15 PM
See friends..
my data was modyfied which i wrote those statements itself.. but my requirement is.. i want to insert those modified data into DATABASES table...
for that i wrote statement like this..
INSERT MARA FROM ITAB1..
but it was showing itab structure is not same the data base table structure..
so, what can i do..
regards
BABU
2007 Jul 18 1:27 PM
Hi,
Dont insert into Master table directly .If you just want to test then,just do like this.
Tables :mara.
Loop at itab1.
mara-matnr = itab1-matnr.
mara-mtart = itab1-mtart.
insert mara.
Endloop.
Commit work.
If you want to insert all the values with one statement then both iab and table structure should be same.