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 statement not working when updating Z table

Former Member
0 Kudos

Hi

I have declared Ztable with fields MANDT, VKORG, VBELN, IDENTCODE and POSNR as key fields, other fields are FKDAT,KUNNR, NETWR, WAERK, SKFBP

First I got the data from presentation server and moved into internal table 'A' and after that declared internal table with structure same as Z table and moving the data from presentation server internal table 'A' into this.

After Endloop I am using statement

UPDATE ZVS_INV FROM TABLE IT_INV.

commit work.

But table is not getting updated and sy-subrc is returning to 4.

What could be the reason...your help appreciated.

10 REPLIES 10

kesavadas_thekkillath
Active Contributor
0 Kudos

At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.

0 Kudos

Keshav,

Thanks for the reply, there is no secondary index in table, and also it;s not going to lead double entries,

I didn't understand from your reply 'No appropriate line was found'...What's that means?

0 Kudos

What could be the reason

Why don't you read the help files? As for your primary key, are those really the correct number/sequence of fields that identify a unique record? I don't think so...

0 Kudos

Thanks for the reply Brad. Before coming to forums I have already gone thru help sites. Anyway thanks for your advice.

Since I am uploading from flat file howcan it make difference if the primary key is defined as per my business requirement. and next point I also checked in Z table whether these entries are already there with the same primary key...but they don't exist in Ztable.

0 Kudos

but they don't exist in Ztable

no appropriate line was found

Both matches .... "How will it update if the entry does not exists" ????

Please check what Update/Insert/Modify does before coding it.

0 Kudos

howcan it make difference if the primary key is defined as per my business requirement

Just because the business requirement 'says so', doesn't mean that's it's right. You appear to be maintaining a Z-table with a subset of billing fields and appear to have 'over-specified' the primary key.

As far as the help files, if you did look at them, I don't think you took the time to understand before just posting your problem here. An UPDATE operation is a very simple operation. You gave the answer to why it didn't work in your comments as Keshav already pointed out...

0 Kudos

I didn't agree with you, since I didn't understand and not able to solve, that's why I have posted here in forums for advice to elaborate more on the issue.

If you don't want to give answer or don't know answer please don't reply. Everybody don't post if they know the answer and also they know how to check before posting.

0 Kudos

>

> If you don't want to give answer or don't know answer please don't reply.

I think if you check Brad's response again you'll see that he does give you an answer and that it's correct.

Rob

kesavadas_thekkillath
Active Contributor
0 Kudos

Hi,

There is no offence ... these are basic database anomalies that a programmer must be known of ...

0 Kudos

I agree with you Keshav...eventhough many times UPDATE was successfully used and worked with out any problems. Since it's not working in this case and not able to figureout the problem came for a suggestion.

No one post in the forums just for fun and everyone knows the initial study before approaching anyone.

Anyway thanks for your humble reply with out giving generic(easy) answer 'CHECK HELP SITES'. I appreciate that.

Given poiints to you for helpful answer.