‎2006 Dec 06 10:42 AM
Hi Experts,
i need to update kna1 table with only one field stcd2.
My requitement
select customer records for range of customers
copy kna1-sortl to kna1-stcd2 and update kna1 table.
Following is the code which i have used
IF NOT it_cdhdr[] IS INITIAL.
SELECT * FROM kna1
INTO TABLE it_kna1
WHERE kunnr EQ ls_cdhdr-objectid.
ENDIF.
LOOP AT it_kna1.
it_kna1-stcd2 = it_kna1-sortl.
MODIFY it_kna1.
CLEAR it_kna1.
ENDLOOP.
ENDIF.
after getting this records how should i update this records so that it should not
affect performance.
1. UPDATE kna1 FROM it_kna1.
COMMIT WORK.
(OR)
2.
LOOP AT it_kna1.
UPDATE kna1
SET stcd2 = it_kna1-stcd2
WHERE kunnr EQ it_kna1-kunnr..
ENDLOOP.
COMMIT WORK.
Please Advice
‎2006 Dec 06 10:44 AM
Please do not update Standard TAbles using modify or direct update statements
Please use std FM or BAPIs
‎2006 Dec 06 10:44 AM
Firstly it is potentially fatal to update the standard tables.
but still for your information,
UPDATE kna1 FROM <b>table</b> it_kna1.
COMMIT WORK.
would be faster.
Regards,
Ravi
‎2006 Dec 06 10:44 AM
Please do not update Standard TAbles using modify or direct update statements
Please use std FM or BAPIs
‎2006 Dec 06 11:24 AM
Here i need to update standard Table KNA1. its required
Can you please tell me the Fun Mods or BAPIs for updating this table.
‎2006 Dec 06 11:28 AM
Try Using: BAPI_CUSTOMER_CREATEFROMDATA1 OR BAPI_CUSTOMER_CREATEFROMDATA
‎2006 Dec 06 11:31 AM
Hi,
Recomendation is always use SAP standard transaction(XD01, in your case) to Update the standard table, but according to your requirement, it seems it is one time requirement because from the second time you can always tell the users to update that particular field in the transaction itself(XD01), so any method you use will not make much difference.
Cheers...
Santosh.
<i><b>Mark All Usefull Answers...</b></i>
‎2006 Dec 06 11:32 AM
You could use Standard Program RFBIDE00
or the BAPI - BAPI_CUSTOMER_CREATEFROMDATA1
‎2006 Dec 07 11:59 PM
Hi Praveen
use BAPI_CUSTOMER_CHANGEFROMDATA1 to update an existing customer.
Thanks
Gareth
‎2006 Dec 13 11:18 AM
Hi Praveen,
There is one BAPI 'sd_customer_maintain_all' which I used to Update any of Cusotmer related tables such as KNA1, KNB5. Please let me know if this is available in the system you are working. I will tell you the process.
Regards,
Vijay
‎2008 Apr 09 11:50 AM
Hi Praveen i am facing the same situation where i need to update a single field in KNA1,KNB1 and KNVV.... can you please let me know the procedure...
I have BAPI 'sd_customer_maintain_all' in my system...
Please let me know how to use that BAPI....
Thanx in advance n will reward points..