2007 Jan 17 7:56 PM
Hi ,
I need to split 1 record in to 2 records with 1 new field(event)
I have one internal table in this format
No country stdate enddate
1 us 12/01/2006 10/07/2007
i need to reformat this record like ;
NO country event pldate acdate
1 us ga 12/01/2006 12/01/2006
1 us es 10/07/2007 10/07/2007
Can any one resolve this issue?
2007 Jan 17 8:00 PM
Hi,
check this example..
DATA: ITAB_RESULT LIKE ITAB OCCURS 0 WITH HEADER LINE.
Assuming the ITAB is having the values
LOOP AT ITAB.
MOVE ITAB TO ITAB_RESULT.
ITAB_RESULT-ENDDATE = ITAB_RESULT-STDATE.
APPEND ITAB_RESULT.
ITAB_RESULT-STDATE = ITAB-ENDDATE.
APPEND ITAB_RESULT.
ENDLOOP.
Thanks,
Naren
Hi ,
I need to split 1 record in to 2 records with 1 new field(event)
I have one internal table in this format
No country stdate enddate
1 us 12/01/2006 10/07/2007
i need to reformat this record like ;
NO country event pldate acdate
1 us ga 12/01/2006 12/01/2006
1 us es 10/07/2007 10/07/2007
Can any one resolve this issue?
2007 Jan 17 8:00 PM
Hi,
check this example..
DATA: ITAB_RESULT LIKE ITAB OCCURS 0 WITH HEADER LINE.
Assuming the ITAB is having the values
LOOP AT ITAB.
MOVE ITAB TO ITAB_RESULT.
ITAB_RESULT-ENDDATE = ITAB_RESULT-STDATE.
APPEND ITAB_RESULT.
ITAB_RESULT-STDATE = ITAB-ENDDATE.
APPEND ITAB_RESULT.
ENDLOOP.
Thanks,
Naren
2007 Jan 17 8:03 PM
Check the example.
report zrich_0001 .
data: begin of itab occurs 0,
no type i,
country(3) type c,
stdate type sy-datum,
enddate type sy-datum,
end of itab.
data: begin of itab2 occurs 0,
no type i,
country(3) type c,
event(2) type c,
stdate type sy-datum,
enddate type sy-datum,
end of itab2.
itab-no = 1.
itab-country = 'US'.
itab-stdate = '20061201'.
itab-enddate = '20071007'.
append itab.
loop at itab.
clear itab2.
move-corresponding itab to itab2.
itab2-event = 'GA'.
itab2-enddate = itab-stdate.
append itab2.
clear itab2.
move-corresponding itab to itab2.
itab2-event = 'ES'.
itab2-stdate = itab-enddate.
append itab2.
endloop.
loop at itab2.
write:/ itab2-no, itab2-country, itab2-event,
itab2-stdate, itab2-enddate.
endloop.
Regards,
Rich Heilman
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |