2014 Jun 19 1:53 PM
Hey gurus,
I have a table with begda and endda. Endda is a primary key and begda an non-primary key. If I make a new entry I automaticly set the endda to 99991231 with event 05 that's work fine. But I also update the old entry on event 05, well, the update works fine also, but the table maintance generator still react like it was not updated and write outs an error message that this primary key is already exist. I find out that the problem is that the <action> symbol is set before the update, so it works with wrong information. I would do the update before the <action> is set, just I can't find where is it. I could put the update to the very begging of PAI, but I should make a IF condition, to do it only when it is in new entry mode, but I don't know how.
Well I don't really mind how it will work, I just wanna make it working. So how to achieve that if I make a new entry, the old entry's endda will be updated to the new one's begda - 1?
Thank you for any posts.
My 05 event:
update zbr_t_max_doba_v set endda = <vim_begdate_mask>
where endda = '99991231'.
<vim_enddate_mask> = '99991231'.
Regards,
Robert
2014 Jun 30 1:28 PM
Can somebody help me? What do I do wrong? or It should be working? and you don't know why not?
2014 Jun 24 2:21 PM
2014 Jun 24 2:29 PM
Hi Robert,
did you apply the time dependency in SE56?
I happened to have rather similar problems and finally i got it solved.
Here is a link to my solved request. It should give you everything you need.
Best regards - Jörg
2014 Jun 24 3:04 PM
Hi Robert,
you can't update primary keys.
If you want change primary key, you need to delete and recreate the record.
Regards,
Angelo.
2014 Jun 24 3:12 PM
Hi Angelo,
this is exactly, where the time dependency has its value. Once you aply TD, it will take care of the primary key issue. That is, internally the entry is deleted and replaced by the same, only with adapted key-fields, but for the user, it appears as though the value has just changed.
BR - Jörg
2014 Jun 26 8:09 AM
Hi Robert,
Use the Event 01 Change_value.
you write the code in that event as below.
FORM change_value.
LOOP AT total.
CHECK ' N' NS <action>.
MOVE-CORRESPONDING <vim_total_struc> TO wa_zmm_po_plan. " Your Work area.
*** Change the Value for your needed field. ******
MOVE-CORRESPONDING wa_zmm_po_plan TO <vim_total_struc>.
MODIFY total.
ENDLOOP.
ENDFORM.
You can update only the non primary key field only.
Otherwise go to the table maintenance generator -> double click the maintenance screen number-> go to element list -> mod. groups/functions .
Remove the keyword "KEY" for your table field.
Save and activate then now try.
Regards,
Ramesh N
2014 Jun 26 10:05 AM
Do not use EVENTS for an option already managed by the SAP tool, also don't be afraid to look at SAP documentation on help.sap.com or search.sap.com :
Read the "Generate Time-Dependence" document for the requirements.
For the update of primary keys, look at UPDATE documentation too for restrictions.
The content of primary key fields can only be changed if the respective database table is not linked with a search help and if pool and cluster tables are not accessed. If these changes would create a row which would cause double entries in the primary key or a unique secondary index of the database table, then no rows are changed and sy-subrc is set to 4.
Also there must be synchronisation if multiple records are updated simultaneously, so better let the generated dialog do the job...
Regards,
Raymond
2014 Jun 26 10:37 AM
Hi Robert,
Primary key values you can't able to change or modify. it will add as new line.
you can delete the same line and add as new line with updated values.
2014 Jun 26 5:47 PM
Hey guys, thank you for helping me out, but I still can't do it. I tried it from the very begining, but it doesn't even fill automaticly the enddate, I made a video, what am I doing wrong?
2014 Jun 30 1:28 PM
Can somebody help me? What do I do wrong? or It should be working? and you don't know why not?
2014 Jun 30 3:48 PM
Hi Robert,
i can't help you because company policies don't allow youtube links.
I simply don't know, what you did or not, so i have no way to tell right from wrong.
Please supply a verbal description for those of us, who can not view your video.
Meanwhile you could try to resolve your problem, studying this.
Make certain, that your begin and end of validity are named BEGDA and ENDDA and are of the date element BEGDA AND ENDDA, since it is an essential prerequisite for time dependency.
Once you have accomplished the time dependency you will be rewarded with two additional buttons in your maintenance view
Then. when you mark an entry and press delimit button, a popup appears, asking you for the start.date of your modified entry.
After setting the new start date and pressing enter, your marked entry with given start-date waits for your modification.
Again, press enter and the time dependency will take care of your date-key fields.
Back in the start view, select the entry again and press "Expand <-> Collapse" and you should see something like this:
Remember, everthing shown here, you can get without a single line of code. You get it for free and it works like a charm. You don't have to bother with events AND SAP ascertains the consistency of your date-key fields.
BR - Jörg
2014 Jun 30 10:33 PM
Thank you, now it is working fine, all the time I was doing the new entry wrongly.
Thank you, and can I ask you, where should I upload my videos next time, to be able to show to you too?
2014 Jul 01 7:29 AM
Hi Robert,
i'm glad to hear that it's working now.
As for the video, i have no idea. Nevertheless, with some accompanying words, it should be possible to convey the essence, even without video.
Best regards - Jörg