cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Modify Z* Db table not working

ricky_shaw
Contributor
2,595

Hi,
I have a Zinvoice table with 'INVNO' as the ONLY key field.

Its type is XBLNR_KK which holds 16 chars.

I am updating this Z* table via reading big volume of data from flat file.

Sometimes i get same value for 'INVNO' field in different rows.
I use modify statement as below in the program.

modify zinvoice from wa_invoice.

Issues:
1)This statement is giving sy-subrc = 0 even when same 'INVNO' field is seen.
2) Also its NOT updating for different INVNO. What could be the reason?
3) Do i need to prefill 0's if INVNO is filled with 9 or 10 chars?

 

Can any one suggest pls.

Accepted Solutions (0)

Answers (2)

Answers (2)

ricky_shaw
Contributor

Hi Sandra, I am testing this one. The prog is showing that its updating the same data for same 'INVNO' (key field) even if i attempt to update multiple times. EVEN showing sy-subrc is showing = 0 all the time.

But the no of entries in the Z* table remains the same .

Do i need to use 'Transporting' addition to my modify stmt?

Sandra_Rossi
Active Contributor
0 Likes
No. Create a test table and try, you will see that it works fine. Then check what can be different. Note that maybe you are confused because you didn't commit, or you are looking at the data in another client. When it's so basic, you should try different things till you find the solution. Only you can find.
RaymondGiuseppi
Active Contributor
0 Likes

The Data/Element  (Domain) XBLNR_KK uses the ALPHA conversion exit. So you MUST convert data to a correct internal forma (e.g. use FM CONVERSION_EXIT_ALPHA_INPUT) 

  1. Else you can get different internal values that share same exernal value (so apparent duplicates and headaches)
  2. Also consider adding the MANDT as the first primary key of the table

 

ricky_shaw
Contributor
0 Likes
Hi Raymond, No Luck..I tried using Alpha Conv & also MANDT field is already in the Z*table..I think i need to change it to insert..
Sandra_Rossi
Active Contributor
0 Likes
@ricky_shaw You're still missing the exact problem. MODIFY = UPSERT (INSERT if new key, UPDATE if existing key). I never saw a bug reported about that and I doubt there's one.
ricky_shaw
Contributor
0 Likes
Then why Sy-subrc = 0 always.?.
Sandra_Rossi
Active Contributor
0 Likes
@ricky_shaw It's sy-subrc = 0 because the insertion or the modification succeeded (anyway, it's very exceptional that sy-subrc <> 0). The only problem is that you're not able to diagnose what happened after (rollbacked, deleted, key updated, or looking at it at the wrong moment, etc.) There are many ways to diagnose.
ricky_shaw
Contributor
0 Likes
Sandra, I ran the same upload file for 5 recs (same OPBEL) for testing. It did NOT insert or update which is good. But i see sy-subrc = 0 . Isn't it like the sy-subrc should be = 4?
Sandra_Rossi
Active Contributor
@ricky_shaw You think that it didn't insert or modify because you don't see it, but it did it because sy-subrc = 0. So, you must check if there was a rollback, a commit, a database trigger, a wrong data selection, etc. It can be anything.
RaymondGiuseppi
Active Contributor
0 Likes

INVNO is part of the primary key so

  • If already in the table, you update with this same value, do you change other fields (try to add a changed on/by field) else nothing to see
  • If it's not in the table it will insert a new record (also if there are already wrong records in the database table, especially wrong format of key fields)

NB: Basically, only an unique secondary index can trigger a sy-subrc <> 0 for statement MODIFY dbtab (LOB doesn't seem relevant here)

Do you use an explicit DB commit or are you relying on an explicit DB commit ?

ricky_shaw
Contributor
0 Likes

Hi Raymond, I am using 'Commit work' if there is at least one update. Even if i don't use commit, its updating 1000's of recs.

What is LOB here?

Sandra_Rossi
Active Contributor
0 Likes

@ricky_shawJust click the links? Or ask GPT.

Sandra_Rossi_0-1718693577971.png