cancel
Showing results for 
Search instead for 
Did you mean: 

help to move date from table

Former Member
0 Kudos

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:

Alvaro Tejada Galindo

Accepted Solutions (1)

Accepted Solutions (1)

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


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

Former Member
0 Kudos

hi ferry

thank u very much!

i am not in office right now i try it tomarrow and i let u now.

thankes again

and Best Regards

Former Member
0 Kudos

Thankes Ferry

u solved my problem

u are Great Men !!!!

Thankes again

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

THANKES MITHUN

I TRY IT.

REGARDS

Former Member
0 Kudos

hi experts

i need some help.

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

regards

Message was edited by:

Alvaro Tejada Galindo