Former Member

help to move date from table

hallow

i have table a_itab with begdate and endate and i wont to move it to table

with period and price for period <b>on every month</b>

how is the <b>best</b> way to do that?

<b><REMOVED BY MODERATOR></b>

i give example

a_itab

reserc--

endate-- -begdate -- knumh --

price

0000008254 20070330 20070101 0000014850 3000.00

0000010599 20080731 20080401 0000014851 15000.00

0000123456 20070331 20070101 0000014834 20000.00

0000123456 20070631 20070601 0000014835 80.00

i wont

b_itab

period---- price --

reserc

012007-- 3000.00 --

0000008254

022007-- 3000.00 --

0000008254

032007 3000.00 0000008254

042008 15000.00 0000010599

052008 15000.00 0000010599

062008 15000.00 0000010599

072008 15000.00 0000010599

012007 20000.00 0000123456

022007 20000.00 0000123456

032007 20000.00 0000123456

042007 80.00 0000123456

052007 80.00 0000123456

062007 80.00 0000123456

Regards

Message was edited by:

10|10000 characters needed characters exceeded

Related questions

Posted on Sep 18, 2007 at 05:47 PM

Hi,

```DATA: DURATION TYPE I,
DATE     TYPE SY-DATUM.

LOOP AT A_ITAB.
CALL FUNCTION 'HR_GBSXP_GET_MONTHS'
EXPORTING
FIRST_DATE        = A_ITAB-BEGDATE
SECOND_DATE       = A_ITAB-ENDDATE
MODIFY_INTERVAL   = ' '
IMPORTING
DURATION          = DURATION
EXCEPTIONS
INVALID_SEQ_DATES = 1
OTHERS            = 2.

DURATION = DURATION + 1.

DO DURATION TIMES.
IF SY-INDEX = 1.
DATE =  A_ITAB-BEGDATE.
ELSE.
IF DATE+4(2) = '12'.
DATE(4) =  DATE(4) + 1.
DATE+4(2) = 1.
ELSE.
DATE+4(2) =  DATE+4(2) + 1.
ENDIF.
ENDIF.

B_ITAB-PERIOD = DATE(6).
B_ITAB-PRICE  = A_ITAB-PRICE.
B_ITAB-RESERC = A_ITAB-RESERC.
APPEND B_ITAB.

ENDDO.
ENDLOOP.
```

Regards,

Ferry Lianto

10|10000 characters needed characters exceeded
• Former Member
Posted on Sep 18, 2007 at 03:44 PM

I can give you some ideas and it requires some time and trial and error probably!!

loop through your first table a_itab.

Get just month from your begda/enda Ex:if begda is 09/18/07 then month would return 09.

You can then use "On change of month inside loop".

Keep accumulating price and then you can then move your price and priod into second internal table b_itab "on change of month"..

You can try something like above!!

Mithun

10|10000 characters needed characters exceeded
• Former Member
Posted on Sep 18, 2007 at 03:41 PM

hi experts

i need some help.

<b><REMOVED BY MODERATOR></b>

regards

Message was edited by: