09-11-2008 2:50 PM
Hi frnds,
I want to update two records in ZTABLE. But in my ZTABLE three fields are there and only MANDT field is unique how to update this two fields in ZTABLE.
Eg: ZTABLE
FIELD1, FILED2, FIELD3.
I want to update con1 = Field1, con2 = Field2.
Regards.
09-11-2008 2:52 PM
You have to be more clear. Do you want to update two records and do not know how to identify them or do you need to update twi field in all records?
09-11-2008 3:01 PM
Hi,
You can do it by following way.
Like use loop on internal table & READ statement on Database table & modify column of database according to your internal table.
It will solve your problem.
SELECT matnr " Material Number
werks " Plants
lgort " Storage Location
FROM mard
INTO TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr EQ i_marc-matnr
AND werks EQ i_marc-werks
AND lgort IN s_lgort.
ENDIF. " IF i_mara[] IS NOT INITIAL
IF sy-subrc EQ 0.
LOOP AT i_output INTO wa_output.
READ TABLE i_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
wa_output-lgort = wa_mard-lgort.
MODIFY i_output FROM wa_output.
CLEAR wa_output.
ENDLOOP. " LOOP AT i_output
ENDIF. " IF sy-subrc EQ 0
Thanks&Regards,
Naresh
09-11-2008 3:06 PM
Hello Ashish,
You can update the key fields in Ztable. You can delete them and re-enter the values thats the only way to update.
Regards,
Naresh.