Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update records into ZTABLE

ashish_shah5
Participant
0 Kudos

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.

3 REPLIES 3

rainer_hbenthal
Active Contributor
0 Kudos

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?

Former Member
0 Kudos

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

Former Member
0 Kudos

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.