‎2008 Jun 20 1:21 PM
Hi Experts,
As i am new to ABAP please update me with the required ABAP Code or atlease with the skeleton Code
Source & target fields
Emp_ID ZEMP_ID (CHAR)
Start Date: ZESTA_DT (DATS)
End Date : ZEEND_DT (DATS)
My requirment is to write a start routine that split the record in to 2
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---01/01/2008
0002----01/01/2007---
(Termination date will be blank if emp is still working)
As per my requirment i would like to see data in DSO as
Emp_ID-Start_Date-Termination Date
0001----01/01/2005---
0001----01/01/2005---01/01/2008
0002----01/01/2007---
I want to split the records of an employee
Please let me know if u need any information
Thanks
‎2008 Jun 20 2:37 PM
Loop at itab.
if itab-ZEEND_DT is initial.
itab1 = itab.
append itab1.
else. " split the records ... based on termination ..
itab1 = itab.
clear itab1-ZEEND_DT
append itab1.
itab1 = itab.
append itab1.
endif.
endloop.
‎2008 Jun 20 1:24 PM
‎2008 Jun 20 1:29 PM
hiii
use code like below
data:
w_locate TYPE thead-tdname, " Location of File
w_ext TYPE thead-tdname VALUE 'xls',
" File Extension
w_del(2) TYPE c VALUE '.x'. " Split Charactor
SPLIT p_data AT w_del
INTO w_locate
w_ext.<REMOVED BY MODERATOR>
thx
twinkal
Edited by: Alvaro Tejada Galindo on Jun 20, 2008 9:35 AM
‎2008 Jun 20 2:19 PM
‎2008 Jun 20 2:37 PM
Loop at itab.
if itab-ZEEND_DT is initial.
itab1 = itab.
append itab1.
else. " split the records ... based on termination ..
itab1 = itab.
clear itab1-ZEEND_DT
append itab1.
itab1 = itab.
append itab1.
endif.
endloop.
‎2008 Jun 20 2:46 PM
Hi Srinivas,
Thanks for the update....
Please correct me my if i was wrong
Data:
Emp_ID-Start date------Termination Date
0001----01/01/2005---01/01/2008
0002------01/01/2005
Loop at itab.
if itab-ZEEND_DT is initial.
itab1 = itab.
append itab1.
else. " split the records ... based on termination ..
itab1 = itab.
clear itab1-ZEEND_DT
append itab1.
itab1 = itab.
append itab1.
endif.
endloop.
My requirment is for the above example data
For the employee 0001 as Termination date is not initial i need that record to be split in to 2
Emp_ID-Start date------Termination Date
0001------01/01/2005
0001----01/01/2005---01/01/2008
Please update
‎2008 Jun 20 2:59 PM
On what dates should the record be split up ...
For every record U'll have begda and endda .. so on what it
should be split ...
Emp_ID-Start date------Termination Date
0001------01/01/2005 <- U want to split this record?
0001----01/01/2005---01/01/2008 <- or this
‎2008 Jun 20 3:44 PM
Hi Srinivas
Sorry to confuse you
For every record U'll have begda and endda .. so on what it
should be split ...
Emp_ID-Start date------Termination Date
0001------01/01/2005 <- U want to split this record?
0001----01/01/2005---01/01/2008 <- or this
If Endda is blank i don't want to split
If Endda is not blank the i want to split
0001----01/01/2005---01/01/2008 <- or this
In this case endda (01/01/2008) is not blank i want to split is like
0001------01/01/2005
0001----01/01/2005---01/01/2008
thanks
‎2008 Jun 20 3:49 PM
The code what I gave will work perfectly ...
Loop at itab.
if itab-ZEEND_DT is initial. <-- this is the endda/termination date
itab1 = itab.
append itab1.
else. " split the records ...
itab1 = itab.
clear itab1-ZEEND_DT
append itab1.
itab1 = itab.
append itab1.
endif.
endloop.
‎2008 Jun 20 2:45 PM
do like this....
select pernr
begda
endda
dar01
dat01
from pa0041
into table itab
where pernr in s_pernr .
loop at itab into wa_itab.
if wa-dat01 is initial.
do nothing.
else.
append wa to itab1 .
endif.
*-----declate the itab1 with the desired fields in the output
loop at itab1.
write:/ itab1-pernr .
endloop.