‎2011 Jan 05 12:16 PM
Hi all ,
I am wokring on Table maintainance generator.
Here my requirement is to add code so that the old record gets delimied autamatically?
I have written code using events where Save before database but could we acheiving it .can you help me in this case,.
record:
emp no emp dept begda enda
1000 org1 1/1/2010 12/31/9999
when emp dept changes when i create new record old record should get delimited.
how can we achieve this
Regards
sas
‎2011 Jan 05 12:25 PM
Hi,
Modify the old record end date with current date and insert a new entry for todays date and enddate as 31.12.9999
Regards,
Thiru
‎2011 Jan 05 2:46 PM
I'm pretty sure this has been asked and answered before. Try searching the forum.
Rob
‎2011 Jan 06 5:48 AM
Hi Rob,
I have searched before I post .
But all the post what I have seen is to default the values to the same row where we are modifying.
Here my requirement is . when you are creating or copying the records of the tbale the old record should automatically delimit.
When Employee 1000 is having one dept 'Dept1' with begda 01/01/2000 and endda = '12/31/9999'.
When user click the copy button and try to change the dept.
ie.e 1000 dept2 and begda = today date and endda = 12/31/9999.
the old record should be automatically delimited at the other end.
like the old recrod and new record as follows.
Emp dept begda endda
1000 dept1 01/01/2000 01/05/2010 -> endda should delimit for first record
1000 dept2 01/06/2010 12/31/9999
I am using Loop at TOTAL concept. which it holds all records in table.
Extract will hold only the modifying record.
But my issue is how to locate the previous record and default endda to yesterday record?
Kindly help in this case.
Regards
sas.
Edited by: saslove sap on Jan 6, 2011 8:08 AM
‎2011 Jan 06 8:58 AM
Based on infotype characteristics, records will be delimited for the date fields.
So check the characteristics of your infotype in PM01 transaction.
‎2011 Jan 06 9:27 AM
I know your are saying about Time constraints.
There is no where related with infotypes here gauthatm.
Just a normal Table which have TMG in it thats it.
Sas.
I am having values in Total all values.
for example. the ZTABLE is having
empno empname beg date endda
1000 dept1 jan 1st 12/31/9999
1001 dept2 jan 3rd 12/31/9999
Now when I select 1000 and click copy and modify it and press save.
1000 dept 2 Jan4th 12/31/9999
I written the event at 01 (Before saving to database)
the Total will hold 3 records.
empno empname beg date endda
1000 dept1 jan 1st 12/31/9999
1001 dept2 jan 3rd 12/31/9999
1000 dept3 jan5th 12/31/9999 -> THis is having an extra action as 'N'.
I am looping at total now..in descending order.
empno empname beg date endda
1000 dept3 jan5th 12/31/9999 -> THis is having an extra action as 'N'.
1001 dept2 jan 3rd 12/31/9999
1000 dept1 jan 1st 12/31/9999
Now I want to store the 1000 employee begin date which is having 'N' in one variable and then I want to add it to END DA WITH 1 DAY minus and add it to last 1000 row. replacing 12/31/9999 .
I can save it to variable but If i have mutilpe Records at the same time how can we do that?
I cant use one vairable to all.
Regards
sas
‎2011 Jan 06 9:45 AM
If you have multiple records you can sort descending based on PERNR ENDDA(31.12.9999),
and delete adjacent records comparing pernr,so that you get the latest record and modify it .
‎2011 Jan 06 10:10 AM
Gautham,
you are misunderstood it seems....
If you have 10 minutes of time..Please create a sample table which should have pernr,dept,begda as key fields and Endda as normal field.
Create on table maintainance generator and In the events select "01" BEfore saving to data base adn event name as delimit.
and clikc source code.
and write the code as .
form delimit.
-> here write " loop at total. But a break point here.
endloop.
endform.
create 2 records and then put the Break point where I SAID above,Then try to create the new record using copy and Check Total
value You may get idea.
See already in database I have as following.
empno !dept no! begda ! endda!
1000- dep100-Jan1- 12/31/9999
1001-dept101-jAN2-12/31/9999
1002-DEPT102-JAN3-12/31/9999
If we are copy 2 exisitng records AS FOR EXAMPLE the above 1000 and 1001 and change the dept numbers to depc1 , deptc2////then when you are saving them in TOTAL internal table it will appear as follows.
empno !dept no! begda ! endda!
1000- dep100-Jan1- 12/31/9999
1001-dept101-jAN2-12/31/9999
1002-DEPT102-JAN3-12/31/9999
1000-deptc1-jan1- 12/31/9999 N
1001-deptc2-jan2-12/31/9999 N
Now I will sort Total as Total descending.
sort total as descending.
Later I am struck up//
Sas
debugger .
‎2011 Jan 06 11:37 AM
Hi,
Did you try this.
If endda is your key field,then select Generate Time-Dep option from Menu Environment->Generate Time-Dep after/when you create Table maintenance.
This will automatically add the delimit button for the Table Maintenance which you can view in SM30.
Hope this helps.
Thanks
Jayanth.Y
‎2011 Jan 06 2:06 PM
Yes - Jayanth's answer has been posted many times. If you search, you should find many more like it.
Rob
‎2011 Jan 06 2:48 PM
Hi Rob,
I know this Generate Time Dept but this doesnt workout for my purpose. Because it is showing hirarchy structures and more
over I have one extra field in the code which represents active when modified I also need to modify that as inactive and make
current record as active. MAIN POINT IS I DONT HAVE KEY FIELDS for Begda and Endda
Any way hopefully I have solved this issue. Hope by tomorow I will post the code .
Regards
sas
Edited by: saslove sap on Jan 7, 2011 7:22 AM
‎2011 Jan 07 7:18 AM
This is Sucess. But issue is I need to go back from SM30 and Come back again to see the changed result.
How can make it visible on the screen when ever I click save button.
I mean changes should reflect autmatically when ever I clikc the save button.
But its not happening I am just going back to SM30 screen and coming back again,
How can I avoid this? WIll commit work will effect?
I have used 01 'BEFORE AVING TO DATABASE ' event.
and Commit is also not success.
Regards
sas
Edited by: saslove sap on Jan 7, 2011 8:20 AM
Edited by: saslove sap on Jan 7, 2011 11:01 AM
Edited by: saslove sap on Jan 7, 2011 11:15 AM