09-29-2008 11:55 AM
Dear Guru's,
I have a Ztable with the following Fields:
OBJECT_ID
BEGDA
ENDDA
SEQNR
WERKS
BTRTL
of which OBJECT_ID, BEGDA, ENDDA, SEQNR are keyfields.
Consider I have a data with OBJECT_ID = 9400, BEGDA = '20080929', ENDDA = '99991231', SEQN = '001'.
now I am gonna save a new record to the table OBJECT_ID = 9400, BEGDA = '20081029', ENDDA = '99991231', SEQN = '001' through a program.
What I want to do in my program is I want the first data to be delimited to the new datas begda.
i.e., first data must change to OBJECT_ID = 9400, BEGDA = '20080929', ENDDA = '20081029', SEQN = '001'.
how to do it....
I cant use modify because the key fields are different so it will add a new record. Please tell me how to go about it???
Regards
VIjay
09-29-2008 11:57 AM
09-29-2008 11:57 AM
09-29-2008 11:59 AM
09-29-2008 12:04 PM
09-29-2008 11:58 AM
Hi,
You have to read the first record and set the new end date using MODIFY and then create the new record.
Regards,
Darren
09-29-2008 12:00 PM
This is why SAP does not include BEGDA in the primary key of their date dependent tables, see table CSKS for example. Maybe you can still adapt that design and solve the problem this way.
Thomas
09-29-2008 12:02 PM
hi,
delete itab1 where index = 1.
loop at itab1 into wa1.
wa_out_end_date = 'enter the new date'.
modify itab1 from wa1 where index = sy-tabix.
clear wa1.
endloop.
09-29-2008 12:03 PM
Hi,
Try like this....
Read table <internaltable> into wa index 1.
lv_tabix = sy-tabix.
wa-enddate = '20080929'.
modify <internaltable> index lv_tabix from wa transporting enddate.
Hope it will helps
09-29-2008 12:03 PM
DATA: wa1 TYPE ztable,
wa2 TYPE ztable.
SELECT SINGLE * FROM ztable INTO wa1 WHERE. "some condition
CHECK sy-subrc EQ 0.
wa2 = wa1.
wa2-BEGDA = '20081029'.
INSERT ztable FROM wa2.
DELETE ztable FROm wa1.
Regards,
Valter Oliveira.