‎2008 Mar 13 7:14 AM
Hi gurus,
I am trying to insert the internal table data into Ztable.
I am sending my piece of code.Please check it out and suggest me is there any modifications required..
In that internal table i have duplicate records..Those duplicates are not inserted..
My piece of code is...
loop at t_ltap into s_ltap.
wa_tab-lgort = s_ltap-lgort.
wa_tab-wdatu = s_ltap-wdatu.
wa_tab-matnr = s_ltap-matnr.
wa_tab-maktx = s_ltap-maktx.
wa_tab-nsola = s_ltap-nsola.
wa_tab-text = s_ltap-text.
append wa_tab to it_tab.
clear wa_tab.
endloop.
insert ztab_ltap from table it_tab accepting duplicate keys.
or
loop at it_tab into wa_tab.
insert ztab_ltap from wa_tab ..
modify ztab_ltap from wa_tab. .
endloop.
I tried out these two types of insert statements.
suppose i have 6 reords, in those recorde the 3 recorde have same lgort ,wdatu, and different matnr..
Remaining 3 recorde have same lgort ,wdatu , and the Matnr are same as above matnrs.
When i am running this code in database table the last record only inserted.
I need to insert 6 record.
Please can any one suggest me on this.
Thanks in Advance
Help ful answers will be rewarded...
Thanks and Regards
Siri..
‎2008 Mar 13 7:23 AM
Use commit work
ex:
insert ztab_ltap from table it_tab accepting duplicate keys.
COMMIT WORK.
‎2008 Mar 13 7:18 AM
Hi,
What are the primary key fields of your ztable?
Based on your primary key and foreign key fields records will get inserted....
‎2008 Mar 13 7:21 AM
Hi murali ,
I put only Lgort is the primary key first time.Then also it will be same..
After that i change the primary key as mandt..Even though it will be same..
Please suggest me how to do..
Thanks and Regards
Siri...
‎2008 Mar 13 7:19 AM
Hi
instead of this code...
{
loop at it_tab into wa_tab.
insert ztab_ltap from wa_tab ..
modify ztab_ltap from wa_tab. .
endloop.
}
you can directly insert the records into ztab_ltap from it_tab by using
modify ztab_ltap from it_tab
‎2008 Mar 13 7:20 AM
Hi,
Try it
loop at it_tab into wa_tab.
append ztab_ltap .
endloop.
Regards
‎2008 Mar 13 7:23 AM
Use commit work
ex:
insert ztab_ltap from table it_tab accepting duplicate keys.
COMMIT WORK.
‎2008 Mar 13 7:27 AM
Hi shaik,
I am using commit work stmt also . Its not working
Please suggest me..
thanks and Regards
Siri..
‎2008 Mar 13 8:03 AM
Hi,
if u are using standard data elements its not possible to insert the dupicate records
‎2008 Mar 13 8:23 AM
Hi Rajesh,
Thanks for giving valuable suggestion.. Its working fyn...
I rewarded u...
Regards...
Siri...
‎2008 Mar 13 7:25 AM