Skip to Content
author's profile photo Former Member
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:

Alvaro Tejada Galindo

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Sep 18, 2007 at 05:47 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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:

    Alvaro Tejada Galindo

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.